class ActionDispatch::Journey::Scanner

:nodoc:
:nodoc:

def eos?

def eos?
  @ss.eos?
end

def initialize

:nodoc:
:nodoc:
def initialize
  @ss = nil
end

def next_token

def next_token
  return if @ss.eos?
  until token = scan || @ss.eos?; end
  token
end

def pos

def pos
  @ss.pos
end

def pre_match

def pre_match
  @ss.pre_match
end

def scan

def scan
  case
    # /
  when text = @ss.scan(/\//)
    [:SLASH, text]
  when text = @ss.scan(/\*\w+/)
    [:STAR, text]
  when text = @ss.scan(/(?<!\\)\(/)
    [:LPAREN, text]
  when text = @ss.scan(/(?<!\\)\)/)
    [:RPAREN, text]
  when text = @ss.scan(/\|/)
    [:OR, text]
  when text = @ss.scan(/\./)
    [:DOT, text]
  when text = @ss.scan(/(?<!\\):\w+/)
    [:SYMBOL, text]
  when text = @ss.scan(/(?:[\w%\-~!$&'*+,;=@]|\\:|\\\(|\\\))+/)
    [:LITERAL, text.tr('\\', '')]
    # any char
  when text = @ss.scan(/./)
    [:LITERAL, text]
  end
end

def scan_setup(str)

def scan_setup(str)
  @ss = StringScanner.new(str)
end