Skip to content

Commit

Permalink
🐛 Support set option=value [...]
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Feb 14, 2024
1 parent 90fc0c5 commit b97a853
Show file tree
Hide file tree
Showing 5 changed files with 6,045 additions and 5,586 deletions.
22 changes: 9 additions & 13 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,19 +427,15 @@ module.exports = grammar({
),
unhook_directive: ($) => command($, "unhook", choice("*", $.hook_type)),

set_directive: ($) =>
command(
$,
"set",
choice(
seq(
$.option,
optional(" "),
choice("+=", "-=", "="),
optional(" "),
choice($.int, $.quadoption, $._string)
),
$._options2
set_directive: ($) => command($, "set", choice($._options2, $._options3)),
_options3: ($) =>
spaceSep1(
seq(
$.option,
optional(" "),
choice("+=", "-=", "="),
optional(" "),
choice($.int, $.quadoption, $._string)
)
),
_options2: ($) => spaceSep1(seq(optional(choice("&", "?")), $.option)),
Expand Down
198 changes: 143 additions & 55 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3193,77 +3193,165 @@
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"type": "SYMBOL",
"name": "_options2"
},
{
"type": "SYMBOL",
"name": "_options3"
}
]
}
]
},
"_options3": {
"type": "SEQ",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "option"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "option"
"type": "STRING",
"value": " "
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": " "
},
{
"type": "BLANK"
}
]
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "+="
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "+="
},
{
"type": "STRING",
"value": "-="
},
{
"type": "STRING",
"value": "="
}
]
"type": "STRING",
"value": "-="
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": " "
},
{
"type": "BLANK"
}
]
"type": "STRING",
"value": "="
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": " "
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "int"
},
{
"type": "SYMBOL",
"name": "quadoption"
},
{
"type": "SYMBOL",
"name": "_string"
}
]
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_options2"
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "int"
},
{
"type": "SYMBOL",
"name": "quadoption"
},
{
"type": "SYMBOL",
"name": "_string"
}
]
}
]
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": " "
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "option"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": " "
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "+="
},
{
"type": "STRING",
"value": "-="
},
{
"type": "STRING",
"value": "="
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": " "
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "int"
},
{
"type": "SYMBOL",
"name": "quadoption"
},
{
"type": "SYMBOL",
"name": "_string"
}
]
}
]
}
]
}
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -4868,7 +4868,7 @@
"named": true,
"fields": {
"content": {
"multiple": false,
"multiple": true,
"required": false,
"types": [
{
Expand Down
Loading

0 comments on commit b97a853

Please sign in to comment.