New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch from XML to S-Expressions file format #192
Comments
Agree!
Yes! I like your suggestions so far. With the "enum item" type we'll definitely be non-standard, but sexprs aren't really standardized anyways. |
Ah, actually the IETF draft differentiates between quoted strings and tokens. Maybe we could try to fully implement that standard? |
I think the enum type is allowed according the IETF draft, they call such strings "token". But it seems that the non-quoted numbers are not allowed, because a token must not start with a digit :( But KiCad also does not quote numbers, so LibrePCB would not be the only non-"standard"-conform application xD |
True, seems that the standard does not include non-quoted numeric types. |
Another very important question: What file extension should we use for our S-Expression files?
|
What about |
The |
I like that! 😃 So far my favorites are |
In #150 we decided to switch from XML to S-Expressions as primary file format. This issue can be used for discussions about the details of the new file format.
I already have a first question to discuss: When should S-Expression values be quoted and when not?
According to this IETF draft, double quotes can optionally be omitted if the value does not contain strings. So following two lines are considered as equivalent:
But IMO it would be better to always use double quotes if the represented value is a string, and omit the quotes only if the represented type is a boolean or number. Examples:
This way one can "see" the data type of the values in an S-Expressions file. This makes it also easier to support syntax highlighting in editors, because the syntax highlighter can distinguish between strings, numbers and booleans. This is how syntax highlighting could look like for our files:
Actually we can even go one step further: Should we define a set of basic data types used in S-Expression files? For example:
-42
)-42.0
)true
orfalse
true
orfalse
(e.g.align_top
)"Hello World!"
)A syntax highlighter could then easily distinguish between all of these data types, so a LibrePCB S-Expressions file would look really nice in editors ;) In addition, such a file is even more expressive because the data type of every value is visible, like this:
The text was updated successfully, but these errors were encountered: