aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/operators.nom2
-rwxr-xr-xnomsu.moon6
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/operators.nom b/lib/operators.nom
index 09bdbcd..c254861 100644
--- a/lib/operators.nom
+++ b/lib/operators.nom
@@ -90,7 +90,7 @@ lua block ".."
# Chained compairsions (e.g. x < y <= z) are defined up to 3 operands
lua block ".."
|local max_operands = 3;
- |for _,chainers in ipairs({{"<","< ="},{">","> ="}}) do;
+ |for _,chainers in ipairs({{"<","<="},{">",">="}}) do;
| local function recurse(chainers, chain)
# The 1-op versions are already more efficiently defined, and a 0-op version doesnt make sense
| if #chain >= 2 then;
diff --git a/nomsu.moon b/nomsu.moon
index 82867ed..a188d1b 100755
--- a/nomsu.moon
+++ b/nomsu.moon
@@ -102,7 +102,7 @@ nomsu = [=[
(expression (dotdot / tok_gap))* word ((dotdot / tok_gap) (expression / word))*
|} }) -> FunctionCall
- word <- ({ { %wordbreaker / (!number %wordchar+) } }) -> Word
+ word <- ({ { (%wordbreaker+) / (!number %wordchar+) } }) -> Word
inline_string <- ({ '"' {|
({~ (("\\" -> "\") / ('\"' -> '"') / ("\n" -> "
@@ -120,7 +120,7 @@ nomsu = [=[
-- Variables can be nameless (i.e. just %) and can't contain apostrophes
-- which is a hack to allow %foo's to parse as "%foo" and "'s" separately
- variable <- ({ ("%" { (%wordbreaker / (%wordchar+))? }) }) -> Var
+ variable <- ({ ("%" { ((%wordbreaker+) / (%wordchar+))? }) }) -> Var
inline_list <- ({ {|
("[" %ws? ((inline_list_item comma)* inline_list_item comma?)? %ws? "]")
@@ -542,7 +542,7 @@ end)]])\format(concat(lua_bits, "\n"))
-- Returns a single stub ("say %"), and list of arg names ({"msg"}) from a single rule def
-- (e.g. "say %msg") or function call (e.g. FunctionCall({Word("say"), Var("msg")))
if type(x) == 'string'
- stub = x\gsub("([#{wordbreaker}])"," %1 ")\gsub("%%%S+","%%")\gsub("%s+"," ")\gsub("%s*$","")
+ stub = x\gsub("([#{wordbreaker}]+)"," %1 ")\gsub("%%%S+","%%")\gsub("%s+"," ")\gsub("%s*$","")
arg_names = [arg for arg in x\gmatch("%%([^%s']*)")]
return stub, arg_names
switch x.type