Class: ActionDispatch::Journey::Parser

Inherits:
Racc::Parser
  • Object
show all
Includes:
Nodes
Defined in:
actionpack/lib/action_dispatch/journey/parser_extras.rb,
actionpack/lib/action_dispatch/journey/parser.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

Returns a new instance of Parser.


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) ⇒ Object

reduce 0 omitted


136
137
138
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 136

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

#_reduce_10(val, _values) ⇒ Object


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

def _reduce_10(val, _values)
 Star.new(Symbol.new(val.last))
end

#_reduce_15(val, _values) ⇒ Object

reduce 14 omitted


176
177
178
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 176

def _reduce_15(val, _values)
 Slash.new('/')
end

#_reduce_16(val, _values) ⇒ Object


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

def _reduce_16(val, _values)
 Symbol.new(val.first)
end

#_reduce_17(val, _values) ⇒ Object


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

def _reduce_17(val, _values)
 Literal.new(val.first)
end

#_reduce_18(val, _values) ⇒ Object


188
189
190
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 188

def _reduce_18(val, _values)
 Dot.new(val.first)
end

#_reduce_2(val, _values) ⇒ Object


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

def _reduce_2(val, _values)
 val.first
end

#_reduce_7(val, _values) ⇒ Object

reduce 6 omitted


152
153
154
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 152

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

#_reduce_8(val, _values) ⇒ Object


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

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

#_reduce_9(val, _values) ⇒ Object


160
161
162
# File 'actionpack/lib/action_dispatch/journey/parser.rb', line 160

def _reduce_9(val, _values)
 Or.new([val.first, val.last])
end

#_reduce_none(val, _values) ⇒ Object


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

def _reduce_none(val, _values)
  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