aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/journey/parser_extras.rb
blob: dfbc6c45293a7adfd51f21086d1b6941661fa7c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

require_relative "scanner"
require_relative "nodes/node"

module ActionDispatch
  # :stopdoc:
  module Journey
    class Parser < Racc::Parser
      include Journey::Nodes

      def self.parse(string)
        new.parse string
      end

      def initialize
        @scanner = Scanner.new
      end

      def parse(string)
        @scanner.scan_setup(string)
        do_parse
      end

      def next_token
        @scanner.next_token
      end
    end
  end
  # :startdoc:
end