Skip to content

Commit

Permalink
fix: remove weird useless precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
ribru17 committed Feb 20, 2024
1 parent 30c2aa1 commit 1530fb8
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 79 deletions.
15 changes: 6 additions & 9 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,12 @@ module.exports = grammar({
),

_version_test: ($) =>
prec(
9,
seq(
alias(/version/i, 'version'),
repeat1(WHITE_SPACE),
choice('=', '==', '>=', '<=', '!=', '>', '<'),
repeat1(WHITE_SPACE),
alias(/\d+\.?\d*/, $.version_number),
),
seq(
alias(/version/i, 'version'),
repeat1(WHITE_SPACE),
choice('=', '==', '>=', '<=', '!=', '>', '<'),
repeat1(WHITE_SPACE),
alias(/\d+\.?\d*/, $.version_number),
),

_application_test: ($) => alias(token(prec(-1, /\S+/)), $.application_name),
Expand Down
136 changes: 66 additions & 70 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,79 +367,75 @@
]
},
"_version_test": {
"type": "PREC",
"value": 9,
"content": {
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "version",
"flags": "i"
},
"named": false,
"value": "version"
},
{
"type": "REPEAT1",
"content": {
"type": "PATTERN",
"value": "[ \\t\\f\\v]"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "="
},
{
"type": "STRING",
"value": "=="
},
{
"type": "STRING",
"value": ">="
},
{
"type": "STRING",
"value": "<="
},
{
"type": "STRING",
"value": "!="
},
{
"type": "STRING",
"value": ">"
},
{
"type": "STRING",
"value": "<"
}
]
},
{
"type": "REPEAT1",
"content": {
"type": "PATTERN",
"value": "[ \\t\\f\\v]"
}
"type": "SEQ",
"members": [
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "version",
"flags": "i"
},
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "\\d+\\.?\\d*"
"named": false,
"value": "version"
},
{
"type": "REPEAT1",
"content": {
"type": "PATTERN",
"value": "[ \\t\\f\\v]"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "="
},
{
"type": "STRING",
"value": "=="
},
{
"type": "STRING",
"value": ">="
},
{
"type": "STRING",
"value": "<="
},
"named": true,
"value": "version_number"
{
"type": "STRING",
"value": "!="
},
{
"type": "STRING",
"value": ">"
},
{
"type": "STRING",
"value": "<"
}
]
},
{
"type": "REPEAT1",
"content": {
"type": "PATTERN",
"value": "[ \\t\\f\\v]"
}
]
}
},
{
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "\\d+\\.?\\d*"
},
"named": true,
"value": "version_number"
}
]
},
"_application_test": {
"type": "ALIAS",
Expand Down

0 comments on commit 1530fb8

Please sign in to comment.