[ALOY-272] Grammar for TSS files
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | High |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2013-01-08T16:29:22.000+0000 |
Affected Version/s | 2012 Sprint 20 |
Fix Version/s | Alloy 0.3.5, 2013 Sprint 02 |
Components | XML |
Labels | GA-candidate, notable |
Reporter | Tony Lukasavage |
Assignee | Unknown |
Created | 2012-09-15T09:10:25.000+0000 |
Updated | 2018-03-07T22:25:33.000+0000 |
Description
description
Our current parsers rely on the style being able to be parsed by the uglifyjs AST parser. Removing the commas breaks this first initial step before we pass it to the JSON parser. It shows us a larger problem in that we should probably have a complete parsing expression grammar for TSS files. This will allow us to account for more than just commas, but also comments and things like that. We should attempt to use [pegjs](http://pegjs.majda.cz/) to create the grammar as it can then be run through Alloy's node scripts. After that it can be incorporated into Alloy, replacing the current method of using the uglifyjs AST parsing, followed by JSON.parse.notes
* We may need to dropexpr()
syntax to keep the grammar from needing to understand all of Javascript as well, which is not a small grammar as you might imagine. I think dropping expr() is fine as it was a catch-all before we had device queries and will be made further obsolete with the introduction of dynamic styles in ALOY-210.
* Grammar will allow us to add comments, which we can't do with the current method.
* This will make our styles more flexibile in the future if we need further changes
Comments
- Tony Lukasavage 2012-09-15 Initial grammar here: https://github.com/appcelerator/alloy/blob/master/Alloy/grammar/tss.pegjs
- Tony Lukasavage 2013-01-08 Grammar-based parser now being used for TSS parsing. All unit tests are passing. Additionally the Codestrong app also parses all of its styles correctly.