Closed jb090979 closed 7 years ago
Thanks for bringing this up. I was originally planning to do such checks outside the parser but I realized I have already started checking for duplicate type names inside the parser so adding this is easy.
I just pushed changes that add checks for duplicate structure fields, enumerators and attributes, together with respective tests, based on your suggestion.
Regarding your proposal for a Validator class, I fully agree that such functionality is necessary and appreciate the proposed code. I'd suggest to treat this as a separate issue though.
I have been working on a similar "Processor" class that handles imports, import directories and type references. I would work on merging your code with mine and releasing it as a new version (0.2?) in the next days. I also like the idea for a separate command-line "validator" tool. Your feedback will be appreciated!
Thank for fixing the duplicate argument issue.
I create a new issue for the proposal of a validator class. see issue https://github.com/zayfod/pyfranca/issues/3
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