oga 1.2.3-java → 1.3.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/css_selectors.md +1 -1
- data/lib/liboga.jar +0 -0
- data/lib/oga.rb +6 -1
- data/lib/oga/blacklist.rb +0 -10
- data/lib/oga/css/lexer.rb +530 -255
- data/lib/oga/css/parser.rb +232 -230
- data/lib/oga/entity_decoder.rb +0 -4
- data/lib/oga/html/entities.rb +0 -4
- data/lib/oga/html/parser.rb +0 -4
- data/lib/oga/html/sax_parser.rb +0 -4
- data/lib/oga/lru.rb +0 -26
- data/lib/oga/oga.rb +0 -8
- data/lib/oga/ruby/generator.rb +225 -0
- data/lib/oga/ruby/node.rb +189 -0
- data/lib/oga/version.rb +1 -1
- data/lib/oga/whitelist.rb +0 -6
- data/lib/oga/xml/attribute.rb +13 -20
- data/lib/oga/xml/cdata.rb +0 -4
- data/lib/oga/xml/character_node.rb +0 -8
- data/lib/oga/xml/comment.rb +0 -4
- data/lib/oga/xml/default_namespace.rb +0 -2
- data/lib/oga/xml/doctype.rb +0 -8
- data/lib/oga/xml/document.rb +10 -14
- data/lib/oga/xml/element.rb +1 -52
- data/lib/oga/xml/entities.rb +0 -26
- data/lib/oga/xml/expanded_name.rb +12 -0
- data/lib/oga/xml/html_void_elements.rb +0 -2
- data/lib/oga/xml/lexer.rb +0 -86
- data/lib/oga/xml/namespace.rb +0 -10
- data/lib/oga/xml/node.rb +18 -34
- data/lib/oga/xml/node_set.rb +0 -50
- data/lib/oga/xml/parser.rb +13 -50
- data/lib/oga/xml/processing_instruction.rb +0 -8
- data/lib/oga/xml/pull_parser.rb +0 -18
- data/lib/oga/xml/querying.rb +58 -19
- data/lib/oga/xml/sax_parser.rb +0 -18
- data/lib/oga/xml/text.rb +0 -12
- data/lib/oga/xml/traversal.rb +0 -4
- data/lib/oga/xml/xml_declaration.rb +0 -8
- data/lib/oga/xpath/compiler.rb +1568 -0
- data/lib/oga/xpath/conversion.rb +102 -0
- data/lib/oga/xpath/lexer.rb +1844 -1238
- data/lib/oga/xpath/parser.rb +182 -153
- metadata +7 -3
- data/lib/oga/xpath/evaluator.rb +0 -1800
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b02ebf4182fe4de0d8b0fe875352a7f87300c19c
|
4
|
+
data.tar.gz: b190fec4be054b8acb23ba2b4e8b3d212a066ad7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 096867f90ece07e4e6aa55d92074a3f5bcfe6626fb652b0f43f5955b0712dd27a7636630b3c003336222f61a5105b3e49a2538ec403be4f23927593895d96d0f
|
7
|
+
data.tar.gz: 939678d51de4fe44eda8dada5d8b6e48a6cddb5b5f76b796501eb0c3dc643bae8a664b8cfe5a85c16194517cde982f22160995e79532f59a5a96ee92e7ae4d66
|
data/doc/css_selectors.md
CHANGED
@@ -364,7 +364,7 @@ numbers="1 2 3" />` but _not_ the element `<foo numbers="2 3 1" />`.
|
|
364
364
|
The corresponding XPath expression is quite complex due to a lack of a
|
365
365
|
`ends-with` function in XPath. Instead one has to resort to using the
|
366
366
|
`substring()` function. As such the corresponding XPath expression for
|
367
|
-
`foo[bar
|
367
|
+
`foo[bar$="baz"]` is as following:
|
368
368
|
|
369
369
|
foo[substring(@bar, string-length(@bar) - string-length("baz") + 1, string-length("baz")) = "baz"]
|
370
370
|
|
data/lib/liboga.jar
CHANGED
Binary file
|
data/lib/oga.rb
CHANGED
@@ -27,6 +27,7 @@ require 'oga/xml/html_void_elements'
|
|
27
27
|
require 'oga/xml/entities'
|
28
28
|
require 'oga/xml/querying'
|
29
29
|
require 'oga/xml/traversal'
|
30
|
+
require 'oga/xml/expanded_name'
|
30
31
|
require 'oga/xml/node'
|
31
32
|
require 'oga/xml/document'
|
32
33
|
require 'oga/xml/character_node'
|
@@ -49,9 +50,13 @@ require 'oga/html/parser'
|
|
49
50
|
require 'oga/html/sax_parser'
|
50
51
|
require 'oga/html/entities'
|
51
52
|
|
53
|
+
require 'oga/ruby/node'
|
54
|
+
require 'oga/ruby/generator'
|
55
|
+
|
52
56
|
require 'oga/xpath/lexer'
|
53
57
|
require 'oga/xpath/parser'
|
54
|
-
require 'oga/xpath/
|
58
|
+
require 'oga/xpath/compiler'
|
59
|
+
require 'oga/xpath/conversion'
|
55
60
|
|
56
61
|
require 'oga/css/lexer'
|
57
62
|
require 'oga/css/parser'
|
data/lib/oga/blacklist.rb
CHANGED
@@ -1,38 +1,28 @@
|
|
1
1
|
module Oga
|
2
|
-
##
|
3
2
|
# @api private
|
4
|
-
#
|
5
3
|
class Blacklist
|
6
4
|
# @return [Set]
|
7
5
|
attr_reader :names
|
8
6
|
|
9
|
-
##
|
10
7
|
# @param [Array] names
|
11
|
-
#
|
12
8
|
def initialize(names)
|
13
9
|
@names = Set.new(names + names.map(&:upcase))
|
14
10
|
end
|
15
11
|
|
16
|
-
##
|
17
12
|
# @yieldparam [String]
|
18
|
-
#
|
19
13
|
def each
|
20
14
|
names.each do |value|
|
21
15
|
yield value
|
22
16
|
end
|
23
17
|
end
|
24
18
|
|
25
|
-
##
|
26
19
|
# @return [TrueClass|FalseClass]
|
27
|
-
#
|
28
20
|
def allow?(name)
|
29
21
|
!names.include?(name)
|
30
22
|
end
|
31
23
|
|
32
|
-
##
|
33
24
|
# @param [Oga::Blacklist] other
|
34
25
|
# @return [Oga::Blacklist]
|
35
|
-
#
|
36
26
|
def +(other)
|
37
27
|
self.class.new(names + other.names)
|
38
28
|
end
|
data/lib/oga/css/lexer.rb
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
# line 3 "lib/oga/css/lexer.rl"
|
5
5
|
module Oga
|
6
6
|
module CSS
|
7
|
-
##
|
8
7
|
# Lexer for turning CSS expressions into a sequence of tokens. Tokens are
|
9
8
|
# returned as arrays with every array having two values:
|
10
9
|
#
|
@@ -19,28 +18,30 @@ module Oga
|
|
19
18
|
# instances in threads just fine.
|
20
19
|
#
|
21
20
|
# @api private
|
22
|
-
#
|
23
21
|
class Lexer
|
24
22
|
|
25
|
-
# line
|
23
|
+
# line 24 "lib/oga/css/lexer.rb"
|
26
24
|
class << self
|
27
25
|
attr_accessor :_css_lexer_trans_keys
|
28
26
|
private :_css_lexer_trans_keys, :_css_lexer_trans_keys=
|
29
27
|
end
|
30
28
|
self._css_lexer_trans_keys = [
|
31
|
-
0, 0,
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
61, 61,
|
36
|
-
|
37
|
-
0,
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
0
|
29
|
+
0, 0, 46, 46, 46, 46,
|
30
|
+
43, 57, 118, 118, 101,
|
31
|
+
101, 110, 110, 100, 100,
|
32
|
+
100, 100, 46, 46, 34, 34,
|
33
|
+
61, 61, 39, 39, 61,
|
34
|
+
61, 61, 61, 61, 61,
|
35
|
+
0, 127, 0, 127, 0, 127,
|
36
|
+
9, 126, 9, 32, 9,
|
37
|
+
32, 9, 32, 9, 32,
|
38
|
+
0, 0, 0, 0, 0, 0,
|
39
|
+
0, 127, 0, 127, 0,
|
40
|
+
127, 9, 32, 0, 0,
|
41
|
+
48, 57, 43, 57, 0, 0,
|
42
|
+
0, 0, 0, 127, 0,
|
43
|
+
127, 0, 127, 9, 32,
|
44
|
+
61, 61, 0
|
44
45
|
]
|
45
46
|
|
46
47
|
class << self
|
@@ -48,10 +49,12 @@ class << self
|
|
48
49
|
private :_css_lexer_key_spans, :_css_lexer_key_spans=
|
49
50
|
end
|
50
51
|
self._css_lexer_key_spans = [
|
51
|
-
0,
|
52
|
-
1, 1, 1, 1, 1,
|
53
|
-
|
54
|
-
|
52
|
+
0, 1, 1, 15, 1, 1, 1, 1,
|
53
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
54
|
+
128, 128, 128, 118, 24, 24, 24, 24,
|
55
|
+
0, 0, 0, 128, 128, 128, 24, 0,
|
56
|
+
10, 15, 0, 0, 128, 128, 128, 24,
|
57
|
+
1
|
55
58
|
]
|
56
59
|
|
57
60
|
class << self
|
@@ -59,10 +62,12 @@ class << self
|
|
59
62
|
private :_css_lexer_index_offsets, :_css_lexer_index_offsets=
|
60
63
|
end
|
61
64
|
self._css_lexer_index_offsets = [
|
62
|
-
0, 0,
|
63
|
-
28, 30, 32, 34, 36, 38,
|
64
|
-
|
65
|
-
|
65
|
+
0, 0, 2, 4, 20, 22, 24, 26,
|
66
|
+
28, 30, 32, 34, 36, 38, 40, 42,
|
67
|
+
44, 173, 302, 431, 550, 575, 600, 625,
|
68
|
+
650, 651, 652, 653, 782, 911, 1040, 1065,
|
69
|
+
1066, 1077, 1093, 1094, 1095, 1224, 1353, 1482,
|
70
|
+
1507
|
66
71
|
]
|
67
72
|
|
68
73
|
class << self
|
@@ -70,112 +75,195 @@ class << self
|
|
70
75
|
private :_css_lexer_indicies, :_css_lexer_indicies=
|
71
76
|
end
|
72
77
|
self._css_lexer_indicies = [
|
73
|
-
1, 0,
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
22, 30, 22, 31, 31, 31, 31, 31,
|
98
|
-
31, 31, 31, 31, 31, 31, 31, 31,
|
99
|
-
31, 31, 31, 31, 31, 31, 31, 31,
|
100
|
-
31, 22, 31, 32, 21, 33, 33, 33,
|
101
|
-
33, 33, 33, 33, 33, 33, 33, 33,
|
102
|
-
33, 33, 33, 33, 33, 33, 33, 33,
|
103
|
-
33, 33, 33, 21, 33, 34, 35, 25,
|
78
|
+
1, 0, 3, 2, 5, 4, 5, 4,
|
79
|
+
4, 6, 6, 6, 6, 6, 6, 6,
|
80
|
+
6, 6, 6, 4, 7, 8, 9, 8,
|
81
|
+
10, 8, 11, 8, 12, 8, 14, 13,
|
82
|
+
16, 15, 17, 8, 16, 18, 19, 8,
|
83
|
+
20, 8, 21, 8, 23, 23, 23, 23,
|
84
|
+
23, 23, 23, 23, 23, 24, 23, 23,
|
85
|
+
23, 23, 23, 23, 23, 23, 23, 23,
|
86
|
+
23, 23, 23, 23, 23, 23, 23, 23,
|
87
|
+
23, 23, 23, 23, 24, 23, 23, 25,
|
88
|
+
23, 23, 23, 23, 26, 23, 27, 28,
|
89
|
+
29, 23, 30, 23, 23, 23, 23, 23,
|
90
|
+
23, 23, 23, 23, 23, 23, 31, 23,
|
91
|
+
23, 23, 32, 23, 23, 22, 22, 22,
|
92
|
+
22, 22, 22, 22, 22, 22, 22, 22,
|
93
|
+
22, 22, 22, 22, 22, 22, 22, 22,
|
94
|
+
22, 22, 22, 22, 22, 22, 22, 33,
|
95
|
+
23, 23, 23, 22, 23, 22, 22, 22,
|
96
|
+
22, 22, 22, 22, 22, 22, 22, 22,
|
97
|
+
22, 22, 22, 22, 22, 22, 22, 22,
|
98
|
+
22, 22, 22, 22, 22, 22, 22, 23,
|
99
|
+
34, 23, 35, 23, 22, 36, 36, 36,
|
100
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
101
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
104
102
|
36, 36, 36, 36, 36, 36, 36, 36,
|
105
103
|
36, 36, 36, 36, 36, 36, 36, 36,
|
106
|
-
36, 36, 36, 36, 36, 36,
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
104
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
105
|
+
36, 36, 22, 36, 36, 22, 22, 22,
|
106
|
+
22, 22, 22, 22, 22, 22, 22, 36,
|
107
|
+
36, 36, 36, 36, 36, 36, 22, 22,
|
108
|
+
22, 22, 22, 22, 22, 22, 22, 22,
|
109
|
+
22, 22, 22, 22, 22, 22, 22, 22,
|
110
|
+
22, 22, 22, 22, 22, 22, 22, 22,
|
111
|
+
36, 37, 36, 36, 22, 36, 22, 22,
|
112
|
+
22, 22, 22, 22, 22, 22, 22, 22,
|
113
|
+
22, 22, 22, 22, 22, 22, 22, 22,
|
114
|
+
22, 22, 22, 22, 22, 22, 22, 22,
|
115
|
+
36, 36, 36, 36, 36, 22, 38, 38,
|
117
116
|
38, 38, 38, 38, 38, 38, 38, 38,
|
118
117
|
38, 38, 38, 38, 38, 38, 38, 38,
|
119
|
-
38, 38, 38, 38, 38, 38,
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
118
|
+
38, 38, 38, 38, 38, 38, 38, 38,
|
119
|
+
38, 38, 38, 38, 38, 38, 38, 38,
|
120
|
+
38, 38, 38, 38, 38, 38, 38, 38,
|
121
|
+
38, 38, 38, 39, 38, 38, 39, 39,
|
122
|
+
39, 39, 39, 39, 39, 39, 39, 39,
|
123
|
+
38, 38, 38, 38, 38, 38, 38, 39,
|
124
|
+
39, 39, 39, 39, 39, 39, 39, 39,
|
125
|
+
39, 39, 39, 39, 39, 39, 39, 39,
|
126
|
+
39, 39, 39, 39, 39, 39, 39, 39,
|
127
|
+
39, 38, 40, 38, 38, 39, 38, 39,
|
128
|
+
39, 39, 39, 39, 39, 39, 39, 39,
|
129
|
+
39, 39, 39, 39, 39, 39, 39, 39,
|
130
|
+
39, 39, 39, 39, 39, 39, 39, 39,
|
131
|
+
39, 38, 38, 38, 38, 38, 39, 24,
|
132
|
+
41, 41, 41, 41, 41, 41, 41, 41,
|
133
|
+
41, 41, 41, 41, 41, 41, 41, 41,
|
134
|
+
41, 41, 41, 41, 41, 41, 24, 41,
|
135
|
+
41, 41, 41, 41, 41, 41, 41, 41,
|
136
|
+
41, 28, 29, 41, 41, 41, 41, 41,
|
137
|
+
41, 41, 41, 41, 41, 41, 41, 41,
|
138
|
+
41, 41, 41, 41, 32, 41, 41, 41,
|
139
|
+
41, 41, 41, 41, 41, 41, 41, 41,
|
140
|
+
41, 41, 41, 41, 41, 41, 41, 41,
|
141
|
+
41, 41, 41, 41, 41, 41, 41, 41,
|
142
|
+
41, 41, 41, 41, 41, 41, 41, 41,
|
143
|
+
41, 41, 41, 41, 41, 41, 41, 41,
|
144
|
+
41, 41, 41, 41, 41, 41, 41, 41,
|
145
|
+
41, 41, 41, 41, 41, 41, 41, 41,
|
146
|
+
41, 41, 41, 41, 35, 41, 28, 42,
|
147
|
+
42, 42, 42, 42, 42, 42, 42, 42,
|
148
|
+
42, 42, 42, 42, 42, 42, 42, 42,
|
149
|
+
42, 42, 42, 42, 42, 28, 42, 29,
|
148
150
|
43, 43, 43, 43, 43, 43, 43, 43,
|
149
151
|
43, 43, 43, 43, 43, 43, 43, 43,
|
150
|
-
43, 43, 43, 43, 43,
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
152
|
+
43, 43, 43, 43, 43, 43, 29, 43,
|
153
|
+
32, 44, 44, 44, 44, 44, 44, 44,
|
154
|
+
44, 44, 44, 44, 44, 44, 44, 44,
|
155
|
+
44, 44, 44, 44, 44, 44, 44, 32,
|
156
|
+
44, 35, 45, 45, 45, 45, 45, 45,
|
157
|
+
45, 45, 45, 45, 45, 45, 45, 45,
|
158
|
+
45, 45, 45, 45, 45, 45, 45, 45,
|
159
|
+
35, 45, 46, 47, 48, 8, 8, 8,
|
160
|
+
8, 8, 8, 8, 8, 8, 50, 8,
|
161
|
+
8, 8, 8, 8, 8, 8, 8, 8,
|
162
|
+
8, 8, 8, 8, 8, 8, 8, 8,
|
163
|
+
8, 8, 8, 8, 8, 50, 8, 8,
|
164
|
+
51, 8, 8, 8, 8, 8, 52, 53,
|
165
|
+
5, 8, 54, 55, 8, 6, 6, 6,
|
166
|
+
6, 6, 6, 6, 6, 6, 6, 56,
|
167
|
+
8, 8, 8, 8, 8, 8, 49, 49,
|
168
|
+
49, 49, 49, 49, 49, 49, 49, 49,
|
169
|
+
49, 49, 49, 49, 49, 49, 49, 49,
|
170
|
+
49, 49, 49, 49, 49, 49, 49, 49,
|
171
|
+
8, 8, 8, 8, 49, 8, 49, 49,
|
172
|
+
49, 49, 57, 49, 49, 49, 49, 49,
|
173
|
+
49, 49, 49, 58, 59, 49, 49, 49,
|
174
|
+
49, 49, 49, 49, 49, 49, 49, 49,
|
175
|
+
8, 8, 8, 8, 8, 49, 60, 60,
|
166
176
|
60, 60, 60, 60, 60, 60, 60, 60,
|
167
177
|
60, 60, 60, 60, 60, 60, 60, 60,
|
168
|
-
60, 60, 60, 60,
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
178
|
+
60, 60, 60, 60, 60, 60, 60, 60,
|
179
|
+
60, 60, 60, 60, 60, 60, 60, 60,
|
180
|
+
60, 60, 60, 60, 60, 60, 60, 60,
|
181
|
+
60, 60, 60, 49, 60, 60, 49, 49,
|
182
|
+
49, 49, 49, 49, 49, 49, 49, 49,
|
183
|
+
60, 60, 60, 60, 60, 60, 60, 49,
|
184
|
+
49, 49, 49, 49, 49, 49, 49, 49,
|
185
|
+
49, 49, 49, 49, 49, 49, 49, 49,
|
186
|
+
49, 49, 49, 49, 49, 49, 49, 49,
|
187
|
+
49, 60, 61, 60, 60, 49, 60, 49,
|
188
|
+
49, 49, 49, 49, 49, 49, 49, 49,
|
189
|
+
49, 49, 49, 49, 49, 49, 49, 49,
|
190
|
+
49, 49, 49, 49, 49, 49, 49, 49,
|
191
|
+
49, 60, 60, 60, 60, 60, 49, 62,
|
192
|
+
62, 62, 62, 62, 62, 62, 62, 62,
|
193
|
+
62, 62, 62, 62, 62, 62, 62, 62,
|
194
|
+
62, 62, 62, 62, 62, 62, 62, 62,
|
195
|
+
62, 62, 62, 62, 62, 62, 62, 62,
|
196
|
+
62, 62, 62, 62, 62, 62, 62, 62,
|
197
|
+
62, 62, 62, 62, 63, 62, 62, 63,
|
198
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
199
|
+
63, 62, 62, 62, 62, 62, 62, 62,
|
200
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
201
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
202
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
203
|
+
63, 63, 62, 64, 62, 62, 63, 62,
|
204
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
205
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
206
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
207
|
+
63, 63, 62, 62, 62, 62, 62, 63,
|
208
|
+
50, 65, 65, 65, 65, 65, 65, 65,
|
209
|
+
65, 65, 65, 65, 65, 65, 65, 65,
|
210
|
+
65, 65, 65, 65, 65, 65, 65, 50,
|
211
|
+
65, 66, 6, 6, 6, 6, 6, 6,
|
212
|
+
6, 6, 6, 6, 67, 5, 68, 5,
|
213
|
+
68, 68, 6, 6, 6, 6, 6, 6,
|
214
|
+
6, 6, 6, 6, 68, 69, 70, 8,
|
215
|
+
8, 8, 8, 8, 8, 8, 8, 8,
|
216
|
+
72, 8, 8, 8, 8, 8, 8, 8,
|
217
|
+
8, 8, 8, 8, 8, 8, 8, 8,
|
218
|
+
8, 8, 8, 8, 8, 8, 8, 72,
|
219
|
+
8, 15, 8, 73, 8, 8, 18, 8,
|
220
|
+
8, 74, 8, 8, 8, 8, 8, 8,
|
221
|
+
8, 8, 8, 8, 8, 8, 8, 8,
|
222
|
+
8, 8, 8, 8, 75, 8, 8, 8,
|
223
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
224
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
225
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
226
|
+
71, 71, 8, 8, 76, 77, 71, 8,
|
227
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
228
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
229
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
230
|
+
71, 71, 8, 78, 8, 79, 8, 71,
|
231
|
+
80, 80, 80, 80, 80, 80, 80, 80,
|
232
|
+
80, 80, 80, 80, 80, 80, 80, 80,
|
233
|
+
80, 80, 80, 80, 80, 80, 80, 80,
|
234
|
+
80, 80, 80, 80, 80, 80, 80, 80,
|
235
|
+
80, 80, 80, 80, 80, 80, 80, 80,
|
236
|
+
80, 80, 80, 80, 80, 71, 80, 80,
|
237
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
238
|
+
71, 71, 80, 80, 80, 80, 80, 80,
|
239
|
+
80, 71, 71, 71, 71, 71, 71, 71,
|
240
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
241
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
242
|
+
71, 71, 71, 80, 81, 80, 80, 71,
|
243
|
+
80, 71, 71, 71, 71, 71, 71, 71,
|
244
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
245
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
246
|
+
71, 71, 71, 80, 80, 80, 80, 80,
|
247
|
+
71, 82, 82, 82, 82, 82, 82, 82,
|
248
|
+
82, 82, 82, 82, 82, 82, 82, 82,
|
249
|
+
82, 82, 82, 82, 82, 82, 82, 82,
|
250
|
+
82, 82, 82, 82, 82, 82, 82, 82,
|
251
|
+
82, 82, 82, 82, 82, 82, 82, 82,
|
252
|
+
82, 82, 82, 82, 82, 82, 83, 82,
|
253
|
+
82, 83, 83, 83, 83, 83, 83, 83,
|
254
|
+
83, 83, 83, 82, 82, 82, 82, 82,
|
255
|
+
82, 82, 83, 83, 83, 83, 83, 83,
|
256
|
+
83, 83, 83, 83, 83, 83, 83, 83,
|
257
|
+
83, 83, 83, 83, 83, 83, 83, 83,
|
258
|
+
83, 83, 83, 83, 82, 84, 82, 82,
|
259
|
+
83, 82, 83, 83, 83, 83, 83, 83,
|
260
|
+
83, 83, 83, 83, 83, 83, 83, 83,
|
261
|
+
83, 83, 83, 83, 83, 83, 83, 83,
|
262
|
+
83, 83, 83, 83, 82, 82, 82, 82,
|
263
|
+
82, 83, 72, 85, 85, 85, 85, 85,
|
264
|
+
85, 85, 85, 85, 85, 85, 85, 85,
|
265
|
+
85, 85, 85, 85, 85, 85, 85, 85,
|
266
|
+
85, 72, 85, 86, 80, 0
|
179
267
|
]
|
180
268
|
|
181
269
|
class << self
|
@@ -183,14 +271,17 @@ class << self
|
|
183
271
|
private :_css_lexer_trans_targs, :_css_lexer_trans_targs=
|
184
272
|
end
|
185
273
|
self._css_lexer_trans_targs = [
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
19,
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
274
|
+
16, 18, 27, 29, 27, 3, 32, 5,
|
275
|
+
0, 6, 27, 8, 27, 36, 38, 10,
|
276
|
+
36, 36, 12, 36, 36, 36, 17, 16,
|
277
|
+
19, 24, 16, 16, 20, 21, 25, 26,
|
278
|
+
22, 16, 16, 23, 16, 1, 16, 17,
|
279
|
+
1, 16, 16, 16, 16, 16, 16, 16,
|
280
|
+
16, 28, 30, 31, 27, 27, 33, 34,
|
281
|
+
35, 4, 27, 7, 27, 2, 27, 28,
|
282
|
+
2, 27, 27, 27, 27, 27, 27, 37,
|
283
|
+
39, 11, 40, 36, 36, 13, 14, 15,
|
284
|
+
36, 9, 36, 37, 9, 36, 36
|
194
285
|
]
|
195
286
|
|
196
287
|
class << self
|
@@ -198,14 +289,17 @@ class << self
|
|
198
289
|
private :_css_lexer_trans_actions, :_css_lexer_trans_actions=
|
199
290
|
end
|
200
291
|
self._css_lexer_trans_actions = [
|
201
|
-
1,
|
202
|
-
|
203
|
-
|
204
|
-
0, 0,
|
205
|
-
18, 19,
|
206
|
-
|
207
|
-
31,
|
208
|
-
|
292
|
+
1, 2, 3, 2, 4, 0, 0, 0,
|
293
|
+
0, 0, 5, 0, 6, 7, 2, 0,
|
294
|
+
8, 9, 0, 10, 11, 12, 2, 15,
|
295
|
+
0, 0, 16, 17, 0, 0, 0, 0,
|
296
|
+
0, 18, 19, 0, 20, 0, 21, 22,
|
297
|
+
23, 24, 25, 26, 27, 28, 29, 30,
|
298
|
+
31, 2, 0, 0, 33, 34, 35, 0,
|
299
|
+
0, 0, 36, 0, 37, 0, 38, 22,
|
300
|
+
23, 39, 40, 41, 42, 43, 44, 2,
|
301
|
+
0, 0, 0, 45, 46, 0, 0, 0,
|
302
|
+
47, 0, 48, 22, 23, 49, 50
|
209
303
|
]
|
210
304
|
|
211
305
|
class << self
|
@@ -214,9 +308,11 @@ class << self
|
|
214
308
|
end
|
215
309
|
self._css_lexer_to_state_actions = [
|
216
310
|
0, 0, 0, 0, 0, 0, 0, 0,
|
217
|
-
0, 0, 0, 0, 0,
|
218
|
-
|
219
|
-
0, 0, 0, 0,
|
311
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
312
|
+
13, 0, 0, 0, 0, 0, 0, 0,
|
313
|
+
0, 0, 0, 32, 0, 0, 0, 0,
|
314
|
+
0, 0, 0, 0, 13, 0, 0, 0,
|
315
|
+
0
|
220
316
|
]
|
221
317
|
|
222
318
|
class << self
|
@@ -225,9 +321,11 @@ class << self
|
|
225
321
|
end
|
226
322
|
self._css_lexer_from_state_actions = [
|
227
323
|
0, 0, 0, 0, 0, 0, 0, 0,
|
228
|
-
0, 0, 0, 0, 0,
|
229
|
-
|
230
|
-
0, 0, 0, 0,
|
324
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
325
|
+
14, 0, 0, 0, 0, 0, 0, 0,
|
326
|
+
0, 0, 0, 14, 0, 0, 0, 0,
|
327
|
+
0, 0, 0, 0, 14, 0, 0, 0,
|
328
|
+
0
|
231
329
|
]
|
232
330
|
|
233
331
|
class << self
|
@@ -235,20 +333,22 @@ class << self
|
|
235
333
|
private :_css_lexer_eof_trans, :_css_lexer_eof_trans=
|
236
334
|
end
|
237
335
|
self._css_lexer_eof_trans = [
|
238
|
-
0, 1,
|
239
|
-
0,
|
240
|
-
|
241
|
-
48, 49,
|
336
|
+
0, 1, 3, 5, 0, 0, 0, 0,
|
337
|
+
0, 14, 0, 0, 0, 0, 0, 0,
|
338
|
+
0, 37, 39, 42, 43, 44, 45, 46,
|
339
|
+
47, 48, 49, 0, 61, 63, 66, 67,
|
340
|
+
68, 69, 70, 71, 0, 81, 83, 86,
|
341
|
+
81
|
242
342
|
]
|
243
343
|
|
244
344
|
class << self
|
245
345
|
attr_accessor :css_lexer_start
|
246
346
|
end
|
247
|
-
self.css_lexer_start =
|
347
|
+
self.css_lexer_start = 16;
|
248
348
|
class << self
|
249
349
|
attr_accessor :css_lexer_first_final
|
250
350
|
end
|
251
|
-
self.css_lexer_first_final =
|
351
|
+
self.css_lexer_first_final = 16;
|
252
352
|
class << self
|
253
353
|
attr_accessor :css_lexer_error
|
254
354
|
end
|
@@ -257,34 +357,30 @@ self.css_lexer_error = 0;
|
|
257
357
|
class << self
|
258
358
|
attr_accessor :css_lexer_en_pseudo_args
|
259
359
|
end
|
260
|
-
self.css_lexer_en_pseudo_args =
|
360
|
+
self.css_lexer_en_pseudo_args = 27;
|
261
361
|
class << self
|
262
362
|
attr_accessor :css_lexer_en_predicate
|
263
363
|
end
|
264
|
-
self.css_lexer_en_predicate =
|
364
|
+
self.css_lexer_en_predicate = 36;
|
265
365
|
class << self
|
266
366
|
attr_accessor :css_lexer_en_main
|
267
367
|
end
|
268
|
-
self.css_lexer_en_main =
|
368
|
+
self.css_lexer_en_main = 16;
|
269
369
|
|
270
370
|
|
271
|
-
# line
|
371
|
+
# line 21 "lib/oga/css/lexer.rl"
|
272
372
|
|
273
373
|
# % fix highlight
|
274
374
|
|
275
|
-
##
|
276
375
|
# @param [String] data The data to lex.
|
277
|
-
#
|
278
376
|
def initialize(data)
|
279
377
|
@data = data
|
280
378
|
end
|
281
379
|
|
282
|
-
##
|
283
380
|
# Gathers all the tokens for the input and returns them as an Array.
|
284
381
|
#
|
285
382
|
# @see [#advance]
|
286
383
|
# @return [Array]
|
287
|
-
#
|
288
384
|
def lex
|
289
385
|
tokens = []
|
290
386
|
|
@@ -295,7 +391,6 @@ self.css_lexer_en_main = 13;
|
|
295
391
|
return tokens
|
296
392
|
end
|
297
393
|
|
298
|
-
##
|
299
394
|
# Advances through the input and generates the corresponding tokens. Each
|
300
395
|
# token is yielded to the supplied block.
|
301
396
|
#
|
@@ -303,9 +398,9 @@ self.css_lexer_en_main = 13;
|
|
303
398
|
# the lexer loop has finished.
|
304
399
|
#
|
305
400
|
# @see [#add_token]
|
306
|
-
#
|
307
401
|
def advance(&block)
|
308
|
-
@block
|
402
|
+
@block = block
|
403
|
+
@escaped = false
|
309
404
|
|
310
405
|
data = @data # saves ivar lookups while lexing.
|
311
406
|
ts = nil
|
@@ -329,7 +424,7 @@ self.css_lexer_en_main = 13;
|
|
329
424
|
_css_lexer_trans_targs = self.class.send(:_css_lexer_trans_targs)
|
330
425
|
|
331
426
|
|
332
|
-
# line
|
427
|
+
# line 428 "lib/oga/css/lexer.rb"
|
333
428
|
begin
|
334
429
|
testEof = false
|
335
430
|
_slen, _trans, _keys, _inds, _acts, _nacts = nil
|
@@ -352,12 +447,12 @@ begin
|
|
352
447
|
end
|
353
448
|
if _goto_level <= _resume
|
354
449
|
case _css_lexer_from_state_actions[cs]
|
355
|
-
when
|
450
|
+
when 14 then
|
356
451
|
# line 1 "NONE"
|
357
452
|
begin
|
358
453
|
ts = p
|
359
454
|
end
|
360
|
-
# line
|
455
|
+
# line 456 "lib/oga/css/lexer.rb"
|
361
456
|
end
|
362
457
|
_keys = cs << 1
|
363
458
|
_inds = _css_lexer_index_offsets[cs]
|
@@ -376,55 +471,72 @@ ts = p
|
|
376
471
|
cs = _css_lexer_trans_targs[_trans]
|
377
472
|
if _css_lexer_trans_actions[_trans] != 0
|
378
473
|
case _css_lexer_trans_actions[_trans]
|
379
|
-
when
|
380
|
-
# line
|
474
|
+
when 23 then
|
475
|
+
# line 151 "lib/oga/css/lexer.rl"
|
476
|
+
begin
|
477
|
+
@escaped = true end
|
478
|
+
when 2 then
|
479
|
+
# line 1 "NONE"
|
381
480
|
begin
|
382
481
|
te = p+1
|
383
|
-
begin add_token(:T_NTH) end
|
384
482
|
end
|
385
|
-
when
|
483
|
+
when 36 then
|
386
484
|
# line 253 "lib/oga/css/lexer.rl"
|
387
485
|
begin
|
486
|
+
te = p+1
|
487
|
+
begin add_token(:T_NTH) end
|
488
|
+
end
|
489
|
+
when 6 then
|
490
|
+
# line 255 "lib/oga/css/lexer.rl"
|
491
|
+
begin
|
388
492
|
te = p+1
|
389
493
|
begin add_token(:T_ODD) end
|
390
494
|
end
|
391
|
-
when
|
392
|
-
# line
|
495
|
+
when 5 then
|
496
|
+
# line 256 "lib/oga/css/lexer.rl"
|
393
497
|
begin
|
394
498
|
te = p+1
|
395
499
|
begin add_token(:T_EVEN) end
|
396
500
|
end
|
397
|
-
when
|
501
|
+
when 33 then
|
398
502
|
# line 235 "lib/oga/css/lexer.rl"
|
399
503
|
begin
|
400
504
|
te = p+1
|
401
505
|
begin
|
402
506
|
add_token(:T_RPAREN)
|
403
507
|
|
404
|
-
cs =
|
508
|
+
cs = 16;
|
405
509
|
end
|
406
510
|
end
|
407
|
-
when
|
408
|
-
# line
|
511
|
+
when 34 then
|
512
|
+
# line 158 "lib/oga/css/lexer.rl"
|
409
513
|
begin
|
410
514
|
te = p+1
|
411
515
|
begin
|
412
|
-
|
516
|
+
value = slice_input(ts, te)
|
517
|
+
|
518
|
+
# Translates "foo\.bar" into "foo.bar"
|
519
|
+
if @escaped
|
520
|
+
value = value.gsub('\.', '.')
|
521
|
+
@escaped = false
|
522
|
+
end
|
523
|
+
|
524
|
+
add_token(:T_IDENT, value)
|
413
525
|
end
|
414
526
|
end
|
415
|
-
when
|
527
|
+
when 39 then
|
416
528
|
# line 246 "lib/oga/css/lexer.rl"
|
417
529
|
begin
|
418
530
|
te = p
|
419
531
|
p = p - 1; end
|
420
|
-
when
|
421
|
-
# line
|
532
|
+
when 42 then
|
533
|
+
# line 254 "lib/oga/css/lexer.rl"
|
422
534
|
begin
|
423
535
|
te = p
|
424
536
|
p = p - 1; begin add_token(:T_MINUS) end
|
425
537
|
end
|
426
|
-
when
|
427
|
-
# line
|
538
|
+
when 41 then
|
539
|
+
# line 196 "lib/oga/css/lexer.rl"
|
428
540
|
begin
|
429
541
|
te = p
|
430
542
|
p = p - 1; begin
|
@@ -433,15 +545,39 @@ p = p - 1; begin
|
|
433
545
|
add_token(:T_INT, value)
|
434
546
|
end
|
435
547
|
end
|
436
|
-
when
|
437
|
-
# line
|
548
|
+
when 37 then
|
549
|
+
# line 158 "lib/oga/css/lexer.rl"
|
438
550
|
begin
|
439
551
|
te = p
|
440
552
|
p = p - 1; begin
|
441
|
-
|
553
|
+
value = slice_input(ts, te)
|
554
|
+
|
555
|
+
# Translates "foo\.bar" into "foo.bar"
|
556
|
+
if @escaped
|
557
|
+
value = value.gsub('\.', '.')
|
558
|
+
@escaped = false
|
559
|
+
end
|
560
|
+
|
561
|
+
add_token(:T_IDENT, value)
|
442
562
|
end
|
443
563
|
end
|
444
|
-
when
|
564
|
+
when 3 then
|
565
|
+
# line 158 "lib/oga/css/lexer.rl"
|
566
|
+
begin
|
567
|
+
begin p = ((te))-1; end
|
568
|
+
begin
|
569
|
+
value = slice_input(ts, te)
|
570
|
+
|
571
|
+
# Translates "foo\.bar" into "foo.bar"
|
572
|
+
if @escaped
|
573
|
+
value = value.gsub('\.', '.')
|
574
|
+
@escaped = false
|
575
|
+
end
|
576
|
+
|
577
|
+
add_token(:T_IDENT, value)
|
578
|
+
end
|
579
|
+
end
|
580
|
+
when 4 then
|
445
581
|
# line 1 "NONE"
|
446
582
|
begin
|
447
583
|
case act
|
@@ -452,58 +588,58 @@ p = p - 1; begin
|
|
452
588
|
next
|
453
589
|
end
|
454
590
|
end
|
455
|
-
when
|
591
|
+
when 4 then
|
456
592
|
begin begin p = ((te))-1; end
|
457
593
|
add_token(:T_MINUS) end
|
458
594
|
end
|
459
595
|
end
|
460
|
-
when
|
461
|
-
# line
|
596
|
+
when 45 then
|
597
|
+
# line 294 "lib/oga/css/lexer.rl"
|
462
598
|
begin
|
463
599
|
te = p+1
|
464
600
|
begin add_token(:T_EQ) end
|
465
601
|
end
|
466
|
-
when
|
467
|
-
# line
|
602
|
+
when 12 then
|
603
|
+
# line 295 "lib/oga/css/lexer.rl"
|
468
604
|
begin
|
469
605
|
te = p+1
|
470
606
|
begin add_token(:T_SPACE_IN) end
|
471
607
|
end
|
472
|
-
when
|
473
|
-
# line
|
608
|
+
when 10 then
|
609
|
+
# line 296 "lib/oga/css/lexer.rl"
|
474
610
|
begin
|
475
611
|
te = p+1
|
476
612
|
begin add_token(:T_STARTS_WITH) end
|
477
613
|
end
|
478
|
-
when
|
479
|
-
# line
|
614
|
+
when 9 then
|
615
|
+
# line 297 "lib/oga/css/lexer.rl"
|
480
616
|
begin
|
481
617
|
te = p+1
|
482
618
|
begin add_token(:T_ENDS_WITH) end
|
483
619
|
end
|
484
|
-
when
|
485
|
-
# line
|
620
|
+
when 50 then
|
621
|
+
# line 298 "lib/oga/css/lexer.rl"
|
486
622
|
begin
|
487
623
|
te = p+1
|
488
624
|
begin add_token(:T_IN) end
|
489
625
|
end
|
490
|
-
when
|
491
|
-
# line
|
626
|
+
when 11 then
|
627
|
+
# line 299 "lib/oga/css/lexer.rl"
|
492
628
|
begin
|
493
629
|
te = p+1
|
494
630
|
begin add_token(:T_HYPHEN_IN) end
|
495
631
|
end
|
496
|
-
when
|
497
|
-
# line
|
632
|
+
when 46 then
|
633
|
+
# line 276 "lib/oga/css/lexer.rl"
|
498
634
|
begin
|
499
635
|
te = p+1
|
500
636
|
begin
|
501
637
|
add_token(:T_RBRACK)
|
502
638
|
|
503
|
-
cs =
|
639
|
+
cs = 16;
|
504
640
|
end
|
505
641
|
end
|
506
|
-
when
|
642
|
+
when 8 then
|
507
643
|
# line 214 "lib/oga/css/lexer.rl"
|
508
644
|
begin
|
509
645
|
te = p+1
|
@@ -511,145 +647,290 @@ te = p+1
|
|
511
647
|
emit(:T_STRING, ts + 1, te - 1)
|
512
648
|
end
|
513
649
|
end
|
514
|
-
when
|
515
|
-
# line
|
650
|
+
when 49 then
|
651
|
+
# line 284 "lib/oga/css/lexer.rl"
|
516
652
|
begin
|
517
653
|
te = p
|
518
654
|
p = p - 1; end
|
519
|
-
when
|
520
|
-
# line
|
655
|
+
when 47 then
|
656
|
+
# line 158 "lib/oga/css/lexer.rl"
|
521
657
|
begin
|
522
658
|
te = p
|
523
659
|
p = p - 1; begin
|
524
|
-
|
660
|
+
value = slice_input(ts, te)
|
661
|
+
|
662
|
+
# Translates "foo\.bar" into "foo.bar"
|
663
|
+
if @escaped
|
664
|
+
value = value.gsub('\.', '.')
|
665
|
+
@escaped = false
|
666
|
+
end
|
667
|
+
|
668
|
+
add_token(:T_IDENT, value)
|
525
669
|
end
|
526
670
|
end
|
527
|
-
when
|
528
|
-
# line
|
671
|
+
when 7 then
|
672
|
+
# line 158 "lib/oga/css/lexer.rl"
|
673
|
+
begin
|
674
|
+
begin p = ((te))-1; end
|
675
|
+
begin
|
676
|
+
value = slice_input(ts, te)
|
677
|
+
|
678
|
+
# Translates "foo\.bar" into "foo.bar"
|
679
|
+
if @escaped
|
680
|
+
value = value.gsub('\.', '.')
|
681
|
+
@escaped = false
|
682
|
+
end
|
683
|
+
|
684
|
+
add_token(:T_IDENT, value)
|
685
|
+
end
|
686
|
+
end
|
687
|
+
when 18 then
|
688
|
+
# line 270 "lib/oga/css/lexer.rl"
|
529
689
|
begin
|
530
690
|
te = p+1
|
531
691
|
begin
|
532
692
|
add_token(:T_LBRACK)
|
533
693
|
|
534
|
-
cs =
|
694
|
+
cs = 36;
|
535
695
|
end
|
536
696
|
end
|
537
|
-
when
|
538
|
-
# line
|
697
|
+
when 19 then
|
698
|
+
# line 134 "lib/oga/css/lexer.rl"
|
539
699
|
begin
|
540
700
|
te = p+1
|
541
701
|
begin
|
542
702
|
add_token(:T_PIPE)
|
543
703
|
end
|
544
704
|
end
|
545
|
-
when
|
705
|
+
when 16 then
|
546
706
|
# line 229 "lib/oga/css/lexer.rl"
|
547
707
|
begin
|
548
708
|
te = p+1
|
549
709
|
begin
|
550
710
|
add_token(:T_LPAREN)
|
551
711
|
|
552
|
-
cs =
|
712
|
+
cs = 27;
|
553
713
|
end
|
554
714
|
end
|
555
|
-
when
|
556
|
-
# line
|
715
|
+
when 17 then
|
716
|
+
# line 158 "lib/oga/css/lexer.rl"
|
557
717
|
begin
|
558
718
|
te = p+1
|
559
719
|
begin
|
560
|
-
|
720
|
+
value = slice_input(ts, te)
|
721
|
+
|
722
|
+
# Translates "foo\.bar" into "foo.bar"
|
723
|
+
if @escaped
|
724
|
+
value = value.gsub('\.', '.')
|
725
|
+
@escaped = false
|
726
|
+
end
|
727
|
+
|
728
|
+
add_token(:T_IDENT, value)
|
561
729
|
end
|
562
730
|
end
|
563
|
-
when
|
564
|
-
# line
|
731
|
+
when 15 then
|
732
|
+
# line 319 "lib/oga/css/lexer.rl"
|
565
733
|
begin
|
566
734
|
te = p+1
|
567
735
|
end
|
568
|
-
when
|
569
|
-
# line
|
736
|
+
when 27 then
|
737
|
+
# line 308 "lib/oga/css/lexer.rl"
|
570
738
|
begin
|
571
739
|
te = p
|
572
740
|
p = p - 1; begin add_token(:T_GREATER) end
|
573
741
|
end
|
574
|
-
when
|
575
|
-
# line
|
742
|
+
when 25 then
|
743
|
+
# line 309 "lib/oga/css/lexer.rl"
|
576
744
|
begin
|
577
745
|
te = p
|
578
746
|
p = p - 1; begin add_token(:T_PLUS) end
|
579
747
|
end
|
580
|
-
when
|
581
|
-
# line
|
748
|
+
when 28 then
|
749
|
+
# line 310 "lib/oga/css/lexer.rl"
|
582
750
|
begin
|
583
751
|
te = p
|
584
752
|
p = p - 1; begin add_token(:T_TILDE) end
|
585
753
|
end
|
586
|
-
when
|
587
|
-
# line
|
754
|
+
when 26 then
|
755
|
+
# line 138 "lib/oga/css/lexer.rl"
|
588
756
|
begin
|
589
757
|
te = p
|
590
758
|
p = p - 1; begin
|
591
759
|
add_token(:T_COMMA)
|
592
760
|
end
|
593
761
|
end
|
594
|
-
when
|
595
|
-
# line
|
762
|
+
when 24 then
|
763
|
+
# line 124 "lib/oga/css/lexer.rl"
|
596
764
|
begin
|
597
765
|
te = p
|
598
766
|
p = p - 1; begin
|
599
767
|
add_token(:T_SPACE)
|
600
768
|
end
|
601
769
|
end
|
602
|
-
when
|
603
|
-
# line
|
770
|
+
when 20 then
|
771
|
+
# line 158 "lib/oga/css/lexer.rl"
|
604
772
|
begin
|
605
773
|
te = p
|
606
774
|
p = p - 1; begin
|
607
|
-
|
775
|
+
value = slice_input(ts, te)
|
776
|
+
|
777
|
+
# Translates "foo\.bar" into "foo.bar"
|
778
|
+
if @escaped
|
779
|
+
value = value.gsub('\.', '.')
|
780
|
+
@escaped = false
|
781
|
+
end
|
782
|
+
|
783
|
+
add_token(:T_IDENT, value)
|
608
784
|
end
|
609
785
|
end
|
610
|
-
when
|
611
|
-
# line
|
786
|
+
when 1 then
|
787
|
+
# line 158 "lib/oga/css/lexer.rl"
|
788
|
+
begin
|
789
|
+
begin p = ((te))-1; end
|
790
|
+
begin
|
791
|
+
value = slice_input(ts, te)
|
792
|
+
|
793
|
+
# Translates "foo\.bar" into "foo.bar"
|
794
|
+
if @escaped
|
795
|
+
value = value.gsub('\.', '.')
|
796
|
+
@escaped = false
|
797
|
+
end
|
798
|
+
|
799
|
+
add_token(:T_IDENT, value)
|
800
|
+
end
|
801
|
+
end
|
802
|
+
when 40 then
|
803
|
+
# line 128 "lib/oga/css/lexer.rl"
|
612
804
|
begin
|
613
805
|
add_token(:T_HASH) end
|
614
|
-
# line
|
806
|
+
# line 248 "lib/oga/css/lexer.rl"
|
615
807
|
begin
|
616
808
|
te = p
|
617
809
|
p = p - 1; end
|
618
|
-
when
|
619
|
-
# line
|
810
|
+
when 29 then
|
811
|
+
# line 128 "lib/oga/css/lexer.rl"
|
812
|
+
begin
|
813
|
+
add_token(:T_HASH) end
|
814
|
+
# line 306 "lib/oga/css/lexer.rl"
|
815
|
+
begin
|
816
|
+
te = p
|
817
|
+
p = p - 1; end
|
818
|
+
when 43 then
|
819
|
+
# line 129 "lib/oga/css/lexer.rl"
|
620
820
|
begin
|
621
821
|
add_token(:T_DOT) end
|
622
|
-
# line
|
822
|
+
# line 248 "lib/oga/css/lexer.rl"
|
623
823
|
begin
|
624
824
|
te = p
|
625
825
|
p = p - 1; end
|
626
|
-
when
|
627
|
-
# line
|
826
|
+
when 30 then
|
827
|
+
# line 129 "lib/oga/css/lexer.rl"
|
828
|
+
begin
|
829
|
+
add_token(:T_DOT) end
|
830
|
+
# line 306 "lib/oga/css/lexer.rl"
|
831
|
+
begin
|
832
|
+
te = p
|
833
|
+
p = p - 1; end
|
834
|
+
when 44 then
|
835
|
+
# line 130 "lib/oga/css/lexer.rl"
|
628
836
|
begin
|
629
837
|
add_token(:T_COLON) end
|
630
|
-
# line
|
838
|
+
# line 248 "lib/oga/css/lexer.rl"
|
631
839
|
begin
|
632
840
|
te = p
|
633
841
|
p = p - 1; end
|
634
|
-
when
|
842
|
+
when 31 then
|
843
|
+
# line 130 "lib/oga/css/lexer.rl"
|
844
|
+
begin
|
845
|
+
add_token(:T_COLON) end
|
846
|
+
# line 306 "lib/oga/css/lexer.rl"
|
847
|
+
begin
|
848
|
+
te = p
|
849
|
+
p = p - 1; end
|
850
|
+
when 38 then
|
851
|
+
# line 151 "lib/oga/css/lexer.rl"
|
852
|
+
begin
|
853
|
+
@escaped = true end
|
854
|
+
# line 158 "lib/oga/css/lexer.rl"
|
855
|
+
begin
|
856
|
+
te = p
|
857
|
+
p = p - 1; begin
|
858
|
+
value = slice_input(ts, te)
|
859
|
+
|
860
|
+
# Translates "foo\.bar" into "foo.bar"
|
861
|
+
if @escaped
|
862
|
+
value = value.gsub('\.', '.')
|
863
|
+
@escaped = false
|
864
|
+
end
|
865
|
+
|
866
|
+
add_token(:T_IDENT, value)
|
867
|
+
end
|
868
|
+
end
|
869
|
+
when 48 then
|
870
|
+
# line 151 "lib/oga/css/lexer.rl"
|
871
|
+
begin
|
872
|
+
@escaped = true end
|
873
|
+
# line 158 "lib/oga/css/lexer.rl"
|
874
|
+
begin
|
875
|
+
te = p
|
876
|
+
p = p - 1; begin
|
877
|
+
value = slice_input(ts, te)
|
878
|
+
|
879
|
+
# Translates "foo\.bar" into "foo.bar"
|
880
|
+
if @escaped
|
881
|
+
value = value.gsub('\.', '.')
|
882
|
+
@escaped = false
|
883
|
+
end
|
884
|
+
|
885
|
+
add_token(:T_IDENT, value)
|
886
|
+
end
|
887
|
+
end
|
888
|
+
when 21 then
|
889
|
+
# line 151 "lib/oga/css/lexer.rl"
|
890
|
+
begin
|
891
|
+
@escaped = true end
|
892
|
+
# line 158 "lib/oga/css/lexer.rl"
|
893
|
+
begin
|
894
|
+
te = p
|
895
|
+
p = p - 1; begin
|
896
|
+
value = slice_input(ts, te)
|
897
|
+
|
898
|
+
# Translates "foo\.bar" into "foo.bar"
|
899
|
+
if @escaped
|
900
|
+
value = value.gsub('\.', '.')
|
901
|
+
@escaped = false
|
902
|
+
end
|
903
|
+
|
904
|
+
add_token(:T_IDENT, value)
|
905
|
+
end
|
906
|
+
end
|
907
|
+
when 22 then
|
908
|
+
# line 1 "NONE"
|
909
|
+
begin
|
910
|
+
te = p+1
|
911
|
+
end
|
912
|
+
# line 151 "lib/oga/css/lexer.rl"
|
913
|
+
begin
|
914
|
+
@escaped = true end
|
915
|
+
when 35 then
|
635
916
|
# line 1 "NONE"
|
636
917
|
begin
|
637
918
|
te = p+1
|
638
919
|
end
|
639
|
-
# line
|
920
|
+
# line 254 "lib/oga/css/lexer.rl"
|
640
921
|
begin
|
641
|
-
act =
|
642
|
-
# line
|
922
|
+
act = 4; end
|
923
|
+
# line 924 "lib/oga/css/lexer.rb"
|
643
924
|
end
|
644
925
|
end
|
645
926
|
end
|
646
927
|
if _goto_level <= _again
|
647
928
|
case _css_lexer_to_state_actions[cs]
|
648
|
-
when
|
929
|
+
when 13 then
|
649
930
|
# line 1 "NONE"
|
650
931
|
begin
|
651
932
|
ts = nil; end
|
652
|
-
when
|
933
|
+
when 32 then
|
653
934
|
# line 1 "NONE"
|
654
935
|
begin
|
655
936
|
ts = nil; end
|
@@ -657,7 +938,7 @@ ts = nil; end
|
|
657
938
|
begin
|
658
939
|
act = 0
|
659
940
|
end
|
660
|
-
# line
|
941
|
+
# line 942 "lib/oga/css/lexer.rb"
|
661
942
|
end
|
662
943
|
|
663
944
|
if cs == 0
|
@@ -686,7 +967,7 @@ act = 0
|
|
686
967
|
end
|
687
968
|
end
|
688
969
|
|
689
|
-
# line
|
970
|
+
# line 76 "lib/oga/css/lexer.rl"
|
690
971
|
|
691
972
|
# % fix highlight
|
692
973
|
ensure
|
@@ -695,7 +976,6 @@ end
|
|
695
976
|
|
696
977
|
private
|
697
978
|
|
698
|
-
##
|
699
979
|
# Emits a token of which the value is based on the supplied start/stop
|
700
980
|
# position.
|
701
981
|
#
|
@@ -705,25 +985,21 @@ end
|
|
705
985
|
#
|
706
986
|
# @see [#text]
|
707
987
|
# @see [#add_token]
|
708
|
-
#
|
709
988
|
def emit(type, start, stop)
|
710
989
|
value = slice_input(start, stop)
|
711
990
|
|
712
991
|
add_token(type, value)
|
713
992
|
end
|
714
993
|
|
715
|
-
##
|
716
994
|
# Returns the text between the specified start and stop position.
|
717
995
|
#
|
718
996
|
# @param [Fixnum] start
|
719
997
|
# @param [Fixnum] stop
|
720
998
|
# @return [String]
|
721
|
-
#
|
722
999
|
def slice_input(start, stop)
|
723
1000
|
return @data.byteslice(start, stop - start)
|
724
1001
|
end
|
725
1002
|
|
726
|
-
##
|
727
1003
|
# Yields a new token to the supplied block.
|
728
1004
|
#
|
729
1005
|
# @param [Symbol] type The token type.
|
@@ -731,13 +1007,12 @@ end
|
|
731
1007
|
#
|
732
1008
|
# @yieldparam [Symbol] type
|
733
1009
|
# @yieldparam [String|NilClass] value
|
734
|
-
#
|
735
1010
|
def add_token(type, value = nil)
|
736
1011
|
@block.call(type, value)
|
737
1012
|
end
|
738
1013
|
|
739
1014
|
|
740
|
-
# line
|
1015
|
+
# line 321 "lib/oga/css/lexer.rl"
|
741
1016
|
|
742
1017
|
end # Lexer
|
743
1018
|
end # CSS
|