From 72d699fe86ddb34473b54a0df27d21b4a9159284 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 5 Feb 2019 15:45:27 -0800 Subject: Bunch of changes: - Added shebangs to generated code output - SyntaxTree:map() -> SyntaxTree:with(), and corresponding changes to metaprogramming API - Added (return Lua 1) shorthand for (return (Lua 1)) - (1 and 2 and 3) compile rule mapping to -> (1 and (*extra arguments*)) - Don't scan for errors, just report them when compiling - Syntax changes: - Added prefix actions (e.g. #$foo) - Operator chars now include utf8 chars - Ditch "escaped nomsu" type (use (\ 1) compile action instead) --- parser.moon | 2 ++ 1 file changed, 2 insertions(+) (limited to 'parser.moon') diff --git a/parser.moon b/parser.moon index 47459b2..ce81ff4 100644 --- a/parser.moon +++ b/parser.moon @@ -20,6 +20,7 @@ DEFS = with {} -- Newline supports either windows-style CR+LF or unix-style LF .nl = P("\r")^-1 * P("\n") .tab = P("\t") + .at_break = lpeg.B(lpeg.S(";,. \r\n\t({[")) + -lpeg.B(1) .tonumber = tonumber .tochar = string.char .unpack = unpack or table.unpack @@ -36,6 +37,7 @@ DEFS = with {} R("\194\223")*R("\128\191") + R("\224\239")*R("\128\191")*R("\128\191") + R("\240\244")*R("\128\191")*R("\128\191")*R("\128\191")) + .operator_char = S("#'`~@^&*+=<>?/%!|\\-") + (P("\xE2") * (R("\x88\x8B")+R("\xA8\xAB")) * R("\128\191")) .Tree = (t, userdata)-> userdata.make_tree(t, userdata) .foldr = foldr -- cgit v1.2.3