diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-13 19:43:55 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-13 19:43:55 -0700 |
| commit | 9dee9dbbd8708ac2fb00c2240c7e0059e8691eb2 (patch) | |
| tree | 0021fa598c2f973ce119f5fb5b8b357c930cc735 | |
| parent | bccfe9d8e12ba024c745cd533f73987439c76499 (diff) | |
Made symbols group with each other, instead of *every* one being alone.
| -rw-r--r-- | lib/operators.nom | 2 | ||||
| -rwxr-xr-x | nomsu.moon | 6 |
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; @@ -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 |
