From 4fa9757fa27d79a0cda399dcf3b711f4d0d60457 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 22 Jul 2018 14:57:37 -0700 Subject: Better handling of parsing non-filechunks text. --- nomsu.2.peg | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'nomsu.2.peg') diff --git a/nomsu.2.peg b/nomsu.2.peg index c1f4f81..1f096af 100644 --- a/nomsu.2.peg +++ b/nomsu.2.peg @@ -1,8 +1,8 @@ -- Nomsu version 2 file: {:curr_indent: ' '* :} - (file_chunks / chunk / (comment? blank_lines? (inline_block / indented_block)))? - blank_lines? + (((action / expression / inline_block / indented_block) eol !.) + / file_chunks / blank_lines / '') %ws* (!! .+ -> "Parse error" !!)? shebang: "#!" (!"nomsu" [^%nl])* "nomsu" %ws+ "-V" %ws* {:version: [0-9.]+ :} [^%nl]* @@ -10,16 +10,12 @@ shebang: "#!" (!"nomsu" [^%nl])* "nomsu" %ws+ "-V" %ws* {:version: [0-9.]+ :} [^ file_chunks (FileChunks): {:curr_indent: ' '* :} shebang? comment? blank_lines? - chunk (nl_nodent section_division nl_nodent chunk)+ + (top_block (nl_nodent section_division top_block)*) blank_lines? -chunk: - top_block / (comment? blank_lines? statement) - top_block (Block): {:curr_indent: ' '* :} - shebang? comment? blank_lines? - statement (nl_nodent statement)+ + comment? blank_lines? statement (nl_nodent statement)* nodent: =curr_indent !(" ") indent: =curr_indent " " -- cgit v1.2.3