zayfod / pyfranca Goto Github PK
View Code? Open in Web Editor NEWA Python module and tools for working with Franca interface definition language (IDL) models.
License: MIT License
A Python module and tools for working with Franca interface definition language (IDL) models.
License: MIT License
Currently pyfranca "only" generates the ast from the fidl file. I am looking for a way to validate the fidl files. Checking for undefined types, broken imports etc. I add franca_validator.py. You can add several fidl packages to class Validator and then validate the parsed packages. The corresponding unittests show you how to use it. franca_validator.py is far away from being finished. But it should give you an impression, what I mean.
Enclosed please find a zip file with some modifications on pyfranca.
pyfranca.zip
The current Version 0.3.0 of pyfranca cannot import a chain of fidl file.
If A.fidl import B.fild, wich imports C.fidl causes the error that all Symbols in C.fidl are missing, because C.fidl isn't processed.
I check the pyfranca code and may found the root cause. I create a pull request with an unittest that show the problem. See pull request 11 for further details.
#11
The idea is to create a new module and corresponding command-line tool that can take a Franca IDL model and generate CommonAPI DBus mock objects, e.g. based on pythond-dbus that can later be used in automated tests, based on Python's unittest methodology.
This is a stretch goal, currently out of the scope of pyfranca
. If there is interest hough, help is always welcome! :)
I check the latest Version 0.2.1 and run into some trouble with the processor. The process checks that the package.name is not defined in multiple files. But as I understand Franca IDL this is a valid syntax. The package.name is the scope of the interfaces and typecollections and I can split a scope over multiple files.
Attached please find 2 fidl files. Your validator told me a circular dependency. But the official CommonAPI Generator accept these fidls files.
fidl_validator.py -I packages Hello.fidl definitions.fidl
ERROR: Circular dependency for package 'myPackage'.
As I understand franca_processor.py the problem is that you use the package.name as the key name of an package. If you take a look into my franca_validator.py I use the fidl file name as the key name. I am not sure that the fild file in the import instruction is just the file name or is it a path. I assume it is a path. The franca user guide does not sepcify the import instruction completely.
import myPackage.MyTypes.* from "definitions.fidl"
franca_processor.py Line 339
self.packages[package.name] = package
franca_validator.py Line 34
abs_path = os.path.abspath(fspec)
self.packages[abs_path] = fpackage
best regards
jens
A command-line tool, based on franca_processor that takes two Franca models as input and outputs the differences between them.
A use case for such a tool would be detecting interface changes in automated build setups.
pyfranca.zip
Hello Zayfod
I have found pyfranca a few weeks ago and use it for a little code generator.
It works quit good. Thank you for your work.
Enclosed please find a zip file with some modifications on pyfranca.
I found 2 issues in you franca_parser.py.
The parser do not check for doubled members. I add the unittest test_doubled_member() to show the problem.
struct MyStruct
{
UInt32 value
UInt16 value
}
The parser also have a problem with types like ., e.g.
method myMethod {
in {
MyType.MyStruct data
}
}
I add the unittest test_alternative_import() to show the problem.
Currently pyfranca "only" generates the ast from the fidl file. I am looking for a way to validate the fidl files. Checking for undefined types, broken imports etc. I add franca_validator.py. You can add several fidl packages to class Validator and then validate the parsed packages. The corresponding unittests show you how to use it. franca_validator.py is far away from being finished. But it should give you an impression, what I mean.
best regards
Jens
There is support for primitive type constants/literals (e.g. integers, floats, strings, etc.) as introduced by @jb090979.
This can be used as a base for introducing complex type constants (e.g. arrays, structures, maps, etc.).
A mdule that can take a Franca IDL AST representation and output it as Franca IDL to a StringIO buffer.
The AST serializer sould work similar to Python's json.dump()
and json.dumps()
.
Among other things, this will allow more unit-testing.
The original franca project provide an example HppGenerator.
I think for all pyfranca users would it be usefull to have an example code generator.
What do you think about this idea?
I can create one if you like. My idea is to create a simple C++ header file using jinja2 as template library.
Currently pyfranca's error handling is rudimentary. Whenever lexer, parser, or processor errors are detected an exception is raised and further processing stops.
Error handling has to be reworked to allow keeping a list of detected errors (objects) as part of a processor. Processing should stop only when fatal errors are detected. Simpler lexer and parser errors should just be detected and added to the list but processing should continue.
A new module and command-line tool that take a Franca IDL model as input and generate documentation in some form, based on the AST and structured comments.
Potential output format options are:
Hi all
I am not able to associate block comment and single line comment with the structure or any other type
only structured comment is getting associated, please let me know how to fix this issue,
package Common
<** @description : struct S
@author Jens Baumann
**>
typeCollection X
{
// Manish - this is not getting associated
struct Common_message
{
// @brief If Skew is larger than
/*
comment 1 - this is not getting associated
*/
Boolean COM_Last_Clock_Sync_Error
}
}
Thank you
Manish
franca_parser.py line 604:
p[0] = ast.Struct(name=p[2], fields=p[4], flags=p[3])
fields=p[4]
should be fields=p[5]
struct_def : STRUCT ID flag_defs '{' struct_fields '}'
p[1]: STRUCT
p[2]: ID
p[3]: glag_defs
p[4]: '{'
p[5]: struct_fields
p[6]: '}'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.