Syntax highlighting not applied with regex-rules using another regex-rule
ssrmm opened this issue · 2 comments
ssrmm commented
The following grammar does not produce any syntax highlighting for the keywords FLOAT
and INTEGER
even though it should.
namespace Test
{
syntax module Test
{
using Nitra.Core;
[StartRule]
syntax Expressions = (Keyword sm IdentifierBody ';' nl)+;
regex Keyword = Keyword_FLOAT | Keyword_INTEGER;
[SpanClass(Keyword)] regex Keyword_FLOAT = "FLOAT";
[SpanClass(Keyword)] regex Keyword_INTEGER = "INTEGER";
}
}
As a workaround one must add [SpanClass(Keyword)]
directly to regex Keyword
which might not always be desirable.
rampelstinskin commented
regex don't have any information about it internals.
Use token or syntax keyword for "Keyword" rule.
ssrmm commented
Makes sense, now that you say it...