Class: Journey::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/journey/scanner.rb

Instance Method Summary collapse

Constructor Details

#initializeScanner

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

Returns:

  • (Boolean)


13
14
15
# File 'lib/journey/scanner.rb', line 13

def eos?
  @ss.eos?
end

#next_tokenObject



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

#posObject



17
18
19
# File 'lib/journey/scanner.rb', line 17

def pos
  @ss.pos
end

#pre_matchObject



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