..= for string concatenation update

This commit is contained in:
leaf corcoran 2011-08-20 10:44:08 -07:00
parent d75c2b04ff
commit 20548ecd70
5 changed files with 6 additions and 5 deletions

View File

@ -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

View File

@ -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}}}

View File

@ -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">",

View File

@ -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

View File

@ -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,