Skip to content

Commit

Permalink
feat: account for optional IDs in the tmLanguage definition
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaka91 committed Jan 9, 2024
1 parent d8d57f1 commit d27361e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
11 changes: 5 additions & 6 deletions vscode-extension/syntaxes/mabo.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
"name": "entity.name.class.enum.variant.named.mabo"
}
},
"end": "(?<=\\})\\s*(@\\d+)(,)?",
"end": "(?<=\\})\\s*(@\\d+)?(,)?",
"endCaptures": {
"1": {
"name": "constant.numeric.mabo"
Expand All @@ -218,7 +218,7 @@
"name": "entity.name.class.enum.variant.unnamed.mabo"
}
},
"end": "(?<=\\))\\s*(@\\d+)(,)?",
"end": "(?<=\\))\\s*(@\\d+)?(,)?",
"endCaptures": {
"1": {
"name": "constant.numeric.mabo"
Expand All @@ -237,7 +237,7 @@
]
},
{
"match": "([a-zA-Z0-9_]+)\\s*(@\\d+)(,)?",
"match": "([a-zA-Z0-9_]+)\\s*(@\\d+)?(,)?",
"captures": {
"1": {
"name": "entity.name.class.enum.variant.unit.mabo"
Expand Down Expand Up @@ -277,7 +277,7 @@
"fieldNamed": {
"patterns": [
{
"match": "\\s*([a-zA-Z0-9_]+)\\s*(:)\\s*(.+?)\\s*(@\\d+)(,)?",
"match": "\\s*([a-zA-Z0-9_]+)\\s*(:)\\s*(&?[a-zA-Z0-9_]+(?:<.+>)?)\\s*(@\\d+)?(,)?",
"captures": {
"1": {
"name": "variable.language.mabo variable.other.mabo"
Expand Down Expand Up @@ -327,10 +327,9 @@
"fieldUnnamed": {
"patterns": [
{
"match": "(.+?)\\s*(@\\d+)(,)?",
"match": "(&?[a-zA-Z0-9_]+(?:<.+>)?)\\s*(@\\d+)?(,)?",
"captures": {
"1": {
"name": "storage.type.mabo",
"patterns": [
{
"include": "#type"
Expand Down
12 changes: 6 additions & 6 deletions vscode-extension/syntaxes/mabo.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ repository:
- begin: ([a-zA-Z0-9_]+)\s*(?=\{)
beginCaptures:
"1": { name: entity.name.class.enum.variant.named.mabo }
end: (?<=\})\s*(@\d+)(,)?
end: (?<=\})\s*(@\d+)?(,)?
endCaptures:
"1": { name: constant.numeric.mabo }
"2": { name: punctuation.comma.mabo }
Expand All @@ -93,14 +93,14 @@ repository:
- begin: ([a-zA-Z0-9_]+)\s*(?=\()
beginCaptures:
"1": { name: entity.name.class.enum.variant.unnamed.mabo }
end: (?<=\))\s*(@\d+)(,)?
end: (?<=\))\s*(@\d+)?(,)?
endCaptures:
"1": { name: constant.numeric.mabo }
"2": { name: punctuation.comma.mabo }
patterns:
- include: "#comments"
- include: "#fieldsUnnamed"
- match: ([a-zA-Z0-9_]+)\s*(@\d+)(,)?
- match: ([a-zA-Z0-9_]+)\s*(@\d+)?(,)?
captures:
"1": { name: entity.name.class.enum.variant.unit.mabo }
"2": { name: constant.numeric.mabo }
Expand All @@ -118,7 +118,7 @@ repository:
- include: "#fieldNamed"
fieldNamed:
patterns:
- match: \s*([a-zA-Z0-9_]+)\s*(:)\s*(.+?)\s*(@\d+)(,)?
- match: \s*([a-zA-Z0-9_]+)\s*(:)\s*(&?[a-zA-Z0-9_]+(?:<.+>)?)\s*(@\d+)?(,)?
captures:
"1": { name: variable.language.mabo variable.other.mabo }
"2": { name: punctuation.colon.mabo }
Expand All @@ -137,9 +137,9 @@ repository:
- include: "#fieldUnnamed"
fieldUnnamed:
patterns:
- match: (.+?)\s*(@\d+)(,)?
- match: (&?[a-zA-Z0-9_]+(?:<.+>)?)\s*(@\d+)?(,)?
captures:
"1": { name: storage.type.mabo, patterns: [include: "#type"] }
"1": { patterns: [include: "#type"] }
"2": { name: constant.numeric.mabo }
"3": { name: punctuation.comma.mabo }

Expand Down

0 comments on commit d27361e

Please sign in to comment.