StringScanner
# File lib/ruby_parser_extras.rb, line 62 def begin_of_line? pos == 0 or string[pos-1] == \n\ end
if ENV then
alias :old_getch :getch def getch warn({:getch => caller[0]}.inspect) old_getch end
end
# File lib/ruby_parser_extras.rb, line 32 def current_line # HAHA fuck you (HACK) string[0..pos][/\A.*__LINE__/].split(/\n/).size end
# File lib/ruby_parser_extras.rb, line 36 def extra_lines_added @extra_lines_added ||= 0 end
# File lib/ruby_parser_extras.rb, line 40 def extra_lines_added= val @extra_lines_added = val end
# File lib/ruby_parser_extras.rb, line 72 def getch c = self.old_getch p :getch => [c, caller.first] c end
# File lib/ruby_parser_extras.rb, line 44 def lineno string[0...pos].count("\n") + 1 - extra_lines_added end
# File lib/ruby_parser_extras.rb, line 79 def scan re s = old_scan re p :scan => [s, caller.first] if s s end
TODO: once we get rid of these, we can make things like TODO: current_line and lineno much more accurate and easy to do
# File lib/ruby_parser_extras.rb, line 50 def unread c # TODO: remove this entirely - we should not need it return if c.nil? # UGH warn({:unread => caller[0]}.inspect) if ENV['TALLY'] string[pos, 0] = c end
Generated with the Darkfish Rdoc Generator 2.