-
Notifications
You must be signed in to change notification settings - Fork 117
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
Unsupported textmate grammar (that contains non-advancing match rules) #9
Comments
@darkxeno That message indicates a problem with the grammar. A TM parser is basically an interpreter for the grammar on the passed in text. Sometimes, grammars contain logical flaws. The one auto-detected in this case is that a grammar contains some rules which leads to the case where the grammar is not advancing the text to be tokenized and also not transitioning to a different state. This all depends on the text being tokenized, so if you wanna share the text that you try to tokenize I can try to find what specific rules in that specific grammar gets it to enter an endless loop. |
For me happens on any JS code file when using that grammar. I send you an This same grammar i being used in some sublime extensions, and as fas as i I really love the colors that this grammar can obtain, would be wonderful Very thanks 2016-04-04 12:35 GMT+02:00 Alexandru Dima notifications@github.com:
|
Any new about this issue? Thanks |
I copy here my message from the I've been able to track down the issue to this regexp (and others similar): (?x)
!(?!=)| # logical-not right-to-left right
\|\| | # logical-or left-to-right both As you can see, these regexp have a trailing pipe that make them match everything. I'm not sure what to do - on one hand, it's obviously a coding mistake to leave this trailing pipe, but on the other hand it seems to work fine with both SublimeText and TextMate (I guess they discard every matching rule with 0-tokens as "not matching"), on a quite popular grammar. What do you think? |
My bad, the issue is actually in the YAML files themselves. |
@bottleofwater Thank you for the analysis. In this case, may I suggest to file an issue against the grammar itself. It should be trivial at that level to remove trailing |
Using the json file with vscode, the following error appears: [4] - Grammar is in an endless loop - Grammar is not advancing, nor is it pushing/popping The 'why' for this error is documented here in [1]. I found out it was because of the 'number' pattern thanks to the repo grammar-debug [2]; I basically did a 'bisect', removing one by one each include in the koka.JSON-tmLanguage file. [1]: microsoft/vscode-textmate#9 [2]: https://github.com/alexandrudima/grammar-debug
@darkxeno if you can tell me please how did you manage to add and use a TM grammar with Visual Studio Code other then the built-in? |
I have removed the console.error since this case is not an error |
This textmate grammar:
https://github.com/Benvie/JavaScriptNext.tmLanguage/blob/master/JavaScriptNext.tmLanguage
Doesn't work, shows the following error:
(command line)
[3400:0401/162730:INFO:CONSOLE(1270)] "Grammar is in an endless loop - case 3", source: (...)/vscode/node_modules/vscode-textmate/release/main.js (1270)
(chrome console, stacktrace)
The text was updated successfully, but these errors were encountered: