actionpack 7.2.2.1 → 8.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +228 -101
  3. data/README.rdoc +1 -1
  4. data/lib/abstract_controller/base.rb +1 -12
  5. data/lib/abstract_controller/collector.rb +1 -1
  6. data/lib/abstract_controller/helpers.rb +1 -1
  7. data/lib/abstract_controller/rendering.rb +0 -1
  8. data/lib/action_controller/base.rb +1 -1
  9. data/lib/action_controller/form_builder.rb +3 -3
  10. data/lib/action_controller/metal/allow_browser.rb +11 -1
  11. data/lib/action_controller/metal/conditional_get.rb +5 -1
  12. data/lib/action_controller/metal/data_streaming.rb +4 -2
  13. data/lib/action_controller/metal/instrumentation.rb +1 -2
  14. data/lib/action_controller/metal/live.rb +59 -11
  15. data/lib/action_controller/metal/params_wrapper.rb +3 -3
  16. data/lib/action_controller/metal/rate_limiting.rb +13 -4
  17. data/lib/action_controller/metal/redirecting.rb +4 -3
  18. data/lib/action_controller/metal/renderers.rb +2 -3
  19. data/lib/action_controller/metal/rendering.rb +1 -1
  20. data/lib/action_controller/metal/request_forgery_protection.rb +3 -1
  21. data/lib/action_controller/metal/streaming.rb +5 -84
  22. data/lib/action_controller/metal/strong_parameters.rb +277 -92
  23. data/lib/action_controller/railtie.rb +6 -7
  24. data/lib/action_controller/renderer.rb +0 -1
  25. data/lib/action_controller/test_case.rb +12 -2
  26. data/lib/action_dispatch/constants.rb +6 -0
  27. data/lib/action_dispatch/http/cache.rb +27 -10
  28. data/lib/action_dispatch/http/content_security_policy.rb +14 -1
  29. data/lib/action_dispatch/http/mime_negotiation.rb +8 -3
  30. data/lib/action_dispatch/http/param_builder.rb +186 -0
  31. data/lib/action_dispatch/http/param_error.rb +26 -0
  32. data/lib/action_dispatch/http/permissions_policy.rb +2 -0
  33. data/lib/action_dispatch/http/query_parser.rb +53 -0
  34. data/lib/action_dispatch/http/request.rb +64 -19
  35. data/lib/action_dispatch/http/response.rb +49 -14
  36. data/lib/action_dispatch/http/url.rb +2 -2
  37. data/lib/action_dispatch/journey/formatter.rb +8 -3
  38. data/lib/action_dispatch/journey/gtg/transition_table.rb +4 -4
  39. data/lib/action_dispatch/journey/parser.rb +99 -196
  40. data/lib/action_dispatch/journey/scanner.rb +44 -42
  41. data/lib/action_dispatch/middleware/cookies.rb +4 -2
  42. data/lib/action_dispatch/middleware/debug_exceptions.rb +19 -4
  43. data/lib/action_dispatch/middleware/debug_view.rb +0 -5
  44. data/lib/action_dispatch/middleware/exception_wrapper.rb +3 -9
  45. data/lib/action_dispatch/middleware/executor.rb +5 -2
  46. data/lib/action_dispatch/middleware/public_exceptions.rb +5 -1
  47. data/lib/action_dispatch/middleware/request_id.rb +2 -1
  48. data/lib/action_dispatch/middleware/ssl.rb +13 -3
  49. data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +0 -3
  50. data/lib/action_dispatch/railtie.rb +8 -0
  51. data/lib/action_dispatch/request/session.rb +1 -0
  52. data/lib/action_dispatch/request/utils.rb +9 -3
  53. data/lib/action_dispatch/routing/inspector.rb +1 -1
  54. data/lib/action_dispatch/routing/mapper.rb +96 -67
  55. data/lib/action_dispatch/routing/polymorphic_routes.rb +2 -2
  56. data/lib/action_dispatch/routing/route_set.rb +21 -10
  57. data/lib/action_dispatch/routing/routes_proxy.rb +1 -0
  58. data/lib/action_dispatch/system_testing/browser.rb +12 -21
  59. data/lib/action_dispatch/testing/assertion_response.rb +1 -1
  60. data/lib/action_dispatch/testing/assertions/response.rb +12 -2
  61. data/lib/action_dispatch/testing/assertions/routing.rb +16 -12
  62. data/lib/action_dispatch/testing/integration.rb +20 -10
  63. data/lib/action_dispatch/testing/request_encoder.rb +9 -9
  64. data/lib/action_dispatch/testing/test_process.rb +1 -2
  65. data/lib/action_dispatch.rb +6 -4
  66. data/lib/action_pack/gem_version.rb +4 -4
  67. metadata +16 -38
  68. data/lib/action_dispatch/journey/parser.y +0 -50
  69. data/lib/action_dispatch/journey/parser_extras.rb +0 -33
@@ -5,6 +5,7 @@
5
5
  require "uri"
6
6
  require "active_support/core_ext/hash/indifferent_access"
7
7
  require "active_support/core_ext/string/access"
8
+ require "active_support/core_ext/module/redefine_method"
8
9
  require "action_controller/metal/exceptions"
9
10
 
10
11
  module ActionDispatch
@@ -20,38 +21,43 @@ module ActionDispatch
20
21
  module ClassMethods
21
22
  def with_routing(&block)
22
23
  old_routes = nil
24
+ old_routes_call_method = nil
23
25
  old_integration_session = nil
24
26
 
25
27
  setup do
26
28
  old_routes = app.routes
29
+ old_routes_call_method = old_routes.method(:call)
27
30
  old_integration_session = integration_session
28
31
  create_routes(&block)
29
32
  end
30
33
 
31
34
  teardown do
32
- reset_routes(old_routes, old_integration_session)
35
+ reset_routes(old_routes, old_routes_call_method, old_integration_session)
33
36
  end
34
37
  end
35
38
  end
36
39
 
37
40
  def with_routing(&block)
38
41
  old_routes = app.routes
42
+ old_routes_call_method = old_routes.method(:call)
39
43
  old_integration_session = integration_session
40
44
  create_routes(&block)
41
45
  ensure
42
- reset_routes(old_routes, old_integration_session)
46
+ reset_routes(old_routes, old_routes_call_method, old_integration_session)
43
47
  end
44
48
 
45
49
  private
46
50
  def create_routes
47
51
  app = self.app
48
52
  routes = ActionDispatch::Routing::RouteSet.new
49
- rack_app = app.config.middleware.build(routes)
53
+
54
+ @original_routes ||= app.routes
55
+ @original_routes.singleton_class.redefine_method(:call, &routes.method(:call))
56
+
50
57
  https = integration_session.https?
51
58
  host = integration_session.host
52
59
 
53
60
  app.instance_variable_set(:@routes, routes)
54
- app.instance_variable_set(:@app, rack_app)
55
61
  @integration_session = Class.new(ActionDispatch::Integration::Session) do
56
62
  include app.routes.url_helpers
57
63
  include app.routes.mounted_helpers
@@ -63,11 +69,9 @@ module ActionDispatch
63
69
  yield routes
64
70
  end
65
71
 
66
- def reset_routes(old_routes, old_integration_session)
67
- old_rack_app = app.config.middleware.build(old_routes)
68
-
72
+ def reset_routes(old_routes, old_routes_call_method, old_integration_session)
69
73
  app.instance_variable_set(:@routes, old_routes)
70
- app.instance_variable_set(:@app, old_rack_app)
74
+ @original_routes.singleton_class.redefine_method(:call, &old_routes_call_method)
71
75
  @integration_session = old_integration_session
72
76
  @routes = old_routes
73
77
  end
@@ -118,9 +122,9 @@ module ActionDispatch
118
122
  # assert_equal "/users", users_path
119
123
  # end
120
124
  #
121
- def with_routing(&block)
125
+ def with_routing(config = nil, &block)
122
126
  old_routes, old_controller = @routes, @controller
123
- create_routes(&block)
127
+ create_routes(config, &block)
124
128
  ensure
125
129
  reset_routes(old_routes, old_controller)
126
130
  end
@@ -267,8 +271,8 @@ module ActionDispatch
267
271
  end
268
272
 
269
273
  private
270
- def create_routes
271
- @routes = ActionDispatch::Routing::RouteSet.new
274
+ def create_routes(config = nil)
275
+ @routes = ActionDispatch::Routing::RouteSet.new(config || ActionDispatch::Routing::RouteSet::DEFAULT_CONFIG)
272
276
  if @controller
273
277
  @controller = @controller.clone
274
278
  _routes = @routes
@@ -184,7 +184,7 @@ module ActionDispatch
184
184
  # Returns `true` if the session is mimicking a secure HTTPS request.
185
185
  #
186
186
  # if session.https?
187
- # ...
187
+ # # ...
188
188
  # end
189
189
  def https?
190
190
  @https
@@ -203,7 +203,7 @@ module ActionDispatch
203
203
  # * `env`: Additional env to pass, as a Hash. The headers will be merged into
204
204
  # the Rack env hash.
205
205
  # * `xhr`: Set to `true` if you want to make an Ajax request. Adds request
206
- # headers characteristic of XMLHttpRequest e.g. HTTP_X_REQUESTED_WITH. The
206
+ # headers characteristic of `XMLHttpRequest`, e.g. `HTTP_X_REQUESTED_WITH`. The
207
207
  # headers will be merged into the Rack env hash.
208
208
  # * `as`: Used for encoding the request with different content type. Supports
209
209
  # `:json` by default and will set the appropriate request headers. The
@@ -218,9 +218,10 @@ module ActionDispatch
218
218
  # This method returns the response status, after performing the request.
219
219
  # Furthermore, if this method was called from an ActionDispatch::IntegrationTest
220
220
  # object, then that object's `@response` instance variable will point to a
221
- # Response object which one can use to inspect the details of the response.
221
+ # ActionDispatch::TestResponse object which one can use to inspect the details of the response.
222
222
  #
223
223
  # Example:
224
+ #
224
225
  # process :get, '/author', params: { since: 201501011400 }
225
226
  def process(method, path, params: nil, headers: nil, env: nil, xhr: false, as: nil)
226
227
  request_encoder = RequestEncoder.encoder(as)
@@ -284,7 +285,17 @@ module ActionDispatch
284
285
 
285
286
  # NOTE: rack-test v0.5 doesn't build a default uri correctly Make sure requested
286
287
  # path is always a full URI.
287
- session.request(build_full_uri(path, request_env), request_env)
288
+ uri = build_full_uri(path, request_env)
289
+
290
+ if method == :get && String === request_env[:params]
291
+ # rack-test will needlessly parse and rebuild a :params
292
+ # querystring, using Rack's query parser. At best that's a
293
+ # waste of time; at worst it can change the value.
294
+
295
+ uri << "?" << request_env.delete(:params)
296
+ end
297
+
298
+ session.request(uri, request_env)
288
299
 
289
300
  @request_count += 1
290
301
  @request = ActionDispatch::Request.new(session.last_request.env)
@@ -539,7 +550,7 @@ module ActionDispatch
539
550
  # https!(false)
540
551
  # get "/articles/all"
541
552
  # assert_response :success
542
- # assert_select 'h1', 'Articles'
553
+ # assert_dom 'h1', 'Articles'
543
554
  # end
544
555
  # end
545
556
  #
@@ -578,7 +589,7 @@ module ActionDispatch
578
589
  # def browses_site
579
590
  # get "/products/all"
580
591
  # assert_response :success
581
- # assert_select 'h1', 'Products'
592
+ # assert_dom 'h1', 'Products'
582
593
  # end
583
594
  # end
584
595
  #
@@ -594,9 +605,8 @@ module ActionDispatch
594
605
  # end
595
606
  # end
596
607
  #
597
- # See the [request helpers documentation]
598
- # (rdoc-ref:ActionDispatch::Integration::RequestHelpers) for help
599
- # on how to use `get`, etc.
608
+ # See the [request helpers documentation](rdoc-ref:ActionDispatch::Integration::RequestHelpers)
609
+ # for help on how to use `get`, etc.
600
610
  #
601
611
  # ### Changing the request encoding
602
612
  #
@@ -612,7 +622,7 @@ module ActionDispatch
612
622
  # end
613
623
  #
614
624
  # assert_response :success
615
- # assert_equal({ id: Article.last.id, title: "Ahoy!" }, response.parsed_body)
625
+ # assert_equal({ "id" => Article.last.id, "title" => "Ahoy!" }, response.parsed_body)
616
626
  # end
617
627
  # end
618
628
  #
@@ -3,6 +3,7 @@
3
3
  # :markup: markdown
4
4
 
5
5
  require "nokogiri"
6
+ require "action_dispatch/http/mime_type"
6
7
 
7
8
  module ActionDispatch
8
9
  class RequestEncoder # :nodoc:
@@ -15,9 +16,9 @@ module ActionDispatch
15
16
 
16
17
  @encoders = { identity: IdentityEncoder.new }
17
18
 
18
- attr_reader :response_parser
19
+ attr_reader :response_parser, :content_type
19
20
 
20
- def initialize(mime_name, param_encoder, response_parser)
21
+ def initialize(mime_name, param_encoder, response_parser, content_type)
21
22
  @mime = Mime[mime_name]
22
23
 
23
24
  unless @mime
@@ -27,10 +28,7 @@ module ActionDispatch
27
28
 
28
29
  @response_parser = response_parser || -> body { body }
29
30
  @param_encoder = param_encoder || :"to_#{@mime.symbol}".to_proc
30
- end
31
-
32
- def content_type
33
- @mime.to_s
31
+ @content_type = content_type || @mime.to_s
34
32
  end
35
33
 
36
34
  def accept_header
@@ -50,11 +48,13 @@ module ActionDispatch
50
48
  @encoders[name] || @encoders[:identity]
51
49
  end
52
50
 
53
- def self.register_encoder(mime_name, param_encoder: nil, response_parser: nil)
54
- @encoders[mime_name] = new(mime_name, param_encoder, response_parser)
51
+ def self.register_encoder(mime_name, param_encoder: nil, response_parser: nil, content_type: nil)
52
+ @encoders[mime_name] = new(mime_name, param_encoder, response_parser, content_type)
55
53
  end
56
54
 
57
- register_encoder :html, response_parser: -> body { Rails::Dom::Testing.html_document.parse(body) }
55
+ register_encoder :html, response_parser: -> body { Rails::Dom::Testing.html_document.parse(body) },
56
+ param_encoder: -> param { param },
57
+ content_type: Mime[:url_encoded_form].to_s
58
58
  register_encoder :json, response_parser: -> body { JSON.parse(body, object_class: ActiveSupport::HashWithIndifferentAccess) }
59
59
  end
60
60
  end
@@ -9,8 +9,7 @@ module ActionDispatch
9
9
  module TestProcess
10
10
  module FixtureFile
11
11
  # Shortcut for
12
- # `Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.file_f
13
- # ixture_path, path), type)`:
12
+ # `Rack::Test::UploadedFile.new(File.join(ActionDispatch::IntegrationTest.file_fixture_path, path), type)`:
14
13
  #
15
14
  # post :change_avatar, params: { avatar: file_fixture_upload('david.png', 'image/png') }
16
15
  #
@@ -30,7 +30,6 @@ require "active_support/core_ext/module/attribute_accessors"
30
30
 
31
31
  require "action_pack"
32
32
  require "rack"
33
- require "uri"
34
33
  require "action_dispatch/deprecator"
35
34
 
36
35
  module Rack # :nodoc:
@@ -48,16 +47,19 @@ end
48
47
  module ActionDispatch
49
48
  extend ActiveSupport::Autoload
50
49
 
51
- RFC2396_PARSER = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::RFC2396_Parser.new
52
- private_constant :RFC2396_PARSER
53
-
54
50
  class MissingController < NameError
55
51
  end
56
52
 
57
53
  eager_autoload do
58
54
  autoload_under "http" do
59
55
  autoload :ContentSecurityPolicy
56
+ autoload :InvalidParameterError, "action_dispatch/http/param_error"
57
+ autoload :ParamBuilder
58
+ autoload :ParamError
59
+ autoload :ParameterTypeError, "action_dispatch/http/param_error"
60
+ autoload :ParamsTooDeepError, "action_dispatch/http/param_error"
60
61
  autoload :PermissionsPolicy
62
+ autoload :QueryParser
61
63
  autoload :Request
62
64
  autoload :Response
63
65
  end
@@ -9,10 +9,10 @@ module ActionPack
9
9
  end
10
10
 
11
11
  module VERSION
12
- MAJOR = 7
13
- MINOR = 2
14
- TINY = 2
15
- PRE = "1"
12
+ MAJOR = 8
13
+ MINOR = 0
14
+ TINY = 5
15
+ PRE = nil
16
16
 
17
17
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
18
18
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.2.1
4
+ version: 8.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - '='
18
17
  - !ruby/object:Gem::Version
19
- version: 7.2.2.1
18
+ version: 8.0.5
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - '='
25
24
  - !ruby/object:Gem::Version
26
- version: 7.2.2.1
25
+ version: 8.0.5
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: nokogiri
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -38,20 +37,6 @@ dependencies:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: 1.8.5
41
- - !ruby/object:Gem::Dependency
42
- name: racc
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
40
  - !ruby/object:Gem::Dependency
56
41
  name: rack
57
42
  requirement: !ruby/object:Gem::Requirement
@@ -59,9 +44,6 @@ dependencies:
59
44
  - - ">="
60
45
  - !ruby/object:Gem::Version
61
46
  version: 2.2.4
62
- - - "<"
63
- - !ruby/object:Gem::Version
64
- version: '3.2'
65
47
  type: :runtime
66
48
  prerelease: false
67
49
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,9 +51,6 @@ dependencies:
69
51
  - - ">="
70
52
  - !ruby/object:Gem::Version
71
53
  version: 2.2.4
72
- - - "<"
73
- - !ruby/object:Gem::Version
74
- version: '3.2'
75
54
  - !ruby/object:Gem::Dependency
76
55
  name: rack-session
77
56
  requirement: !ruby/object:Gem::Requirement
@@ -148,28 +127,28 @@ dependencies:
148
127
  requirements:
149
128
  - - '='
150
129
  - !ruby/object:Gem::Version
151
- version: 7.2.2.1
130
+ version: 8.0.5
152
131
  type: :runtime
153
132
  prerelease: false
154
133
  version_requirements: !ruby/object:Gem::Requirement
155
134
  requirements:
156
135
  - - '='
157
136
  - !ruby/object:Gem::Version
158
- version: 7.2.2.1
137
+ version: 8.0.5
159
138
  - !ruby/object:Gem::Dependency
160
139
  name: activemodel
161
140
  requirement: !ruby/object:Gem::Requirement
162
141
  requirements:
163
142
  - - '='
164
143
  - !ruby/object:Gem::Version
165
- version: 7.2.2.1
144
+ version: 8.0.5
166
145
  type: :development
167
146
  prerelease: false
168
147
  version_requirements: !ruby/object:Gem::Requirement
169
148
  requirements:
170
149
  - - '='
171
150
  - !ruby/object:Gem::Version
172
- version: 7.2.2.1
151
+ version: 8.0.5
173
152
  description: Web apps on Rails. Simple, battle-tested conventions for building and
174
153
  testing MVC web applications. Works with any Rack-compatible server.
175
154
  email: david@loudthinking.com
@@ -253,8 +232,11 @@ files:
253
232
  - lib/action_dispatch/http/mime_negotiation.rb
254
233
  - lib/action_dispatch/http/mime_type.rb
255
234
  - lib/action_dispatch/http/mime_types.rb
235
+ - lib/action_dispatch/http/param_builder.rb
236
+ - lib/action_dispatch/http/param_error.rb
256
237
  - lib/action_dispatch/http/parameters.rb
257
238
  - lib/action_dispatch/http/permissions_policy.rb
239
+ - lib/action_dispatch/http/query_parser.rb
258
240
  - lib/action_dispatch/http/rack_cache.rb
259
241
  - lib/action_dispatch/http/request.rb
260
242
  - lib/action_dispatch/http/response.rb
@@ -268,8 +250,6 @@ files:
268
250
  - lib/action_dispatch/journey/nfa/dot.rb
269
251
  - lib/action_dispatch/journey/nodes/node.rb
270
252
  - lib/action_dispatch/journey/parser.rb
271
- - lib/action_dispatch/journey/parser.y
272
- - lib/action_dispatch/journey/parser_extras.rb
273
253
  - lib/action_dispatch/journey/path/pattern.rb
274
254
  - lib/action_dispatch/journey/route.rb
275
255
  - lib/action_dispatch/journey/router.rb
@@ -369,12 +349,11 @@ licenses:
369
349
  - MIT
370
350
  metadata:
371
351
  bug_tracker_uri: https://github.com/rails/rails/issues
372
- changelog_uri: https://github.com/rails/rails/blob/v7.2.2.1/actionpack/CHANGELOG.md
373
- documentation_uri: https://api.rubyonrails.org/v7.2.2.1/
352
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.5/actionpack/CHANGELOG.md
353
+ documentation_uri: https://api.rubyonrails.org/v8.0.5/
374
354
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
375
- source_code_uri: https://github.com/rails/rails/tree/v7.2.2.1/actionpack
355
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.5/actionpack
376
356
  rubygems_mfa_required: 'true'
377
- post_install_message:
378
357
  rdoc_options: []
379
358
  require_paths:
380
359
  - lib
@@ -382,7 +361,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
382
361
  requirements:
383
362
  - - ">="
384
363
  - !ruby/object:Gem::Version
385
- version: 3.1.0
364
+ version: 3.2.0
386
365
  required_rubygems_version: !ruby/object:Gem::Requirement
387
366
  requirements:
388
367
  - - ">="
@@ -390,8 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
390
369
  version: '0'
391
370
  requirements:
392
371
  - none
393
- rubygems_version: 3.5.22
394
- signing_key:
372
+ rubygems_version: 4.0.6
395
373
  specification_version: 4
396
374
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
397
375
  test_files: []
@@ -1,50 +0,0 @@
1
- class ActionDispatch::Journey::Parser
2
- options no_result_var
3
- token SLASH LITERAL SYMBOL LPAREN RPAREN DOT STAR OR
4
-
5
- rule
6
- expressions
7
- : expression expressions { Cat.new(val.first, val.last) }
8
- | expression { val.first }
9
- | or
10
- ;
11
- expression
12
- : terminal
13
- | group
14
- | star
15
- ;
16
- group
17
- : LPAREN expressions RPAREN { Group.new(val[1]) }
18
- ;
19
- or
20
- : expression OR expression { Or.new([val.first, val.last]) }
21
- | expression OR or { Or.new([val.first, val.last]) }
22
- ;
23
- star
24
- : STAR { Star.new(Symbol.new(val.last, Symbol::GREEDY_EXP)) }
25
- ;
26
- terminal
27
- : symbol
28
- | literal
29
- | slash
30
- | dot
31
- ;
32
- slash
33
- : SLASH { Slash.new(val.first) }
34
- ;
35
- symbol
36
- : SYMBOL { Symbol.new(val.first) }
37
- ;
38
- literal
39
- : LITERAL { Literal.new(val.first) }
40
- ;
41
- dot
42
- : DOT { Dot.new(val.first) }
43
- ;
44
-
45
- end
46
-
47
- ---- header
48
- # :stopdoc:
49
-
50
- require "action_dispatch/journey/parser_extras"
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :markup: markdown
4
-
5
- require "action_dispatch/journey/scanner"
6
- require "action_dispatch/journey/nodes/node"
7
-
8
- module ActionDispatch
9
- # :stopdoc:
10
- module Journey
11
- class Parser < Racc::Parser
12
- include Journey::Nodes
13
-
14
- def self.parse(string)
15
- new.parse string
16
- end
17
-
18
- def initialize
19
- @scanner = Scanner.new
20
- end
21
-
22
- def parse(string)
23
- @scanner.scan_setup(string)
24
- do_parse
25
- end
26
-
27
- def next_token
28
- @scanner.next_token
29
- end
30
- end
31
- end
32
- # :startdoc:
33
- end