Skip to content

Commit

Permalink
Allow empty verbatim text
Browse files Browse the repository at this point in the history
  • Loading branch information
kolen committed Feb 17, 2024
1 parent 15daba0 commit 40858d6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ module.exports = grammar({

verbatim_text: $ => seq(
choice('|', $.verbatim_text_modifier_trailing_whitespace),
$._text
optional($._text)
),

verbatim_text_modifier_trailing_whitespace: $ => "'",
Expand Down
12 changes: 10 additions & 2 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1503,8 +1503,16 @@
]
},
{
"type": "SYMBOL",
"name": "_text"
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_text"
},
{
"type": "BLANK"
}
]
}
]
},
Expand Down
23 changes: 23 additions & 0 deletions test/corpus/verbatim_text.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,26 @@ Verbatim text with trailing space
(source_file
(verbatim_text
(verbatim_text_modifier_trailing_whitespace)))

===================
Empty verbatim text
===================

|

---

(source_file
(verbatim_text))

=======================================
Empty verbatim text with trailing space
=======================================

'

---

(source_file
(verbatim_text
(verbatim_text_modifier_trailing_whitespace)))

0 comments on commit 40858d6

Please sign in to comment.