Skip to content

Commit

Permalink
Fix highlighting of strings if only a single @ symbol
Browse files Browse the repository at this point in the history
Fixes #175
  • Loading branch information
tristan957 committed Nov 6, 2023
1 parent 28e16c6 commit 3b528ed
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 18 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## next

- Fix format strings in TextMate grammar
- Fix comments in various locations in TextMate grammar

## 1.16.1

- Update TextMate grammar
Expand Down
105 changes: 87 additions & 18 deletions syntaxes/meson.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,28 +182,33 @@
"match": "\\b[1-9][0-9]*|0\\.[0-9]+",
"name": "constant.numeric.float.meson"
},
"format-placeholder": {
"begin": "(@)",
"beginCaptures": {
"format-placeholder-variable": {
"match": "(@)([[:alpha:]_]+)(@)",
"captures": {
"1": {
"name": "constant.character.format.placeholder.begin.meson punctuation.definition.placeholder.begin.meson"
},
"2": {
"name": "variable.parameter.interpolated.meson"
},
"3": {
"name": "constant.character.format.placeholder.begin.meson punctuation.definition.placeholder.begin.meson"
}
},
"end": "(@)",
"endCaptures": {
}
},
"format-placeholder-index": {
"match": "(@)([1-9][0-9]*|0)(@)",
"captures": {
"1": {
"name": "constant.character.format.placeholder.end.meson punctuation.definition.placeholder.begin.meson"
}
},
"patterns": [
{
"include": "#decimal_literal"
"name": "constant.character.format.placeholder.begin.meson punctuation.definition.placeholder.begin.meson"
},
{
"match": "[[:alpha:]_]+",
"name": "variable.parameter.interpolated.meson"
"2": {
"name": "constant.numeric.integer.decimal.meson"
},
"3": {
"name": "constant.character.format.placeholder.begin.meson punctuation.definition.placeholder.begin.meson"
}
]
}
},
"function_expression": {
"name": "meta.function-call.meson",
Expand Down Expand Up @@ -352,9 +357,15 @@
},
"string_literal": {
"patterns": [
{
"include": "#format_string_multi_literal"
},
{
"include": "#string_multi_literal"
},
{
"include": "#format_string_single_literal"
},
{
"include": "#string_single_literal"
}
Expand All @@ -376,7 +387,36 @@
"name": "string.quoted.triple",
"patterns": [
{
"include": "#format-placeholder"
"include": "#format-placeholder-index"
},
{
"include": "#escaped-character"
}
]
},
"format_string_multi_literal": {
"begin": "(f)(''')",
"beginCaptures": {
"1": {
"name": "storage.type.string.python"
},
"2": {
"name": "punctuation.definition.string.triple.begin.meson"
}
},
"end": "(''')",
"endCaptures": {
"1": {
"name": "punctuation.definition.string.triple.end.meson"
},
"2": {
"name": "invalid.illegal.string.triple.meson"
}
},
"name": "meta.fstring.meson string.interpolated.meson string.quoted.triple.meson",
"patterns": [
{
"include": "#format-placeholder-variable"
},
{
"include": "#escaped-character"
Expand All @@ -402,7 +442,36 @@
"name": "string.quoted.single.meson",
"patterns": [
{
"include": "#format-placeholder"
"include": "#format-placeholder-index"
},
{
"include": "#escaped-character"
}
]
},
"format_string_single_literal": {
"begin": "(f)(')",
"beginCaptures": {
"1": {
"name": "storage.type.string.python"
},
"2": {
"name": "punctuation.definition.string.single.begin.meson"
}
},
"end": "(')|(\\n)",
"endCaptures": {
"1": {
"name": "punctuation.definition.string.single.end.meson"
},
"2": {
"name": "invalid.illegal.string.single.meson"
}
},
"name": "meta.fstring.meson string.interpolated.meson string.quoted.single.meson",
"patterns": [
{
"include": "#format-placeholder-variable"
},
{
"include": "#escaped-character"
Expand Down

0 comments on commit 3b528ed

Please sign in to comment.