Skip to content

Commit

Permalink
fix: incorrect detection of trailing modifiers (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
vhyrro committed Feb 22, 2022
1 parent 35d9f25 commit 323ef05
Show file tree
Hide file tree
Showing 4 changed files with 606 additions and 458 deletions.
14 changes: 10 additions & 4 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ module.exports = grammar({
key: _ => /[^\-\s:][^\s:]*/,

value: $ => seq(
/[^\s\[\]\{\}][^\n\[\]\{\}(\~\n)]*/,
/[^\s\[\]\{\}][^\n\[\]\{\}\~]+/,
optional(
seq(
"~\n",
alias($.value, "_value")
choice(
seq(
"~",
/[^\n\[\]\{\}\~]+/,
),
seq(
"~\n",
alias($.value, "_value")
)
)
)
),
Expand Down
40 changes: 29 additions & 11 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,44 @@
"members": [
{
"type": "PATTERN",
"value": "[^\\s\\[\\]\\{\\}][^\\n\\[\\]\\{\\}(\\~\\n)]*"
"value": "[^\\s\\[\\]\\{\\}][^\\n\\[\\]\\{\\}\\~]+"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "~\n"
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "~"
},
{
"type": "PATTERN",
"value": "[^\\n\\[\\]\\{\\}\\~]+"
}
]
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "value"
},
"named": false,
"value": "_value"
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "~\n"
},
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "value"
},
"named": false,
"value": "_value"
}
]
}
]
},
Expand Down
4 changes: 4 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@
"type": "}",
"named": false
},
{
"type": "~",
"named": false
},
{
"type": "~\n",
"named": false
Expand Down
Loading

0 comments on commit 323ef05

Please sign in to comment.