Class: RDoc::Markup::Parser::MyStringScanner
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rdoc/markup/parser.rb |
Overview
A simple wrapper of StringScanner that is aware of the current column and lineno
Class Method Summary
- .new(input) ⇒ MyStringScanner constructor
Instance Attribute Summary
- #eos? ⇒ Boolean readonly
Instance Method Summary
Constructor Details
.new(input) ⇒ MyStringScanner
# File 'lib/rdoc/markup/parser.rb', line 425
def initialize(input) @line = @column = 0 @s = StringScanner.new input end
Instance Attribute Details
#eos? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/rdoc/markup/parser.rb', line 450
def eos? @s.eos? end
Instance Method Details
#[](i)
[ GitHub ]# File 'lib/rdoc/markup/parser.rb', line 458
def [](i) @s[i] end
#matched
[ GitHub ]# File 'lib/rdoc/markup/parser.rb', line 454
def matched @s.matched end
#newline!
[ GitHub ]# File 'lib/rdoc/markup/parser.rb', line 445
def newline! @column = 0 @line += 1 end
#pos
[ GitHub ]# File 'lib/rdoc/markup/parser.rb', line 441
def pos [@column, @line] end
#scan(re)
[ GitHub ]# File 'lib/rdoc/markup/parser.rb', line 430
def scan(re) ret = @s.scan(re) @column += ret.length if ret ret end
#unscan(s)
[ GitHub ]# File 'lib/rdoc/markup/parser.rb', line 436
def unscan(s) @s.pos -= s.bytesize @column -= s.length end