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.moon | |
| parent | 8da2b1d64ca486662fb22b6635688048269c811b (diff) | |
Simplified parser by removing prev_edge.
Diffstat (limited to 'nomsu.moon')
| -rwxr-xr-x | nomsu.moon | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -98,13 +98,13 @@ nomsu = [=[ -- 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 @@ -146,7 +146,6 @@ nomsu = [=[ 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? @@ -166,7 +165,6 @@ 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.,:;}])\"\\'~`!@$^&*-+=|<>?/")) -- Includes "operator" line_no: (src, pos)-> line_no = 1 for _ in src\sub(1,pos)\gmatch("\n") do line_no += 1 |
