diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-12-08 15:39:05 -0800 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-12-08 15:39:05 -0800 |
| commit | 28b6bc188370fe3c20b26c483b48ab70673bd35b (patch) | |
| tree | fdcab702c79281622c4f42f380263474cf6213b5 /nomsu.lua | |
| parent | 8da2b1d64ca486662fb22b6635688048269c811b (diff) | |
Simplified parser by removing prev_edge.
Diffstat (limited to 'nomsu.lua')
| -rw-r--r-- | nomsu.lua | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -105,13 +105,13 @@ local nomsu = [=[ file <- ({{| shebang? -- Function calls need at least one word in them inline_functioncall <- ({(''=>line_no) {| - (inline_expression tok_gap)* word (tok_gap (inline_expression / word))* + (inline_expression %ws?)* word (%ws? (inline_expression / word))* |} }) -> FunctionCall noeol_functioncall <- ({(''=>line_no) {| - (noeol_expression tok_gap)* word (tok_gap (noeol_expression / word))* + (noeol_expression %ws?)* word (%ws? (noeol_expression / word))* |} }) -> FunctionCall functioncall <- ({(''=>line_no) {| - (expression (dotdot / tok_gap))* word ((dotdot / tok_gap) (expression / word))* + (expression (dotdot / %ws?))* word ((dotdot / %ws?) (expression / word))* |} }) -> FunctionCall word <- ({ { %operator / (!number %plain_word) } }) -> Word @@ -153,7 +153,6 @@ local nomsu = [=[ file <- ({{| shebang? indent <- eol (%nl ignored_line)* %nl %indented ((block_comment/line_comment) (%nl ignored_line)* nodent)? nodent <- eol (%nl ignored_line)* %nl %nodented dedent <- eol (%nl ignored_line)* (((!.) &%dedented) / (&(%nl %dedented))) - tok_gap <- %ws / %prev_edge / &("[" / "\" / [.,:;{("#%] / &%operator) comma <- %ws? "," %ws? semicolon <- %ws? ";" %ws? dotdot <- nodent ".." %ws? @@ -173,7 +172,6 @@ local defs = { indented = Cmt(S(" \t") ^ 0 * (#(P(1) - S(" \t\n") + (-P(1)))), check_indent), nodented = Cmt(S(" \t") ^ 0 * (#(P(1) - S(" \t\n") + (-P(1)))), check_nodent), dedented = Cmt(S(" \t") ^ 0 * (#(P(1) - S(" \t\n") + (-P(1)))), check_dedent), - prev_edge = B(S(" \t\n.,:;}])\"\\'~`!@$^&*-+=|<>?/")), line_no = function(src, pos) local line_no = 1 for _ in src:sub(1, pos):gmatch("\n") do |
