unary minus must not have any whitespace after it

avoids precedence ambiguity between minus with fncall
This commit is contained in:
leaf corcoran 2011-06-20 08:28:25 -07:00
parent 63437f8c52
commit 17184f2aa8
3 changed files with 17 additions and 11 deletions

View File

@ -35,6 +35,7 @@ local Indent = C(S"\t "^0) / count_indent
local Comment = P"--" * (1 - S"\n")^0 * #Stop
local Space = _Space * Comment^-1
local SomeSpace = S" \t"^1 * Comment^-1
local _Name = C(R("az", "AZ", "__") * R("az", "AZ", "09", "__")^0)
local Name = Space * _Name
@ -279,7 +280,7 @@ local build_grammar = wrap(function()
Value =
If +
sym"-" * Exp / mark"minus" +
sym"-" * -SomeSpace * Exp / mark"minus" +
sym"#" * Exp / mark"length" +
sym"not" * Exp / mark"not" +
TableLit +
@ -407,12 +408,3 @@ function string(str)
return g:match(str)
end
local program3 = [[
-- hello
class Hello
@something: 2323
hello: () ->
print 200
]]

View File

@ -159,3 +159,12 @@ hello =
good: 230203
5 + what wack
what whack + 5
5 - what wack
what whack - 5
x = hello - world - something

View File

@ -119,3 +119,8 @@ local hello = {
["function"] = "okay",
good = 230203
}
_ = 5 + what(wack)
what(whack + 5)
_ = 5 - what(wack)
what(whack - 5)
x = hello - world - something