mirror of
https://github.com/leafo/moonscript.git
synced 2025-01-09 00:04:22 +00:00
..= for string concatenation update
This commit is contained in:
parent
d75c2b04ff
commit
20548ecd70
@ -117,7 +117,7 @@ line_compile = {
|
||||
end,
|
||||
update = function(self, node)
|
||||
local _, name, op, exp = unpack(node)
|
||||
local op_final = op:match("(.)=")
|
||||
local op_final = op:match("^(.+)=$")
|
||||
if not op_final then
|
||||
error("Unknown op: " .. op)
|
||||
end
|
||||
|
@ -66,7 +66,7 @@ line_compile =
|
||||
|
||||
update: (node) =>
|
||||
_, name, op, exp = unpack node
|
||||
op_final = op\match "(.)="
|
||||
op_final = op\match "^(.+)=$"
|
||||
error "Unknown op: "..op if not op_final
|
||||
@stm {"assign", {name}, {{"exp", name, op_final, exp}}}
|
||||
|
||||
|
@ -305,7 +305,7 @@ local build_grammar = wrap(function()
|
||||
CompClause = CompFor + key"when" * Exp / mark"when",
|
||||
|
||||
Assign = Ct(AssignableList) * sym"=" * (With + If + Ct(TableBlock + ExpListLow)) / mark"assign",
|
||||
Update = Assignable * ((sym"+=" + sym"-=" + sym"*=" + sym"/=" + sym"%=")/trim) * Exp / mark"update",
|
||||
Update = Assignable * ((sym"..=" + sym"+=" + sym"-=" + sym"*=" + sym"/=" + sym"%=")/trim) * Exp / mark"update",
|
||||
|
||||
-- we can ignore precedence for now
|
||||
OtherOps = op"or" + op"and" + op"<=" + op">=" + op"~=" + op"!=" + op"==" + op".." + op"<" + op">",
|
||||
|
@ -138,7 +138,7 @@ j -= "hello"
|
||||
y *= 2
|
||||
y /= 100
|
||||
m %= 2
|
||||
|
||||
hello ..= "world"
|
||||
|
||||
x = 0
|
||||
(if ntype(v) == "fndef" then x += 1) for v in *values
|
||||
|
@ -142,6 +142,7 @@ local j = j - "hello"
|
||||
y = y * 2
|
||||
y = y / 100
|
||||
local m = m % 2
|
||||
local hello = hello .. "world"
|
||||
x = 0
|
||||
do
|
||||
local _item_0 = values
|
||||
@ -155,7 +156,7 @@ do
|
||||
end)())
|
||||
end
|
||||
end
|
||||
local hello = {
|
||||
hello = {
|
||||
something = world,
|
||||
["if"] = "hello",
|
||||
["else"] = 3434,
|
||||
|
Loading…
Reference in New Issue
Block a user