Skip to content

Commit

Permalink
fix: properly handle flags
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 30, 2024
1 parent 5f49bb7 commit 5848acd
Show file tree
Hide file tree
Showing 142 changed files with 1,280 additions and 1,276 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@types/node": "^22.5.1",
"@types/semver": "^7.5.8",
"@vitest/expect": "^2.0.5",
"adm-zip": "^0.5.15",
"adm-zip": "^0.5.16",
"bumpp": "^9.5.2",
"chai": "^5.1.1",
"chalk": "^5.3.0",
Expand All @@ -46,7 +46,7 @@
"lint-staged": "^15.2.9",
"octokit": "^4.0.2",
"ofetch": "^1.3.4",
"oniguruma-to-js": "^0.1.1",
"oniguruma-to-js": "^0.2.0",
"p-limit": "^6.1.0",
"pnpm": "^9.9.0",
"rimraf": "^6.0.1",
Expand Down
198 changes: 99 additions & 99 deletions packages/tm-grammars/README.md

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions packages/tm-grammars/grammars/abap.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/tm-grammars/grammars/actionscript-3.json
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@
"name": "meta.namespace_declaration.actionscript.3"
},
"numbers": {
"match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\\b",
"match": "\\b((0(x|X)[0-9a-fA-F]*)|((\\d+\\.?\\d*)|(\\.\\d+))((e|E)(\\+|-)?\\d+)?)(L|l|UL|ul|u|U|F|f)?\\b",
"name": "constant.numeric.actionscript.3"
},
"object_literal": {
Expand Down
2 changes: 1 addition & 1 deletion packages/tm-grammars/grammars/angular-expression.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
"name": "meta.delimiter.decimal.period.ts"
}
},
"match": "(?<!\\$)(?:(?:\\b[0-9]+(\\.)[0-9]+[eE][+-]?[0-9]+\\b)|#1.1E+3(?:\\b[0-9]+(\\.)[eE][+-]?[0-9]+\\b)|#1.E+3(?:\\B(\\.)[0-9]+[eE][+-]?[0-9]+\\b)|#.1E+3(?:\\b[0-9]+[eE][+-]?[0-9]+\\b)|#1E+3(?:\\b[0-9]+(\\.)[0-9]+\\b)|#1.1(?:\\b[0-9]+(\\.)\\B)|#1.(?:\\B(\\.)[0-9]+\\b)|#.1(?:\\b[0-9]+\\b(?!\\.))#1)(?!\\$)"
"match": "(?<!\\$)(?:(?:\\b\\d+(\\.)\\d+[eE][+-]?\\d+\\b)|#1.1E+3(?:\\b\\d+(\\.)[eE][+-]?\\d+\\b)|#1.E+3(?:\\B(\\.)\\d+[eE][+-]?\\d+\\b)|#.1E+3(?:\\b\\d+[eE][+-]?\\d+\\b)|#1E+3(?:\\b\\d+(\\.)\\d+\\b)|#1.1(?:\\b\\d+(\\.)\\B)|#1.(?:\\B(\\.)\\d+\\b)|#.1(?:\\b\\d+\\b(?!\\.))#1)(?!\\$)"
}
]
},
Expand Down
52 changes: 26 additions & 26 deletions packages/tm-grammars/grammars/angular-ts.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/tm-grammars/grammars/apex.json
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@
"name": "constant.numeric.binary.apex"
},
{
"match": "\\b([0-9_]+)?\\.[0-9_]+((e|E)[0-9]+)?(F|f|D|d|M|m)?\\b",
"match": "\\b([0-9_]+)?\\.[0-9_]+((e|E)\\d+)?(F|f|D|d|M|m)?\\b",
"name": "constant.numeric.decimal.apex"
},
{
Expand Down Expand Up @@ -3082,7 +3082,7 @@
"name": "punctuation.definition.constant.apex"
}
},
"match": "(&)((?:[A-Za-z:_][0-9A-Za-z:_.-]*)|(?:\\#[0-9]+)|(?:\\#x[0-9A-Fa-f]+))(;)",
"match": "(&)((?:[A-Za-z:_][0-9A-Za-z:_.-]*)|(?:\\#\\d+)|(?:\\#x[0-9A-Fa-f]+))(;)",
"name": "constant.character.entity.apex"
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/tm-grammars/grammars/apl.json
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@
"number": {
"patterns": [
{
"match": "¯?[0-9][¯0-9A-Za-z]*(?:\\.[¯0-9Ee][¯0-9A-Za-z]*)*|¯?\\.[0-9Ee][¯0-9A-Za-z]*",
"match": "¯?\\d[¯0-9A-Za-z]*(?:\\.[¯0-9Ee][¯0-9A-Za-z]*)*|¯?\\.[0-9Ee][¯0-9A-Za-z]*",
"name": "constant.numeric.apl"
}
]
Expand Down
6 changes: 3 additions & 3 deletions packages/tm-grammars/grammars/applescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -860,12 +860,12 @@
"name": "keyword.operator.comparison.applescript"
},
{
"match": "(?ix)\\b\n\t\t\t\t\t\t(and|or|div|mod|as|not\n\t\t\t\t\t\t|(a\\s+)?(ref(\\s+to)?|reference\\s+to)\n\t\t\t\t\t\t|equal(s|\\s+to)|contains?|comes\\s+(after|before)|(start|begin|end)s?\\s+with\n\t\t\t\t\t\t)\n\t\t\t\t\t\\b",
"match": "(?i)\\b(and|or|div|mod|as|not|(a\\s+)?(ref(\\s+to)?|reference\\s+to)|equal(s|\\s+to)|contains?|comes\\s+(after|before)|(start|begin|end)s?\\s+with)\\b",
"name": "keyword.operator.word.applescript"
},
{
"comment": "In double quotes so we can use a single quote in the keywords.",
"match": "(?ix)\\b\n\t\t\t\t\t\t(is(n't|\\s+not)?(\\s+(equal(\\s+to)?|(less|greater)\\s+than(\\s+or\\s+equal(\\s+to)?)?|in|contained\\s+by))?\n\t\t\t\t\t\t|does(n't|\\s+not)\\s+(equal|come\\s+(before|after)|contain)\n\t\t\t\t\t\t)\n\t\t\t\t\t\\b",
"match": "(?i)\\b(is(n't|\\s+not)?(\\s+(equal(\\s+to)?|(less|greater)\\s+than(\\s+or\\s+equal(\\s+to)?)?|in|contained\\s+by))?|does(n't|\\s+not)\\s+(equal|come\\s+(before|after)|contain))\\b",
"name": "keyword.operator.word.applescript"
},
{
Expand Down Expand Up @@ -927,7 +927,7 @@
"name": "support.class.built-in.applescript"
},
{
"match": "(?ix)\\b\n\t\t\t\t\t\t(\t(cubic\\s+(centi)?|square\\s+(kilo)?|centi|kilo)met(er|re)s\n\t\t\t\t\t\t|\tsquare\\s+(yards|feet|miles)|cubic\\s+(yards|feet|inches)|miles|inches\n\t\t\t\t\t\t|\tlit(re|er)s|gallons|quarts\n\t\t\t\t\t\t|\t(kilo)?grams|ounces|pounds\n\t\t\t\t\t\t|\tdegrees\\s+(Celsius|Fahrenheit|Kelvin)\n\t\t\t\t\t\t)\n\t\t\t\t\t\\b",
"match": "(?i)\\b((cubic\\s+(centi)?|square\\s+(kilo)?|centi|kilo)met(er|re)s|square\\s+(yards|feet|miles)|cubic\\s+(yards|feet|inches)|miles|inches|lit(re|er)s|gallons|quarts|(kilo)?grams|ounces|pounds|degrees\\s+(Celsius|Fahrenheit|Kelvin))\\b",
"name": "support.class.built-in.unit.applescript"
},
{
Expand Down
4 changes: 2 additions & 2 deletions packages/tm-grammars/grammars/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@
"name": "punctuation.separator.decimal.period.ara"
}
},
"match": "(?:(?:[0-9]+(?:_[0-9]+)*)?(\\.)[0-9]+(?:_[0-9]+)*(?:[eE][+-]?[0-9]+(?:_[0-9]+)*)?|[0-9]+(?:_[0-9]+)*(\\.)(?:[0-9]+(?:_[0-9]+)*)?(?:[eE][+-]?[0-9]+(?:_[0-9]+)*)?|[0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)*)",
"match": "(?:(?:\\d+(?:_\\d+)*)?(\\.)\\d+(?:_\\d+)*(?:[eE][+-]?\\d+(?:_\\d+)*)?|\\d+(?:_\\d+)*(\\.)(?:\\d+(?:_\\d+)*)?(?:[eE][+-]?\\d+(?:_\\d+)*)?|\\d+(?:_\\d+)*[eE][+-]?\\d+(?:_\\d+)*)",
"name": "constant.numeric.decimal.ara"
},
{
"match": "0|[1-9](?:_?[0-9]+)*",
"match": "0|[1-9](?:_?\\d+)*",
"name": "constant.numeric.decimal.ara"
}
]
Expand Down
34 changes: 17 additions & 17 deletions packages/tm-grammars/grammars/asm.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,47 +56,47 @@
"constants": {
"patterns": [
{
"match": "(?i)\\b0[by](?:[01][01_]*)\\.(?:(?:[01][01_]*)?(?:p[+-]?(?:[0-9][0-9_]*))?\\b)?",
"match": "(?i)\\b0[by](?:[01][01_]*)\\.(?:(?:[01][01_]*)?(?:p[+-]?(?:\\d[0-9_]*))?\\b)?",
"name": "constant.numeric.binary.floating-point.asm.x86_64"
},
{
"match": "(?i)\\b0[by](?:[01][01_]*)(?:p[+-]?(?:[0-9][0-9_]*))\\b",
"match": "(?i)\\b0[by](?:[01][01_]*)(?:p[+-]?(?:\\d[0-9_]*))\\b",
"name": "constant.numeric.binary.floating-point.asm.x86_64"
},
{
"match": "(?i)\\b0[oq](?:[0-7][0-7_]*)\\.(?:(?:[0-7][0-7_]*)?(?:p[+-]?(?:[0-9][0-9_]*))?\\b)?",
"match": "(?i)\\b0[oq](?:[0-7][0-7_]*)\\.(?:(?:[0-7][0-7_]*)?(?:p[+-]?(?:\\d[0-9_]*))?\\b)?",
"name": "constant.numeric.octal.floating-point.asm.x86_64"
},
{
"match": "(?i)\\b0[oq](?:[0-7][0-7_]*)(?:p[+-]?(?:[0-9][0-9_]*))\\b",
"match": "(?i)\\b0[oq](?:[0-7][0-7_]*)(?:p[+-]?(?:\\d[0-9_]*))\\b",
"name": "constant.numeric.octal.floating-point.asm.x86_64"
},
{
"match": "(?i)\\b(?:0[dt])?(?:[0-9][0-9_]*)\\.(?:(?:[0-9][0-9_]*)?(?:e[+-]?(?:[0-9][0-9_]*))?\\b)?",
"match": "(?i)\\b(?:0[dt])?(?:\\d[0-9_]*)\\.(?:(?:\\d[0-9_]*)?(?:e[+-]?(?:\\d[0-9_]*))?\\b)?",
"name": "constant.numeric.decimal.floating-point.asm.x86_64"
},
{
"match": "(?i)\\b(?:[0-9][0-9_]*)(?:e[+-]?(?:[0-9][0-9_]*))\\b",
"match": "(?i)\\b(?:\\d[0-9_]*)(?:e[+-]?(?:\\d[0-9_]*))\\b",
"name": "constant.numeric.decimal.floating-point.asm.x86_64"
},
{
"match": "(?i)\\b(?:[0-9][0-9_]*)p(?:[0-9][0-9_]*)?\\b",
"match": "(?i)\\b(?:\\d[0-9_]*)p(?:\\d[0-9_]*)?\\b",
"name": "constant.numeric.decimal.packed-bcd.asm.x86_64"
},
{
"match": "(?i)\\b0[xh](?:[0-9A-Fa-f][0-9A-Fa-f_]*)\\.(?:(?:[0-9A-Fa-f][0-9A-Fa-f_]*)?(?:p[+-]?(?:[0-9][0-9_]*))?\\b)?",
"match": "(?i)\\b0[xh](?:[0-9A-Fa-f][0-9A-Fa-f_]*)\\.(?:(?:[0-9A-Fa-f][0-9A-Fa-f_]*)?(?:p[+-]?(?:\\d[0-9_]*))?\\b)?",
"name": "constant.numeric.hex.floating-point.asm.x86_64"
},
{
"match": "(?i)\\b0[xh](?:[0-9A-Fa-f][0-9A-Fa-f_]*)(?:p[+-]?(?:[0-9][0-9_]*))\\b",
"match": "(?i)\\b0[xh](?:[0-9A-Fa-f][0-9A-Fa-f_]*)(?:p[+-]?(?:\\d[0-9_]*))\\b",
"name": "constant.numeric.hex.floating-point.asm.x86_64"
},
{
"match": "(?i)\\$[0-9]\\_?(?:[0-9A-Fa-f][0-9A-Fa-f_]*)?\\.(?:(?:[0-9A-Fa-f][0-9A-Fa-f_]*)?(?:p[+-]?(?:[0-9][0-9_]*))?\\b)?",
"match": "(?i)\\$\\d\\_?(?:[0-9A-Fa-f][0-9A-Fa-f_]*)?\\.(?:(?:[0-9A-Fa-f][0-9A-Fa-f_]*)?(?:p[+-]?(?:\\d[0-9_]*))?\\b)?",
"name": "constant.numeric.hex.floating-point.asm.x86_64"
},
{
"match": "(?i)\\$[0-9]\\_?(?:[0-9A-Fa-f][0-9A-Fa-f_]*)(?:p[+-]?(?:[0-9][0-9_]*))\\b",
"match": "(?i)\\$\\d\\_?(?:[0-9A-Fa-f][0-9A-Fa-f_]*)(?:p[+-]?(?:\\d[0-9_]*))\\b",
"name": "constant.numeric.hex.floating-point.asm.x86_64"
},
{
Expand All @@ -108,11 +108,11 @@
"name": "constant.numeric.octal.asm.x86_64"
},
{
"match": "(?i)\\b(?:(?:0[dt](?:[0-9][0-9_]*))|(?:(?:[0-9][0-9_]*)[dt]?))\\b",
"match": "(?i)\\b(?:(?:0[dt](?:\\d[0-9_]*))|(?:(?:\\d[0-9_]*)[dt]?))\\b",
"name": "constant.numeric.decimal.asm.x86_64"
},
{
"match": "(?i)(?:\\$[0-9]\\_?(?:[0-9A-Fa-f][0-9A-Fa-f_]*)?)\\b",
"match": "(?i)(?:\\$\\d\\_?(?:[0-9A-Fa-f][0-9A-Fa-f_]*)?)\\b",
"name": "constant.numeric.hex.asm.x86_64"
},
{
Expand Down Expand Up @@ -177,7 +177,7 @@
"name": "punctuation.separator.asm.x86_64"
}
},
"match": "(\\.)([0-9]+(?:[0-9A-Za-z_$#@~.?]*))(?:(\\:)?|\\b)",
"match": "(\\.)(\\d+(?:[0-9A-Za-z_$#@~.?]*))(?:(\\:)?|\\b)",
"name": "entity.name.function.asm.x86_64"
},
{
Expand Down Expand Up @@ -1486,11 +1486,11 @@
"name": "constant.language.register.mmx.asm.x86_64"
},
{
"match": "(?i)\\b(?:[xy]mm(?:[0-9]|1[0-5])|mxcsr)\\b",
"match": "(?i)\\b(?:[xy]mm(?:\\d|1[0-5])|mxcsr)\\b",
"name": "constant.language.register.sse_avx.asm.x86_64"
},
{
"match": "(?i)\\b(?:zmm(?:[12]?[0-9]|30|31))\\b",
"match": "(?i)\\b(?:zmm(?:[12]?\\d|30|31))\\b",
"name": "constant.language.register.avx512.asm.x86_64"
},
{
Expand All @@ -1514,7 +1514,7 @@
"name": "invalid.deprecated.constant.language.register.asm.x86_64"
},
{
"match": "(?i)\\b[xy]mm(?:1[6-9]|2[0-9]|3[01])\\b",
"match": "(?i)\\b[xy]mm(?:1[6-9]|2\\d|3[01])\\b",
"name": "constant.language.register.general-purpose.alias.asm.x86_64"
}
]
Expand Down
4 changes: 2 additions & 2 deletions packages/tm-grammars/grammars/astro.json
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@
"name": "punctuation.definition.entity.astro"
}
},
"match": "(&)#[0-9]+(;)",
"match": "(&)#\\d+(;)",
"name": "constant.character.entity.numeric.decimal.astro"
},
{
Expand Down Expand Up @@ -737,7 +737,7 @@
"tags-name": {
"patterns": [
{
"match": "[A-Z][a-zA-Z0-9_]*",
"match": "[A-Z]\\w*",
"name": "support.class.component.astro"
},
{
Expand Down
4 changes: 2 additions & 2 deletions packages/tm-grammars/grammars/awk.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"name": "keyword.control.awk"
},
"numeric-constant": {
"match": "\\b[0-9]+(?:\\.[0-9]+)?(?:e[+-][0-9]+)?\\b",
"match": "\\b\\d+(?:\\.\\d+)?(?:e[+-]\\d+)?\\b",
"name": "constant.numeric.awk"
},
"operator": {
Expand Down Expand Up @@ -366,7 +366,7 @@
"variable": {
"patterns": [
{
"match": "\\$[0-9]+",
"match": "\\$\\d+",
"name": "variable.language.awk"
},
{
Expand Down
Loading

0 comments on commit 5848acd

Please sign in to comment.