Parent

Journey::Scanner

Public Class Methods

new() click to toggle source
   # File lib/journey/scanner.rb, line 5
5:     def initialize
6:       @ss = nil
7:     end

Public Instance Methods

eos?() click to toggle source
    # File lib/journey/scanner.rb, line 13
13:     def eos?
14:       @ss.eos?
15:     end
next_token() click to toggle source
    # File lib/journey/scanner.rb, line 25
25:     def next_token
26:       return if @ss.eos?
27: 
28:       until token = scan || @ss.eos?; end
29:       token
30:     end
pos() click to toggle source
    # File lib/journey/scanner.rb, line 17
17:     def pos
18:       @ss.pos
19:     end
pre_match() click to toggle source
    # File lib/journey/scanner.rb, line 21
21:     def pre_match
22:       @ss.pre_match
23:     end
scan_setup(str) click to toggle source
    # File lib/journey/scanner.rb, line 9
 9:     def scan_setup str
10:       @ss = StringScanner.new str
11:     end

Private Instance Methods

scan() click to toggle source
    # File lib/journey/scanner.rb, line 33
33:     def scan
34:       case
35:         # /
36:       when text = @ss.scan(/\//)
37:         [:SLASH, text]
38:       when text = @ss.scan(/\*/)
39:         [:STAR, text]
40:       when text = @ss.scan(/\(/)
41:         [:LPAREN, text]
42:       when text = @ss.scan(/\)/)
43:         [:RPAREN, text]
44:       when text = @ss.scan(/\|/)
45:         [:OR, text]
46:       when text = @ss.scan(/\./)
47:         [:DOT, text]
48:       when text = @ss.scan(/:\w+/)
49:         [:SYMBOL, text]
50:       when text = @ss.scan(/[\w%\-~]+/)
51:         [:LITERAL, text]
52:         # any char
53:       when text = @ss.scan(/./)
54:         [:LITERAL, text]
55:       end
56:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.