merb-core 0.9.12 → 0.9.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/merb-core/bootloader.rb +1 -0
- data/lib/merb-core/controller/merb_controller.rb +1 -0
- data/lib/merb-core/dispatch/router.rb +14 -10
- data/lib/merb-core/dispatch/router/behavior.rb +2 -0
- data/lib/merb-core/dispatch/router/resources.rb +13 -8
- data/lib/merb-core/dispatch/router/route.rb +18 -9
- data/lib/merb-core/rack/adapter/abstract.rb +1 -1
- data/lib/merb-core/rack/adapter/mongrel.rb +9 -1
- data/lib/merb-core/tasks/gem_management.rb +16 -5
- data/lib/merb-core/test.rb +7 -6
- data/lib/merb-core/test/helpers.rb +1 -2
- data/lib/merb-core/test/matchers.rb +4 -1
- data/lib/merb-core/test/matchers/view_matchers.rb +101 -273
- data/lib/merb-core/test/run_spec.rb +40 -0
- data/lib/merb-core/test/run_specs.rb +32 -41
- data/lib/merb-core/test/test_ext/rspec.rb +0 -1
- data/lib/merb-core/test/webrat.rb +37 -0
- data/lib/merb-core/vendor/nokogiri/css.rb +6 -0
- data/lib/merb-core/vendor/nokogiri/css/generated_parser.rb +653 -0
- data/lib/merb-core/vendor/nokogiri/css/generated_tokenizer.rb +159 -0
- data/lib/merb-core/vendor/nokogiri/css/node.rb +95 -0
- data/lib/merb-core/vendor/nokogiri/css/parser.rb +24 -0
- data/lib/merb-core/vendor/nokogiri/css/parser.y +198 -0
- data/lib/merb-core/vendor/nokogiri/css/tokenizer.rb +9 -0
- data/lib/merb-core/vendor/nokogiri/css/tokenizer.rex +63 -0
- data/lib/merb-core/vendor/nokogiri/css/xpath_visitor.rb +159 -0
- data/lib/merb-core/version.rb +1 -1
- metadata +17 -4
- data/lib/merb-core/test/helpers/view_helper.rb +0 -121
@@ -0,0 +1,40 @@
|
|
1
|
+
require "stringio"
|
2
|
+
require 'rubygems'
|
3
|
+
require 'spec'
|
4
|
+
require 'spec/runner/formatter/specdoc_formatter'
|
5
|
+
|
6
|
+
module Spec
|
7
|
+
module Runner
|
8
|
+
module Formatter
|
9
|
+
class BaseTextFormatter
|
10
|
+
def dump_failure(counter, failure)
|
11
|
+
output = @options.error_stream
|
12
|
+
output.puts
|
13
|
+
output.puts "#{counter.to_s})"
|
14
|
+
output.puts colourise("#{failure.header}\n#{failure.exception.message}", failure)
|
15
|
+
output.puts format_backtrace(failure.exception.backtrace)
|
16
|
+
output.flush
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def run_spec(spec, base_dir)
|
24
|
+
|
25
|
+
$VERBOSE = nil
|
26
|
+
err, out = StringIO.new, StringIO.new
|
27
|
+
def out.tty?() true end
|
28
|
+
options = Spec::Runner::OptionParser.parse(%W(#{spec} -fs --color), err, out)
|
29
|
+
options.filename_pattern = File.expand_path(spec)
|
30
|
+
failure = ! Spec::Runner::CommandLine.run(options)
|
31
|
+
File.open(base_dir / "results" / "#{File.basename(spec)}_out", "w") do |file|
|
32
|
+
file.puts out.string
|
33
|
+
end
|
34
|
+
File.open(base_dir / "results" / "#{File.basename(spec)}_err", "w") do |file|
|
35
|
+
file.puts err.string
|
36
|
+
end
|
37
|
+
exit!(failure ? -1 : 0)
|
38
|
+
end
|
39
|
+
|
40
|
+
run_spec(ARGV[0], File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".."))) if ENV["NOW"]
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'benchmark'
|
3
|
-
require 'drb'
|
4
3
|
require 'spec'
|
5
4
|
require 'spec/runner/formatter/base_text_formatter'
|
6
5
|
require 'spec/spec_helper.rb'
|
@@ -13,6 +12,7 @@ require 'base64'
|
|
13
12
|
require 'nkf'
|
14
13
|
require 'kconv'
|
15
14
|
require 'rack'
|
15
|
+
require 'fileutils'
|
16
16
|
|
17
17
|
begin
|
18
18
|
require 'json'
|
@@ -22,26 +22,8 @@ end
|
|
22
22
|
|
23
23
|
Merb::Dispatcher
|
24
24
|
|
25
|
-
module Spec
|
26
|
-
module Runner
|
27
|
-
module Formatter
|
28
|
-
class BaseTextFormatter
|
29
|
-
def dump_failure(counter, failure)
|
30
|
-
output = @options.error_stream
|
31
|
-
output.puts
|
32
|
-
output.puts "#{counter.to_s})"
|
33
|
-
output.puts colourise("#{failure.header}\n#{failure.exception.message}", failure)
|
34
|
-
output.puts format_backtrace(failure.exception.backtrace)
|
35
|
-
output.flush
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
25
|
module Merb
|
43
26
|
class Counter
|
44
|
-
include DRb::DRbUndumped
|
45
27
|
|
46
28
|
attr_accessor :time
|
47
29
|
def initialize
|
@@ -50,6 +32,10 @@ module Merb
|
|
50
32
|
@mutex = Mutex.new
|
51
33
|
end
|
52
34
|
|
35
|
+
def failed?
|
36
|
+
@failures > 0
|
37
|
+
end
|
38
|
+
|
53
39
|
def add(spec, out, err)
|
54
40
|
@mutex.synchronize do
|
55
41
|
puts
|
@@ -73,6 +59,11 @@ module Merb
|
|
73
59
|
end
|
74
60
|
|
75
61
|
def report
|
62
|
+
i = 0
|
63
|
+
@err.gsub!(/^\d*\)\s*/) do
|
64
|
+
"#{i += 1})\n"
|
65
|
+
end
|
66
|
+
|
76
67
|
puts @err
|
77
68
|
puts
|
78
69
|
if @failures != 0 || @errors != 0
|
@@ -82,7 +73,6 @@ module Merb
|
|
82
73
|
else
|
83
74
|
print "\e[32m" # Green
|
84
75
|
end
|
85
|
-
puts "Total actual time: #{@total_time}"
|
86
76
|
puts "#{@examples} examples, #{@failures} failures, #{@errors} errors, #{@pending} pending, #{sprintf("suite run in %3.3f seconds", @time.real)}"
|
87
77
|
# TODO: we need to report pending examples all together
|
88
78
|
puts "\e[0m"
|
@@ -90,6 +80,8 @@ module Merb
|
|
90
80
|
end
|
91
81
|
end
|
92
82
|
|
83
|
+
require File.dirname(__FILE__) / "run_spec"
|
84
|
+
|
93
85
|
# Runs specs in all files matching the file pattern.
|
94
86
|
#
|
95
87
|
# ==== Parameters
|
@@ -103,40 +95,39 @@ def run_specs(globs, spec_cmd='spec', run_opts = "-c", except = [])
|
|
103
95
|
require "spec"
|
104
96
|
globs = globs.is_a?(Array) ? globs : [globs]
|
105
97
|
|
98
|
+
forking = (ENV["FORK"] ? ENV["FORK"] == "1" : Merb.forking_environment?)
|
99
|
+
base_dir = File.expand_path(File.dirname(__FILE__) / ".." / ".." / "..")
|
100
|
+
|
106
101
|
counter = Merb::Counter.new
|
107
102
|
forks = 0
|
108
103
|
failure = false
|
109
104
|
|
105
|
+
FileUtils.rm_rf(base_dir / "results")
|
106
|
+
FileUtils.mkdir_p(base_dir / "results")
|
107
|
+
|
110
108
|
time = Benchmark.measure do
|
111
|
-
|
109
|
+
files = {}
|
112
110
|
globs.each do |glob|
|
113
111
|
Dir[glob].each do |spec|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
DRb.stop_service
|
118
|
-
DRb.start_service
|
119
|
-
counter_client = DRbObject.new_with_uri(drb_uri)
|
120
|
-
err, out = StringIO.new, StringIO.new
|
121
|
-
def out.tty?() true end
|
122
|
-
options = Spec::Runner::OptionParser.parse(%W(#{spec} -fs --color), err, out)
|
123
|
-
options.filename_pattern = File.expand_path(spec)
|
124
|
-
failure = ! Spec::Runner::CommandLine.run(options)
|
125
|
-
begin
|
126
|
-
counter_client.add(spec, out.string, err.string)
|
127
|
-
rescue DRb::DRbConnError => e
|
128
|
-
puts "#{Process.pid}: Exception caught"
|
129
|
-
puts "#{e.class}: #{e.message}"
|
130
|
-
retry
|
112
|
+
if forking
|
113
|
+
Kernel.fork do
|
114
|
+
run_spec(spec, base_dir)
|
131
115
|
end
|
132
|
-
|
116
|
+
Process.wait
|
117
|
+
else
|
118
|
+
`NOW=1 #{Gem.ruby} #{File.dirname(__FILE__) / "run_spec.rb"} \"#{spec}\"`
|
133
119
|
end
|
120
|
+
out = File.read(base_dir / "results" / "#{File.basename(spec)}_out")
|
121
|
+
err = File.read(base_dir / "results" / "#{File.basename(spec)}_err")
|
122
|
+
counter.add(spec, out, err)
|
134
123
|
end
|
135
|
-
failure = Process.waitall.any? { |pid, s| !s.success? }
|
136
124
|
end
|
137
125
|
end
|
138
126
|
|
127
|
+
Process.waitall
|
128
|
+
|
139
129
|
counter.time = time
|
140
130
|
counter.report
|
141
|
-
|
131
|
+
FileUtils.rm_rf(base_dir / "results")
|
132
|
+
exit!(counter.failed? ? -1 : 0)
|
142
133
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Merb
|
2
|
+
module WebratHelper
|
3
|
+
|
4
|
+
def self.delegate_to_session(*meths)
|
5
|
+
meths.each do |meth|
|
6
|
+
self.class_eval <<-RUBY
|
7
|
+
def #{meth}(*args, &blk)
|
8
|
+
with_session do |sess|
|
9
|
+
sess.#{meth}(*args, &blk)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
RUBY
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def with_session
|
17
|
+
@session ||= ::Webrat::Session.new
|
18
|
+
yield @session
|
19
|
+
@session.response
|
20
|
+
end
|
21
|
+
|
22
|
+
# all of these methods delegate to the @session, which should
|
23
|
+
# be created transparently.
|
24
|
+
#
|
25
|
+
# Note that when using Webrat, #request also uses @session, so
|
26
|
+
# that #request and webrat native functions behave interchangably
|
27
|
+
delegate_to_session :visits, :within, :clicks_link_within,
|
28
|
+
:reload, :header, :http_accept, :basic_auth,
|
29
|
+
:save_and_open_page, :fill_in, :check,
|
30
|
+
:uncheck, :choose, :select, :attach_file,
|
31
|
+
:click_area, :click_link, :click_button,
|
32
|
+
:field_labeled
|
33
|
+
|
34
|
+
alias reloads reload
|
35
|
+
alias visit visits
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require 'merb-core/vendor/nokogiri/css/node'
|
2
|
+
require 'merb-core/vendor/nokogiri/css/xpath_visitor'
|
3
|
+
require 'merb-core/vendor/nokogiri/css/generated_tokenizer'
|
4
|
+
require 'merb-core/vendor/nokogiri/css/generated_parser'
|
5
|
+
require 'merb-core/vendor/nokogiri/css/tokenizer'
|
6
|
+
require 'merb-core/vendor/nokogiri/css/parser'
|
@@ -0,0 +1,653 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by racc 1.4.5
|
4
|
+
# from racc grammer file "lib/nokogiri/css/parser.y".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser'
|
8
|
+
|
9
|
+
|
10
|
+
module Nokogiri
|
11
|
+
|
12
|
+
module CSS
|
13
|
+
|
14
|
+
class GeneratedParser < Racc::Parser
|
15
|
+
|
16
|
+
##### racc 1.4.5 generates ###
|
17
|
+
|
18
|
+
racc_reduce_table = [
|
19
|
+
0, 0, :racc_error,
|
20
|
+
4, 46, :_reduce_1,
|
21
|
+
1, 46, :_reduce_2,
|
22
|
+
2, 49, :_reduce_3,
|
23
|
+
2, 49, :_reduce_4,
|
24
|
+
2, 49, :_reduce_5,
|
25
|
+
1, 49, :_reduce_6,
|
26
|
+
2, 49, :_reduce_7,
|
27
|
+
2, 49, :_reduce_8,
|
28
|
+
2, 50, :_reduce_9,
|
29
|
+
2, 50, :_reduce_10,
|
30
|
+
1, 50, :_reduce_none,
|
31
|
+
2, 50, :_reduce_12,
|
32
|
+
1, 50, :_reduce_13,
|
33
|
+
3, 48, :_reduce_14,
|
34
|
+
1, 48, :_reduce_none,
|
35
|
+
2, 57, :_reduce_16,
|
36
|
+
1, 51, :_reduce_17,
|
37
|
+
1, 51, :_reduce_18,
|
38
|
+
6, 55, :_reduce_19,
|
39
|
+
6, 55, :_reduce_20,
|
40
|
+
5, 55, :_reduce_21,
|
41
|
+
2, 54, :_reduce_22,
|
42
|
+
3, 54, :_reduce_23,
|
43
|
+
3, 54, :_reduce_24,
|
44
|
+
3, 54, :_reduce_25,
|
45
|
+
1, 59, :_reduce_none,
|
46
|
+
1, 59, :_reduce_none,
|
47
|
+
4, 60, :_reduce_28,
|
48
|
+
3, 60, :_reduce_29,
|
49
|
+
2, 60, :_reduce_30,
|
50
|
+
1, 60, :_reduce_31,
|
51
|
+
2, 61, :_reduce_32,
|
52
|
+
2, 61, :_reduce_33,
|
53
|
+
1, 52, :_reduce_none,
|
54
|
+
0, 52, :_reduce_none,
|
55
|
+
2, 56, :_reduce_36,
|
56
|
+
2, 56, :_reduce_37,
|
57
|
+
2, 56, :_reduce_38,
|
58
|
+
2, 56, :_reduce_39,
|
59
|
+
1, 56, :_reduce_none,
|
60
|
+
1, 56, :_reduce_none,
|
61
|
+
1, 56, :_reduce_none,
|
62
|
+
1, 56, :_reduce_none,
|
63
|
+
1, 62, :_reduce_44,
|
64
|
+
4, 58, :_reduce_45,
|
65
|
+
4, 58, :_reduce_46,
|
66
|
+
0, 58, :_reduce_none,
|
67
|
+
1, 63, :_reduce_none,
|
68
|
+
1, 63, :_reduce_none,
|
69
|
+
1, 63, :_reduce_none,
|
70
|
+
1, 63, :_reduce_none,
|
71
|
+
1, 63, :_reduce_none,
|
72
|
+
1, 63, :_reduce_none,
|
73
|
+
1, 63, :_reduce_none,
|
74
|
+
5, 53, :_reduce_55,
|
75
|
+
1, 64, :_reduce_none,
|
76
|
+
2, 47, :_reduce_none,
|
77
|
+
0, 47, :_reduce_none ]
|
78
|
+
|
79
|
+
racc_reduce_n = 59
|
80
|
+
|
81
|
+
racc_shift_n = 97
|
82
|
+
|
83
|
+
racc_action_table = [
|
84
|
+
5, 79, 81, 27, 10, 26, 94, 93, 42, 2,
|
85
|
+
42, 30, 56, 5, 5, 28, 79, 81, 10, 42,
|
86
|
+
42, 42, 47, 2, 51, 42, 42, 10, 82, 84,
|
87
|
+
85, 52, 78, 10, 10, 7, 9, 12, 15, 42,
|
88
|
+
10, 17, 77, 82, 84, 85, 10, 78, 7, 7,
|
89
|
+
9, 12, 15, 42, 5, 17, 68, 77, 10, 9,
|
90
|
+
69, 15, 10, 2, 17, 9, 9, 15, 15, 50,
|
91
|
+
17, 17, 9, 5, 15, 26, 21, 17, 9, 54,
|
92
|
+
15, 23, 63, 17, 37, 38, 39, 64, 42, 7,
|
93
|
+
9, 12, 15, 44, 9, 17, 15, 42, 15, 17,
|
94
|
+
76, 42, 86, 31, 42, 89, 42, 25, 7, 91,
|
95
|
+
33, 92, 34, 35, 53, 42, 42 ]
|
96
|
+
|
97
|
+
racc_action_check = [
|
98
|
+
0, 73, 73, 6, 0, 7, 90, 90, 63, 0,
|
99
|
+
28, 7, 29, 17, 55, 6, 71, 71, 55, 33,
|
100
|
+
34, 35, 17, 55, 22, 37, 38, 4, 73, 73,
|
101
|
+
73, 23, 73, 1, 11, 0, 0, 0, 0, 42,
|
102
|
+
67, 0, 73, 71, 71, 71, 14, 71, 17, 55,
|
103
|
+
55, 55, 55, 44, 36, 55, 50, 71, 36, 4,
|
104
|
+
52, 4, 16, 36, 4, 1, 11, 1, 11, 21,
|
105
|
+
1, 11, 67, 41, 67, 5, 5, 67, 14, 27,
|
106
|
+
14, 5, 41, 14, 13, 13, 13, 41, 64, 36,
|
107
|
+
36, 36, 36, 16, 16, 36, 16, 65, 18, 16,
|
108
|
+
69, 15, 72, 9, 75, 80, 83, 5, 41, 87,
|
109
|
+
13, 88, 13, 13, 24, 93, 94 ]
|
110
|
+
|
111
|
+
racc_action_pointer = [
|
112
|
+
-2, 27, nil, nil, 21, 65, 3, -5, nil, 92,
|
113
|
+
nil, 28, nil, 77, 40, 92, 56, 11, 58, nil,
|
114
|
+
nil, 62, -18, 20, 72, nil, nil, 79, 1, -30,
|
115
|
+
nil, nil, nil, 10, 11, 12, 52, 16, 17, nil,
|
116
|
+
nil, 71, 30, nil, 44, nil, nil, nil, nil, nil,
|
117
|
+
40, nil, 53, nil, nil, 12, nil, nil, nil, nil,
|
118
|
+
nil, nil, nil, -1, 79, 88, nil, 34, nil, 84,
|
119
|
+
nil, 13, 61, -2, nil, 95, nil, nil, nil, nil,
|
120
|
+
64, nil, nil, 97, nil, nil, nil, 68, 69, nil,
|
121
|
+
-4, nil, nil, 106, 107, nil, nil ]
|
122
|
+
|
123
|
+
racc_action_default = [
|
124
|
+
-59, -42, -17, -13, -41, -59, -59, -59, -2, -59,
|
125
|
+
-44, -43, -18, -15, -40, -58, -35, -59, -11, -38,
|
126
|
+
-37, -31, -59, -26, -59, -22, -27, -59, -58, -59,
|
127
|
+
-26, -16, -39, -58, -58, -58, -59, -58, -58, -6,
|
128
|
+
-36, -59, -58, -34, -58, -9, -10, -33, -32, -12,
|
129
|
+
-59, -23, -30, -24, 97, -59, -25, -5, -8, -7,
|
130
|
+
-14, -3, -4, -58, -58, -58, -57, -59, -29, -59,
|
131
|
+
-1, -47, -59, -47, -56, -58, -28, -48, -52, -53,
|
132
|
+
-59, -54, -49, -58, -50, -51, -21, -59, -59, -19,
|
133
|
+
-59, -20, -55, -58, -58, -45, -46 ]
|
134
|
+
|
135
|
+
racc_goto_table = [
|
136
|
+
41, 19, 8, 80, 20, 87, 48, 22, 6, 29,
|
137
|
+
49, 32, 46, 55, 40, 45, 43, 36, 57, 58,
|
138
|
+
59, 24, 61, 62, 75, nil, nil, 66, nil, 67,
|
139
|
+
65, nil, nil, nil, nil, nil, nil, nil, 60, nil,
|
140
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 71, 72,
|
141
|
+
73, nil, nil, nil, nil, nil, nil, 70, nil, nil,
|
142
|
+
88, nil, nil, nil, nil, nil, nil, 74, 90, nil,
|
143
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 95, 96 ]
|
144
|
+
|
145
|
+
racc_goto_check = [
|
146
|
+
2, 11, 3, 13, 11, 13, 9, 14, 1, 14,
|
147
|
+
10, 11, 8, 2, 11, 7, 11, 4, 2, 2,
|
148
|
+
2, 15, 2, 2, 19, nil, nil, 2, nil, 2,
|
149
|
+
9, nil, nil, nil, nil, nil, nil, nil, 3, nil,
|
150
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 2, 2,
|
151
|
+
2, nil, nil, nil, nil, nil, nil, 3, nil, nil,
|
152
|
+
2, nil, nil, nil, nil, nil, nil, 11, 2, nil,
|
153
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 2, 2 ]
|
154
|
+
|
155
|
+
racc_goto_pointer = [
|
156
|
+
nil, 8, -15, 2, 4, nil, nil, -1, -4, -11,
|
157
|
+
-8, 0, nil, -68, 2, 16, nil, nil, nil, -43 ]
|
158
|
+
|
159
|
+
racc_goto_default = [
|
160
|
+
nil, nil, nil, nil, nil, 13, 16, nil, nil, 18,
|
161
|
+
1, 3, 4, nil, nil, nil, 11, 14, 83, nil ]
|
162
|
+
|
163
|
+
racc_token_table = {
|
164
|
+
false => 0,
|
165
|
+
Object.new => 1,
|
166
|
+
:FUNCTION => 2,
|
167
|
+
:INCLUDES => 3,
|
168
|
+
:DASHMATCH => 4,
|
169
|
+
:LBRACE => 5,
|
170
|
+
:HASH => 6,
|
171
|
+
:PLUS => 7,
|
172
|
+
:GREATER => 8,
|
173
|
+
:S => 9,
|
174
|
+
:STRING => 10,
|
175
|
+
:IDENT => 11,
|
176
|
+
:COMMA => 12,
|
177
|
+
:URI => 13,
|
178
|
+
:CDO => 14,
|
179
|
+
:CDC => 15,
|
180
|
+
:NUMBER => 16,
|
181
|
+
:PERCENTAGE => 17,
|
182
|
+
:LENGTH => 18,
|
183
|
+
:EMS => 19,
|
184
|
+
:EXS => 20,
|
185
|
+
:ANGLE => 21,
|
186
|
+
:TIME => 22,
|
187
|
+
:FREQ => 23,
|
188
|
+
:IMPORTANT_SYM => 24,
|
189
|
+
:IMPORT_SYM => 25,
|
190
|
+
:MEDIA_SYM => 26,
|
191
|
+
:PAGE_SYM => 27,
|
192
|
+
:CHARSET_SYM => 28,
|
193
|
+
:DIMENSION => 29,
|
194
|
+
:PREFIXMATCH => 30,
|
195
|
+
:SUFFIXMATCH => 31,
|
196
|
+
:SUBSTRINGMATCH => 32,
|
197
|
+
:TILDE => 33,
|
198
|
+
:NOT_EQUAL => 34,
|
199
|
+
:SLASH => 35,
|
200
|
+
:DOUBLESLASH => 36,
|
201
|
+
:NOT => 37,
|
202
|
+
"." => 38,
|
203
|
+
"*" => 39,
|
204
|
+
"[" => 40,
|
205
|
+
"]" => 41,
|
206
|
+
")" => 42,
|
207
|
+
":" => 43,
|
208
|
+
"=" => 44 }
|
209
|
+
|
210
|
+
racc_use_result_var = true
|
211
|
+
|
212
|
+
racc_nt_base = 45
|
213
|
+
|
214
|
+
Racc_arg = [
|
215
|
+
racc_action_table,
|
216
|
+
racc_action_check,
|
217
|
+
racc_action_default,
|
218
|
+
racc_action_pointer,
|
219
|
+
racc_goto_table,
|
220
|
+
racc_goto_check,
|
221
|
+
racc_goto_default,
|
222
|
+
racc_goto_pointer,
|
223
|
+
racc_nt_base,
|
224
|
+
racc_reduce_table,
|
225
|
+
racc_token_table,
|
226
|
+
racc_shift_n,
|
227
|
+
racc_reduce_n,
|
228
|
+
racc_use_result_var ]
|
229
|
+
|
230
|
+
Racc_token_to_s_table = [
|
231
|
+
'$end',
|
232
|
+
'error',
|
233
|
+
'FUNCTION',
|
234
|
+
'INCLUDES',
|
235
|
+
'DASHMATCH',
|
236
|
+
'LBRACE',
|
237
|
+
'HASH',
|
238
|
+
'PLUS',
|
239
|
+
'GREATER',
|
240
|
+
'S',
|
241
|
+
'STRING',
|
242
|
+
'IDENT',
|
243
|
+
'COMMA',
|
244
|
+
'URI',
|
245
|
+
'CDO',
|
246
|
+
'CDC',
|
247
|
+
'NUMBER',
|
248
|
+
'PERCENTAGE',
|
249
|
+
'LENGTH',
|
250
|
+
'EMS',
|
251
|
+
'EXS',
|
252
|
+
'ANGLE',
|
253
|
+
'TIME',
|
254
|
+
'FREQ',
|
255
|
+
'IMPORTANT_SYM',
|
256
|
+
'IMPORT_SYM',
|
257
|
+
'MEDIA_SYM',
|
258
|
+
'PAGE_SYM',
|
259
|
+
'CHARSET_SYM',
|
260
|
+
'DIMENSION',
|
261
|
+
'PREFIXMATCH',
|
262
|
+
'SUFFIXMATCH',
|
263
|
+
'SUBSTRINGMATCH',
|
264
|
+
'TILDE',
|
265
|
+
'NOT_EQUAL',
|
266
|
+
'SLASH',
|
267
|
+
'DOUBLESLASH',
|
268
|
+
'NOT',
|
269
|
+
'"."',
|
270
|
+
'"*"',
|
271
|
+
'"["',
|
272
|
+
'"]"',
|
273
|
+
'")"',
|
274
|
+
'":"',
|
275
|
+
'"="',
|
276
|
+
'$start',
|
277
|
+
'selector',
|
278
|
+
's_0toN',
|
279
|
+
'simple_selector_1toN',
|
280
|
+
'combinator',
|
281
|
+
'simple_selector',
|
282
|
+
'element_name',
|
283
|
+
'hcap_0toN',
|
284
|
+
'negation',
|
285
|
+
'function',
|
286
|
+
'attrib',
|
287
|
+
'hcap_1toN',
|
288
|
+
'class',
|
289
|
+
'attrib_val_0or1',
|
290
|
+
'expr',
|
291
|
+
'an_plus_b',
|
292
|
+
'pseudo',
|
293
|
+
'attribute_id',
|
294
|
+
'eql_incl_dash',
|
295
|
+
'negation_arg']
|
296
|
+
|
297
|
+
Racc_debug_parser = false
|
298
|
+
|
299
|
+
##### racc system variables end #####
|
300
|
+
|
301
|
+
# reduce 0 omitted
|
302
|
+
|
303
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 13
|
304
|
+
def _reduce_1( val, _values, result )
|
305
|
+
result = [val.first, val.last].flatten
|
306
|
+
result
|
307
|
+
end
|
308
|
+
.,.,
|
309
|
+
|
310
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 13
|
311
|
+
def _reduce_2( val, _values, result )
|
312
|
+
result = val.flatten
|
313
|
+
result
|
314
|
+
end
|
315
|
+
.,.,
|
316
|
+
|
317
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 16
|
318
|
+
def _reduce_3( val, _values, result )
|
319
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
320
|
+
result
|
321
|
+
end
|
322
|
+
.,.,
|
323
|
+
|
324
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 17
|
325
|
+
def _reduce_4( val, _values, result )
|
326
|
+
result = :CHILD_SELECTOR
|
327
|
+
result
|
328
|
+
end
|
329
|
+
.,.,
|
330
|
+
|
331
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 18
|
332
|
+
def _reduce_5( val, _values, result )
|
333
|
+
result = :PRECEDING_SELECTOR
|
334
|
+
result
|
335
|
+
end
|
336
|
+
.,.,
|
337
|
+
|
338
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 19
|
339
|
+
def _reduce_6( val, _values, result )
|
340
|
+
result = :DESCENDANT_SELECTOR
|
341
|
+
result
|
342
|
+
end
|
343
|
+
.,.,
|
344
|
+
|
345
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 20
|
346
|
+
def _reduce_7( val, _values, result )
|
347
|
+
result = :DESCENDANT_SELECTOR
|
348
|
+
result
|
349
|
+
end
|
350
|
+
.,.,
|
351
|
+
|
352
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 21
|
353
|
+
def _reduce_8( val, _values, result )
|
354
|
+
result = :CHILD_SELECTOR
|
355
|
+
result
|
356
|
+
end
|
357
|
+
.,.,
|
358
|
+
|
359
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 31
|
360
|
+
def _reduce_9( val, _values, result )
|
361
|
+
result = if val[1].nil?
|
362
|
+
val.first
|
363
|
+
else
|
364
|
+
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
365
|
+
end
|
366
|
+
result
|
367
|
+
end
|
368
|
+
.,.,
|
369
|
+
|
370
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 34
|
371
|
+
def _reduce_10( val, _values, result )
|
372
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
373
|
+
result
|
374
|
+
end
|
375
|
+
.,.,
|
376
|
+
|
377
|
+
# reduce 11 omitted
|
378
|
+
|
379
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 38
|
380
|
+
def _reduce_12( val, _values, result )
|
381
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
382
|
+
result
|
383
|
+
end
|
384
|
+
.,.,
|
385
|
+
|
386
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 43
|
387
|
+
def _reduce_13( val, _values, result )
|
388
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
389
|
+
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
390
|
+
)
|
391
|
+
result
|
392
|
+
end
|
393
|
+
.,.,
|
394
|
+
|
395
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 48
|
396
|
+
def _reduce_14( val, _values, result )
|
397
|
+
result = Node.new(val[1], [val.first, val.last])
|
398
|
+
result
|
399
|
+
end
|
400
|
+
.,.,
|
401
|
+
|
402
|
+
# reduce 15 omitted
|
403
|
+
|
404
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 51
|
405
|
+
def _reduce_16( val, _values, result )
|
406
|
+
result = Node.new(:CLASS_CONDITION, [val[1]])
|
407
|
+
result
|
408
|
+
end
|
409
|
+
.,.,
|
410
|
+
|
411
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 54
|
412
|
+
def _reduce_17( val, _values, result )
|
413
|
+
result = Node.new(:ELEMENT_NAME, val)
|
414
|
+
result
|
415
|
+
end
|
416
|
+
.,.,
|
417
|
+
|
418
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 55
|
419
|
+
def _reduce_18( val, _values, result )
|
420
|
+
result = Node.new(:ELEMENT_NAME, val)
|
421
|
+
result
|
422
|
+
end
|
423
|
+
.,.,
|
424
|
+
|
425
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 63
|
426
|
+
def _reduce_19( val, _values, result )
|
427
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
428
|
+
[Node.new(:ELEMENT_NAME, [val[2]])] + (val[4] || [])
|
429
|
+
)
|
430
|
+
result
|
431
|
+
end
|
432
|
+
.,.,
|
433
|
+
|
434
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 68
|
435
|
+
def _reduce_20( val, _values, result )
|
436
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
437
|
+
[val[2]] + (val[4] || [])
|
438
|
+
)
|
439
|
+
result
|
440
|
+
end
|
441
|
+
.,.,
|
442
|
+
|
443
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 74
|
444
|
+
def _reduce_21( val, _values, result )
|
445
|
+
# Non standard, but hpricot supports it.
|
446
|
+
result = Node.new(:PSEUDO_CLASS,
|
447
|
+
[Node.new(:FUNCTION, ['nth-child(', val[2]])]
|
448
|
+
)
|
449
|
+
result
|
450
|
+
end
|
451
|
+
.,.,
|
452
|
+
|
453
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 79
|
454
|
+
def _reduce_22( val, _values, result )
|
455
|
+
result = Node.new(:FUNCTION, [val.first.strip])
|
456
|
+
result
|
457
|
+
end
|
458
|
+
.,.,
|
459
|
+
|
460
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 82
|
461
|
+
def _reduce_23( val, _values, result )
|
462
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
463
|
+
result
|
464
|
+
end
|
465
|
+
.,.,
|
466
|
+
|
467
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 85
|
468
|
+
def _reduce_24( val, _values, result )
|
469
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
470
|
+
result
|
471
|
+
end
|
472
|
+
.,.,
|
473
|
+
|
474
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 88
|
475
|
+
def _reduce_25( val, _values, result )
|
476
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
477
|
+
result
|
478
|
+
end
|
479
|
+
.,.,
|
480
|
+
|
481
|
+
# reduce 26 omitted
|
482
|
+
|
483
|
+
# reduce 27 omitted
|
484
|
+
|
485
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 102
|
486
|
+
def _reduce_28( val, _values, result )
|
487
|
+
if val[1] == 'n'
|
488
|
+
result = Node.new(:AN_PLUS_B, val)
|
489
|
+
else
|
490
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
491
|
+
end
|
492
|
+
result
|
493
|
+
end
|
494
|
+
.,.,
|
495
|
+
|
496
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 113
|
497
|
+
def _reduce_29( val, _values, result )
|
498
|
+
# n+3, -n+3
|
499
|
+
if val[0] == 'n'
|
500
|
+
val.unshift("1")
|
501
|
+
result = Node.new(:AN_PLUS_B, val)
|
502
|
+
elsif val[0] == '-n'
|
503
|
+
val[0] = 'n'
|
504
|
+
val.unshift("-1")
|
505
|
+
result = Node.new(:AN_PLUS_B, val)
|
506
|
+
else
|
507
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
508
|
+
end
|
509
|
+
result
|
510
|
+
end
|
511
|
+
.,.,
|
512
|
+
|
513
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 124
|
514
|
+
def _reduce_30( val, _values, result )
|
515
|
+
if val[1] == 'n'
|
516
|
+
val << "+"
|
517
|
+
val << "0"
|
518
|
+
result = Node.new(:AN_PLUS_B, val)
|
519
|
+
else
|
520
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
521
|
+
end
|
522
|
+
result
|
523
|
+
end
|
524
|
+
.,.,
|
525
|
+
|
526
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 136
|
527
|
+
def _reduce_31( val, _values, result )
|
528
|
+
if val[0] == 'even'
|
529
|
+
val = ["2","n","+","0"]
|
530
|
+
result = Node.new(:AN_PLUS_B, val)
|
531
|
+
elsif val[0] == 'odd'
|
532
|
+
val = ["2","n","+","1"]
|
533
|
+
result = Node.new(:AN_PLUS_B, val)
|
534
|
+
else
|
535
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[0]}'"
|
536
|
+
end
|
537
|
+
result
|
538
|
+
end
|
539
|
+
.,.,
|
540
|
+
|
541
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 141
|
542
|
+
def _reduce_32( val, _values, result )
|
543
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
544
|
+
result
|
545
|
+
end
|
546
|
+
.,.,
|
547
|
+
|
548
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 141
|
549
|
+
def _reduce_33( val, _values, result )
|
550
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
551
|
+
result
|
552
|
+
end
|
553
|
+
.,.,
|
554
|
+
|
555
|
+
# reduce 34 omitted
|
556
|
+
|
557
|
+
# reduce 35 omitted
|
558
|
+
|
559
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 151
|
560
|
+
def _reduce_36( val, _values, result )
|
561
|
+
result = Node.new(:COMBINATOR, val)
|
562
|
+
result
|
563
|
+
end
|
564
|
+
.,.,
|
565
|
+
|
566
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 154
|
567
|
+
def _reduce_37( val, _values, result )
|
568
|
+
result = Node.new(:COMBINATOR, val)
|
569
|
+
result
|
570
|
+
end
|
571
|
+
.,.,
|
572
|
+
|
573
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 157
|
574
|
+
def _reduce_38( val, _values, result )
|
575
|
+
result = Node.new(:COMBINATOR, val)
|
576
|
+
result
|
577
|
+
end
|
578
|
+
.,.,
|
579
|
+
|
580
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 160
|
581
|
+
def _reduce_39( val, _values, result )
|
582
|
+
result = Node.new(:COMBINATOR, val)
|
583
|
+
result
|
584
|
+
end
|
585
|
+
.,.,
|
586
|
+
|
587
|
+
# reduce 40 omitted
|
588
|
+
|
589
|
+
# reduce 41 omitted
|
590
|
+
|
591
|
+
# reduce 42 omitted
|
592
|
+
|
593
|
+
# reduce 43 omitted
|
594
|
+
|
595
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 166
|
596
|
+
def _reduce_44( val, _values, result )
|
597
|
+
result = Node.new(:ID, val)
|
598
|
+
result
|
599
|
+
end
|
600
|
+
.,.,
|
601
|
+
|
602
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 169
|
603
|
+
def _reduce_45( val, _values, result )
|
604
|
+
result = [val.first, val[2]]
|
605
|
+
result
|
606
|
+
end
|
607
|
+
.,.,
|
608
|
+
|
609
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 170
|
610
|
+
def _reduce_46( val, _values, result )
|
611
|
+
result = [val.first, val[2]]
|
612
|
+
result
|
613
|
+
end
|
614
|
+
.,.,
|
615
|
+
|
616
|
+
# reduce 47 omitted
|
617
|
+
|
618
|
+
# reduce 48 omitted
|
619
|
+
|
620
|
+
# reduce 49 omitted
|
621
|
+
|
622
|
+
# reduce 50 omitted
|
623
|
+
|
624
|
+
# reduce 51 omitted
|
625
|
+
|
626
|
+
# reduce 52 omitted
|
627
|
+
|
628
|
+
# reduce 53 omitted
|
629
|
+
|
630
|
+
# reduce 54 omitted
|
631
|
+
|
632
|
+
module_eval <<'.,.,', 'lib/nokogiri/css/parser.y', 186
|
633
|
+
def _reduce_55( val, _values, result )
|
634
|
+
result = Node.new(:NOT, [val[2]])
|
635
|
+
result
|
636
|
+
end
|
637
|
+
.,.,
|
638
|
+
|
639
|
+
# reduce 56 omitted
|
640
|
+
|
641
|
+
# reduce 57 omitted
|
642
|
+
|
643
|
+
# reduce 58 omitted
|
644
|
+
|
645
|
+
def _reduce_none( val, _values, result )
|
646
|
+
result
|
647
|
+
end
|
648
|
+
|
649
|
+
end # class GeneratedParser
|
650
|
+
|
651
|
+
end # module CSS
|
652
|
+
|
653
|
+
end # module Nokogiri
|