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

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeParser

Returns a new instance of Parser.



16
17
18
# File 'actionpack/lib/action_dispatch/journey/parser_extras.rb', line 16

def initialize
  @scanner = Scanner.new
end

Class Method Details

.parse(string) ⇒ Object



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

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

Instance Method Details

#_reduce_1(val, _values) ⇒ Object

reduce 0 omitted



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

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

#_reduce_10(val, _values) ⇒ Object



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

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

#_reduce_15(val, _values) ⇒ Object

reduce 14 omitted



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

def _reduce_15(val, _values)
 Slash.new(val.first)
end

#_reduce_16(val, _values) ⇒ Object



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

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

#_reduce_17(val, _values) ⇒ Object



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

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

#_reduce_18(val, _values) ⇒ Object



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

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

#_reduce_2(val, _values) ⇒ Object



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

def _reduce_2(val, _values)
 val.first
end

#_reduce_7(val, _values) ⇒ Object

reduce 6 omitted



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

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

#_reduce_8(val, _values) ⇒ Object



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

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

#_reduce_9(val, _values) ⇒ Object



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

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

#_reduce_none(val, _values) ⇒ Object



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

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

#next_tokenObject



25
26
27
# File 'actionpack/lib/action_dispatch/journey/parser_extras.rb', line 25

def next_token
  @scanner.next_token
end

#parse(string) ⇒ Object



20
21
22
23
# File 'actionpack/lib/action_dispatch/journey/parser_extras.rb', line 20

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