Class: Journey::Scanner
- Inherits:
-
Object
- Object
- Journey::Scanner
- Defined in:
- lib/journey/scanner.rb
Instance Method Summary collapse
- #eos? ⇒ Boolean
-
#initialize ⇒ Scanner
constructor
A new instance of Scanner.
- #next_token ⇒ Object
- #pos ⇒ Object
- #pre_match ⇒ Object
- #scan_setup(str) ⇒ Object
Constructor Details
#initialize ⇒ Scanner
Returns a new instance of Scanner.
5 6 7 |
# File 'lib/journey/scanner.rb', line 5 def initialize @ss = nil end |
Instance Method Details
#eos? ⇒ Boolean
13 14 15 |
# File 'lib/journey/scanner.rb', line 13 def eos? @ss.eos? end |
#next_token ⇒ Object
25 26 27 28 29 30 |
# File 'lib/journey/scanner.rb', line 25 def next_token return if @ss.eos? until token = scan || @ss.eos?; end token end |
#pos ⇒ Object
17 18 19 |
# File 'lib/journey/scanner.rb', line 17 def pos @ss.pos end |
#pre_match ⇒ Object
21 22 23 |
# File 'lib/journey/scanner.rb', line 21 def pre_match @ss.pre_match end |
#scan_setup(str) ⇒ Object
9 10 11 |
# File 'lib/journey/scanner.rb', line 9 def scan_setup str @ss = StringScanner.new str end |