oga 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/c/lexer.c +555 -474
- data/ext/java/org/liboga/xml/Lexer.java +217 -208
- data/ext/ragel/base_lexer.rl +3 -1
- data/lib/oga/css/parser.rb +217 -177
- data/lib/oga/version.rb +1 -1
- metadata +2 -2
data/ext/ragel/base_lexer.rl
CHANGED
data/lib/oga/css/parser.rb
CHANGED
@@ -47,111 +47,118 @@ class Parser < LL::Driver
|
|
47
47
|
:T_EVEN, # 23
|
48
48
|
:T_DOT, # 24
|
49
49
|
:T_HASH, # 25
|
50
|
+
:T_COMMA, # 26
|
50
51
|
].freeze
|
51
52
|
|
52
53
|
CONFIG.rules = [
|
53
54
|
[3, 0, 0, 1], # 0
|
54
55
|
[3, 1, 2, 0], # 1
|
55
|
-
[3, 2, 4,
|
56
|
-
[3, 3, 0, 3, 1,
|
57
|
-
[3, 4,
|
58
|
-
[3, 5,
|
59
|
-
[3, 6, 0,
|
60
|
-
[3, 7, 0, 7], # 7
|
61
|
-
[3, 8, 0,
|
62
|
-
[3, 9, 0,
|
63
|
-
[3, 10, 0,
|
64
|
-
[3, 11, 0,
|
65
|
-
[3, 12, 0,
|
66
|
-
[3, 13, 0,
|
67
|
-
[3, 14,
|
68
|
-
[3, 15,
|
69
|
-
[3, 16,
|
70
|
-
[3, 17,
|
71
|
-
[3, 18, 0,
|
56
|
+
[3, 2, 4, 31, 6, 0, 0, 3], # 2
|
57
|
+
[3, 3, 0, 3, 1, 26], # 3
|
58
|
+
[3, 4, 4, 32, 6, 0, 0, 5], # 4
|
59
|
+
[3, 5, 0, 5, 1, 6], # 5
|
60
|
+
[3, 6, 8, 33, 0, 6], # 6
|
61
|
+
[3, 7, 8, 34, 0, 7], # 7
|
62
|
+
[3, 8, 0, 12], # 8
|
63
|
+
[3, 9, 0, 9], # 9
|
64
|
+
[3, 10, 0, 8, 1, 16], # 10
|
65
|
+
[3, 11, 0, 8, 1, 17], # 11
|
66
|
+
[3, 12, 0, 8, 1, 18], # 12
|
67
|
+
[3, 13, 0, 9], # 13
|
68
|
+
[3, 14, 0, 7], # 14
|
69
|
+
[3, 15, 0, 10], # 15
|
70
|
+
[3, 16, 8, 35, 1, 1], # 16
|
71
|
+
[3, 17, 1, 1, 1, 2], # 17
|
72
|
+
[3, 18, 4, 36, 6, 0, 0, 13], # 18
|
72
73
|
[3, 19, 0, 19], # 19
|
73
|
-
[3, 20, 0,
|
74
|
-
[3, 21,
|
75
|
-
[3, 22, 0,
|
76
|
-
[3, 23, 0,
|
77
|
-
[3, 24,
|
78
|
-
[3, 25,
|
79
|
-
[3, 26,
|
80
|
-
[3, 27, 1,
|
81
|
-
[3, 28, 1,
|
82
|
-
[3, 29, 1,
|
83
|
-
[3, 30, 1,
|
84
|
-
[3, 31, 1,
|
85
|
-
[3, 32, 1,
|
86
|
-
[3, 33,
|
87
|
-
[3, 34, 1, 1, 1,
|
88
|
-
[3, 35,
|
89
|
-
[3, 36,
|
90
|
-
[3, 37, 0,
|
91
|
-
[3, 38, 0,
|
92
|
-
[3, 39, 0,
|
93
|
-
[3, 40,
|
94
|
-
[3, 41,
|
95
|
-
[3, 42,
|
96
|
-
[3, 43,
|
97
|
-
[3, 44, 8, 39,
|
98
|
-
[3, 45, 1,
|
99
|
-
[3, 46,
|
100
|
-
[3, 47, 1,
|
101
|
-
[3, 48,
|
102
|
-
[3, 49,
|
103
|
-
[3, 50, 0,
|
104
|
-
[3, 51, 0,
|
105
|
-
[3, 52, 0,
|
106
|
-
[3, 53, 0,
|
107
|
-
[3, 54, 0,
|
108
|
-
[3, 55, 0,
|
109
|
-
[3, 56, 0,
|
110
|
-
[3, 57, 0,
|
111
|
-
[3, 58, 0,
|
74
|
+
[3, 20, 0, 20], # 20
|
75
|
+
[3, 21, 0, 21], # 21
|
76
|
+
[3, 22, 0, 14], # 22
|
77
|
+
[3, 23, 1, 4, 0, 15, 1, 3], # 23
|
78
|
+
[3, 24, 0, 17], # 24
|
79
|
+
[3, 25, 0, 10], # 25
|
80
|
+
[3, 26, 8, 37, 0, 16], # 26
|
81
|
+
[3, 27, 1, 10], # 27
|
82
|
+
[3, 28, 1, 11], # 28
|
83
|
+
[3, 29, 1, 12], # 29
|
84
|
+
[3, 30, 1, 13], # 30
|
85
|
+
[3, 31, 1, 14], # 31
|
86
|
+
[3, 32, 1, 15], # 32
|
87
|
+
[3, 33, 1, 1, 1, 24], # 33
|
88
|
+
[3, 34, 1, 1, 1, 25], # 34
|
89
|
+
[3, 35, 8, 38, 0, 22], # 35
|
90
|
+
[3, 36, 1, 1, 1, 5], # 36
|
91
|
+
[3, 37, 1, 8, 0, 24, 1, 7], # 37
|
92
|
+
[3, 38, 0, 29], # 38
|
93
|
+
[3, 39, 0, 30], # 39
|
94
|
+
[3, 40, 0, 27], # 40
|
95
|
+
[3, 41, 0, 5], # 41
|
96
|
+
[3, 42, 1, 21], # 42
|
97
|
+
[3, 43, 1, 20], # 43
|
98
|
+
[3, 44, 8, 39, 0, 28], # 44
|
99
|
+
[3, 45, 8, 40, 0, 28, 1, 9], # 45
|
100
|
+
[3, 46, 8, 42, 8, 41, 0, 26], # 46
|
101
|
+
[3, 47, 1, 19], # 47
|
102
|
+
[3, 48, 1, 22], # 48
|
103
|
+
[3, 49, 1, 23], # 49
|
104
|
+
[3, 50, 0, 2], # 50
|
105
|
+
[3, 51, 0, 4], # 51
|
106
|
+
[3, 52, 0, 12], # 52
|
107
|
+
[3, 53, 0, 12], # 53
|
108
|
+
[3, 54, 0, 11], # 54
|
109
|
+
[3, 55, 0, 13], # 55
|
110
|
+
[3, 56, 0, 25, 0, 18], # 56
|
111
|
+
[3, 57, 0, 23], # 57
|
112
|
+
[3, 58, 0, 26], # 58
|
113
|
+
[3, 59, 0, 26], # 59
|
114
|
+
[3, 60, 0, 28], # 60
|
115
|
+
[3, 61, 0, 26], # 61
|
112
116
|
].freeze
|
113
117
|
|
114
118
|
CONFIG.table = [
|
115
|
-
[1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0], # 0
|
116
|
-
[-1, 2, -1, 2, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, -1, -1, -1, -1, -1, 2, 2], # 1
|
117
|
-
[-1, -1, -1, -1, -1, -1,
|
118
|
-
[-1, 4, -1,
|
119
|
-
[-1,
|
120
|
-
[-1,
|
121
|
-
[-1,
|
122
|
-
[-1,
|
123
|
-
[-1,
|
124
|
-
[-1, -1,
|
125
|
-
[-1, -1, -1,
|
126
|
-
[-1, -1, -1,
|
127
|
-
[-1, -1, -1,
|
128
|
-
[-1,
|
129
|
-
[-1,
|
130
|
-
[-1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 15
|
131
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
132
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
133
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
134
|
-
[-1, -1, -1, -1, -1,
|
135
|
-
[-1, -1, -1, -1, -1,
|
136
|
-
[-1, -1, -1, -1, -1, -1, -1,
|
137
|
-
[-1,
|
138
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
139
|
-
[-1,
|
140
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1,
|
141
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
142
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1,
|
143
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
144
|
-
[-1, -1, -1, -1, -1, -1,
|
145
|
-
[-1, -1, -1,
|
146
|
-
[-1, -1, -1,
|
147
|
-
[-1, -1,
|
148
|
-
[-1, -1, -1, 52, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, 52], # 33
|
149
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
150
|
-
[-1, -1, -1, -1, -1, -1, -1,
|
151
|
-
[-1, -1, -1,
|
152
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
153
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
154
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1], # 39
|
119
|
+
[1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1], # 0
|
120
|
+
[-1, 2, -1, 2, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, -1, -1, -1, -1, -1, 2, 2, -1], # 1
|
121
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3], # 2
|
122
|
+
[-1, 4, -1, 4, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 4, 4, -1, -1, -1, -1, -1, 4, 4, -1], # 3
|
123
|
+
[-1, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 4
|
124
|
+
[-1, 6, -1, 8, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 7, 7, -1, -1, -1, -1, -1, 8, 8, -1], # 5
|
125
|
+
[-1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 6
|
126
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, -1, -1, -1, -1, -1, -1, -1, -1], # 7
|
127
|
+
[-1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, 14, 14, -1, -1, -1, -1, -1, -1, -1, -1], # 8
|
128
|
+
[-1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 9
|
129
|
+
[-1, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 10
|
130
|
+
[-1, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 11
|
131
|
+
[-1, -1, -1, 18, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, 18, -1], # 12
|
132
|
+
[-1, -1, -1, 22, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, -1], # 13
|
133
|
+
[-1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 14
|
134
|
+
[-1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 15
|
135
|
+
[-1, 25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 16
|
136
|
+
[-1, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 17
|
137
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 18
|
138
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1], # 19
|
139
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1], # 20
|
140
|
+
[-1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 21
|
141
|
+
[-1, -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 22
|
142
|
+
[-1, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 23
|
143
|
+
[-1, 41, -1, 41, -1, 41, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, 41, 41, 41, 40, 40, -1, 38, 39, 41, 41, -1], # 24
|
144
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1], # 25
|
145
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1], # 26
|
146
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 46, -1, -1, -1, -1, -1, -1], # 27
|
147
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, -1], # 28
|
148
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, -1, -1], # 29
|
149
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1], # 30
|
150
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50], # 31
|
151
|
+
[-1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 32
|
152
|
+
[-1, -1, -1, 52, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, 52, -1], # 33
|
153
|
+
[-1, -1, -1, 53, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, 53, -1], # 34
|
154
|
+
[-1, -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 35
|
155
|
+
[-1, -1, -1, 55, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, 55, -1], # 36
|
156
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, 56, 56, 56, 56, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 37
|
157
|
+
[-1, -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 38
|
158
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1], # 39
|
159
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1], # 40
|
160
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, -1], # 41
|
161
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1], # 42
|
155
162
|
].freeze
|
156
163
|
|
157
164
|
CONFIG.actions = [
|
@@ -161,59 +168,62 @@ class Parser < LL::Driver
|
|
161
168
|
[:_rule_3, 2], # 3
|
162
169
|
[:_rule_4, 2], # 4
|
163
170
|
[:_rule_5, 2], # 5
|
164
|
-
[:_rule_6,
|
165
|
-
[:_rule_7,
|
166
|
-
[:_rule_8,
|
167
|
-
[:_rule_9,
|
171
|
+
[:_rule_6, 2], # 6
|
172
|
+
[:_rule_7, 2], # 7
|
173
|
+
[:_rule_8, 1], # 8
|
174
|
+
[:_rule_9, 1], # 9
|
168
175
|
[:_rule_10, 2], # 10
|
169
|
-
[:_rule_11,
|
170
|
-
[:_rule_12,
|
176
|
+
[:_rule_11, 2], # 11
|
177
|
+
[:_rule_12, 2], # 12
|
171
178
|
[:_rule_13, 1], # 13
|
172
|
-
[:_rule_14,
|
173
|
-
[:_rule_15,
|
179
|
+
[:_rule_14, 1], # 14
|
180
|
+
[:_rule_15, 1], # 15
|
174
181
|
[:_rule_16, 2], # 16
|
175
|
-
[:_rule_17,
|
176
|
-
[:_rule_18,
|
182
|
+
[:_rule_17, 2], # 17
|
183
|
+
[:_rule_18, 2], # 18
|
177
184
|
[:_rule_19, 1], # 19
|
178
185
|
[:_rule_20, 1], # 20
|
179
|
-
[:_rule_21,
|
186
|
+
[:_rule_21, 1], # 21
|
180
187
|
[:_rule_22, 1], # 22
|
181
|
-
[:_rule_23,
|
182
|
-
[:_rule_24,
|
188
|
+
[:_rule_23, 3], # 23
|
189
|
+
[:_rule_24, 1], # 24
|
183
190
|
[:_rule_25, 1], # 25
|
184
|
-
[:_rule_26,
|
191
|
+
[:_rule_26, 2], # 26
|
185
192
|
[:_rule_27, 1], # 27
|
186
193
|
[:_rule_28, 1], # 28
|
187
194
|
[:_rule_29, 1], # 29
|
188
195
|
[:_rule_30, 1], # 30
|
189
|
-
[:_rule_31,
|
190
|
-
[:_rule_32,
|
196
|
+
[:_rule_31, 1], # 31
|
197
|
+
[:_rule_32, 1], # 32
|
191
198
|
[:_rule_33, 2], # 33
|
192
199
|
[:_rule_34, 2], # 34
|
193
|
-
[:_rule_35,
|
194
|
-
[:_rule_36,
|
195
|
-
[:_rule_37,
|
200
|
+
[:_rule_35, 2], # 35
|
201
|
+
[:_rule_36, 2], # 36
|
202
|
+
[:_rule_37, 3], # 37
|
196
203
|
[:_rule_38, 1], # 38
|
197
204
|
[:_rule_39, 1], # 39
|
198
205
|
[:_rule_40, 1], # 40
|
199
206
|
[:_rule_41, 1], # 41
|
200
|
-
[:_rule_42,
|
201
|
-
[:_rule_43,
|
202
|
-
[:_rule_44,
|
203
|
-
[:_rule_45,
|
204
|
-
[:_rule_46,
|
207
|
+
[:_rule_42, 1], # 42
|
208
|
+
[:_rule_43, 1], # 43
|
209
|
+
[:_rule_44, 2], # 44
|
210
|
+
[:_rule_45, 3], # 45
|
211
|
+
[:_rule_46, 3], # 46
|
205
212
|
[:_rule_47, 1], # 47
|
206
213
|
[:_rule_48, 1], # 48
|
207
214
|
[:_rule_49, 1], # 49
|
208
215
|
[:_rule_50, 1], # 50
|
209
216
|
[:_rule_51, 1], # 51
|
210
217
|
[:_rule_52, 1], # 52
|
211
|
-
[:_rule_53,
|
218
|
+
[:_rule_53, 1], # 53
|
212
219
|
[:_rule_54, 1], # 54
|
213
220
|
[:_rule_55, 1], # 55
|
214
|
-
[:_rule_56,
|
221
|
+
[:_rule_56, 2], # 56
|
215
222
|
[:_rule_57, 1], # 57
|
216
223
|
[:_rule_58, 1], # 58
|
224
|
+
[:_rule_59, 1], # 59
|
225
|
+
[:_rule_60, 1], # 60
|
226
|
+
[:_rule_61, 1], # 61
|
217
227
|
].freeze
|
218
228
|
|
219
229
|
##
|
@@ -360,6 +370,16 @@ class Parser < LL::Driver
|
|
360
370
|
generate_nth_child('following-sibling', arg, current_element)
|
361
371
|
end
|
362
372
|
|
373
|
+
##
|
374
|
+
# Generates the AST for the `nth` pseudo class.
|
375
|
+
#
|
376
|
+
# @param [AST::Node] arg
|
377
|
+
# @return [AST::Node]
|
378
|
+
#
|
379
|
+
def on_pseudo_class_nth(arg)
|
380
|
+
s(:eq, s(:call, 'position'), arg)
|
381
|
+
end
|
382
|
+
|
363
383
|
##
|
364
384
|
# Generates the AST for the `:first-child` selector.
|
365
385
|
#
|
@@ -621,6 +641,22 @@ class Parser < LL::Driver
|
|
621
641
|
|
622
642
|
def _rule_2(val)
|
623
643
|
|
644
|
+
path = val[0]
|
645
|
+
|
646
|
+
val[1].each do |chunk|
|
647
|
+
path = s(:pipe, path, chunk)
|
648
|
+
end
|
649
|
+
|
650
|
+
path
|
651
|
+
|
652
|
+
end
|
653
|
+
|
654
|
+
def _rule_3(val)
|
655
|
+
val[1]
|
656
|
+
end
|
657
|
+
|
658
|
+
def _rule_4(val)
|
659
|
+
|
624
660
|
# Single selector
|
625
661
|
if val[1].empty?
|
626
662
|
ret = val[0]
|
@@ -650,45 +686,45 @@ class Parser < LL::Driver
|
|
650
686
|
|
651
687
|
end
|
652
688
|
|
653
|
-
def
|
689
|
+
def _rule_5(val)
|
654
690
|
val[1]
|
655
691
|
end
|
656
692
|
|
657
|
-
def
|
693
|
+
def _rule_6(val)
|
658
694
|
|
659
695
|
val[1] ? s(:predicate, val[0], val[1]) : val[0]
|
660
696
|
|
661
697
|
end
|
662
698
|
|
663
|
-
def
|
699
|
+
def _rule_7(val)
|
664
700
|
|
665
701
|
val[1] ? s(:predicate, val[0], val[1]) : val[0]
|
666
702
|
|
667
703
|
end
|
668
704
|
|
669
|
-
def
|
705
|
+
def _rule_8(val)
|
670
706
|
|
671
707
|
s(:predicate, s(:axis, 'descendant', on_test(nil, '*')), val[0])
|
672
708
|
|
673
709
|
end
|
674
710
|
|
675
|
-
def
|
711
|
+
def _rule_9(val)
|
676
712
|
s(:axis, 'descendant', val[0])
|
677
713
|
end
|
678
714
|
|
679
|
-
def
|
715
|
+
def _rule_10(val)
|
680
716
|
|
681
717
|
s(:axis, 'child', val[1])
|
682
718
|
|
683
719
|
end
|
684
720
|
|
685
|
-
def
|
721
|
+
def _rule_11(val)
|
686
722
|
|
687
723
|
s(:axis, 'following-sibling', val[1])
|
688
724
|
|
689
725
|
end
|
690
726
|
|
691
|
-
def
|
727
|
+
def _rule_12(val)
|
692
728
|
|
693
729
|
[
|
694
730
|
s(
|
@@ -701,27 +737,27 @@ class Parser < LL::Driver
|
|
701
737
|
|
702
738
|
end
|
703
739
|
|
704
|
-
def
|
740
|
+
def _rule_13(val)
|
705
741
|
val[0]
|
706
742
|
end
|
707
743
|
|
708
|
-
def
|
744
|
+
def _rule_14(val)
|
709
745
|
val[0]
|
710
746
|
end
|
711
747
|
|
712
|
-
def
|
748
|
+
def _rule_15(val)
|
713
749
|
on_test(*val[0])
|
714
750
|
end
|
715
751
|
|
716
|
-
def
|
752
|
+
def _rule_16(val)
|
717
753
|
val[1] ? [val[0], val[1]] : [nil, val[0]]
|
718
754
|
end
|
719
755
|
|
720
|
-
def
|
756
|
+
def _rule_17(val)
|
721
757
|
val[1]
|
722
758
|
end
|
723
759
|
|
724
|
-
def
|
760
|
+
def _rule_18(val)
|
725
761
|
|
726
762
|
ret = val[0]
|
727
763
|
|
@@ -733,35 +769,35 @@ class Parser < LL::Driver
|
|
733
769
|
|
734
770
|
end
|
735
771
|
|
736
|
-
def
|
772
|
+
def _rule_19(val)
|
737
773
|
val[0]
|
738
774
|
end
|
739
775
|
|
740
|
-
def
|
776
|
+
def _rule_20(val)
|
741
777
|
val[0]
|
742
778
|
end
|
743
779
|
|
744
|
-
def
|
780
|
+
def _rule_21(val)
|
745
781
|
val[0]
|
746
782
|
end
|
747
783
|
|
748
|
-
def
|
784
|
+
def _rule_22(val)
|
749
785
|
val[0]
|
750
786
|
end
|
751
787
|
|
752
|
-
def
|
788
|
+
def _rule_23(val)
|
753
789
|
val[1]
|
754
790
|
end
|
755
791
|
|
756
|
-
def
|
792
|
+
def _rule_24(val)
|
757
793
|
val[0]
|
758
794
|
end
|
759
795
|
|
760
|
-
def
|
796
|
+
def _rule_25(val)
|
761
797
|
s(:axis, 'attribute', on_test(*val[0]))
|
762
798
|
end
|
763
799
|
|
764
|
-
def
|
800
|
+
def _rule_26(val)
|
765
801
|
|
766
802
|
op_type = val[1] ? val[1][0] : nil
|
767
803
|
|
@@ -796,31 +832,31 @@ class Parser < LL::Driver
|
|
796
832
|
|
797
833
|
end
|
798
834
|
|
799
|
-
def
|
835
|
+
def _rule_27(val)
|
800
836
|
:eq
|
801
837
|
end
|
802
838
|
|
803
|
-
def
|
839
|
+
def _rule_28(val)
|
804
840
|
:space_in
|
805
841
|
end
|
806
842
|
|
807
|
-
def
|
843
|
+
def _rule_29(val)
|
808
844
|
:starts_with
|
809
845
|
end
|
810
846
|
|
811
|
-
def
|
847
|
+
def _rule_30(val)
|
812
848
|
:ends_with
|
813
849
|
end
|
814
850
|
|
815
|
-
def
|
851
|
+
def _rule_31(val)
|
816
852
|
:in
|
817
853
|
end
|
818
854
|
|
819
|
-
def
|
855
|
+
def _rule_32(val)
|
820
856
|
:hyphen_in
|
821
857
|
end
|
822
858
|
|
823
|
-
def
|
859
|
+
def _rule_33(val)
|
824
860
|
|
825
861
|
axis = s(:axis, 'attribute', s(:test, nil, 'class'))
|
826
862
|
|
@@ -833,7 +869,7 @@ class Parser < LL::Driver
|
|
833
869
|
|
834
870
|
end
|
835
871
|
|
836
|
-
def
|
872
|
+
def _rule_34(val)
|
837
873
|
|
838
874
|
s(
|
839
875
|
:eq,
|
@@ -843,55 +879,55 @@ class Parser < LL::Driver
|
|
843
879
|
|
844
880
|
end
|
845
881
|
|
846
|
-
def
|
882
|
+
def _rule_35(val)
|
847
883
|
on_pseudo_class(val[0], val[1])
|
848
884
|
end
|
849
885
|
|
850
|
-
def
|
886
|
+
def _rule_36(val)
|
851
887
|
val[1]
|
852
888
|
end
|
853
889
|
|
854
|
-
def
|
890
|
+
def _rule_37(val)
|
855
891
|
val[1]
|
856
892
|
end
|
857
893
|
|
858
|
-
def
|
894
|
+
def _rule_38(val)
|
859
895
|
val[0]
|
860
896
|
end
|
861
897
|
|
862
|
-
def
|
898
|
+
def _rule_39(val)
|
863
899
|
val[0]
|
864
900
|
end
|
865
901
|
|
866
|
-
def
|
902
|
+
def _rule_40(val)
|
867
903
|
val[0]
|
868
904
|
end
|
869
905
|
|
870
|
-
def
|
906
|
+
def _rule_41(val)
|
871
907
|
val[0]
|
872
908
|
end
|
873
909
|
|
874
|
-
def
|
910
|
+
def _rule_42(val)
|
875
911
|
s(:string, val[0])
|
876
912
|
end
|
877
913
|
|
878
|
-
def
|
914
|
+
def _rule_43(val)
|
879
915
|
s(:int, val[0].to_i)
|
880
916
|
end
|
881
917
|
|
882
|
-
def
|
918
|
+
def _rule_44(val)
|
883
919
|
|
884
920
|
val[1] ? s(:nth, s(:int, 1), val[1]) : s(:nth, s(:int, 1))
|
885
921
|
|
886
922
|
end
|
887
923
|
|
888
|
-
def
|
924
|
+
def _rule_45(val)
|
889
925
|
|
890
926
|
val[2] ? s(:nth, s(:int, -1), val[2]) : s(:nth, s(:int, 1))
|
891
927
|
|
892
928
|
end
|
893
929
|
|
894
|
-
def
|
930
|
+
def _rule_46(val)
|
895
931
|
|
896
932
|
# 2n+1
|
897
933
|
if val[1] and val[2]
|
@@ -916,24 +952,16 @@ class Parser < LL::Driver
|
|
916
952
|
|
917
953
|
end
|
918
954
|
|
919
|
-
def _rule_45(val)
|
920
|
-
:nth
|
921
|
-
end
|
922
|
-
|
923
|
-
def _rule_46(val)
|
924
|
-
s(:nth, s(:int, 2), s(:int, 1))
|
925
|
-
end
|
926
|
-
|
927
955
|
def _rule_47(val)
|
928
|
-
|
956
|
+
:nth
|
929
957
|
end
|
930
958
|
|
931
959
|
def _rule_48(val)
|
932
|
-
|
960
|
+
s(:nth, s(:int, 2), s(:int, 1))
|
933
961
|
end
|
934
962
|
|
935
963
|
def _rule_49(val)
|
936
|
-
|
964
|
+
s(:nth, s(:int, 2))
|
937
965
|
end
|
938
966
|
|
939
967
|
def _rule_50(val)
|
@@ -949,7 +977,7 @@ class Parser < LL::Driver
|
|
949
977
|
end
|
950
978
|
|
951
979
|
def _rule_53(val)
|
952
|
-
val
|
980
|
+
val[0]
|
953
981
|
end
|
954
982
|
|
955
983
|
def _rule_54(val)
|
@@ -961,7 +989,7 @@ class Parser < LL::Driver
|
|
961
989
|
end
|
962
990
|
|
963
991
|
def _rule_56(val)
|
964
|
-
val
|
992
|
+
val
|
965
993
|
end
|
966
994
|
|
967
995
|
def _rule_57(val)
|
@@ -971,6 +999,18 @@ class Parser < LL::Driver
|
|
971
999
|
def _rule_58(val)
|
972
1000
|
val[0]
|
973
1001
|
end
|
1002
|
+
|
1003
|
+
def _rule_59(val)
|
1004
|
+
val[0]
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
def _rule_60(val)
|
1008
|
+
val[0]
|
1009
|
+
end
|
1010
|
+
|
1011
|
+
def _rule_61(val)
|
1012
|
+
val[0]
|
1013
|
+
end
|
974
1014
|
end
|
975
1015
|
end
|
976
1016
|
end
|