mirror of
https://github.com/leafo/moonscript.git
synced 2025-01-09 00:04:22 +00:00
fixed parse error for empty lines before else/elseif
This commit is contained in:
parent
79b7cc25e5
commit
472c107786
@ -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",
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -174,4 +174,16 @@ x = hello - world - something
|
||||
end
|
||||
end
|
||||
return print(something)
|
||||
end)()
|
||||
end)()
|
||||
if something then
|
||||
_ = 3589
|
||||
else
|
||||
_ = 3434
|
||||
end
|
||||
if something then
|
||||
_ = yeah
|
||||
elseif "ymmm" then
|
||||
print("cool")
|
||||
else
|
||||
_ = okay
|
||||
end
|
Loading…
Reference in New Issue
Block a user