git @ Cat's Eye Technologies Wanda / e941eab
Implement `sink` in Lua implementation. Chris Pressey 6 years ago
1 changed file(s) with 11 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
9898 return {start=i, stop=i+2, pattern={x, "$", "dup"}, replacement={x, x, "$"}}
9999 end
100100
101 if redex[i] == ")" and redex[i+1] == "$" and redex[i+2] and redex[i+3] == "sink" then
102 local x = redex[i+2]
103 return {start=i, stop=i+3, pattern={")", "$", x, "sink"}, replacement={")", "$", x}}
104 end
105
106 if redex[i] and redex[i+1] == "$" and redex[i+2] and redex[i+3] == "sink" then
107 local x = redex[i]
108 local y = redex[i+2]
109 return {start=i, stop=i+3, pattern={x, "$", y, "sink"}, replacement={"$", y, "sink", x}}
110 end
111
101112 if redex[i] == "$" and is_number(redex[i+1]) then
102113 return {start=i, stop=i+1, pattern={"$", redex[i+1]}, replacement={redex[i+1], "$"}}
103114 end