lgierth-rack-mount 0.6.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +36 -0
  3. data/lib/rack/mount.rb +32 -0
  4. data/lib/rack/mount/analysis/frequency.rb +60 -0
  5. data/lib/rack/mount/analysis/histogram.rb +74 -0
  6. data/lib/rack/mount/analysis/splitting.rb +159 -0
  7. data/lib/rack/mount/code_generation.rb +117 -0
  8. data/lib/rack/mount/generatable_regexp.rb +210 -0
  9. data/lib/rack/mount/multimap.rb +53 -0
  10. data/lib/rack/mount/prefix.rb +36 -0
  11. data/lib/rack/mount/regexp_with_named_groups.rb +69 -0
  12. data/lib/rack/mount/route.rb +130 -0
  13. data/lib/rack/mount/route_set.rb +420 -0
  14. data/lib/rack/mount/strexp.rb +68 -0
  15. data/lib/rack/mount/strexp/parser.rb +160 -0
  16. data/lib/rack/mount/strexp/parser.y +34 -0
  17. data/lib/rack/mount/strexp/tokenizer.rb +83 -0
  18. data/lib/rack/mount/strexp/tokenizer.rex +12 -0
  19. data/lib/rack/mount/utils.rb +162 -0
  20. data/lib/rack/mount/vendor/multimap/multimap.rb +569 -0
  21. data/lib/rack/mount/vendor/multimap/multiset.rb +185 -0
  22. data/lib/rack/mount/vendor/multimap/nested_multimap.rb +158 -0
  23. data/lib/rack/mount/vendor/regin/regin.rb +75 -0
  24. data/lib/rack/mount/vendor/regin/regin/alternation.rb +40 -0
  25. data/lib/rack/mount/vendor/regin/regin/anchor.rb +4 -0
  26. data/lib/rack/mount/vendor/regin/regin/atom.rb +54 -0
  27. data/lib/rack/mount/vendor/regin/regin/character.rb +51 -0
  28. data/lib/rack/mount/vendor/regin/regin/character_class.rb +50 -0
  29. data/lib/rack/mount/vendor/regin/regin/collection.rb +77 -0
  30. data/lib/rack/mount/vendor/regin/regin/expression.rb +126 -0
  31. data/lib/rack/mount/vendor/regin/regin/group.rb +85 -0
  32. data/lib/rack/mount/vendor/regin/regin/options.rb +55 -0
  33. data/lib/rack/mount/vendor/regin/regin/parser.rb +520 -0
  34. data/lib/rack/mount/vendor/regin/regin/tokenizer.rb +246 -0
  35. data/lib/rack/mount/vendor/regin/regin/version.rb +3 -0
  36. data/lib/rack/mount/version.rb +3 -0
  37. metadata +140 -0
@@ -0,0 +1,246 @@
1
+ #--
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by rex 1.0.5.beta1
4
+ # from lexical definition file "lib/regin/tokenizer.rex".
5
+ #++
6
+
7
+ require 'racc/parser'
8
+ class Regin::Parser < Racc::Parser
9
+ require 'strscan'
10
+
11
+ class ScanError < StandardError ; end
12
+
13
+ attr_reader :lineno
14
+ attr_reader :filename
15
+ attr_accessor :state
16
+
17
+ def scan_setup(str)
18
+ @ss = StringScanner.new(str)
19
+ @lineno = 1
20
+ @state = nil
21
+ end
22
+
23
+ def action
24
+ yield
25
+ end
26
+
27
+ def scan_str(str)
28
+ scan_setup(str)
29
+ do_parse
30
+ end
31
+ alias :scan :scan_str
32
+
33
+ def load_file( filename )
34
+ @filename = filename
35
+ open(filename, "r") do |f|
36
+ scan_setup(f.read)
37
+ end
38
+ end
39
+
40
+ def scan_file( filename )
41
+ load_file(filename)
42
+ do_parse
43
+ end
44
+
45
+
46
+ def next_token
47
+ return if @ss.eos?
48
+
49
+ # skips empty actions
50
+ until token = _next_token or @ss.eos?; end
51
+ token
52
+ end
53
+
54
+ def _next_token
55
+ text = @ss.peek(1)
56
+ @lineno += 1 if text == "\n"
57
+ token = case @state
58
+ when nil
59
+ case
60
+ when (text = @ss.scan(/\\[dDsSwW]/))
61
+ action { [:CCLASS, text] }
62
+
63
+ when (text = @ss.scan(/\^|\\A/))
64
+ action { [:L_ANCHOR, text] }
65
+
66
+ when (text = @ss.scan(/\$|\\Z/))
67
+ action { [:R_ANCHOR, text] }
68
+
69
+ when (text = @ss.scan(/<(\w+)>/))
70
+ action { [:NAME, @ss[1]] }
71
+
72
+ when (text = @ss.scan(/\(/))
73
+ action {
74
+ @capture_index_stack << @capture_index
75
+ @capture_index += 1
76
+ @state = :OPTIONS if @ss.peek(1) == '?';
77
+ [:LPAREN, text]
78
+ }
79
+
80
+
81
+ when (text = @ss.scan(/\)/))
82
+ action { [:RPAREN, text] }
83
+
84
+ when (text = @ss.scan(/\[/))
85
+ action { @state = :CCLASS; [:LBRACK, text] }
86
+
87
+ when (text = @ss.scan(/\{/))
88
+ action { [:LCURLY, text] }
89
+
90
+ when (text = @ss.scan(/\}/))
91
+ action { [:RCURLY, text] }
92
+
93
+ when (text = @ss.scan(/\|/))
94
+ action { [:BAR, text] }
95
+
96
+ when (text = @ss.scan(/\./))
97
+ action { [:DOT, text] }
98
+
99
+ when (text = @ss.scan(/\?/))
100
+ action { [:QMARK, text] }
101
+
102
+ when (text = @ss.scan(/\+/))
103
+ action { [:PLUS, text] }
104
+
105
+ when (text = @ss.scan(/\*/))
106
+ action { [:STAR, text] }
107
+
108
+ when (text = @ss.scan(/\#/))
109
+ action {
110
+ if @options_stack[-1][:extended]
111
+ @state = :COMMENT;
112
+ next_token
113
+ else
114
+ [:CHAR, text]
115
+ end
116
+ }
117
+
118
+
119
+ when (text = @ss.scan(/\s|\n/))
120
+ action {
121
+ if @options_stack[-1][:extended]
122
+ next_token
123
+ else
124
+ [:CHAR, text]
125
+ end
126
+ }
127
+
128
+
129
+ when (text = @ss.scan(/\\(.)/))
130
+ action { [:CHAR, @ss[1]] }
131
+
132
+ when (text = @ss.scan(/./))
133
+ action { [:CHAR, text] }
134
+
135
+ else
136
+ text = @ss.string[@ss.pos .. -1]
137
+ raise ScanError, "can not match: '" + text + "'"
138
+ end # if
139
+
140
+ when :CCLASS
141
+ case
142
+ when (text = @ss.scan(/\[/))
143
+ action { [:LBRACK, text] }
144
+
145
+ when (text = @ss.scan(/\]/))
146
+ action { @state = nil; [:RBRACK, text] }
147
+
148
+ when (text = @ss.scan(/\^/))
149
+ action { [@ss.string[@ss.pos-2, 1] == '[' ? :NEGATE : :CHAR, text] }
150
+
151
+ when (text = @ss.scan(/:/))
152
+ action {
153
+ if @ss.string[@ss.pos-2, 1] == '['
154
+ @state = :POSIX_CCLASS
155
+ [:COLON, text]
156
+ else
157
+ [:CHAR, text]
158
+ end
159
+ }
160
+
161
+
162
+ when (text = @ss.scan(/\\-/))
163
+ action { [:CHAR, text] }
164
+
165
+ when (text = @ss.scan(/\\(.)/))
166
+ action { [:CHAR, @ss[1]] }
167
+
168
+ when (text = @ss.scan(/./))
169
+ action { [:CHAR, text] }
170
+
171
+ else
172
+ text = @ss.string[@ss.pos .. -1]
173
+ raise ScanError, "can not match: '" + text + "'"
174
+ end # if
175
+
176
+ when :POSIX_CCLASS
177
+ case
178
+ when (text = @ss.scan(/\w+/))
179
+ action { [text, text] }
180
+
181
+ when (text = @ss.scan(/:/))
182
+ action { [:COLON, text] }
183
+
184
+ when (text = @ss.scan(/\]/))
185
+ action { @state = :CCLASS; [:RBRACK, text] }
186
+
187
+ else
188
+ text = @ss.string[@ss.pos .. -1]
189
+ raise ScanError, "can not match: '" + text + "'"
190
+ end # if
191
+
192
+ when :OPTIONS
193
+ case
194
+ when (text = @ss.scan(/\?/))
195
+ action {
196
+ @state = nil unless @ss.peek(1) =~ /-|m|i|x|:/
197
+ [:QMARK, text]
198
+ }
199
+
200
+
201
+ when (text = @ss.scan(/\-/))
202
+ action { [:MINUS, text] }
203
+
204
+ when (text = @ss.scan(/m/))
205
+ action { [:MULTILINE, text] }
206
+
207
+ when (text = @ss.scan(/i/))
208
+ action { [:IGNORECASE, text] }
209
+
210
+ when (text = @ss.scan(/x/))
211
+ action { [:EXTENDED, text] }
212
+
213
+ when (text = @ss.scan(/\:/))
214
+ action {
215
+ @capture_index_stack.pop
216
+ @capture_index -= 1
217
+ @state = nil;
218
+ [:COLON, text]
219
+ }
220
+
221
+
222
+ else
223
+ text = @ss.string[@ss.pos .. -1]
224
+ raise ScanError, "can not match: '" + text + "'"
225
+ end # if
226
+
227
+ when :COMMENT
228
+ case
229
+ when (text = @ss.scan(/\n/))
230
+ action { @state = nil; next_token }
231
+
232
+ when (text = @ss.scan(/./))
233
+ action { next_token }
234
+
235
+ else
236
+ text = @ss.string[@ss.pos .. -1]
237
+ raise ScanError, "can not match: '" + text + "'"
238
+ end # if
239
+
240
+ else
241
+ raise ScanError, "undefined state: '" + state.to_s + "'"
242
+ end # case state
243
+ token
244
+ end # def _next_token
245
+
246
+ end # class
@@ -0,0 +1,3 @@
1
+ module Regin
2
+ Version = '0.3.7'
3
+ end
@@ -0,0 +1,3 @@
1
+ module Rack::Mount
2
+ Version = '0.6.13'
3
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lgierth-rack-mount
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 6
8
+ - 13
9
+ version: 0.6.13
10
+ platform: ruby
11
+ authors:
12
+ - Joshua Peek
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-08-31 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rack
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 0
31
+ - 0
32
+ version: 1.0.0
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: racc
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :development
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: rexical
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ type: :development
60
+ version_requirements: *id003
61
+ description: See https://github.com/josh/rack-mount/issues/13
62
+ email: josh@joshpeek.com
63
+ executables: []
64
+
65
+ extensions: []
66
+
67
+ extra_rdoc_files:
68
+ - LICENSE
69
+ - README.rdoc
70
+ files:
71
+ - lib/rack/mount.rb
72
+ - lib/rack/mount/analysis/frequency.rb
73
+ - lib/rack/mount/analysis/histogram.rb
74
+ - lib/rack/mount/analysis/splitting.rb
75
+ - lib/rack/mount/code_generation.rb
76
+ - lib/rack/mount/generatable_regexp.rb
77
+ - lib/rack/mount/multimap.rb
78
+ - lib/rack/mount/prefix.rb
79
+ - lib/rack/mount/regexp_with_named_groups.rb
80
+ - lib/rack/mount/route.rb
81
+ - lib/rack/mount/route_set.rb
82
+ - lib/rack/mount/strexp.rb
83
+ - lib/rack/mount/strexp/parser.rb
84
+ - lib/rack/mount/strexp/parser.y
85
+ - lib/rack/mount/strexp/tokenizer.rb
86
+ - lib/rack/mount/strexp/tokenizer.rex
87
+ - lib/rack/mount/utils.rb
88
+ - lib/rack/mount/vendor/multimap/multimap.rb
89
+ - lib/rack/mount/vendor/multimap/multiset.rb
90
+ - lib/rack/mount/vendor/multimap/nested_multimap.rb
91
+ - lib/rack/mount/vendor/regin/regin.rb
92
+ - lib/rack/mount/vendor/regin/regin/alternation.rb
93
+ - lib/rack/mount/vendor/regin/regin/anchor.rb
94
+ - lib/rack/mount/vendor/regin/regin/atom.rb
95
+ - lib/rack/mount/vendor/regin/regin/character.rb
96
+ - lib/rack/mount/vendor/regin/regin/character_class.rb
97
+ - lib/rack/mount/vendor/regin/regin/collection.rb
98
+ - lib/rack/mount/vendor/regin/regin/expression.rb
99
+ - lib/rack/mount/vendor/regin/regin/group.rb
100
+ - lib/rack/mount/vendor/regin/regin/options.rb
101
+ - lib/rack/mount/vendor/regin/regin/parser.rb
102
+ - lib/rack/mount/vendor/regin/regin/tokenizer.rb
103
+ - lib/rack/mount/vendor/regin/regin/version.rb
104
+ - lib/rack/mount/version.rb
105
+ - LICENSE
106
+ - README.rdoc
107
+ has_rdoc: true
108
+ homepage: http://github.com/josh/rack-mount
109
+ licenses: []
110
+
111
+ post_install_message:
112
+ rdoc_options: []
113
+
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ segments:
122
+ - 0
123
+ version: "0"
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ segments:
130
+ - 0
131
+ version: "0"
132
+ requirements: []
133
+
134
+ rubyforge_project:
135
+ rubygems_version: 1.3.7
136
+ signing_key:
137
+ specification_version: 3
138
+ summary: Rack::Mount with patch for exposing the matched route (GH-13)
139
+ test_files: []
140
+