diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-17 14:12:11 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-17 14:12:51 -0700 |
| commit | 0442c8dd216f16c7371873a8e8fd8bf83d30dad0 (patch) | |
| tree | f3ca5f178b9851d27d95bf060f966e2398ef9a6a /nomsu.1.peg | |
| parent | be06fc096aa28358914bd6a76b4ea380a04b8873 (diff) | |
Overhaul of comment handling, plus a few fixes (e.g. a fix for indented
text that begins with a nomsu comment)
Diffstat (limited to 'nomsu.1.peg')
| -rw-r--r-- | nomsu.1.peg | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/nomsu.1.peg b/nomsu.1.peg index 1551b6d..39c0a9a 100644 --- a/nomsu.1.peg +++ b/nomsu.1.peg @@ -1,6 +1,7 @@ -- Nomsu version 2 file (FileChunks): {:curr_indent: ' '* :} + ("#!" (!"nomsu" [^%nl])* "nomsu" %ws+ "-V" %ws* {:version: ([0-9.]+ -> tonumber) :} [^%nl]*)? comment? blank_lines? (chunk (nl_nodent chunk_delimeter nl_nodent chunk)*)? blank_lines? @@ -100,12 +101,12 @@ inline_text_interpolation: ) indented_text (Text): - '".."' eol %nl {:curr_indent: indent :} - (indented_plain_text / text_interpolation / {~ blank_lines (=curr_indent -> "") ~})* + '".."' eol %nl {%nl*} {:curr_indent: indent :} + (indented_plain_text / text_interpolation / {~ %nl+ (=curr_indent -> "") ~})* (!! [^%nl]+ -> "Unexpected character while parsing Text" !!)? indented_plain_text (Text): {~ (("\\" -> "\") / (("\" blank_lines =curr_indent "..") -> "") / (!text_interpolation "\") / [^%nl\]+)+ - (blank_lines (=curr_indent -> ""))* ~} + (%nl+ (=curr_indent -> ""))* ~} text_interpolation: inline_text_interpolation / ("\" indented_expression blank_lines =curr_indent "..") |
