Class: ActionDispatch::Journey::Parser

Inherits:
Racc::Parser
  • Object
show all
Includes:
Nodes
Defined in:
actionpack/lib/action_dispatch/journey/parser.rb,
actionpack/lib/action_dispatch/journey/parser_extras.rb

Overview

:nodoc:

Constant Summary collapse

Racc_arg =
[
racc_action_table,
racc_action_check,
racc_action_default,
racc_action_pointer,
racc_goto_table,
racc_goto_check,
racc_goto_default,
racc_goto_pointer,
racc_nt_base,
racc_reduce_table,
racc_token_table,
racc_shift_n,
racc_reduce_n,
racc_use_result_var ]
Racc_token_to_s_table =
[
"$end",
"error",
"SLASH",
"LITERAL",
"SYMBOL",
"LPAREN",
"RPAREN",
"DOT",
"STAR",
"OR",
"$start",
"expressions",
"expression",
"or",
"terminal",
"group",
"star",
"symbol",
"literal",
"slash",
"dot" ]
Racc_debug_parser =
false

Instance Method Summary collapse

Constructor Details

#initializeParser


9
10
11
# File 'actionpack/lib/action_dispatch/journey/parser_extras.rb', line 9

def initialize
  @scanner = Scanner.new
end

Instance Method Details

#_reduce_1(val, _values, result) ⇒ Object

reduce 0 omitted


139
140
141
142
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 139

def _reduce_1(val, _values, result)
 result = Cat.new(val.first, val.last)
    result
end

#_reduce_14(val, _values, result) ⇒ Object

reduce 13 omitted


180
181
182
183
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 180

def _reduce_14(val, _values, result)
 result = Slash.new('/')
    result
end

#_reduce_15(val, _values, result) ⇒ Object


185
186
187
188
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 185

def _reduce_15(val, _values, result)
 result = Symbol.new(val.first)
    result
end

#_reduce_16(val, _values, result) ⇒ Object


190
191
192
193
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 190

def _reduce_16(val, _values, result)
 result = Literal.new(val.first)
    result
end

#_reduce_17(val, _values, result) ⇒ Object


195
196
197
198
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 195

def _reduce_17(val, _values, result)
 result = Dot.new(val.first)
    result
end

#_reduce_2(val, _values, result) ⇒ Object


144
145
146
147
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 144

def _reduce_2(val, _values, result)
 result = val.first
    result
end

#_reduce_7(val, _values, result) ⇒ Object

reduce 6 omitted


157
158
159
160
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 157

def _reduce_7(val, _values, result)
 result = Group.new(val[1])
    result
end

#_reduce_8(val, _values, result) ⇒ Object


162
163
164
165
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 162

def _reduce_8(val, _values, result)
 result = Or.new([val.first, val.last])
    result
end

#_reduce_9(val, _values, result) ⇒ Object


167
168
169
170
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 167

def _reduce_9(val, _values, result)
 result = Star.new(Symbol.new(val.last))
    result
end

#_reduce_none(val, _values, result) ⇒ Object


200
201
202
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 200

def _reduce_none(val, _values, result)
  val[0]
end

#next_tokenObject


18
19
20
# File 'actionpack/lib/action_dispatch/journey/parser_extras.rb', line 18

def next_token
  @scanner.next_token
end

#parse(string) ⇒ Object


13
14
15
16
# File 'actionpack/lib/action_dispatch/journey/parser_extras.rb', line 13

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