diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-26 13:09:20 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-26 13:09:25 -0700 |
| commit | 0b4a81191ae61d53832d85614f0bb0f2912d7a39 (patch) | |
| tree | 62a34b551d915f0f2b34be33cda1b0d44dfe8008 | |
| parent | 64294f5cd6ab67236625cf4d645debafc35d0055 (diff) | |
Minor tidying.
| -rw-r--r-- | nomsu.lua | 2 | ||||
| -rwxr-xr-x | nomsu.moon | 2 | ||||
| -rw-r--r-- | nomsu.peg | 21 |
3 files changed, 12 insertions, 13 deletions
@@ -193,7 +193,7 @@ do end) _with_0.dedent = P(function(self, start) local nodent = lpeg.userdata.indent_stack[#lpeg.userdata.indent_stack] - local spaces = self:match("[ ]*", start) + local spaces = self:match("^[ ]*", start) if #spaces <= #nodent - 4 then remove(lpeg.userdata.indent_stack) return start @@ -166,7 +166,7 @@ NOMSU_DEFS = with {} -- stack minus 4, this pattern matches and pops off the top of the stack exactly once. .dedent = P (start)=> nodent = lpeg.userdata.indent_stack[#lpeg.userdata.indent_stack] - spaces = @match("[ ]*", start) + spaces = @match("^[ ]*", start) if #spaces <= #nodent-4 remove(lpeg.userdata.indent_stack) return start @@ -7,20 +7,13 @@ file: shebang: "#!" [^%nl]* (!. / %nl) -statement: (action / expression) (eol / (({} ([^%nl]* -> "Error while parsing line")) => error)) -inline_statement: inline_action / inline_expression - inline_block (Block): inline_statement (%ws* ";" %ws* inline_statement)+ block (Block): statement (nodent (statement / (({} ([^%nl]* -> "Error while parsing block line")) => error)))+ -inline_nomsu (EscapedNomsu): "\" noindex_inline_expression -indented_nomsu (EscapedNomsu): - "\" (noindex_inline_expression / (":" %ws* (inline_block / inline_action / inline_expression) eol) / indented_expression) - -index_chain (IndexChain): - noindex_inline_expression ("." (text_word / noindex_inline_expression))+ +statement: (action / expression) (eol / (({} ([^%nl]* -> "Error while parsing line")) => error)) +inline_statement: inline_action / inline_expression noindex_inline_expression: number / variable / inline_text / inline_list / inline_dict / inline_nomsu @@ -31,7 +24,6 @@ noindex_inline_expression: / (({} ([^%nl]* -> 'Error while parsing subexpression')) => error) ) ) - inline_expression: index_chain / noindex_inline_expression indented_expression: @@ -43,7 +35,14 @@ indented_expression: expression: inline_expression / (":" %ws* (inline_block / inline_action / inline_expression) eol) / indented_expression --- Function calls need at least one word in them +inline_nomsu (EscapedNomsu): "\" inline_expression +indented_nomsu (EscapedNomsu): + "\" (noindex_inline_expression / (":" %ws* (inline_block / inline_action / inline_expression) eol) / indented_expression) + +index_chain (IndexChain): + noindex_inline_expression ("." (text_word / noindex_inline_expression))+ + +-- Actions need at least one word in them inline_action (Action): (inline_expression %ws*)* word (%ws* (inline_expression / word))* (%ws* ":" %ws* (inline_block / inline_action / inline_expression))? |
