-
Notifications
You must be signed in to change notification settings - Fork 0
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
Support nested categories #22
Support nested categories #22
Conversation
…gnore-category-production-inside-category-production
7dbad78
to
eb9b78a
Compare
? true | ||
: any(p <- prodsOf(g, delabel(s)), | ||
/Symbol child := p.symbols, | ||
isRecursive(g, child, checking = checking + s)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a refactoring to make the code simpler (no more nested functions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
it can also be written as:
= s in checking || any(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new tests check the intended highlighting when four symbols with/without categories are organized in a diamond like this:
A
/ \
B C
\ /
D
The .rsc
file defines the grammar; the .test
file (below) checks the tokenizations
please commit an editor config file (and mark it as a suggested extension in the |
? true | ||
: any(p <- prodsOf(g, delabel(s)), | ||
/Symbol child := p.symbols, | ||
isRecursive(g, child, checking = checking + s)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
it can also be written as:
= s in checking || any(...)
lexical C12 = D12 [\ ] "baz12"; | ||
lexical D12 = "foo12"; | ||
|
||
Grammar rsc = preprocess(grammar(#Start)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ouch, what a grammar 🗡️
This PR adds support for nested categories to the converter. Concretely:
lang::rascal::grammar::analyze::Categories
that has some functions to analyze which categories might be active for each productionAlso:
prodsOf
) to make its name more consistent with another new function. It's used throughout the project, though, so there are a few extra files changed because of this.