fixed parse error for empty lines before else/elseif

This commit is contained in:
leaf corcoran 2011-07-22 19:21:12 -07:00
parent 79b7cc25e5
commit 472c107786
4 changed files with 35 additions and 6 deletions

View File

@ -270,8 +270,8 @@ local build_grammar = wrap(function()
With = key"with" * Exp * key"do"^-1 * Body / mark"with",
If = key"if" * Exp * key"then"^-1 * Body *
((Break * Cmt(Indent, check_indent))^-1 * key"elseif" * Exp * key"then"^-1 * Body / mark"elseif")^0 *
((Break * Cmt(Indent, check_indent))^-1 * key"else" * Body / mark"else")^-1 / mark"if",
((Break * Cmt(Indent, check_indent))^-1 * EmptyLine^0 * key"elseif" * Exp * key"then"^-1 * Body / mark"elseif")^0 *
((Break * Cmt(Indent, check_indent))^-1 * EmptyLine^0 * key"else" * Body / mark"else")^-1 / mark"if",
While = key"while" * Exp * key"do"^-1 * Body / mark"while",

View File

@ -164,4 +164,24 @@ x = hello - world - something
\cool 100) ->
print something)!
if something
03589
-- okay what about this
else
3434
if something
yeah
elseif "ymmm"
print "cool"
else
okay

View File

@ -175,3 +175,15 @@ x = hello - world - something
end
return print(something)
end)()
if something then
_ = 3589
else
_ = 3434
end
if something then
_ = yeah
elseif "ymmm" then
print("cool")
else
_ = okay
end

3
todo
View File

@ -39,6 +39,3 @@ or
* any/every keywords for comprehensions?
fix error when blank line is before else block