Add support for punctuation in generated textmate grammars [#3337]#3377
Add support for punctuation in generated textmate grammars [#3337]#3377iTob191 wants to merge 1 commit intoeclipse-xtext:mainfrom
Conversation
7bb90e3 to
2a6cd93
Compare
...se.xtext.xtext.generator/src/org/eclipse/xtext/xtext/generator/textmate/TextMateGrammar.java
Outdated
Show resolved
Hide resolved
| matchBuilder.append("(?i)"); | ||
| } | ||
| matchBuilder.append("("); | ||
| List<String> allKeywords = GrammarUtil.getAllKeywords(grammar) |
There was a problem hiding this comment.
It seems as if we could use the same implementation for bother regex rules. The only meaningful difference seems to be the s.matches("\\w+") vs its negation and the name of the match rule.
Regular keywords should still work if we funnel them through escapeAndAddWordBoundaries
Would that work?
There was a problem hiding this comment.
That works and I've updated the PR accordingly. Only downside is that the generated regex for the keyword.control rule is less optimized: (\\ba\\b|\\bb\\b|\\bc\\b) instead of \\b(a|b|c)\\b
2a6cd93 to
a546293
Compare
…text#3337] Signed-off-by: iTob <itobdev@gmail.com>
a546293 to
f579467
Compare
|
After extending my grammar with Xbase support which brings in a lot more punctuation characters, I've noticed that this PR breaks highlighting of comments. The problem is that Xbase introduces |
I've implemented the change as outlined in #3337 (comment).