Comments (1)
Thanks for opening this issue, ideally they'd all be like this one, well documented and reasoned out.
I seem to recall the reason it was removed is that the grammar was causing problems with some DBC files for reasons I cannot remember and will have to remind myself of, and seeing as the program was not using the enum values, the offending bit in the grammar was removed. Development in this project is mainly driven by "why does this not work with my DBC file?".
To answer your questions:
I would probably handle duplicate enum values with your second option, by prefixing the enum with the enum name. It does generate long names, but I think it is sensible to do by default. A command line option could be given to surpress that behaviour, but I would only add that if someone actually asked for it.
You could use the grammar to detect valid C identifiers, the "ident" type encodes most of the rules that detemines whether an id is valid (as both a C id and a DBC one). By adding the suffix "_e" to the generated enumeration values as well then you could avoid having to detect whether or not an enum if a keyword as well.
Looking at the commit you've made, there's still more to do, but it's a good start, and it does not seem to break anything. It might be worth developing a branch "feature/enum" before merging into master. I'd like to add bounds checking and printing before merging.
from dbcc.
Related Issues (20)
- why sig->start_bit <= 64 ? HOT 1
- Removing Struct Parameter of encode/decode function? HOT 4
- Documentation on Conversion of 8 bytes to uint64 HOT 1
- dbcc.xsd not valid because of typo HOT 1
- Make NS_ and BS_ parser syntax slightly more flexible HOT 2
- suggest: about decode param type HOT 3
- cannot decode messages that share same address HOT 2
- can it convert CanFD.dbc file convert .h header file? HOT 1
- Decoding float signal: wrong type? HOT 3
- Missing infromation about CAN-FD on main page HOT 4
- Can't get CM_ string when it has \". HOT 5
- Best way to get message length HOT 4
- Hide breaking changes behind feature flag HOT 2
- Something wrong with generating the message ID of extended frame HOT 1
- Long signal value generates invalid C code. HOT 5
- Generated code do not support extended messages HOT 4
- Feature request: Generating enum for Frame ID. HOT 1
- Having a single VAL_ inside the dbc will not generate enums HOT 1
- dbcc doesnt detect float if blank line above SIG_VALTYPE_ entry HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbcc.