|
|
@ -16,6 +16,8 @@ module Lox
|
|
|
|
statements << declaration
|
|
|
|
statements << declaration
|
|
|
|
end
|
|
|
|
end
|
|
|
|
statements
|
|
|
|
statements
|
|
|
|
|
|
|
|
rescue ParseError
|
|
|
|
|
|
|
|
synchronize!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
private
|
|
|
@ -24,8 +26,6 @@ module Lox
|
|
|
|
return var_declaration if match?(:VAR)
|
|
|
|
return var_declaration if match?(:VAR)
|
|
|
|
|
|
|
|
|
|
|
|
statement
|
|
|
|
statement
|
|
|
|
rescue ParseError
|
|
|
|
|
|
|
|
synchronize!
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def var_declaration
|
|
|
|
def var_declaration
|
|
|
@ -240,6 +240,8 @@ module Lox
|
|
|
|
args = []
|
|
|
|
args = []
|
|
|
|
if !check?(:RIGHT_PAREN)
|
|
|
|
if !check?(:RIGHT_PAREN)
|
|
|
|
loop do
|
|
|
|
loop do
|
|
|
|
|
|
|
|
raise ParseError.new(peek, "Can't have more than 255 arguments.") if args.size >= 255
|
|
|
|
|
|
|
|
|
|
|
|
args << expression
|
|
|
|
args << expression
|
|
|
|
break unless match?(:COMMA)
|
|
|
|
break unless match?(:COMMA)
|
|
|
|
end
|
|
|
|
end
|
|
|
|