aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nomsu.2.peg2
-rw-r--r--nomsu.3.peg2
-rw-r--r--nomsu.4.peg2
-rw-r--r--nomsu.5.peg2
-rw-r--r--nomsu.6.peg9
5 files changed, 7 insertions, 10 deletions
diff --git a/nomsu.2.peg b/nomsu.2.peg
index 3b98a20..49d4aaf 100644
--- a/nomsu.2.peg
+++ b/nomsu.2.peg
@@ -15,7 +15,7 @@ file_chunks (FileChunks) <-
ws* unexpected_chunk?
top_block (Block) <-
- (comment nl_nodent)? statement (nl_nodent statement)*
+ ((blank_lines nodent) / (comment nl_nodent))? statement (nl_nodent statement)*
empty_block (Block) <-
comment? blank_lines?
diff --git a/nomsu.3.peg b/nomsu.3.peg
index df29772..9daaa35 100644
--- a/nomsu.3.peg
+++ b/nomsu.3.peg
@@ -15,7 +15,7 @@ file_chunks (FileChunks) <-
ws* unexpected_chunk?
top_block (Block) <-
- (comment nl_nodent)? statement (nl_nodent statement)*
+ ((blank_lines nodent) / (comment nl_nodent))? statement (nl_nodent statement)*
empty_block (Block) <-
comment? blank_lines?
diff --git a/nomsu.4.peg b/nomsu.4.peg
index 7d57831..cb2a561 100644
--- a/nomsu.4.peg
+++ b/nomsu.4.peg
@@ -17,7 +17,7 @@ file_chunks (FileChunks) <-
ws* unexpected_chunk?
top_block (Block) <-
- (comment nl_nodent)? statement (nl_nodent statement)*
+ ((blank_lines nodent) / (comment nl_nodent))? statement (nl_nodent statement)*
empty_block (Block) <-
comment? blank_lines?
diff --git a/nomsu.5.peg b/nomsu.5.peg
index 2ecc800..9886132 100644
--- a/nomsu.5.peg
+++ b/nomsu.5.peg
@@ -17,7 +17,7 @@ file_chunks (FileChunks) <-
ws* unexpected_chunk?
top_block (Block) <-
- (comment nl_nodent)? statement (nl_nodent statement)*
+ ((blank_lines nodent) / (comment nl_nodent))? statement (nl_nodent statement)*
empty_block (Block) <-
comment? blank_lines?
diff --git a/nomsu.6.peg b/nomsu.6.peg
index 9b82345..d0ccd9a 100644
--- a/nomsu.6.peg
+++ b/nomsu.6.peg
@@ -2,7 +2,7 @@
file <-
{:curr_indent: ' '* :}
(((methodchain / action / expression / inline_block) eol !.)
- / file_chunks / comment? (blank_lines ws*)?)
+ / file_chunks / comment? blank_lines?)
{:curr_indent: %nil :}
!.
@@ -19,7 +19,7 @@ section_division <- ("~")^+3 eol
eof <- !.
eol <- ws* (&%nl / !.)
nodent <- (unexpected_indent [^%nl]* / =curr_indent)
-indent <- {=curr_indent " "}
+indent <- { =curr_indent " " }
blank_lines <- %nl ((nodent comment / ws*) %nl)*
nl_nodent <- blank_lines nodent
nl_indent <- blank_lines tab_error? {:curr_indent: indent :} (comment nl_nodent)*
@@ -30,7 +30,7 @@ comment (Comment) <-
top_block (Block) <-
- (comment nl_nodent)? statement (nl_nodent statement)*
+ ((blank_lines nodent) / (comment nl_nodent))? statement (nl_nodent statement)*
inline_block (Block) <-
":" ws* (inline_statement (ws* ";" ws* inline_statement)*)?
@@ -243,9 +243,6 @@ _unexpected_code (Error) <-
{:error: {~ [^%nl]+ -> "Couldn't parse this code" ~} :}
unexpected_chunk (Error) <-
{:error: {~ .+ -> "Couldn't parse this code" ~} :}
-unexpected_space (Error) <-
- {:error: {~ ws+ -> "Messed up indentation" ~} :}
- {:hint: {~ '' -> 'Either make sure this line is aligned with the one above it, or make sure the previous line ends with something that uses indentation, like ":" or "(..)"' ~} :}
unexpected_indent (Error) <-
{:error: {~ (=curr_indent ws+) -> "Messed up indentation" ~} :}
{:hint: {~ '' -> 'Either make sure this line is aligned with the one above it, or make sure the previous line ends with something that uses indentation, like ":" or "(..)"' ~} :}