Class: RPStringScanner
- Inherits:
-
StringScanner
- Object
- StringScanner
- RPStringScanner
- Defined in:
- lib/ruby_parser_extras.rb
Overview
:startdoc:
Instance Method Summary collapse
- #d(o) ⇒ Object
- #getch ⇒ Object
- #old_getch ⇒ Object
- #old_scan ⇒ Object
- #scan(re) ⇒ Object
- #string_to_pos ⇒ Object
-
#unread_many(str) ⇒ Object
TODO: remove this entirely - we should not need it.
Instance Method Details
#d(o) ⇒ Object
88 89 90 |
# File 'lib/ruby_parser_extras.rb', line 88 def d o $stderr.puts o.inspect end |
#getch ⇒ Object
73 74 75 76 77 |
# File 'lib/ruby_parser_extras.rb', line 73 def getch c = self.old_getch p :getch => [c, caller.first] c end |
#old_getch ⇒ Object
72 |
# File 'lib/ruby_parser_extras.rb', line 72 alias :old_getch :getch |
#old_scan ⇒ Object
79 |
# File 'lib/ruby_parser_extras.rb', line 79 alias :old_scan :scan |
#scan(re) ⇒ Object
80 81 82 83 84 85 |
# File 'lib/ruby_parser_extras.rb', line 80 def scan re s = old_scan re where = caller.first.split(/:/).first(2).join(":") d :scan => [s, where] if s s end |
#string_to_pos ⇒ Object
42 43 44 |
# File 'lib/ruby_parser_extras.rb', line 42 def string_to_pos string.byteslice(0, pos) end |
#unread_many(str) ⇒ Object
TODO: remove this entirely - we should not need it
62 63 64 65 66 67 68 69 |
# File 'lib/ruby_parser_extras.rb', line 62 def unread_many str # TODO: remove this entirely - we should not need it warn({:unread_many => caller[0]}.inspect) if ENV['TALLY'] begin string[charpos, 0] = str rescue IndexError # HACK -- this is a bandaid on a dirty rag on an open festering wound end end |