Behavior of $base and $self in injection grammars
See original GitHub issueAs far as I can tell, $base
and $self
currently do not work as expected in external injection grammars. Both seem to resolve to the injection grammar itself.
Instead, here’s how I think they should work:
$base
in an injection grammar should always be resolved to root grammar (it should have the same behavior as using $base
in a normal grammar file that is included from another grammar)
The expected behavior of $self
is less clear. I think it would make most sense for $self
to resolve to the grammar being targeted by the injection, although you could argue that it could be resolved to the injection grammar itself
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Writing a TextMate Grammar: Some Lessons Learned
The value of an include rule can also be $self , meaning the whole current grammar, or $base , the grammar inside which...
Read more >Normal forms for Context-Free Grammars - Computer Science
Basis : Every Symbol of T is obviously generating; it generates itself. Induction: If we have a production A → a, and every...
Read more >Testing Web Applications - The Fuzzing Book
We set up a (vulnerable) Web server and demonstrate how to systematically explore its behavior – first with hand-written grammars, then with grammars...
Read more >the use of physical restraint in the treatment of self-injury and ...
DESCRIPTORS: self-injurious behavior, restraint, lemon-juice treatment, distrac- tion, toy play, retardates ... Self-injury increased to its previous base-.
Read more >Target Behavior Documentation
Target Behavior Documentation Date. You can tally this information, Yes or No this information, and change the target behaviors ... Self-Selected. Reading.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jeff-hykin Thanks for your explanation of the reasoning! In any case
$base
has no effect in my current injection grammar.I follow your logic about explicit scope names. I’d argue very little about TextMate grammars is documented or even consistent. I’ve been writing regexes for 15 years yet struggling for more than a week to fix a bug I expected to spend a half day on.
There are more bugs I could track here but I’d really prefer some update on https://github.com/microsoft/vscode/issues/216#issuecomment-913872371 (I know you’re even more invested in that topic).
@texastoland I’ll continue the topic over here since this is off topic from the original issue
https://github.com/jeff-hykin/fsharp-injections-demo/issues/1