Skip to content

Commit

Permalink
fix: nan as number instead of command
Browse files Browse the repository at this point in the history
  • Loading branch information
blindFS committed Dec 6, 2024
1 parent ab25512 commit 8b91552
Show file tree
Hide file tree
Showing 4 changed files with 43,780 additions and 44,175 deletions.
7 changes: 3 additions & 4 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,13 @@ module.exports = grammar({
cmd_identifier: ($) => {
const excluded = "\\[\\]\\{}<>=\"`':";
const pattern_repeat = repeat(none_of(excluded));
const pattern_one = repeat1(none_of(excluded));
return choice(
token(
prec(PREC().low, seq(none_of(excluded + "^#$\\-"), pattern_repeat)),
),
...Object.values(KEYWORD()).map((x) => token(seq(x, pattern_one))),
...Object.values(MODIFIER()).map((x) => token(seq(x, pattern_one))),
...Object.values(SPECIAL()).map((x) => token(seq(x, pattern_one))),
...Object.values(KEYWORD()).map((x) => token(seq(x, pattern_repeat))),
...Object.values(MODIFIER()).map((x) => token(seq(x, pattern_repeat))),
...Object.values(SPECIAL()).map((x) => token(seq(x, pattern_repeat))),
seq(
$._val_number_decimal,
optional(
Expand Down
78 changes: 39 additions & 39 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@
"value": "def"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -895,7 +895,7 @@
"value": "alias"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -914,7 +914,7 @@
"value": "use"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -933,7 +933,7 @@
"value": "export-env"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -952,7 +952,7 @@
"value": "extern"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -971,7 +971,7 @@
"value": "module"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -990,7 +990,7 @@
"value": "let"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1009,7 +1009,7 @@
"value": "let-env"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1028,7 +1028,7 @@
"value": "mut"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1047,7 +1047,7 @@
"value": "const"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1066,7 +1066,7 @@
"value": "hide"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1085,7 +1085,7 @@
"value": "hide-env"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1104,7 +1104,7 @@
"value": "source"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1123,7 +1123,7 @@
"value": "source-env"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1142,7 +1142,7 @@
"value": "overlay"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1161,7 +1161,7 @@
"value": "register"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1180,7 +1180,7 @@
"value": "for"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1199,7 +1199,7 @@
"value": "loop"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1218,7 +1218,7 @@
"value": "while"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1237,7 +1237,7 @@
"value": "error"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1256,7 +1256,7 @@
"value": "do"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1275,7 +1275,7 @@
"value": "if"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1294,7 +1294,7 @@
"value": "else"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1313,7 +1313,7 @@
"value": "try"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1332,7 +1332,7 @@
"value": "catch"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1351,7 +1351,7 @@
"value": "match"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1370,7 +1370,7 @@
"value": "break"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1389,7 +1389,7 @@
"value": "continue"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1408,7 +1408,7 @@
"value": "return"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1427,7 +1427,7 @@
"value": "as"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1446,7 +1446,7 @@
"value": "in"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1465,7 +1465,7 @@
"value": "make"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1484,7 +1484,7 @@
"value": "export"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1503,7 +1503,7 @@
"value": "true"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1522,7 +1522,7 @@
"value": "false"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1541,7 +1541,7 @@
"value": "null"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1560,7 +1560,7 @@
"value": "[iI][nN][fF]([iI][nN][iI][tT][yY])?"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1579,7 +1579,7 @@
"value": "-[iI][nN][fF]([iI][nN][iI][tT][yY])?"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand All @@ -1598,7 +1598,7 @@
"value": "[nN][aA][nN]"
},
{
"type": "REPEAT1",
"type": "REPEAT",
"content": {
"type": "PATTERN",
"value": "[^\\s\\r\\n\\t\\|();\\[\\]\\{}<>=\"`':]"
Expand Down
Loading

0 comments on commit 8b91552

Please sign in to comment.