Made symbols group with each other, instead of *every* one being alone.
This commit is contained in:
parent
bccfe9d8e1
commit
9dee9dbbd8
@ -90,7 +90,7 @@ lua block ".."
|
|||||||
# Chained compairsions (e.g. x < y <= z) are defined up to 3 operands
|
# Chained compairsions (e.g. x < y <= z) are defined up to 3 operands
|
||||||
lua block ".."
|
lua block ".."
|
||||||
|local max_operands = 3;
|
|local max_operands = 3;
|
||||||
|for _,chainers in ipairs({{"<","< ="},{">","> ="}}) do;
|
|for _,chainers in ipairs({{"<","<="},{">",">="}}) do;
|
||||||
| local function recurse(chainers, chain)
|
| local function recurse(chainers, chain)
|
||||||
# The 1-op versions are already more efficiently defined, and a 0-op version doesnt make sense
|
# The 1-op versions are already more efficiently defined, and a 0-op version doesnt make sense
|
||||||
| if #chain >= 2 then;
|
| if #chain >= 2 then;
|
||||||
|
@ -102,7 +102,7 @@ nomsu = [=[
|
|||||||
(expression (dotdot / tok_gap))* word ((dotdot / tok_gap) (expression / word))*
|
(expression (dotdot / tok_gap))* word ((dotdot / tok_gap) (expression / word))*
|
||||||
|} }) -> FunctionCall
|
|} }) -> FunctionCall
|
||||||
|
|
||||||
word <- ({ { %wordbreaker / (!number %wordchar+) } }) -> Word
|
word <- ({ { (%wordbreaker+) / (!number %wordchar+) } }) -> Word
|
||||||
|
|
||||||
inline_string <- ({ '"' {|
|
inline_string <- ({ '"' {|
|
||||||
({~ (("\\" -> "\") / ('\"' -> '"') / ("\n" -> "
|
({~ (("\\" -> "\") / ('\"' -> '"') / ("\n" -> "
|
||||||
@ -120,7 +120,7 @@ nomsu = [=[
|
|||||||
|
|
||||||
-- Variables can be nameless (i.e. just %) and can't contain apostrophes
|
-- 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
|
-- 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 <- ({ {|
|
inline_list <- ({ {|
|
||||||
("[" %ws? ((inline_list_item comma)* inline_list_item comma?)? %ws? "]")
|
("[" %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
|
-- 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")))
|
-- (e.g. "say %msg") or function call (e.g. FunctionCall({Word("say"), Var("msg")))
|
||||||
if type(x) == 'string'
|
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']*)")]
|
arg_names = [arg for arg in x\gmatch("%%([^%s']*)")]
|
||||||
return stub, arg_names
|
return stub, arg_names
|
||||||
switch x.type
|
switch x.type
|
||||||
|
Loading…
Reference in New Issue
Block a user