expression can be used inside slide boundaries, fixes #233

This commit is contained in:
leaf corcoran 2016-09-25 17:34:59 -07:00
parent 0a2399ef39
commit 2e7d5153f1
4 changed files with 18 additions and 2 deletions

View File

@ -155,7 +155,7 @@ local build_grammar = wrap_env(debug_grammar, function(root)
SimpleValue = If + Unless + Switch + With + ClassDecl + ForEach + For + While + Cmt(Do, check_do) + sym("-") * -SomeSpace * Exp / mark("minus") + sym("#") * Exp / mark("length") + sym("~") * Exp / mark("bitnot") + key("not") * Exp / mark("not") + TblComprehension + TableLit + Comprehension + FunLit + Num,
ChainValue = (Chain + Callable) * Ct(InvokeArgs ^ -1) / join_chain,
Value = pos(SimpleValue + Ct(KeyValueList) / mark("table") + ChainValue + String),
SliceValue = SimpleValue + ChainValue,
SliceValue = Exp,
String = Space * DoubleString + Space * SingleString + LuaString,
SingleString = simple_string("'"),
DoubleString = simple_string('"', true),

View File

@ -211,7 +211,7 @@ build_grammar = wrap_env debug_grammar, (root) ->
ChainValue +
String)
SliceValue: SimpleValue + ChainValue
SliceValue: Exp
String: Space * DoubleString + Space * SingleString + LuaString
SingleString: simple_string("'")

View File

@ -42,5 +42,11 @@ hi = {hello,world for {:hello, :world} in *things}
ok(a,b,c) for {a,b,c} in things
--
[item for item in *items[1 + 2,3+4]]
[item for item in *items[hello! * 4, 2 - thing[4]]]
nil

View File

@ -247,4 +247,14 @@ for _des_0 in things do
a, b, c = _des_0[1], _des_0[2], _des_0[3]
ok(a, b, c)
end
local _max_0 = 3 + 4
for _index_0 = 1 + 2, _max_0 < 0 and #items + _max_0 or _max_0 do
local item = items[_index_0]
_ = item
end
local _max_1 = 2 - thing[4]
for _index_0 = hello() * 4, _max_1 < 0 and #items + _max_1 or _max_1 do
local item = items[_index_0]
_ = item
end
return nil