Skip to content

Commit 9c12fbc

Browse files
committed
fix(grammar): use fixed-length look-behind in FunC function definitions
The function-definition rule used a variable-length look-behind, `(?<=^|[;{]\s*)`. Oniguruma accepts it, so VS Code highlighting is unaffected, but engines that require fixed-length look-behind reject it (for example the grammar compiler GitHub Linguist uses), which prevents the grammar from being reused there. Split the assertion into two fixed-length look-behinds, `(?<=^)` and `(?<=[;{])`, and move `\s*` into the match. Behavior is unchanged: a function name is still matched at the start of a line, or after `;` or `{` with optional whitespace.
1 parent 611df4f commit 9c12fbc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

editors/code/src/languages/syntaxes/func.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
"patterns": [
181181
{
182182
"name": "entity.name.function.definition.func",
183-
"match": "(?x)(?<=^|[;{]\\s*)(`[^`]+`|[A-Za-z_\\$][^\\s+\\-*\\/%,.;(){}\\[\\]=<>|\\^~]*)\\s*(?=\\()"
183+
"match": "(?x)(?:(?<=^)|(?<=[;{])\\s*)(`[^`]+`|[A-Za-z_\\$][^\\s+\\-*\\/%,.;(){}\\[\\]=<>|\\^~]*)\\s*(?=\\()"
184184
},
185185
{
186186
"name": "variable.other.func",

0 commit comments

Comments
 (0)