nokogiri 1.10.10 → 1.14.3-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (251) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +44 -0
  3. data/LICENSE-DEPENDENCIES.md +1632 -1022
  4. data/LICENSE.md +1 -1
  5. data/README.md +185 -96
  6. data/bin/nokogiri +63 -50
  7. data/dependencies.yml +33 -66
  8. data/ext/nokogiri/depend +38 -358
  9. data/ext/nokogiri/extconf.rb +819 -421
  10. data/ext/nokogiri/gumbo.c +594 -0
  11. data/ext/nokogiri/html4_document.c +166 -0
  12. data/ext/nokogiri/html4_element_description.c +294 -0
  13. data/ext/nokogiri/html4_entity_lookup.c +37 -0
  14. data/ext/nokogiri/html4_sax_parser_context.c +114 -0
  15. data/ext/nokogiri/html4_sax_push_parser.c +95 -0
  16. data/ext/nokogiri/include/libexslt/exslt.h +108 -0
  17. data/ext/nokogiri/include/libexslt/exsltconfig.h +70 -0
  18. data/ext/nokogiri/include/libexslt/exsltexports.h +63 -0
  19. data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +306 -0
  20. data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +147 -0
  21. data/ext/nokogiri/include/libxml2/libxml/SAX.h +204 -0
  22. data/ext/nokogiri/include/libxml2/libxml/SAX2.h +172 -0
  23. data/ext/nokogiri/include/libxml2/libxml/c14n.h +128 -0
  24. data/ext/nokogiri/include/libxml2/libxml/catalog.h +182 -0
  25. data/ext/nokogiri/include/libxml2/libxml/chvalid.h +230 -0
  26. data/ext/nokogiri/include/libxml2/libxml/debugXML.h +217 -0
  27. data/ext/nokogiri/include/libxml2/libxml/dict.h +81 -0
  28. data/ext/nokogiri/include/libxml2/libxml/encoding.h +232 -0
  29. data/ext/nokogiri/include/libxml2/libxml/entities.h +153 -0
  30. data/ext/nokogiri/include/libxml2/libxml/globals.h +499 -0
  31. data/ext/nokogiri/include/libxml2/libxml/hash.h +236 -0
  32. data/ext/nokogiri/include/libxml2/libxml/list.h +137 -0
  33. data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +186 -0
  34. data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +81 -0
  35. data/ext/nokogiri/include/libxml2/libxml/parser.h +1244 -0
  36. data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +656 -0
  37. data/ext/nokogiri/include/libxml2/libxml/pattern.h +100 -0
  38. data/ext/nokogiri/include/libxml2/libxml/relaxng.h +218 -0
  39. data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +958 -0
  40. data/ext/nokogiri/include/libxml2/libxml/schematron.h +142 -0
  41. data/ext/nokogiri/include/libxml2/libxml/threads.h +91 -0
  42. data/ext/nokogiri/include/libxml2/libxml/tree.h +1312 -0
  43. data/ext/nokogiri/include/libxml2/libxml/uri.h +94 -0
  44. data/ext/nokogiri/include/libxml2/libxml/valid.h +463 -0
  45. data/ext/nokogiri/include/libxml2/libxml/xinclude.h +129 -0
  46. data/ext/nokogiri/include/libxml2/libxml/xlink.h +189 -0
  47. data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +368 -0
  48. data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
  49. data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +947 -0
  50. data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +77 -0
  51. data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +226 -0
  52. data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +57 -0
  53. data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +428 -0
  54. data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +222 -0
  55. data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +88 -0
  56. data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +246 -0
  57. data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +152 -0
  58. data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +140 -0
  59. data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +202 -0
  60. data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +503 -0
  61. data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +488 -0
  62. data/ext/nokogiri/include/libxml2/libxml/xpath.h +575 -0
  63. data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +632 -0
  64. data/ext/nokogiri/include/libxml2/libxml/xpointer.h +137 -0
  65. data/ext/nokogiri/include/libxslt/attributes.h +38 -0
  66. data/ext/nokogiri/include/libxslt/documents.h +93 -0
  67. data/ext/nokogiri/include/libxslt/extensions.h +262 -0
  68. data/ext/nokogiri/include/libxslt/extra.h +72 -0
  69. data/ext/nokogiri/include/libxslt/functions.h +78 -0
  70. data/ext/nokogiri/include/libxslt/imports.h +75 -0
  71. data/ext/nokogiri/include/libxslt/keys.h +53 -0
  72. data/ext/nokogiri/include/libxslt/namespaces.h +68 -0
  73. data/ext/nokogiri/include/libxslt/numbersInternals.h +73 -0
  74. data/ext/nokogiri/include/libxslt/pattern.h +84 -0
  75. data/ext/nokogiri/include/libxslt/preproc.h +43 -0
  76. data/ext/nokogiri/include/libxslt/security.h +104 -0
  77. data/ext/nokogiri/include/libxslt/templates.h +77 -0
  78. data/ext/nokogiri/include/libxslt/transform.h +207 -0
  79. data/ext/nokogiri/include/libxslt/variables.h +118 -0
  80. data/ext/nokogiri/include/libxslt/xslt.h +110 -0
  81. data/ext/nokogiri/include/libxslt/xsltInternals.h +1982 -0
  82. data/ext/nokogiri/include/libxslt/xsltconfig.h +179 -0
  83. data/ext/nokogiri/include/libxslt/xsltexports.h +64 -0
  84. data/ext/nokogiri/include/libxslt/xsltlocale.h +76 -0
  85. data/ext/nokogiri/include/libxslt/xsltutils.h +310 -0
  86. data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
  87. data/ext/nokogiri/nokogiri.c +228 -104
  88. data/ext/nokogiri/nokogiri.h +204 -90
  89. data/ext/nokogiri/test_global_handlers.c +40 -0
  90. data/ext/nokogiri/xml_attr.c +17 -17
  91. data/ext/nokogiri/xml_attribute_decl.c +22 -22
  92. data/ext/nokogiri/xml_cdata.c +15 -20
  93. data/ext/nokogiri/xml_comment.c +19 -26
  94. data/ext/nokogiri/xml_document.c +306 -225
  95. data/ext/nokogiri/xml_document_fragment.c +12 -16
  96. data/ext/nokogiri/xml_dtd.c +64 -58
  97. data/ext/nokogiri/xml_element_content.c +33 -28
  98. data/ext/nokogiri/xml_element_decl.c +26 -26
  99. data/ext/nokogiri/xml_encoding_handler.c +45 -20
  100. data/ext/nokogiri/xml_entity_decl.c +37 -35
  101. data/ext/nokogiri/xml_entity_reference.c +16 -18
  102. data/ext/nokogiri/xml_namespace.c +136 -61
  103. data/ext/nokogiri/xml_node.c +1344 -672
  104. data/ext/nokogiri/xml_node_set.c +178 -168
  105. data/ext/nokogiri/xml_processing_instruction.c +17 -19
  106. data/ext/nokogiri/xml_reader.c +316 -190
  107. data/ext/nokogiri/xml_relax_ng.c +52 -30
  108. data/ext/nokogiri/xml_sax_parser.c +130 -124
  109. data/ext/nokogiri/xml_sax_parser_context.c +110 -89
  110. data/ext/nokogiri/xml_sax_push_parser.c +36 -29
  111. data/ext/nokogiri/xml_schema.c +98 -50
  112. data/ext/nokogiri/xml_syntax_error.c +42 -21
  113. data/ext/nokogiri/xml_text.c +14 -18
  114. data/ext/nokogiri/xml_xpath_context.c +263 -148
  115. data/ext/nokogiri/xslt_stylesheet.c +271 -178
  116. data/gumbo-parser/CHANGES.md +63 -0
  117. data/gumbo-parser/Makefile +111 -0
  118. data/gumbo-parser/THANKS +27 -0
  119. data/lib/nokogiri/2.7/nokogiri.so +0 -0
  120. data/lib/nokogiri/3.0/nokogiri.so +0 -0
  121. data/lib/nokogiri/3.1/nokogiri.so +0 -0
  122. data/lib/nokogiri/3.2/nokogiri.so +0 -0
  123. data/lib/nokogiri/class_resolver.rb +67 -0
  124. data/lib/nokogiri/css/node.rb +10 -8
  125. data/lib/nokogiri/css/parser.rb +397 -377
  126. data/lib/nokogiri/css/parser.y +250 -245
  127. data/lib/nokogiri/css/parser_extras.rb +54 -49
  128. data/lib/nokogiri/css/syntax_error.rb +3 -1
  129. data/lib/nokogiri/css/tokenizer.rb +5 -3
  130. data/lib/nokogiri/css/tokenizer.rex +3 -2
  131. data/lib/nokogiri/css/xpath_visitor.rb +223 -94
  132. data/lib/nokogiri/css.rb +56 -17
  133. data/lib/nokogiri/decorators/slop.rb +9 -7
  134. data/lib/nokogiri/encoding_handler.rb +57 -0
  135. data/lib/nokogiri/extension.rb +32 -0
  136. data/lib/nokogiri/gumbo.rb +15 -0
  137. data/lib/nokogiri/html.rb +38 -27
  138. data/lib/nokogiri/{html → html4}/builder.rb +4 -2
  139. data/lib/nokogiri/html4/document.rb +214 -0
  140. data/lib/nokogiri/html4/document_fragment.rb +54 -0
  141. data/lib/nokogiri/{html → html4}/element_description.rb +3 -1
  142. data/lib/nokogiri/html4/element_description_defaults.rb +572 -0
  143. data/lib/nokogiri/html4/encoding_reader.rb +121 -0
  144. data/lib/nokogiri/{html → html4}/entity_lookup.rb +4 -2
  145. data/lib/nokogiri/{html → html4}/sax/parser.rb +17 -16
  146. data/lib/nokogiri/html4/sax/parser_context.rb +20 -0
  147. data/lib/nokogiri/{html → html4}/sax/push_parser.rb +12 -11
  148. data/lib/nokogiri/html4.rb +47 -0
  149. data/lib/nokogiri/html5/document.rb +168 -0
  150. data/lib/nokogiri/html5/document_fragment.rb +90 -0
  151. data/lib/nokogiri/html5/node.rb +98 -0
  152. data/lib/nokogiri/html5.rb +389 -0
  153. data/lib/nokogiri/jruby/dependencies.rb +3 -0
  154. data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
  155. data/lib/nokogiri/syntax_error.rb +2 -0
  156. data/lib/nokogiri/version/constant.rb +6 -0
  157. data/lib/nokogiri/version/info.rb +223 -0
  158. data/lib/nokogiri/version.rb +3 -108
  159. data/lib/nokogiri/xml/attr.rb +55 -3
  160. data/lib/nokogiri/xml/attribute_decl.rb +3 -1
  161. data/lib/nokogiri/xml/builder.rb +75 -34
  162. data/lib/nokogiri/xml/cdata.rb +3 -1
  163. data/lib/nokogiri/xml/character_data.rb +2 -0
  164. data/lib/nokogiri/xml/document.rb +312 -126
  165. data/lib/nokogiri/xml/document_fragment.rb +93 -48
  166. data/lib/nokogiri/xml/dtd.rb +4 -2
  167. data/lib/nokogiri/xml/element_content.rb +2 -0
  168. data/lib/nokogiri/xml/element_decl.rb +3 -1
  169. data/lib/nokogiri/xml/entity_decl.rb +4 -2
  170. data/lib/nokogiri/xml/entity_reference.rb +2 -0
  171. data/lib/nokogiri/xml/namespace.rb +45 -0
  172. data/lib/nokogiri/xml/node/save_options.rb +15 -8
  173. data/lib/nokogiri/xml/node.rb +1067 -406
  174. data/lib/nokogiri/xml/node_set.rb +135 -59
  175. data/lib/nokogiri/xml/notation.rb +13 -0
  176. data/lib/nokogiri/xml/parse_options.rb +145 -52
  177. data/lib/nokogiri/xml/pp/character_data.rb +9 -6
  178. data/lib/nokogiri/xml/pp/node.rb +27 -26
  179. data/lib/nokogiri/xml/pp.rb +4 -2
  180. data/lib/nokogiri/xml/processing_instruction.rb +4 -1
  181. data/lib/nokogiri/xml/reader.rb +21 -28
  182. data/lib/nokogiri/xml/relax_ng.rb +8 -2
  183. data/lib/nokogiri/xml/sax/document.rb +45 -49
  184. data/lib/nokogiri/xml/sax/parser.rb +39 -36
  185. data/lib/nokogiri/xml/sax/parser_context.rb +8 -3
  186. data/lib/nokogiri/xml/sax/push_parser.rb +6 -5
  187. data/lib/nokogiri/xml/sax.rb +6 -4
  188. data/lib/nokogiri/xml/schema.rb +19 -9
  189. data/lib/nokogiri/xml/searchable.rb +112 -72
  190. data/lib/nokogiri/xml/syntax_error.rb +6 -4
  191. data/lib/nokogiri/xml/text.rb +2 -0
  192. data/lib/nokogiri/xml/xpath/syntax_error.rb +4 -2
  193. data/lib/nokogiri/xml/xpath.rb +15 -4
  194. data/lib/nokogiri/xml/xpath_context.rb +3 -3
  195. data/lib/nokogiri/xml.rb +38 -37
  196. data/lib/nokogiri/xslt/stylesheet.rb +3 -1
  197. data/lib/nokogiri/xslt.rb +29 -20
  198. data/lib/nokogiri.rb +48 -72
  199. data/lib/xsd/xmlparser/nokogiri.rb +29 -25
  200. metadata +146 -307
  201. data/ext/nokogiri/html_document.c +0 -170
  202. data/ext/nokogiri/html_document.h +0 -10
  203. data/ext/nokogiri/html_element_description.c +0 -279
  204. data/ext/nokogiri/html_element_description.h +0 -10
  205. data/ext/nokogiri/html_entity_lookup.c +0 -32
  206. data/ext/nokogiri/html_entity_lookup.h +0 -8
  207. data/ext/nokogiri/html_sax_parser_context.c +0 -116
  208. data/ext/nokogiri/html_sax_parser_context.h +0 -11
  209. data/ext/nokogiri/html_sax_push_parser.c +0 -87
  210. data/ext/nokogiri/html_sax_push_parser.h +0 -9
  211. data/ext/nokogiri/xml_attr.h +0 -9
  212. data/ext/nokogiri/xml_attribute_decl.h +0 -9
  213. data/ext/nokogiri/xml_cdata.h +0 -9
  214. data/ext/nokogiri/xml_comment.h +0 -9
  215. data/ext/nokogiri/xml_document.h +0 -23
  216. data/ext/nokogiri/xml_document_fragment.h +0 -10
  217. data/ext/nokogiri/xml_dtd.h +0 -10
  218. data/ext/nokogiri/xml_element_content.h +0 -10
  219. data/ext/nokogiri/xml_element_decl.h +0 -9
  220. data/ext/nokogiri/xml_encoding_handler.h +0 -8
  221. data/ext/nokogiri/xml_entity_decl.h +0 -10
  222. data/ext/nokogiri/xml_entity_reference.h +0 -9
  223. data/ext/nokogiri/xml_io.c +0 -61
  224. data/ext/nokogiri/xml_io.h +0 -11
  225. data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
  226. data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
  227. data/ext/nokogiri/xml_namespace.h +0 -14
  228. data/ext/nokogiri/xml_node.h +0 -13
  229. data/ext/nokogiri/xml_node_set.h +0 -12
  230. data/ext/nokogiri/xml_processing_instruction.h +0 -9
  231. data/ext/nokogiri/xml_reader.h +0 -10
  232. data/ext/nokogiri/xml_relax_ng.h +0 -9
  233. data/ext/nokogiri/xml_sax_parser.h +0 -39
  234. data/ext/nokogiri/xml_sax_parser_context.h +0 -10
  235. data/ext/nokogiri/xml_sax_push_parser.h +0 -9
  236. data/ext/nokogiri/xml_schema.h +0 -9
  237. data/ext/nokogiri/xml_syntax_error.h +0 -13
  238. data/ext/nokogiri/xml_text.h +0 -9
  239. data/ext/nokogiri/xml_xpath_context.h +0 -10
  240. data/ext/nokogiri/xslt_stylesheet.h +0 -14
  241. data/lib/nokogiri/html/document.rb +0 -335
  242. data/lib/nokogiri/html/document_fragment.rb +0 -49
  243. data/lib/nokogiri/html/element_description_defaults.rb +0 -671
  244. data/lib/nokogiri/html/sax/parser_context.rb +0 -16
  245. data/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch +0 -78
  246. data/patches/libxml2/0002-Remove-script-macro-support.patch +0 -40
  247. data/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch +0 -44
  248. data/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch +0 -25
  249. data/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch +0 -32
  250. data/ports/archives/libxml2-2.9.10.tar.gz +0 -0
  251. data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
@@ -1,13 +1,22 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.14
4
- # from Racc grammer file "".
4
+ # This file is automatically generated by Racc 1.6.0
5
+ # from Racc grammar file "".
5
6
  #
6
7
 
7
8
  require 'racc/parser.rb'
8
9
 
9
10
 
10
- require 'nokogiri/css/parser_extras'
11
+ require_relative "parser_extras"
12
+
13
+ module Nokogiri
14
+ module CSS
15
+ # :nodoc: all
16
+ class Parser < Racc::Parser
17
+ end
18
+ end
19
+ end
11
20
 
12
21
  module Nokogiri
13
22
  module CSS
@@ -30,190 +39,204 @@ end
30
39
  ##### State transition tables begin ###
31
40
 
32
41
  racc_action_table = [
33
- 24, 93, 56, 57, 33, 55, 94, 23, 24, 22,
34
- 12, 93, 33, 27, 35, 52, 44, 22, -23, 25,
35
- 45, 98, 23, 33, 26, 18, 20, 25, 27, -23,
36
- 23, 24, 26, 18, 20, 33, 27, 11, 39, 24,
37
- 22, 23, 74, 33, 18, 91, 90, 27, 22, 12,
38
- 25, 24, -23, 23, 85, 26, 18, 20, 25, 27,
39
- 66, 23, 24, 26, 18, 20, 33, 27, 86, 88,
40
- 51, 22, 89, 92, 24, 26, 56, 87, 95, 60,
41
- 90, 25, 96, 46, 23, 49, 26, 18, 20, 99,
42
- 27, 33, 33, 51, 103, 104, 56, 58, 26, 60,
43
- 93, 106, 33, 33, 33, 109, 39, 39, 110, 23,
44
- 23, nil, 18, 18, 20, 27, 27, 39, 39, 39,
45
- 23, 23, 23, 18, 18, 18, 27, 27, 27, 33,
46
- 33, 101, 100, nil, 102, 22, 56, 87, nil, 60,
47
- 33, nil, nil, nil, 39, 39, nil, 23, 23, nil,
48
- 18, 18, 20, 27, 27, 39, 82, 83, 23, 56,
49
- 87, 18, 60, nil, 27, 82, 83, 78, 79, 80,
50
- nil, 81, nil, nil, nil, 77, 78, 79, 80, nil,
51
- 81, 4, 5, 10, 77, 4, 5, 43, nil, 56,
52
- 87, 6, 60, 8, 7, 6, nil, 8, 7, 4,
53
- 5, 10, nil, nil, nil, nil, nil, nil, nil, 6,
54
- nil, 8, 7 ]
42
+ 27, 11, 38, 99, 36, 12, 40, 26, 48, 25,
43
+ 49, 27, 100, 12, 30, 36, 105, 99, -26, 28,
44
+ 25, -26, 26, 27, 29, 14, 21, 23, 80, 30,
45
+ 28, 36, 72, 26, -26, 29, 14, 21, 23, 27,
46
+ 30, 91, 56, 36, 97, 96, 43, 29, 25, 26,
47
+ 27, 92, 94, 21, 36, 95, 30, 98, 28, 25,
48
+ 101, 26, 102, 29, 14, 21, 23, 96, 30, 28,
49
+ 36, 36, 26, 103, 29, 14, 21, 23, 27, 30,
50
+ 108, 107, 36, 109, 106, 43, 43, 25, 26, 26,
51
+ 27, 110, 21, 21, 111, 30, 30, 28, 99, 50,
52
+ 26, 53, 29, 14, 21, 23, 36, 30, 36, 56,
53
+ 61, 64, 113, 66, 29, 14, 116, 36, 118, 36,
54
+ nil, 43, nil, 43, 26, nil, 26, 14, 21, 23,
55
+ 21, 30, 43, 30, 43, 26, nil, 26, 36, 21,
56
+ 36, 21, 30, 25, 30, nil, nil, nil, nil, nil,
57
+ nil, 61, 62, 43, 60, 43, 26, nil, 26, nil,
58
+ 21, 23, 21, 30, 57, 30, 88, 89, 14, nil,
59
+ nil, 88, 89, nil, nil, nil, nil, 84, 85, 86,
60
+ nil, 87, 84, 85, 86, 83, 87, nil, 61, 93,
61
+ 83, 66, 61, 93, nil, 66, 61, 93, nil, 66,
62
+ 61, 93, nil, 66, nil, 14, nil, 61, 93, 14,
63
+ 66, nil, nil, 14, nil, nil, nil, 14, 4, 5,
64
+ 10, nil, nil, nil, 14, 4, 5, 47, 6, nil,
65
+ 8, 7, 4, 5, 10, 6, nil, 8, 7, nil,
66
+ nil, nil, 6, nil, 8, 7 ]
55
67
 
56
68
  racc_action_check = [
57
- 3, 58, 24, 24, 3, 24, 57, 15, 9, 3,
58
- 64, 57, 9, 15, 11, 24, 18, 9, 58, 3,
59
- 21, 64, 3, 14, 3, 3, 3, 9, 3, 22,
60
- 9, 12, 9, 9, 9, 12, 9, 1, 14, 42,
61
- 12, 14, 45, 42, 14, 55, 55, 14, 42, 1,
62
- 12, 27, 46, 12, 49, 12, 12, 12, 42, 12,
63
- 27, 42, 43, 42, 42, 42, 43, 42, 50, 53,
64
- 27, 43, 54, 56, 23, 27, 51, 51, 59, 51,
65
- 60, 43, 61, 23, 43, 23, 43, 43, 43, 75,
66
- 43, 28, 25, 23, 84, 86, 25, 25, 23, 25,
67
- 87, 91, 29, 30, 31, 94, 28, 25, 106, 28,
68
- 25, nil, 28, 25, 25, 28, 25, 29, 30, 31,
69
- 29, 30, 31, 29, 30, 31, 29, 30, 31, 32,
70
- 39, 76, 76, nil, 76, 39, 90, 90, nil, 90,
71
- 62, nil, nil, nil, 32, 39, nil, 32, 39, nil,
72
- 32, 39, 39, 32, 39, 62, 47, 47, 62, 92,
73
- 92, 62, 92, nil, 62, 48, 48, 47, 47, 47,
74
- nil, 47, nil, nil, nil, 47, 48, 48, 48, nil,
75
- 48, 0, 0, 0, 48, 17, 17, 17, nil, 93,
76
- 93, 0, 93, 0, 0, 17, nil, 17, 17, 26,
77
- 26, 26, nil, nil, nil, nil, nil, nil, nil, 26,
78
- nil, 26, 26 ]
69
+ 3, 1, 11, 64, 3, 70, 14, 17, 21, 3,
70
+ 24, 9, 62, 1, 17, 9, 70, 62, 25, 3,
71
+ 9, 64, 3, 30, 3, 3, 3, 3, 49, 3,
72
+ 9, 16, 30, 9, 50, 9, 9, 9, 9, 12,
73
+ 9, 53, 30, 12, 60, 60, 16, 30, 12, 16,
74
+ 46, 54, 58, 16, 46, 59, 16, 61, 12, 46,
75
+ 63, 12, 65, 12, 12, 12, 12, 66, 12, 46,
76
+ 31, 32, 46, 67, 46, 46, 46, 46, 47, 46,
77
+ 82, 82, 47, 82, 81, 31, 32, 47, 31, 32,
78
+ 26, 90, 31, 32, 92, 31, 32, 47, 93, 26,
79
+ 47, 26, 47, 47, 47, 47, 28, 47, 33, 26,
80
+ 28, 28, 97, 28, 26, 26, 100, 34, 113, 35,
81
+ nil, 28, nil, 33, 28, nil, 33, 28, 28, 28,
82
+ 33, 28, 34, 33, 35, 34, nil, 35, 43, 34,
83
+ 68, 35, 34, 43, 35, nil, nil, nil, nil, nil,
84
+ nil, 27, 27, 43, 27, 68, 43, nil, 68, nil,
85
+ 43, 43, 68, 43, 27, 68, 51, 51, 27, nil,
86
+ nil, 52, 52, nil, nil, nil, nil, 51, 51, 51,
87
+ nil, 51, 52, 52, 52, 51, 52, nil, 56, 56,
88
+ 52, 56, 96, 96, nil, 96, 98, 98, nil, 98,
89
+ 99, 99, nil, 99, nil, 56, nil, 101, 101, 96,
90
+ 101, nil, nil, 98, nil, nil, nil, 99, 0, 0,
91
+ 0, nil, nil, nil, 101, 20, 20, 20, 0, nil,
92
+ 0, 0, 29, 29, 29, 20, nil, 20, 20, nil,
93
+ nil, nil, 29, nil, 29, 29 ]
79
94
 
80
95
  racc_action_pointer = [
81
- 174, 37, nil, -2, nil, nil, nil, nil, nil, 6,
82
- nil, 14, 29, nil, 17, -17, nil, 178, 5, nil,
83
- nil, -9, 0, 72, -8, 86, 192, 49, 85, 96,
84
- 97, 98, 123, nil, nil, nil, nil, nil, nil, 124,
85
- nil, nil, 37, 60, nil, 31, 23, 153, 162, 29,
86
- 39, 66, nil, 46, 49, 34, 61, -1, -11, 55,
87
- 68, 59, 134, nil, -2, nil, nil, nil, nil, nil,
88
- nil, nil, nil, nil, nil, 64, 121, nil, nil, nil,
89
- nil, nil, nil, nil, 69, nil, 84, 88, nil, nil,
90
- 126, 94, 149, 179, 92, nil, nil, nil, nil, nil,
91
- nil, nil, nil, nil, nil, nil, 95, nil, nil, nil,
92
- nil ]
96
+ 211, 1, nil, -2, nil, nil, nil, nil, nil, 9,
97
+ nil, 2, 37, nil, -5, nil, 25, -17, nil, nil,
98
+ 218, -3, nil, nil, -20, -12, 88, 141, 100, 225,
99
+ 21, 64, 65, 102, 111, 113, nil, nil, nil, nil,
100
+ nil, nil, nil, 132, nil, nil, 48, 76, nil, 17,
101
+ 4, 163, 168, 16, 21, nil, 178, nil, 29, 32,
102
+ 33, 45, 5, 48, -9, 39, 55, 50, 134, nil,
103
+ -7, nil, nil, nil, nil, nil, nil, nil, nil, nil,
104
+ nil, 59, 70, nil, nil, nil, nil, nil, nil, nil,
105
+ 66, nil, 83, 86, nil, nil, 182, 105, 186, 190,
106
+ 103, 197, nil, nil, nil, nil, nil, nil, nil, nil,
107
+ nil, nil, nil, 105, nil, nil, nil, nil, nil ]
93
108
 
94
109
  racc_action_default = [
95
- -75, -76, -2, -24, -4, -5, -6, -7, -8, -24,
96
- -74, -76, -24, -3, -47, -10, -13, -17, -76, -19,
97
- -20, -76, -22, -24, -76, -24, -75, -76, -53, -54,
98
- -55, -56, -57, -58, -14, 111, -1, -9, -46, -24,
99
- -11, -12, -24, -24, -18, -76, -29, -62, -62, -76,
100
- -76, -76, -30, -76, -76, -38, -39, -40, -22, -76,
101
- -38, -76, -71, -73, -76, -44, -45, -48, -49, -50,
102
- -51, -52, -15, -16, -21, -76, -76, -63, -64, -65,
103
- -66, -67, -68, -69, -76, -27, -76, -40, -31, -32,
104
- -76, -43, -76, -76, -76, -33, -70, -72, -34, -25,
105
- -59, -60, -61, -26, -28, -35, -76, -36, -37, -42,
106
- -41 ]
110
+ -81, -82, -2, -27, -4, -5, -6, -7, -8, -27,
111
+ -80, -82, -27, -3, -82, -10, -53, -12, -15, -16,
112
+ -20, -82, -22, -23, -82, -25, -27, -82, -27, -81,
113
+ -82, -59, -60, -61, -62, -63, -64, -17, 119, -1,
114
+ -9, -11, -52, -27, -13, -14, -27, -27, -21, -82,
115
+ -32, -68, -68, -82, -82, -33, -82, -34, -82, -82,
116
+ -43, -44, -45, -46, -25, -82, -43, -82, -77, -79,
117
+ -82, -50, -51, -54, -55, -56, -57, -58, -18, -19,
118
+ -24, -82, -82, -69, -70, -71, -72, -73, -74, -75,
119
+ -82, -30, -82, -45, -35, -36, -82, -49, -82, -82,
120
+ -82, -82, -37, -76, -78, -38, -28, -65, -66, -67,
121
+ -29, -31, -39, -82, -40, -41, -48, -42, -47 ]
107
122
 
108
123
  racc_goto_table = [
109
- 53, 38, 13, 1, 42, 48, 62, 37, 34, 65,
110
- 40, 36, 63, 75, 84, 67, 68, 69, 70, 71,
111
- 62, 41, 50, 47, 54, nil, 63, nil, nil, 64,
112
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
113
- nil, 72, 73, nil, nil, nil, nil, nil, nil, 97,
114
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
115
- nil, nil, nil, nil, nil, nil, 105, nil, 107, 108 ]
124
+ 58, 42, 13, 1, 46, 52, 19, 68, 37, 71,
125
+ 41, 39, 19, 69, 44, 19, 73, 74, 75, 76,
126
+ 77, 45, 68, 81, 90, 54, 51, 59, 69, 55,
127
+ nil, nil, 70, nil, nil, nil, nil, nil, nil, nil,
128
+ nil, nil, nil, nil, nil, 78, 79, nil, nil, 19,
129
+ 19, nil, nil, 104, nil, nil, nil, nil, nil, nil,
130
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, 112,
131
+ nil, 114, 115, nil, 117 ]
116
132
 
117
133
  racc_goto_check = [
118
- 18, 12, 2, 1, 5, 9, 7, 8, 2, 9,
119
- 10, 2, 12, 17, 17, 12, 12, 12, 12, 12,
120
- 7, 11, 15, 16, 19, nil, 12, nil, nil, 1,
121
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
122
- nil, 2, 2, nil, nil, nil, nil, nil, nil, 12,
123
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
124
- nil, nil, nil, nil, nil, nil, 18, nil, 18, 18 ]
134
+ 20, 14, 2, 1, 5, 11, 7, 9, 2, 11,
135
+ 10, 2, 7, 14, 12, 7, 14, 14, 14, 14,
136
+ 14, 13, 9, 19, 19, 17, 18, 21, 14, 7,
137
+ nil, nil, 1, nil, nil, nil, nil, nil, nil, nil,
138
+ nil, nil, nil, nil, nil, 2, 2, nil, nil, 7,
139
+ 7, nil, nil, 14, nil, nil, nil, nil, nil, nil,
140
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, 20,
141
+ nil, 20, 20, nil, 20 ]
125
142
 
126
143
  racc_goto_pointer = [
127
- nil, 3, -1, nil, nil, -13, nil, -19, -7, -18,
128
- -5, 6, -13, nil, nil, -1, 0, -34, -24, 0,
129
- nil, nil, nil, nil ]
144
+ nil, 3, -1, nil, nil, -16, nil, 3, nil, -21,
145
+ -6, -21, -3, 4, -15, nil, nil, -1, 0, -28,
146
+ -27, 0, nil, nil, nil, nil ]
130
147
 
131
148
  racc_goto_default = [
132
- nil, nil, nil, 2, 3, 9, 17, 14, nil, 15,
133
- 31, 30, 16, 29, 19, 21, nil, nil, 59, nil,
134
- 28, 32, 76, 61 ]
149
+ nil, nil, nil, 2, 3, 9, 15, 63, 20, 16,
150
+ nil, 17, 34, 33, 18, 32, 22, 24, nil, nil,
151
+ 65, nil, 31, 35, 82, 67 ]
135
152
 
136
153
  racc_reduce_table = [
137
154
  0, 0, :racc_error,
138
- 3, 32, :_reduce_1,
139
- 1, 32, :_reduce_2,
140
- 2, 32, :_reduce_3,
141
- 1, 36, :_reduce_4,
142
- 1, 36, :_reduce_5,
143
- 1, 36, :_reduce_6,
144
- 1, 36, :_reduce_7,
145
- 1, 36, :_reduce_8,
146
- 2, 37, :_reduce_9,
147
- 1, 37, :_reduce_none,
148
- 2, 37, :_reduce_11,
149
- 2, 37, :_reduce_12,
150
- 1, 37, :_reduce_13,
151
- 2, 34, :_reduce_14,
152
- 3, 33, :_reduce_15,
153
- 3, 33, :_reduce_16,
154
- 1, 33, :_reduce_none,
155
- 2, 44, :_reduce_18,
156
- 1, 38, :_reduce_none,
157
- 1, 38, :_reduce_20,
158
- 3, 45, :_reduce_21,
159
- 1, 45, :_reduce_22,
160
- 1, 46, :_reduce_23,
161
- 0, 46, :_reduce_none,
162
- 4, 42, :_reduce_25,
163
- 4, 42, :_reduce_26,
164
- 3, 42, :_reduce_27,
165
- 3, 47, :_reduce_28,
166
- 1, 47, :_reduce_29,
167
- 2, 40, :_reduce_30,
168
- 3, 40, :_reduce_31,
169
- 3, 40, :_reduce_32,
170
- 3, 40, :_reduce_33,
171
- 3, 40, :_reduce_34,
172
- 3, 49, :_reduce_35,
173
- 3, 49, :_reduce_36,
174
- 3, 49, :_reduce_37,
175
- 1, 49, :_reduce_none,
176
- 1, 49, :_reduce_none,
177
- 1, 49, :_reduce_40,
178
- 4, 50, :_reduce_41,
179
- 3, 50, :_reduce_42,
180
- 2, 50, :_reduce_43,
181
- 2, 41, :_reduce_44,
182
- 2, 41, :_reduce_45,
183
- 1, 39, :_reduce_none,
184
- 0, 39, :_reduce_none,
185
- 2, 43, :_reduce_48,
186
- 2, 43, :_reduce_49,
187
- 2, 43, :_reduce_50,
188
- 2, 43, :_reduce_51,
189
- 2, 43, :_reduce_52,
190
- 1, 43, :_reduce_none,
191
- 1, 43, :_reduce_none,
192
- 1, 43, :_reduce_none,
193
- 1, 43, :_reduce_none,
194
- 1, 43, :_reduce_none,
195
- 1, 51, :_reduce_58,
196
- 2, 48, :_reduce_59,
197
- 2, 48, :_reduce_60,
198
- 2, 48, :_reduce_61,
199
- 0, 48, :_reduce_none,
200
- 1, 53, :_reduce_63,
201
- 1, 53, :_reduce_64,
202
- 1, 53, :_reduce_65,
203
- 1, 53, :_reduce_66,
204
- 1, 53, :_reduce_67,
205
- 1, 53, :_reduce_68,
206
- 1, 53, :_reduce_69,
207
- 3, 52, :_reduce_70,
208
- 1, 54, :_reduce_none,
209
- 2, 54, :_reduce_none,
210
- 1, 54, :_reduce_none,
211
- 1, 35, :_reduce_none,
212
- 0, 35, :_reduce_none ]
213
-
214
- racc_reduce_n = 76
215
-
216
- racc_shift_n = 111
155
+ 3, 33, :_reduce_1,
156
+ 1, 33, :_reduce_2,
157
+ 2, 33, :_reduce_3,
158
+ 1, 37, :_reduce_4,
159
+ 1, 37, :_reduce_5,
160
+ 1, 37, :_reduce_6,
161
+ 1, 37, :_reduce_7,
162
+ 1, 37, :_reduce_8,
163
+ 2, 38, :_reduce_9,
164
+ 1, 39, :_reduce_10,
165
+ 2, 40, :_reduce_11,
166
+ 1, 40, :_reduce_none,
167
+ 2, 40, :_reduce_13,
168
+ 2, 40, :_reduce_14,
169
+ 1, 40, :_reduce_15,
170
+ 1, 40, :_reduce_none,
171
+ 2, 35, :_reduce_17,
172
+ 3, 34, :_reduce_18,
173
+ 3, 34, :_reduce_19,
174
+ 1, 34, :_reduce_none,
175
+ 2, 47, :_reduce_21,
176
+ 1, 41, :_reduce_none,
177
+ 1, 41, :_reduce_23,
178
+ 3, 48, :_reduce_24,
179
+ 1, 48, :_reduce_25,
180
+ 1, 49, :_reduce_26,
181
+ 0, 49, :_reduce_none,
182
+ 4, 45, :_reduce_28,
183
+ 4, 45, :_reduce_29,
184
+ 3, 45, :_reduce_30,
185
+ 3, 50, :_reduce_31,
186
+ 1, 50, :_reduce_32,
187
+ 1, 50, :_reduce_none,
188
+ 2, 43, :_reduce_34,
189
+ 3, 43, :_reduce_35,
190
+ 3, 43, :_reduce_36,
191
+ 3, 43, :_reduce_37,
192
+ 3, 43, :_reduce_38,
193
+ 3, 52, :_reduce_39,
194
+ 3, 52, :_reduce_40,
195
+ 3, 52, :_reduce_41,
196
+ 3, 52, :_reduce_42,
197
+ 1, 52, :_reduce_none,
198
+ 1, 52, :_reduce_none,
199
+ 1, 52, :_reduce_45,
200
+ 1, 52, :_reduce_none,
201
+ 4, 53, :_reduce_47,
202
+ 3, 53, :_reduce_48,
203
+ 2, 53, :_reduce_49,
204
+ 2, 44, :_reduce_50,
205
+ 2, 44, :_reduce_51,
206
+ 1, 42, :_reduce_none,
207
+ 0, 42, :_reduce_none,
208
+ 2, 46, :_reduce_54,
209
+ 2, 46, :_reduce_55,
210
+ 2, 46, :_reduce_56,
211
+ 2, 46, :_reduce_57,
212
+ 2, 46, :_reduce_58,
213
+ 1, 46, :_reduce_none,
214
+ 1, 46, :_reduce_none,
215
+ 1, 46, :_reduce_none,
216
+ 1, 46, :_reduce_none,
217
+ 1, 46, :_reduce_none,
218
+ 1, 54, :_reduce_64,
219
+ 2, 51, :_reduce_65,
220
+ 2, 51, :_reduce_66,
221
+ 2, 51, :_reduce_67,
222
+ 0, 51, :_reduce_none,
223
+ 1, 56, :_reduce_69,
224
+ 1, 56, :_reduce_70,
225
+ 1, 56, :_reduce_71,
226
+ 1, 56, :_reduce_72,
227
+ 1, 56, :_reduce_73,
228
+ 1, 56, :_reduce_74,
229
+ 1, 56, :_reduce_75,
230
+ 3, 55, :_reduce_76,
231
+ 1, 57, :_reduce_none,
232
+ 2, 57, :_reduce_none,
233
+ 1, 57, :_reduce_none,
234
+ 1, 36, :_reduce_none,
235
+ 0, 36, :_reduce_none ]
236
+
237
+ racc_reduce_n = 82
238
+
239
+ racc_shift_n = 119
217
240
 
218
241
  racc_token_table = {
219
242
  false => 0,
@@ -243,12 +266,13 @@ racc_token_table = {
243
266
  :LSQUARE => 24,
244
267
  :RSQUARE => 25,
245
268
  :HAS => 26,
246
- "." => 27,
247
- "*" => 28,
248
- "|" => 29,
249
- ":" => 30 }
269
+ "@" => 27,
270
+ "." => 28,
271
+ "*" => 29,
272
+ "|" => 30,
273
+ ":" => 31 }
250
274
 
251
- racc_nt_base = 31
275
+ racc_nt_base = 32
252
276
 
253
277
  racc_use_result_var = true
254
278
 
@@ -296,6 +320,7 @@ Racc_token_to_s_table = [
296
320
  "LSQUARE",
297
321
  "RSQUARE",
298
322
  "HAS",
323
+ "\"@\"",
299
324
  "\".\"",
300
325
  "\"*\"",
301
326
  "\"|\"",
@@ -306,6 +331,8 @@ Racc_token_to_s_table = [
306
331
  "prefixless_combinator_selector",
307
332
  "optional_S",
308
333
  "combinator",
334
+ "xpath_attribute_name",
335
+ "xpath_attribute",
309
336
  "simple_selector",
310
337
  "element_name",
311
338
  "hcap_0toN",
@@ -332,419 +359,412 @@ Racc_debug_parser = false
332
359
  # reduce 0 omitted
333
360
 
334
361
  def _reduce_1(val, _values, result)
335
- result = [val.first, val.last].flatten
336
-
362
+ result = [val[0], val[2]].flatten
363
+
337
364
  result
338
365
  end
339
366
 
340
367
  def _reduce_2(val, _values, result)
341
- result = val.flatten
368
+ result = val.flatten
342
369
  result
343
370
  end
344
371
 
345
372
  def _reduce_3(val, _values, result)
346
- result = [val.last].flatten
373
+ result = [val[1]].flatten
347
374
  result
348
375
  end
349
376
 
350
377
  def _reduce_4(val, _values, result)
351
- result = :DIRECT_ADJACENT_SELECTOR
378
+ result = :DIRECT_ADJACENT_SELECTOR
352
379
  result
353
380
  end
354
381
 
355
382
  def _reduce_5(val, _values, result)
356
- result = :CHILD_SELECTOR
383
+ result = :CHILD_SELECTOR
357
384
  result
358
385
  end
359
386
 
360
387
  def _reduce_6(val, _values, result)
361
- result = :FOLLOWING_SELECTOR
388
+ result = :FOLLOWING_SELECTOR
362
389
  result
363
390
  end
364
391
 
365
392
  def _reduce_7(val, _values, result)
366
- result = :DESCENDANT_SELECTOR
393
+ result = :DESCENDANT_SELECTOR
367
394
  result
368
395
  end
369
396
 
370
397
  def _reduce_8(val, _values, result)
371
- result = :CHILD_SELECTOR
398
+ result = :CHILD_SELECTOR
372
399
  result
373
400
  end
374
401
 
375
402
  def _reduce_9(val, _values, result)
376
- result = if val[1].nil?
377
- val.first
378
- else
379
- Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
380
- end
381
-
403
+ result = val[1]
382
404
  result
383
405
  end
384
406
 
385
- # reduce 10 omitted
386
-
387
- def _reduce_11(val, _values, result)
388
- result = Node.new(:CONDITIONAL_SELECTOR, val)
389
-
407
+ def _reduce_10(val, _values, result)
408
+ result = Node.new(:ATTRIB_NAME, [val[0]])
390
409
  result
391
410
  end
392
411
 
393
- def _reduce_12(val, _values, result)
394
- result = Node.new(:CONDITIONAL_SELECTOR, val)
395
-
412
+ def _reduce_11(val, _values, result)
413
+ result = if val[1].nil?
414
+ val[0]
415
+ else
416
+ Node.new(:CONDITIONAL_SELECTOR, [val[0], val[1]])
417
+ end
418
+
396
419
  result
397
420
  end
398
421
 
422
+ # reduce 12 omitted
423
+
399
424
  def _reduce_13(val, _values, result)
400
- result = Node.new(:CONDITIONAL_SELECTOR,
401
- [Node.new(:ELEMENT_NAME, ['*']), val.first]
402
- )
403
-
425
+ result = Node.new(:CONDITIONAL_SELECTOR, val)
404
426
  result
405
427
  end
406
428
 
407
429
  def _reduce_14(val, _values, result)
408
- result = Node.new(val.first, [nil, val.last])
409
-
430
+ result = Node.new(:CONDITIONAL_SELECTOR, val)
410
431
  result
411
432
  end
412
433
 
413
434
  def _reduce_15(val, _values, result)
414
- result = Node.new(val[1], [val.first, val.last])
415
-
435
+ result = Node.new(:CONDITIONAL_SELECTOR, [Node.new(:ELEMENT_NAME, ['*']), val[0]])
416
436
  result
417
437
  end
418
438
 
419
- def _reduce_16(val, _values, result)
420
- result = Node.new(:DESCENDANT_SELECTOR, [val.first, val.last])
421
-
439
+ # reduce 16 omitted
440
+
441
+ def _reduce_17(val, _values, result)
442
+ result = Node.new(val[0], [nil, val[1]])
422
443
  result
423
444
  end
424
445
 
425
- # reduce 17 omitted
426
-
427
446
  def _reduce_18(val, _values, result)
428
- result = Node.new(:CLASS_CONDITION, [unescape_css_identifier(val[1])])
447
+ result = Node.new(val[1], [val[0], val[2]])
429
448
  result
430
449
  end
431
450
 
432
- # reduce 19 omitted
433
-
434
- def _reduce_20(val, _values, result)
435
- result = Node.new(:ELEMENT_NAME, val)
451
+ def _reduce_19(val, _values, result)
452
+ result = Node.new(:DESCENDANT_SELECTOR, [val[0], val[2]])
436
453
  result
437
454
  end
438
455
 
456
+ # reduce 20 omitted
457
+
439
458
  def _reduce_21(val, _values, result)
440
- result = Node.new(:ELEMENT_NAME,
441
- [[val.first, val.last].compact.join(':')]
442
- )
443
-
459
+ result = Node.new(:CLASS_CONDITION, [unescape_css_identifier(val[1])])
444
460
  result
445
461
  end
446
462
 
447
- def _reduce_22(val, _values, result)
448
- name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
449
- result = Node.new(:ELEMENT_NAME, [name])
450
-
451
- result
452
- end
463
+ # reduce 22 omitted
453
464
 
454
465
  def _reduce_23(val, _values, result)
455
- result = val[0]
466
+ result = Node.new(:ELEMENT_NAME, val)
456
467
  result
457
468
  end
458
469
 
459
- # reduce 24 omitted
470
+ def _reduce_24(val, _values, result)
471
+ result = Node.new(:ELEMENT_NAME, [[val[0], val[2]].compact.join(':')])
472
+ result
473
+ end
460
474
 
461
475
  def _reduce_25(val, _values, result)
462
- result = Node.new(:ATTRIBUTE_CONDITION,
463
- [val[1]] + (val[2] || [])
464
- )
465
-
476
+ name = @namespaces.key?('xmlns') ? "xmlns:#{val[0]}" : val[0]
477
+ result = Node.new(:ELEMENT_NAME, [name])
478
+
466
479
  result
467
480
  end
468
481
 
469
482
  def _reduce_26(val, _values, result)
470
- result = Node.new(:ATTRIBUTE_CONDITION,
471
- [val[1]] + (val[2] || [])
472
- )
473
-
483
+ result = val[0]
474
484
  result
475
485
  end
476
486
 
477
- def _reduce_27(val, _values, result)
478
- # Non standard, but hpricot supports it.
479
- result = Node.new(:PSEUDO_CLASS,
480
- [Node.new(:FUNCTION, ['nth-child(', val[1]])]
481
- )
482
-
483
- result
484
- end
487
+ # reduce 27 omitted
485
488
 
486
489
  def _reduce_28(val, _values, result)
487
- result = Node.new(:ELEMENT_NAME,
488
- [[val.first, val.last].compact.join(':')]
489
- )
490
-
490
+ result = Node.new(:ATTRIBUTE_CONDITION, [val[1]] + (val[2] || []))
491
+
491
492
  result
492
493
  end
493
494
 
494
495
  def _reduce_29(val, _values, result)
495
- # Default namespace is not applied to attributes.
496
- # So we don't add prefix "xmlns:" as in namespaced_ident.
497
- result = Node.new(:ELEMENT_NAME, [val.first])
498
-
496
+ result = Node.new(:ATTRIBUTE_CONDITION, [val[1]] + (val[2] || []))
497
+
499
498
  result
500
499
  end
501
500
 
502
501
  def _reduce_30(val, _values, result)
503
- result = Node.new(:FUNCTION, [val.first.strip])
504
-
502
+ result = Node.new(:PSEUDO_CLASS, [Node.new(:FUNCTION, ['nth-child(', val[1]])])
503
+
505
504
  result
506
505
  end
507
506
 
508
507
  def _reduce_31(val, _values, result)
509
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
510
-
508
+ result = Node.new(:ATTRIB_NAME, [[val[0], val[2]].compact.join(':')])
511
509
  result
512
510
  end
513
511
 
514
512
  def _reduce_32(val, _values, result)
515
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
516
-
513
+ result = Node.new(:ATTRIB_NAME, [val[0]])
517
514
  result
518
515
  end
519
516
 
520
- def _reduce_33(val, _values, result)
521
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
522
-
523
- result
524
- end
517
+ # reduce 33 omitted
525
518
 
526
519
  def _reduce_34(val, _values, result)
527
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
528
-
520
+ result = Node.new(:FUNCTION, [val[0].strip])
521
+
529
522
  result
530
523
  end
531
524
 
532
525
  def _reduce_35(val, _values, result)
533
- result = [val.first, val.last]
526
+ result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
527
+
534
528
  result
535
529
  end
536
530
 
537
531
  def _reduce_36(val, _values, result)
538
- result = [val.first, val.last]
532
+ result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
533
+
539
534
  result
540
535
  end
541
536
 
542
537
  def _reduce_37(val, _values, result)
543
- result = [val.first, val.last]
538
+ result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
539
+
544
540
  result
545
541
  end
546
542
 
547
- # reduce 38 omitted
548
-
549
- # reduce 39 omitted
543
+ def _reduce_38(val, _values, result)
544
+ result = Node.new(:FUNCTION, [val[0].strip, val[1]].flatten)
550
545
 
551
- def _reduce_40(val, _values, result)
552
- case val[0]
553
- when 'even'
554
- result = Node.new(:NTH, ['2','n','+','0'])
555
- when 'odd'
556
- result = Node.new(:NTH, ['2','n','+','1'])
557
- when 'n'
558
- result = Node.new(:NTH, ['1','n','+','0'])
559
- else
560
- # This is not CSS standard. It allows us to support this:
561
- # assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
562
- # assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
563
- # assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
564
- result = val
565
- end
566
-
567
546
  result
568
547
  end
569
548
 
570
- def _reduce_41(val, _values, result)
571
- if val[1] == 'n'
572
- result = Node.new(:NTH, val)
573
- else
574
- raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
575
- end
576
-
549
+ def _reduce_39(val, _values, result)
550
+ result = [val[0], val[2]]
577
551
  result
578
552
  end
579
553
 
580
- def _reduce_42(val, _values, result)
581
- # n+3, -n+3
582
- if val[0] == 'n'
583
- val.unshift("1")
584
- result = Node.new(:NTH, val)
585
- elsif val[0] == '-n'
586
- val[0] = 'n'
587
- val.unshift("-1")
588
- result = Node.new(:NTH, val)
589
- else
590
- raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
591
- end
592
-
554
+ def _reduce_40(val, _values, result)
555
+ result = [val[0], val[2]]
593
556
  result
594
557
  end
595
558
 
596
- def _reduce_43(val, _values, result)
597
- # 5n, -5n, 10n-1
598
- n = val[1]
599
- if n[0, 2] == 'n-'
600
- val[1] = 'n'
601
- val << "-"
602
- # b is contained in n as n is the string "n-b"
603
- val << n[2, n.size]
604
- result = Node.new(:NTH, val)
605
- elsif n == 'n'
606
- val << "+"
607
- val << "0"
608
- result = Node.new(:NTH, val)
609
- else
610
- raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
611
- end
612
-
559
+ def _reduce_41(val, _values, result)
560
+ result = [val[0], val[2]]
613
561
  result
614
562
  end
615
563
 
616
- def _reduce_44(val, _values, result)
617
- result = Node.new(:PSEUDO_CLASS, [val[1]])
618
-
564
+ def _reduce_42(val, _values, result)
565
+ result = [val[0], val[2]]
619
566
  result
620
567
  end
621
568
 
569
+ # reduce 43 omitted
570
+
571
+ # reduce 44 omitted
572
+
622
573
  def _reduce_45(val, _values, result)
623
- result = Node.new(:PSEUDO_CLASS, [val[1]])
574
+ case val[0]
575
+ when 'even'
576
+ result = Node.new(:NTH, ['2','n','+','0'])
577
+ when 'odd'
578
+ result = Node.new(:NTH, ['2','n','+','1'])
579
+ when 'n'
580
+ result = Node.new(:NTH, ['1','n','+','0'])
581
+ else
582
+ result = val
583
+ end
584
+
624
585
  result
625
586
  end
626
587
 
627
588
  # reduce 46 omitted
628
589
 
629
- # reduce 47 omitted
590
+ def _reduce_47(val, _values, result)
591
+ if val[1] == 'n'
592
+ result = Node.new(:NTH, val)
593
+ else
594
+ raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
595
+ end
596
+
597
+ result
598
+ end
630
599
 
631
600
  def _reduce_48(val, _values, result)
632
- result = Node.new(:COMBINATOR, val)
633
-
601
+ # n+3, -n+3
602
+ if val[0] == 'n'
603
+ val.unshift("1")
604
+ result = Node.new(:NTH, val)
605
+ elsif val[0] == '-n'
606
+ val[0] = 'n'
607
+ val.unshift("-1")
608
+ result = Node.new(:NTH, val)
609
+ else
610
+ raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
611
+ end
612
+
634
613
  result
635
614
  end
636
615
 
637
616
  def _reduce_49(val, _values, result)
638
- result = Node.new(:COMBINATOR, val)
639
-
617
+ # 5n, -5n, 10n-1
618
+ n = val[1]
619
+ if n[0, 2] == 'n-'
620
+ val[1] = 'n'
621
+ val << "-"
622
+ # b is contained in n as n is the string "n-b"
623
+ val << n[2, n.size]
624
+ result = Node.new(:NTH, val)
625
+ elsif n == 'n'
626
+ val << "+"
627
+ val << "0"
628
+ result = Node.new(:NTH, val)
629
+ else
630
+ raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
631
+ end
632
+
640
633
  result
641
634
  end
642
635
 
643
636
  def _reduce_50(val, _values, result)
644
- result = Node.new(:COMBINATOR, val)
645
-
637
+ result = Node.new(:PSEUDO_CLASS, [val[1]])
638
+
646
639
  result
647
640
  end
648
641
 
649
642
  def _reduce_51(val, _values, result)
650
- result = Node.new(:COMBINATOR, val)
651
-
643
+ result = Node.new(:PSEUDO_CLASS, [val[1]])
652
644
  result
653
645
  end
654
646
 
655
- def _reduce_52(val, _values, result)
656
- result = Node.new(:COMBINATOR, val)
657
-
658
- result
659
- end
647
+ # reduce 52 omitted
660
648
 
661
649
  # reduce 53 omitted
662
650
 
663
- # reduce 54 omitted
664
-
665
- # reduce 55 omitted
651
+ def _reduce_54(val, _values, result)
652
+ result = Node.new(:COMBINATOR, val)
666
653
 
667
- # reduce 56 omitted
654
+ result
655
+ end
668
656
 
669
- # reduce 57 omitted
657
+ def _reduce_55(val, _values, result)
658
+ result = Node.new(:COMBINATOR, val)
670
659
 
671
- def _reduce_58(val, _values, result)
672
- result = Node.new(:ID, [unescape_css_identifier(val.first)])
673
660
  result
674
661
  end
675
662
 
676
- def _reduce_59(val, _values, result)
677
- result = [val.first, unescape_css_identifier(val[1])]
663
+ def _reduce_56(val, _values, result)
664
+ result = Node.new(:COMBINATOR, val)
665
+
678
666
  result
679
667
  end
680
668
 
681
- def _reduce_60(val, _values, result)
682
- result = [val.first, unescape_css_string(val[1])]
669
+ def _reduce_57(val, _values, result)
670
+ result = Node.new(:COMBINATOR, val)
671
+
683
672
  result
684
673
  end
685
674
 
686
- def _reduce_61(val, _values, result)
687
- result = [val.first, val[1]]
675
+ def _reduce_58(val, _values, result)
676
+ result = Node.new(:COMBINATOR, val)
677
+
688
678
  result
689
679
  end
690
680
 
681
+ # reduce 59 omitted
682
+
683
+ # reduce 60 omitted
684
+
685
+ # reduce 61 omitted
686
+
691
687
  # reduce 62 omitted
692
688
 
693
- def _reduce_63(val, _values, result)
694
- result = :equal
695
- result
696
- end
689
+ # reduce 63 omitted
697
690
 
698
691
  def _reduce_64(val, _values, result)
699
- result = :prefix_match
692
+ result = Node.new(:ID, [unescape_css_identifier(val[0])])
700
693
  result
701
694
  end
702
695
 
703
696
  def _reduce_65(val, _values, result)
704
- result = :suffix_match
697
+ result = [val[0], unescape_css_identifier(val[1])]
705
698
  result
706
699
  end
707
700
 
708
701
  def _reduce_66(val, _values, result)
709
- result = :substring_match
702
+ result = [val[0], unescape_css_string(val[1])]
710
703
  result
711
704
  end
712
705
 
713
706
  def _reduce_67(val, _values, result)
714
- result = :not_equal
707
+ result = [val[0], val[1]]
715
708
  result
716
709
  end
717
710
 
718
- def _reduce_68(val, _values, result)
719
- result = :includes
720
- result
721
- end
711
+ # reduce 68 omitted
722
712
 
723
713
  def _reduce_69(val, _values, result)
724
- result = :dash_match
714
+ result = :equal
725
715
  result
726
716
  end
727
717
 
728
718
  def _reduce_70(val, _values, result)
729
- result = Node.new(:NOT, [val[1]])
730
-
719
+ result = :prefix_match
720
+ result
721
+ end
722
+
723
+ def _reduce_71(val, _values, result)
724
+ result = :suffix_match
725
+ result
726
+ end
727
+
728
+ def _reduce_72(val, _values, result)
729
+ result = :substring_match
730
+ result
731
+ end
732
+
733
+ def _reduce_73(val, _values, result)
734
+ result = :not_equal
735
+ result
736
+ end
737
+
738
+ def _reduce_74(val, _values, result)
739
+ result = :includes
740
+ result
741
+ end
742
+
743
+ def _reduce_75(val, _values, result)
744
+ result = :dash_match
745
+ result
746
+ end
747
+
748
+ def _reduce_76(val, _values, result)
749
+ result = Node.new(:NOT, [val[1]])
750
+
731
751
  result
732
752
  end
733
753
 
734
- # reduce 71 omitted
754
+ # reduce 77 omitted
735
755
 
736
- # reduce 72 omitted
756
+ # reduce 78 omitted
737
757
 
738
- # reduce 73 omitted
758
+ # reduce 79 omitted
739
759
 
740
- # reduce 74 omitted
760
+ # reduce 80 omitted
741
761
 
742
- # reduce 75 omitted
762
+ # reduce 81 omitted
743
763
 
744
764
  def _reduce_none(val, _values, result)
745
765
  val[0]
746
766
  end
747
767
 
748
768
  end # class Parser
749
- end # module CSS
750
- end # module Nokogiri
769
+ end # module CSS
770
+ end # module Nokogiri