diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-01-08 18:53:57 -0800 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-01-08 18:53:57 -0800 |
| commit | f97ab858edae5495f8ebfef46656e86150665888 (patch) | |
| tree | ed47620eba2365192ba54950647d6307223cac29 /nomsu.peg | |
| parent | 568a44ef191e1f4072d379700e3b6f599150a92b (diff) | |
Modernized the codebase a bit to include "immediately:" for immediately
running code before further parsing takes place. That means that in the
default case, whole files can be run at once, which makes all but the
weirdest edge cases make a lot more sense and operate smoothly.
Diffstat (limited to 'nomsu.peg')
| -rw-r--r-- | nomsu.peg | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -11,12 +11,12 @@ statement: functioncall / expression noeol_statement: noeol_functioncall / noeol_expression inline_statement: inline_functioncall / inline_expression -inline_thunk (Thunk): {| ":" %ws* inline_statement |} -eol_thunk (Thunk): {| ":" %ws* noeol_statement eol |} -indented_thunk (Thunk): +inline_block (Block): {| ":" %ws* inline_statement |} +eol_block (Block): {| ":" %ws* noeol_statement eol |} +indented_block (Block): {| ":" indent statement (nodent statement)* - (dedent / (("" -> "Error while parsing thunk") => error)) + (dedent / (("" -> "Error while parsing block") => error)) |} inline_nomsu (Nomsu): "\" inline_expression @@ -25,18 +25,18 @@ indented_nomsu (Nomsu): "\" expression inline_expression: number / variable / inline_string / inline_list / inline_dict / inline_nomsu - / ("(" %ws* (inline_thunk / inline_statement) %ws* ")") + / ("(" %ws* (inline_block / inline_statement) %ws* ")") noeol_expression: - indented_string / indented_nomsu / indented_list / indented_dict / indented_thunk + indented_string / indented_nomsu / indented_list / indented_dict / indented_block / ("(..)" indent statement (dedent / (("" -> "Error while parsing indented expression") => error)) ) / inline_expression -expression: eol_thunk / eol_nomsu / noeol_expression +expression: eol_block / eol_nomsu / noeol_expression -- Function calls need at least one word in them inline_functioncall (FunctionCall): - {| (inline_expression %ws*)* word (%ws* (inline_expression / word))* (%ws* inline_thunk)?|} + {| (inline_expression %ws*)* word (%ws* (inline_expression / word))* (%ws* inline_block)?|} noeol_functioncall (FunctionCall): {| (noeol_expression %ws*)* word (%ws* (noeol_expression / word))* |} functioncall (FunctionCall): @@ -57,7 +57,7 @@ indented_string (String): ~} / string_interpolation)* |} ((!.) / (&(%nl+ !%gt_nodented)) / (("" -> "Error while parsing String") => error)) string_interpolation: - "\" (variable / inline_list / inline_dict / inline_string / ("(" %ws* (inline_thunk / inline_statement) %ws* ")")) + "\" (variable / inline_list / inline_dict / inline_string / ("(" %ws* (inline_block / inline_statement) %ws* ")")) number (Number): (("-"? (([0-9]+ "." [0-9]+) / ("." [0-9]+) / ([0-9]+)))-> tonumber) |
