oga 0.3.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +0 -1
- data/LICENSE +362 -19
- data/README.md +33 -18
- data/ext/c/lexer.c +71 -73
- data/ext/c/lexer.rl +0 -1
- data/ext/java/org/liboga/xml/Lexer.java +33 -35
- data/ext/java/org/liboga/xml/Lexer.rl +0 -1
- data/ext/ragel/base_lexer.rl +0 -1
- data/lib/oga/blacklist.rb +40 -0
- data/lib/oga/css/lexer.rb +47 -45
- data/lib/oga/css/parser.rb +3 -1
- data/lib/oga/lru.rb +2 -0
- data/lib/oga/version.rb +1 -1
- data/lib/oga/whitelist.rb +20 -0
- data/lib/oga/xml/document.rb +1 -1
- data/lib/oga/xml/element.rb +15 -13
- data/lib/oga/xml/entities.rb +1 -1
- data/lib/oga/xml/html_void_elements.rb +6 -21
- data/lib/oga/xml/lexer.rb +87 -19
- data/lib/oga/xml/parser.rb +51 -52
- data/lib/oga/xml/text.rb +1 -1
- data/lib/oga/xpath/evaluator.rb +30 -23
- data/lib/oga/xpath/lexer.rb +72 -70
- data/lib/oga/xpath/parser.rb +3 -1
- data/lib/oga.rb +2 -0
- data/oga.gemspec +1 -1
- metadata +6 -5
- data/doc/DCO.md +0 -25
data/lib/oga/css/parser.rb
CHANGED
@@ -15,6 +15,8 @@ module CSS
|
|
15
15
|
# Similar to {Oga::XPath::Parser} this parser only takes String instances as
|
16
16
|
# input.
|
17
17
|
#
|
18
|
+
# @api private
|
19
|
+
#
|
18
20
|
class Parser < LL::Driver
|
19
21
|
CONFIG = LL::DriverConfig.new
|
20
22
|
|
@@ -572,7 +574,7 @@ class Parser < LL::Driver
|
|
572
574
|
# @return [TrueClass|FalseClass]
|
573
575
|
#
|
574
576
|
def int_node?(node)
|
575
|
-
return node.type
|
577
|
+
return node.type.equal?(:int)
|
576
578
|
end
|
577
579
|
|
578
580
|
##
|
data/lib/oga/lru.rb
CHANGED
data/lib/oga/version.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Oga
|
2
|
+
##
|
3
|
+
# @api private
|
4
|
+
#
|
5
|
+
class Whitelist < Blacklist
|
6
|
+
##
|
7
|
+
# @return [TrueClass|FalseClass]
|
8
|
+
#
|
9
|
+
def allow?(name)
|
10
|
+
return names.include?(name)
|
11
|
+
end
|
12
|
+
|
13
|
+
##
|
14
|
+
# @return [Oga::Blacklist]
|
15
|
+
#
|
16
|
+
def to_blacklist
|
17
|
+
return Blacklist.new(names)
|
18
|
+
end
|
19
|
+
end # Whitelist
|
20
|
+
end # Oga
|
data/lib/oga/xml/document.rb
CHANGED
data/lib/oga/xml/element.rb
CHANGED
@@ -320,21 +320,23 @@ module Oga
|
|
320
320
|
#
|
321
321
|
def available_namespaces
|
322
322
|
# HTML(5) completely ignores namespaces
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
node.namespaces
|
331
|
-
|
323
|
+
unless @available_namespaces
|
324
|
+
if html?
|
325
|
+
@available_namespaces = {}
|
326
|
+
else
|
327
|
+
merged = namespaces.dup
|
328
|
+
node = parent
|
329
|
+
|
330
|
+
while node && node.respond_to?(:namespaces)
|
331
|
+
node.namespaces.each do |prefix, ns|
|
332
|
+
merged[prefix] = ns unless merged[prefix]
|
333
|
+
end
|
334
|
+
|
335
|
+
node = node.parent
|
332
336
|
end
|
333
337
|
|
334
|
-
|
338
|
+
@available_namespaces = merged
|
335
339
|
end
|
336
|
-
|
337
|
-
@available_namespaces = merged
|
338
340
|
end
|
339
341
|
|
340
342
|
return @available_namespaces
|
@@ -350,7 +352,7 @@ module Oga
|
|
350
352
|
root = root_node
|
351
353
|
|
352
354
|
if root.is_a?(Document) and root.html? \
|
353
|
-
and !HTML_VOID_ELEMENTS.
|
355
|
+
and !HTML_VOID_ELEMENTS.allow?(name)
|
354
356
|
self_closing = false
|
355
357
|
end
|
356
358
|
|
data/lib/oga/xml/entities.rb
CHANGED
@@ -4,27 +4,12 @@ module Oga
|
|
4
4
|
# Names of the HTML void elements that should be handled when HTML lexing
|
5
5
|
# is enabled.
|
6
6
|
#
|
7
|
-
# @
|
7
|
+
# @api private
|
8
|
+
# @return [Oga::Whitelist]
|
8
9
|
#
|
9
|
-
HTML_VOID_ELEMENTS =
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
'col',
|
14
|
-
'command',
|
15
|
-
'embed',
|
16
|
-
'hr',
|
17
|
-
'img',
|
18
|
-
'input',
|
19
|
-
'keygen',
|
20
|
-
'link',
|
21
|
-
'meta',
|
22
|
-
'param',
|
23
|
-
'source',
|
24
|
-
'track',
|
25
|
-
'wbr'
|
26
|
-
])
|
27
|
-
|
28
|
-
HTML_VOID_ELEMENTS.merge(HTML_VOID_ELEMENTS.map { |name| name.upcase })
|
10
|
+
HTML_VOID_ELEMENTS = Whitelist.new(%w{
|
11
|
+
area base br col command embed hr img input keygen link meta param source
|
12
|
+
track wbr
|
13
|
+
})
|
29
14
|
end # XML
|
30
15
|
end # Oga
|
data/lib/oga/xml/lexer.rb
CHANGED
@@ -40,18 +40,53 @@ module Oga
|
|
40
40
|
class Lexer
|
41
41
|
attr_reader :html
|
42
42
|
|
43
|
-
#
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
# These are all constant/frozen to remove the need for String allocations
|
44
|
+
# every time they are referenced in the lexer.
|
45
|
+
HTML_SCRIPT = 'script'.freeze
|
46
|
+
HTML_STYLE = 'style'.freeze
|
47
|
+
|
48
|
+
# Elements that are allowed directly in a <table> element.
|
49
|
+
HTML_TABLE_ALLOWED = Whitelist.new(
|
50
|
+
%w{thead tbody tfoot tr caption colgroup col}
|
51
|
+
)
|
52
|
+
|
53
|
+
# Elements that should be closed automatically before a new opening tag is
|
54
|
+
# processed.
|
55
|
+
HTML_CLOSE_SELF = {
|
56
|
+
'head' => Blacklist.new(%w{head body}),
|
57
|
+
'body' => Blacklist.new(%w{head body}),
|
58
|
+
'li' => Blacklist.new(%w{li}),
|
59
|
+
'dt' => Blacklist.new(%w{dt dd}),
|
60
|
+
'dd' => Blacklist.new(%w{dt dd}),
|
61
|
+
'p' => Blacklist.new(%w{
|
62
|
+
address article aside blockquote div dl fieldset footer form h1 h2 h3
|
63
|
+
h4 h5 h6 header hgroup hr main nav ol p pre section table ul
|
64
|
+
}),
|
65
|
+
'rb' => Blacklist.new(%w{rb rt rtc rp}),
|
66
|
+
'rt' => Blacklist.new(%w{rb rt rtc rp}),
|
67
|
+
'rtc' => Blacklist.new(%w{rb rtc}),
|
68
|
+
'rp' => Blacklist.new(%w{rb rt rtc rp}),
|
69
|
+
'optgroup' => Blacklist.new(%w{optgroup}),
|
70
|
+
'option' => Blacklist.new(%w{optgroup option}),
|
71
|
+
'colgroup' => Whitelist.new(%w{col template}),
|
72
|
+
'caption' => HTML_TABLE_ALLOWED.to_blacklist,
|
73
|
+
'table' => HTML_TABLE_ALLOWED,
|
74
|
+
'thead' => Whitelist.new(%w{tr}),
|
75
|
+
'tbody' => Whitelist.new(%w{tr}),
|
76
|
+
'tfoot' => Whitelist.new(%w{tr}),
|
77
|
+
'tr' => Whitelist.new(%w{td th}),
|
78
|
+
'td' => Blacklist.new(%w{td th}) + HTML_TABLE_ALLOWED,
|
79
|
+
'th' => Blacklist.new(%w{td th}) + HTML_TABLE_ALLOWED
|
80
|
+
}
|
81
|
+
|
82
|
+
HTML_CLOSE_SELF.keys.each do |key|
|
83
|
+
HTML_CLOSE_SELF[key.upcase] = HTML_CLOSE_SELF[key]
|
84
|
+
end
|
48
85
|
|
49
86
|
##
|
50
87
|
# Names of HTML tags of which the content should be lexed as-is.
|
51
88
|
#
|
52
|
-
|
53
|
-
#
|
54
|
-
LITERAL_HTML_ELEMENTS = [HTML_SCRIPT, HTML_STYLE]
|
89
|
+
LITERAL_HTML_ELEMENTS = Whitelist.new([HTML_SCRIPT, HTML_STYLE])
|
55
90
|
|
56
91
|
##
|
57
92
|
# @param [String|IO] data The data to lex. This can either be a String or
|
@@ -151,6 +186,11 @@ module Oga
|
|
151
186
|
read_data do |chunk|
|
152
187
|
advance_native(chunk)
|
153
188
|
end
|
189
|
+
|
190
|
+
# Add any missing closing tags
|
191
|
+
unless @elements.empty?
|
192
|
+
@elements.length.times { on_element_end }
|
193
|
+
end
|
154
194
|
ensure
|
155
195
|
@block = nil
|
156
196
|
end
|
@@ -332,13 +372,6 @@ module Oga
|
|
332
372
|
add_token(:T_XML_DECL_END)
|
333
373
|
end
|
334
374
|
|
335
|
-
##
|
336
|
-
# Called on the start of an element.
|
337
|
-
#
|
338
|
-
def on_element_start
|
339
|
-
add_token(:T_ELEM_START)
|
340
|
-
end
|
341
|
-
|
342
375
|
##
|
343
376
|
# Called on the start of a processing instruction.
|
344
377
|
#
|
@@ -377,7 +410,40 @@ module Oga
|
|
377
410
|
# @param [String] name The name of the element, including namespace.
|
378
411
|
#
|
379
412
|
def on_element_name(name)
|
380
|
-
|
413
|
+
before_html_element_name(name) if html?
|
414
|
+
|
415
|
+
add_element(name)
|
416
|
+
end
|
417
|
+
|
418
|
+
##
|
419
|
+
# Handles inserting of any missing tags whenever a new HTML tag is opened.
|
420
|
+
#
|
421
|
+
# @param [String] name
|
422
|
+
#
|
423
|
+
def before_html_element_name(name)
|
424
|
+
close_current = HTML_CLOSE_SELF[current_element]
|
425
|
+
|
426
|
+
if close_current and !close_current.allow?(name)
|
427
|
+
on_element_end
|
428
|
+
end
|
429
|
+
|
430
|
+
# Close remaining parent elements. This for example ensures that a
|
431
|
+
# "<tbody>" not only closes an unclosed "<th>" but also the surrounding,
|
432
|
+
# unclosed "<tr>".
|
433
|
+
while close_current = HTML_CLOSE_SELF[current_element]
|
434
|
+
if close_current.allow?(name)
|
435
|
+
break
|
436
|
+
else
|
437
|
+
on_element_end
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
442
|
+
##
|
443
|
+
# @param [String] name
|
444
|
+
#
|
445
|
+
def add_element(name)
|
446
|
+
@elements << name
|
381
447
|
|
382
448
|
add_token(:T_ELEM_NAME, name)
|
383
449
|
end
|
@@ -399,8 +465,8 @@ module Oga
|
|
399
465
|
|
400
466
|
# Only downcase the name if we can't find an all lower/upper version of
|
401
467
|
# the element name. This can save us a *lot* of String allocations.
|
402
|
-
if HTML_VOID_ELEMENTS.
|
403
|
-
or HTML_VOID_ELEMENTS.
|
468
|
+
if HTML_VOID_ELEMENTS.allow?(current_element) \
|
469
|
+
or HTML_VOID_ELEMENTS.allow?(current_element.downcase)
|
404
470
|
add_token(:T_ELEM_END)
|
405
471
|
@elements.pop
|
406
472
|
end
|
@@ -410,9 +476,11 @@ module Oga
|
|
410
476
|
# Called on the closing tag of an element.
|
411
477
|
#
|
412
478
|
def on_element_end
|
479
|
+
return if @elements.empty?
|
480
|
+
|
413
481
|
add_token(:T_ELEM_END)
|
414
482
|
|
415
|
-
@elements.pop
|
483
|
+
@elements.pop
|
416
484
|
end
|
417
485
|
|
418
486
|
##
|
data/lib/oga/xml/parser.rb
CHANGED
@@ -43,18 +43,17 @@ class Parser < LL::Driver
|
|
43
43
|
:T_CDATA_START, # 13
|
44
44
|
:T_CDATA_BODY, # 14
|
45
45
|
:T_CDATA_END, # 15
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:T_PROC_INS_END, # 27
|
46
|
+
:T_ELEM_NAME, # 16
|
47
|
+
:T_ELEM_NS, # 17
|
48
|
+
:T_ELEM_END, # 18
|
49
|
+
:T_ATTR, # 19
|
50
|
+
:T_ATTR_NS, # 20
|
51
|
+
:T_XML_DECL_START, # 21
|
52
|
+
:T_XML_DECL_END, # 22
|
53
|
+
:T_PROC_INS_START, # 23
|
54
|
+
:T_PROC_INS_NAME, # 24
|
55
|
+
:T_PROC_INS_BODY, # 25
|
56
|
+
:T_PROC_INS_END, # 26
|
58
57
|
].freeze
|
59
58
|
|
60
59
|
CONFIG.rules = [
|
@@ -80,17 +79,17 @@ class Parser < LL::Driver
|
|
80
79
|
[3, 19, 1, 12, 0, 10, 1, 10], # 19
|
81
80
|
[3, 20, 0, 10, 1, 11], # 20
|
82
81
|
[3, 21, 2, 0], # 21
|
83
|
-
[3, 22, 1,
|
84
|
-
[3, 23, 0, 12, 1,
|
82
|
+
[3, 22, 1, 26, 0, 12, 1, 24, 1, 23], # 22
|
83
|
+
[3, 23, 0, 12, 1, 25], # 23
|
85
84
|
[3, 24, 2, 0], # 24
|
86
|
-
[3, 25, 1,
|
87
|
-
[3, 26, 1,
|
88
|
-
[3, 27, 0, 16, 0, 13
|
89
|
-
[3, 28, 1,
|
85
|
+
[3, 25, 1, 16], # 25
|
86
|
+
[3, 26, 1, 16, 1, 17], # 26
|
87
|
+
[3, 27, 0, 16, 0, 13], # 27
|
88
|
+
[3, 28, 1, 18, 0, 1, 0, 14], # 28
|
90
89
|
[3, 29, 4, 26, 6, 0], # 29
|
91
|
-
[3, 30, 8, 27, 1,
|
92
|
-
[3, 31, 8, 28, 1,
|
93
|
-
[3, 32, 1,
|
90
|
+
[3, 30, 8, 27, 1, 19, 1, 20], # 30
|
91
|
+
[3, 31, 8, 28, 1, 19], # 31
|
92
|
+
[3, 32, 1, 22, 0, 16, 1, 21], # 32
|
94
93
|
[3, 33, 0, 20, 1, 1], # 33
|
95
94
|
[3, 34, 0, 20, 1, 1], # 34
|
96
95
|
[3, 35, 2, 0], # 35
|
@@ -107,35 +106,35 @@ class Parser < LL::Driver
|
|
107
106
|
].freeze
|
108
107
|
|
109
108
|
CONFIG.table = [
|
110
|
-
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
111
|
-
[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, 1
|
112
|
-
[-1, 6, -1, -1, -1, 2, -1, -1, -1, -1, 4, -1, -1, 3, -1, -1, 7,
|
113
|
-
[-1, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
114
|
-
[12, 12, 12, 12, 12, 12, 10, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
|
115
|
-
[13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13
|
116
|
-
[-1, -1, 14, 14, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
117
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
118
|
-
[18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18
|
119
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
120
|
-
[21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21
|
121
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
122
|
-
[24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
123
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
124
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 27,
|
125
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28,
|
126
|
-
[29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
|
127
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
128
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
129
|
-
[-1, 33, -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
|
130
|
-
[35, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35
|
131
|
-
[-1, -1, 37, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
132
|
-
[39, 39, 39, 39, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39
|
133
|
-
[-1, 40, -1, -1, -1, 40, -1, -1, -1, -1, 40, -1, -1, 40, -1, -1, 40,
|
134
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
135
|
-
[-1, -1, 42, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
136
|
-
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
137
|
-
[-1, -1, 44, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
138
|
-
[-1, -1, 45, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
109
|
+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], # 0
|
110
|
+
[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, 1], # 1
|
111
|
+
[-1, 6, -1, -1, -1, 2, -1, -1, -1, -1, 4, -1, -1, 3, -1, -1, 7, 7, -1, -1, -1, 8, -1, 5, -1, -1, -1], # 2
|
112
|
+
[-1, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 3
|
113
|
+
[12, 12, 12, 12, 12, 12, 10, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], # 4
|
114
|
+
[13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13], # 5
|
115
|
+
[-1, -1, 14, 14, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 6
|
116
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 7
|
117
|
+
[18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18], # 8
|
118
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 9
|
119
|
+
[21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21], # 10
|
120
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1], # 11
|
121
|
+
[24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 23, 24], # 12
|
122
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 13
|
123
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 27, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 14
|
124
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 15
|
125
|
+
[29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29], # 16
|
126
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, 30, -1, -1, -1, -1, -1, -1], # 17
|
127
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1], # 18
|
128
|
+
[-1, 33, -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], # 19
|
129
|
+
[35, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35], # 20
|
130
|
+
[-1, -1, 37, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 21
|
131
|
+
[39, 39, 39, 39, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39], # 22
|
132
|
+
[-1, 40, -1, -1, -1, 40, -1, -1, -1, -1, 40, -1, -1, 40, -1, -1, 40, 40, -1, -1, -1, 40, -1, 40, -1, -1, -1], # 23
|
133
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 24
|
134
|
+
[-1, -1, 42, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 25
|
135
|
+
[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, 43, -1, -1, -1, -1, -1, -1], # 26
|
136
|
+
[-1, -1, 44, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 27
|
137
|
+
[-1, -1, 45, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], # 28
|
139
138
|
].freeze
|
140
139
|
|
141
140
|
CONFIG.actions = [
|
@@ -166,7 +165,7 @@ class Parser < LL::Driver
|
|
166
165
|
[:_rule_24, 0], # 24
|
167
166
|
[:_rule_25, 1], # 25
|
168
167
|
[:_rule_26, 2], # 26
|
169
|
-
[:_rule_27,
|
168
|
+
[:_rule_27, 2], # 27
|
170
169
|
[:_rule_28, 3], # 28
|
171
170
|
[:_rule_29, 1], # 29
|
172
171
|
[:_rule_30, 3], # 30
|
@@ -542,7 +541,7 @@ class Parser < LL::Driver
|
|
542
541
|
|
543
542
|
def _rule_27(val)
|
544
543
|
|
545
|
-
on_element(val[
|
544
|
+
on_element(val[0][0], val[0][1], val[1])
|
546
545
|
|
547
546
|
end
|
548
547
|
|