fix: correct syntax highlighting for texts

This commit is contained in:
Jindra Petřík
2026-03-28 12:59:14 +01:00
parent 8c0b16938a
commit 212b1af6a5
2 changed files with 10 additions and 3 deletions

Binary file not shown.

View File

@@ -75,6 +75,7 @@ OIdentifierCharacter = [^\r\n\u00A7\\]
"]" {
yybegin(YYINITIAL);
tokenStart = -1;
tokenLength = 0;
return token(TokenType.OPERATOR, -BRACKET);
}
}
@@ -98,6 +99,7 @@ OIdentifierCharacter = [^\r\n\u00A7\\]
"]" {
yybegin(YYINITIAL);
tokenStart = -1;
tokenLength = 0;
return token(TokenType.OPERATOR, -BRACKET);
}
}
@@ -106,7 +108,10 @@ OIdentifierCharacter = [^\r\n\u00A7\\]
\" {
yybegin(VALUE);
// length also includes the trailing quote
return token(TokenType.STRING, tokenStart, tokenLength + 1);
Token ret = token(TokenType.STRING, tokenStart, tokenLength + 1);
tokenStart = -1;
tokenLength = 0;
return ret;
}
{StringCharacter}+ { tokenLength += yylength(); }
@@ -123,7 +128,9 @@ OIdentifierCharacter = [^\r\n\u00A7\\]
"\u00A7" {
yybegin(PARAMETER);
// length also includes the trailing quote
return token(TokenType.REGEX, tokenStart, tokenLength + 1);
Token ret = token(TokenType.REGEX, tokenStart, tokenLength + 1);
tokenStart = -1;
tokenLength = 0;
}
{OIdentifierCharacter}+ { tokenLength += yylength(); }
@@ -132,7 +139,7 @@ OIdentifierCharacter = [^\r\n\u00A7\\]
/* escape sequences */
\\. { tokenLength += 2; }
{LineTerminator} { yybegin(PARAMETER); }
{LineTerminator} { tokenStart = -1; tokenLength = 0; yybegin(PARAMETER); }
}
/* error fallback */