Skip to content

Commit

Permalink
feat: basic delimiter support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrossinek committed Nov 9, 2021
1 parent 22ae523 commit 7268ed1
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 106 deletions.
7 changes: 6 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ module.exports = grammar({

rules: {
metadata: $ => repeat(
$.statement
choice(
$.statement,
$.delimiter
)
),

statement: $ => seq(
Expand All @@ -22,6 +25,8 @@ module.exports = grammar({
$._text_till_eol
),

delimiter: $ => /---+\n/,

_separator: $ => ":",

_space: $ => /\s+/,
Expand Down
17 changes: 15 additions & 2 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@
"metadata": {
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "statement"
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "statement"
},
{
"type": "SYMBOL",
"name": "delimiter"
}
]
}
},
"statement": {
Expand Down Expand Up @@ -57,6 +66,10 @@
}
]
},
"delimiter": {
"type": "PATTERN",
"value": "---+\\n"
},
"_separator": {
"type": "STRING",
"value": ":"
Expand Down
8 changes: 8 additions & 0 deletions src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"multiple": true,
"required": false,
"types": [
{
"type": "delimiter",
"named": true
},
{
"type": "statement",
"named": true
Expand Down Expand Up @@ -38,6 +42,10 @@
"named": true,
"fields": {}
},
{
"type": "delimiter",
"named": true
},
{
"type": "keyword",
"named": true
Expand Down
Loading

0 comments on commit 7268ed1

Please sign in to comment.