fix: make TextMate grammar regexes compatible with Joni/TM4E#113
Open
jgsuess wants to merge 1 commit intoFHIR:masterfrom
Open
fix: make TextMate grammar regexes compatible with Joni/TM4E#113jgsuess wants to merge 1 commit intoFHIR:masterfrom
jgsuess wants to merge 1 commit intoFHIR:masterfrom
Conversation
The FSH TextMate grammar uses several regex patterns that are incompatible with the Joni regex engine (Java port of Oniguruma) used by Eclipse TM4E. These patterns work in VS Code's Oniguruma but fail silently in Joni, causing syntax highlighting to break. Fixes: - Remove nested variable-length lookbehind (?<=\bfrom\s*) in keywords pattern — `system` is now matched as a plain reserved keyword - Replace (?=\s)\b with (?=\s|$) in keywords, booleans patterns so tokens at end-of-line are matched (e.g. `* name 1..* MS`) - Replace (?=[\s,])\b with (?=[\s,]|$) in numbers pattern for same reason - Replace \b with (?=\s|$) in cardinality pattern — \b fails after non-word char `*` (e.g. `1..*` was not highlighted) - Move \s* outside lookbehind in insert RuleSet bracket pattern — variable-length content inside (?<=...) is not supported All patterns now use only fixed-length lookbehinds, which is the common subset supported by Oniguruma (VS Code), Joni (Eclipse TM4E), and JetBrains regex engines. No change in VS Code behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The FSH TextMate grammar uses several regex patterns that are incompatible with the Joni regex engine (Java port of Oniguruma) used by Eclipse TM4E. These patterns work in VS Code's Oniguruma but fail silently in Joni, causing syntax highlighting to break entirely or miss tokens at end-of-line.
Changes (5 patterns, 5 lines changed)
(?<=\bfrom\s*);systemis now a plain reserved keyword(?=\s)\b→(?=\s|$)so tokens likeMSat end-of-line are matched\s*outside lookbehind (variable-length content inside(?<=...)not supported)(?=\s)\b→(?=\s|$)for end-of-line matching(?=[\s,])\b→(?=[\s,]|$)for end-of-line matching\b→(?=\s|$)because\bfails after non-word char*(e.g.1..*)Compatibility
All patterns now use only fixed-length lookbehinds — the common subset supported by:
Testing
Tested in Eclipse 2026-03 with TM4E 0.17.2. Before: no syntax highlighting (regex parse errors on every line). After: full keyword, string, comment, number, and cardinality highlighting.
No change in VS Code behavior — Oniguruma is a superset of the patterns used here.