Parent

RPStringScanner

Public Instance Methods

charpos() click to toggle source
# File lib/ruby_parser_extras.rb, line 50
def charpos
  string_to_pos.length
end
current_line() click to toggle source
# File lib/ruby_parser_extras.rb, line 61
def current_line # HAHA fuck you (HACK)
  string_to_pos[/\A.*__LINE__/].split(/\n/).size
end
d(o) click to toggle source
# File lib/ruby_parser_extras.rb, line 107
def d o
  $stderr.puts o.inspect
end
extra_lines_added() click to toggle source
# File lib/ruby_parser_extras.rb, line 65
def extra_lines_added
  @extra_lines_added ||= 0
end
extra_lines_added=(val) click to toggle source
# File lib/ruby_parser_extras.rb, line 69
def extra_lines_added= val
  @extra_lines_added = val
end
getch() click to toggle source
# File lib/ruby_parser_extras.rb, line 92
def getch
  c = self.old_getch
  p :getch => [c, caller.first]
  c
end
Also aliased as: old_getch
lineno() click to toggle source
# File lib/ruby_parser_extras.rb, line 73
def lineno
  string[0...charpos].count("\n") + 1 - extra_lines_added
end
old_getch() click to toggle source
Alias for: getch
old_scan(re) click to toggle source
Alias for: scan
scan(re) click to toggle source
# File lib/ruby_parser_extras.rb, line 99
def scan re
  s = old_scan re
  where = caller.first.split(/:/).first(2).join(":")
  d :scan => [s, where] if s
  s
end
Also aliased as: old_scan
string_to_pos() click to toggle source
# File lib/ruby_parser_extras.rb, line 41
def string_to_pos
  string.byteslice(0, pos)
end
unread_many(str) click to toggle source

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 80
def unread_many str # TODO: remove this entirely - we should not need it
  warn({:unread_many => caller[0]}.inspect) if ENV['TALLY']
  self.extra_lines_added += str.count("\n") - 1
  begin
    string[charpos, 0] = str
  rescue IndexError
    # HACK -- this is a bandaid on a dirty rag on an open festering wound
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.