Conflicts in Grammar Files (example: Jade)


#1

This is in reference to a few bugs that cropped up in the https://github.com/devongovett/atom-jade package. After a little testing, it turns out that there is a rule inside the grammar file that, despite being later in the instructions, seems to be overriding a previous rule. I will try to dig a bit deeper, but commenting that entire rule out fixes the issues (see https://github.com/devongovett/atom-jade/issues/16#issuecomment-77073123).

Not entirely sure if this is a plugin-specific issue or something much closer to the atom core. Any suggestions??


#2

I would suggest making tests that reproduce the issue by calling the tokenizer directly. Once the exact problem is characterized, then it’ll be easier to figure out where the place to fix it should be.

I don’t think though that one should assume that rules at the same level are applied in any particular order. I’ve never seen any documentation to that effect. It may just be that the grammar should be rewritten to make it less ambiguous.


#3

Gotcha! I think I assumed there was an order due to it being in an array, but it makes sense to remove any ambiguity. I think it’s pulled from the original textmate bundle, so I’ll check sublime text’s version to see if any edits had to be made! Thanks.


#4

I did a fresh conversion of the sublime text/textmate bundle found at https://github.com/davidrios/jade-tmbundle and it came back with the same output, same ambiguity selector. Is https://github.com/atom/first-mate responsible for the actual tokenization? I might check in with folks there too, see if they have any thoughts if it’s an appropriate space.


#5

Just an FYI, I posted a request in the first-mate repo to see if those folks have any additional insight: https://github.com/atom/first-mate/issues/38