aboutsummaryrefslogtreecommitdiff
path: root/nomnom/parser.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-09-26 14:00:05 -0700
committerBruce Hill <bruce@bruce-hill.com>2018-09-26 14:00:05 -0700
commit3f31b09e7404e1ea374bbeb230bf34664b641efb (patch)
treeb619f129e263de2e2a8a5a4866188fcb779031e6 /nomnom/parser.nom
parent17dfd248640caae5eecc13be8974378c39953f39 (diff)
Updated to the point of actually compiling.
Diffstat (limited to 'nomnom/parser.nom')
-rw-r--r--nomnom/parser.nom13
1 files changed, 7 insertions, 6 deletions
diff --git a/nomnom/parser.nom b/nomnom/parser.nom
index 1f460bd..dc98c24 100644
--- a/nomnom/parser.nom
+++ b/nomnom/parser.nom
@@ -1,11 +1,12 @@
# This file contains the parser, which converts text into abstract syntax trees
-use "nomonom/ast.nom"
+#use "nomonom/ast.nom"
%lpeg = (=lua "require('lpeg')")
%re = (=lua "require('re')")
-call %lpeg.setmaxstack with [20_000]
+call %lpeg.setmaxstack with [20000]
set {..}
(action (P 1)): %lpeg.P, (action (R 1)): %lpeg.R, (action (Carg 1)): %lpeg.Carg,
+ (action (S 1)): %lpeg.S,
(action (Cc 1)): %lpeg.Cc, (action (lpeg re pattern 1)): %re.compile,
(action (lpeg re pattern 1 using 2)): %re.compile
@@ -43,11 +44,11 @@ set {..}
%id_patt = (((P "") - (R "09")) * ((%defs.utf8_char + (R "az") + (R "AZ") + (P "_") + (R "09"))^1 * -1))
%operator_patt = ((S "'`~!@$^&*+=|<>?/-")^1 * -1)
-%text_methods = (""'s metatable).__index
-%text_methods.(action (is a nomsu identifier)) = (..)
+%text_methods = (""'s metatable).__methods
+%text_methods.("is a nomsu identifier"::as lua id) = (..)
[%str] -> (call %id_patt.match with [%id_patt, %str])
-%text_methods.(action (is a nomsu id)) = %text_methods.(action (is a nomsu identifier))
-%text_methods.(action (is a nomsu operator)) = (..)
+%text_methods.("is a nomsu id"::as lua id) = %text_methods.("is a nomsu identifier"::as lua id)
+%text_methods.("is a nomsu operator"::as lua id) = (..)
[%str] -> (call %operator_patt.match with [%operator_patt, %str])
%peg_tidier = (..)