Skip to content

Commit

Permalink
feat: crude trailing modifier support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrossinek committed Nov 9, 2021
1 parent 3efff85 commit 22ae523
Show file tree
Hide file tree
Showing 5 changed files with 261 additions and 67 deletions.
16 changes: 14 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,23 @@ module.exports = grammar({

keyword: $ => /[^\s:]+/,

value: $ => /[^\n]+/,
value: $ => seq(
optional(
repeat($._text_with_trailing_modifier)
),
$._text_till_eol
),

_separator: $ => ":",

_space: $ => /\s+/
_space: $ => /\s+/,

_text_till_eol: $ => /[^(\~\n)]+/,

_text_with_trailing_modifier: $ => seq(
$._text_till_eol,
"\~\n"
)

}
});
41 changes: 39 additions & 2 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,28 @@
"value": "[^\\s:]+"
},
"value": {
"type": "PATTERN",
"value": "[^\\n]+"
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_text_with_trailing_modifier"
}
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_text_till_eol"
}
]
},
"_separator": {
"type": "STRING",
Expand All @@ -44,6 +64,23 @@
"_space": {
"type": "PATTERN",
"value": "\\s+"
},
"_text_till_eol": {
"type": "PATTERN",
"value": "[^(\\~\\n)]+"
},
"_text_with_trailing_modifier": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_text_till_eol"
},
{
"type": "STRING",
"value": "~\n"
}
]
}
},
"extras": [
Expand Down
9 changes: 7 additions & 2 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,17 @@
]
}
},
{
"type": "value",
"named": true,
"fields": {}
},
{
"type": "keyword",
"named": true
},
{
"type": "value",
"named": true
"type": "~\n",
"named": false
}
]
Loading

0 comments on commit 22ae523

Please sign in to comment.