-
-
Save aycabta/30ab96334275bced5796f118c9220b0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start = Time.now | |
def each_top_level_statement | |
initialize_input | |
catch(:TERM_INPUT) do | |
loop do | |
begin | |
prompt | |
unless l = lex | |
throw :TERM_INPUT if @line == '' | |
else | |
@line_no += l.count("\n") | |
next if l == "\n" | |
@line.concat l | |
if @code_block_open or @ltype or @continue or @indent > 0 | |
next | |
end | |
end | |
if @line != "\n" | |
@line.force_encoding(@io.encoding) | |
yield @line, @exp_line_no | |
end | |
break if @io.eof? | |
@line = '' | |
@exp_line_no = @line_no | |
@indent = 0 | |
rescue TerminateLineInput | |
initialize_input | |
prompt | |
end | |
end | |
end | |
end | |
puts "Duration: #{Time.now - start} seconds" | |
# end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment