nokogiri 1.3.0-x86-mingw32
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.
- data/.autotest +27 -0
- data/CHANGELOG.ja.rdoc +233 -0
- data/CHANGELOG.rdoc +222 -0
- data/Manifest.txt +247 -0
- data/README.ja.rdoc +103 -0
- data/README.rdoc +117 -0
- data/Rakefile +205 -0
- data/bin/nokogiri +47 -0
- data/ext/nokogiri/extconf.rb +89 -0
- data/ext/nokogiri/html_document.c +183 -0
- data/ext/nokogiri/html_document.h +10 -0
- data/ext/nokogiri/html_element_description.c +272 -0
- data/ext/nokogiri/html_element_description.h +10 -0
- data/ext/nokogiri/html_entity_lookup.c +30 -0
- data/ext/nokogiri/html_entity_lookup.h +8 -0
- data/ext/nokogiri/html_sax_parser.c +57 -0
- data/ext/nokogiri/html_sax_parser.h +11 -0
- data/ext/nokogiri/iconv.dll +0 -0
- data/ext/nokogiri/libexslt.dll +0 -0
- data/ext/nokogiri/libxml2.dll +0 -0
- data/ext/nokogiri/libxslt.dll +0 -0
- data/ext/nokogiri/nokogiri.c +81 -0
- data/ext/nokogiri/nokogiri.h +149 -0
- data/ext/nokogiri/xml_attr.c +92 -0
- data/ext/nokogiri/xml_attr.h +9 -0
- data/ext/nokogiri/xml_cdata.c +53 -0
- data/ext/nokogiri/xml_cdata.h +9 -0
- data/ext/nokogiri/xml_comment.c +51 -0
- data/ext/nokogiri/xml_comment.h +9 -0
- data/ext/nokogiri/xml_document.c +308 -0
- data/ext/nokogiri/xml_document.h +21 -0
- data/ext/nokogiri/xml_document_fragment.c +48 -0
- data/ext/nokogiri/xml_document_fragment.h +10 -0
- data/ext/nokogiri/xml_dtd.c +102 -0
- data/ext/nokogiri/xml_dtd.h +8 -0
- data/ext/nokogiri/xml_entity_reference.c +50 -0
- data/ext/nokogiri/xml_entity_reference.h +9 -0
- data/ext/nokogiri/xml_io.c +24 -0
- data/ext/nokogiri/xml_io.h +10 -0
- data/ext/nokogiri/xml_namespace.c +69 -0
- data/ext/nokogiri/xml_namespace.h +12 -0
- data/ext/nokogiri/xml_node.c +928 -0
- data/ext/nokogiri/xml_node.h +14 -0
- data/ext/nokogiri/xml_node_set.c +386 -0
- data/ext/nokogiri/xml_node_set.h +9 -0
- data/ext/nokogiri/xml_processing_instruction.c +54 -0
- data/ext/nokogiri/xml_processing_instruction.h +9 -0
- data/ext/nokogiri/xml_reader.c +572 -0
- data/ext/nokogiri/xml_reader.h +10 -0
- data/ext/nokogiri/xml_relax_ng.c +106 -0
- data/ext/nokogiri/xml_relax_ng.h +9 -0
- data/ext/nokogiri/xml_sax_parser.c +336 -0
- data/ext/nokogiri/xml_sax_parser.h +10 -0
- data/ext/nokogiri/xml_sax_push_parser.c +86 -0
- data/ext/nokogiri/xml_sax_push_parser.h +9 -0
- data/ext/nokogiri/xml_schema.c +107 -0
- data/ext/nokogiri/xml_schema.h +9 -0
- data/ext/nokogiri/xml_syntax_error.c +203 -0
- data/ext/nokogiri/xml_syntax_error.h +12 -0
- data/ext/nokogiri/xml_text.c +47 -0
- data/ext/nokogiri/xml_text.h +9 -0
- data/ext/nokogiri/xml_xpath.c +53 -0
- data/ext/nokogiri/xml_xpath.h +11 -0
- data/ext/nokogiri/xml_xpath_context.c +252 -0
- data/ext/nokogiri/xml_xpath_context.h +9 -0
- data/ext/nokogiri/xslt_stylesheet.c +131 -0
- data/ext/nokogiri/xslt_stylesheet.h +9 -0
- data/ext/nokogiri/zlib1.dll +0 -0
- data/lib/action-nokogiri.rb +36 -0
- data/lib/nokogiri.rb +110 -0
- data/lib/nokogiri/1.8/nokogiri.so +0 -0
- data/lib/nokogiri/1.9/nokogiri.so +0 -0
- data/lib/nokogiri/css.rb +25 -0
- data/lib/nokogiri/css/generated_parser.rb +748 -0
- data/lib/nokogiri/css/generated_tokenizer.rb +144 -0
- data/lib/nokogiri/css/node.rb +107 -0
- data/lib/nokogiri/css/parser.rb +82 -0
- data/lib/nokogiri/css/parser.y +227 -0
- data/lib/nokogiri/css/syntax_error.rb +7 -0
- data/lib/nokogiri/css/tokenizer.rb +11 -0
- data/lib/nokogiri/css/tokenizer.rex +54 -0
- data/lib/nokogiri/css/xpath_visitor.rb +172 -0
- data/lib/nokogiri/decorators.rb +2 -0
- data/lib/nokogiri/decorators/hpricot.rb +3 -0
- data/lib/nokogiri/decorators/hpricot/node.rb +56 -0
- data/lib/nokogiri/decorators/hpricot/node_set.rb +54 -0
- data/lib/nokogiri/decorators/hpricot/xpath_visitor.rb +30 -0
- data/lib/nokogiri/decorators/slop.rb +33 -0
- data/lib/nokogiri/ffi/html/document.rb +37 -0
- data/lib/nokogiri/ffi/html/element_description.rb +85 -0
- data/lib/nokogiri/ffi/html/entity_lookup.rb +16 -0
- data/lib/nokogiri/ffi/html/sax/parser.rb +21 -0
- data/lib/nokogiri/ffi/io_callbacks.rb +32 -0
- data/lib/nokogiri/ffi/libxml.rb +314 -0
- data/lib/nokogiri/ffi/structs/common_node.rb +26 -0
- data/lib/nokogiri/ffi/structs/html_elem_desc.rb +24 -0
- data/lib/nokogiri/ffi/structs/html_entity_desc.rb +13 -0
- data/lib/nokogiri/ffi/structs/xml_alloc.rb +16 -0
- data/lib/nokogiri/ffi/structs/xml_attr.rb +19 -0
- data/lib/nokogiri/ffi/structs/xml_buffer.rb +16 -0
- data/lib/nokogiri/ffi/structs/xml_document.rb +108 -0
- data/lib/nokogiri/ffi/structs/xml_dtd.rb +26 -0
- data/lib/nokogiri/ffi/structs/xml_node.rb +28 -0
- data/lib/nokogiri/ffi/structs/xml_node_set.rb +53 -0
- data/lib/nokogiri/ffi/structs/xml_notation.rb +11 -0
- data/lib/nokogiri/ffi/structs/xml_ns.rb +15 -0
- data/lib/nokogiri/ffi/structs/xml_relax_ng.rb +14 -0
- data/lib/nokogiri/ffi/structs/xml_sax_handler.rb +51 -0
- data/lib/nokogiri/ffi/structs/xml_sax_push_parser_context.rb +14 -0
- data/lib/nokogiri/ffi/structs/xml_schema.rb +13 -0
- data/lib/nokogiri/ffi/structs/xml_syntax_error.rb +31 -0
- data/lib/nokogiri/ffi/structs/xml_text_reader.rb +12 -0
- data/lib/nokogiri/ffi/structs/xml_xpath_context.rb +37 -0
- data/lib/nokogiri/ffi/structs/xml_xpath_object.rb +35 -0
- data/lib/nokogiri/ffi/structs/xml_xpath_parser_context.rb +20 -0
- data/lib/nokogiri/ffi/structs/xslt_stylesheet.rb +13 -0
- data/lib/nokogiri/ffi/xml/attr.rb +41 -0
- data/lib/nokogiri/ffi/xml/cdata.rb +19 -0
- data/lib/nokogiri/ffi/xml/comment.rb +18 -0
- data/lib/nokogiri/ffi/xml/document.rb +107 -0
- data/lib/nokogiri/ffi/xml/document_fragment.rb +26 -0
- data/lib/nokogiri/ffi/xml/dtd.rb +42 -0
- data/lib/nokogiri/ffi/xml/entity_reference.rb +19 -0
- data/lib/nokogiri/ffi/xml/namespace.rb +38 -0
- data/lib/nokogiri/ffi/xml/node.rb +380 -0
- data/lib/nokogiri/ffi/xml/node_set.rb +130 -0
- data/lib/nokogiri/ffi/xml/processing_instruction.rb +20 -0
- data/lib/nokogiri/ffi/xml/reader.rb +217 -0
- data/lib/nokogiri/ffi/xml/relax_ng.rb +51 -0
- data/lib/nokogiri/ffi/xml/sax/parser.rb +148 -0
- data/lib/nokogiri/ffi/xml/sax/push_parser.rb +38 -0
- data/lib/nokogiri/ffi/xml/schema.rb +55 -0
- data/lib/nokogiri/ffi/xml/syntax_error.rb +76 -0
- data/lib/nokogiri/ffi/xml/text.rb +18 -0
- data/lib/nokogiri/ffi/xml/xpath.rb +19 -0
- data/lib/nokogiri/ffi/xml/xpath_context.rb +135 -0
- data/lib/nokogiri/ffi/xslt/stylesheet.rb +47 -0
- data/lib/nokogiri/hpricot.rb +62 -0
- data/lib/nokogiri/html.rb +34 -0
- data/lib/nokogiri/html/builder.rb +35 -0
- data/lib/nokogiri/html/document.rb +71 -0
- data/lib/nokogiri/html/document_fragment.rb +15 -0
- data/lib/nokogiri/html/element_description.rb +23 -0
- data/lib/nokogiri/html/entity_lookup.rb +13 -0
- data/lib/nokogiri/html/sax/parser.rb +47 -0
- data/lib/nokogiri/nokogiri.rb +1 -0
- data/lib/nokogiri/syntax_error.rb +4 -0
- data/lib/nokogiri/version.rb +29 -0
- data/lib/nokogiri/version_warning.rb +11 -0
- data/lib/nokogiri/xml.rb +62 -0
- data/lib/nokogiri/xml/attr.rb +9 -0
- data/lib/nokogiri/xml/builder.rb +254 -0
- data/lib/nokogiri/xml/cdata.rb +11 -0
- data/lib/nokogiri/xml/document.rb +100 -0
- data/lib/nokogiri/xml/document_fragment.rb +49 -0
- data/lib/nokogiri/xml/dtd.rb +11 -0
- data/lib/nokogiri/xml/entity_declaration.rb +11 -0
- data/lib/nokogiri/xml/fragment_handler.rb +55 -0
- data/lib/nokogiri/xml/namespace.rb +7 -0
- data/lib/nokogiri/xml/node.rb +745 -0
- data/lib/nokogiri/xml/node/save_options.rb +42 -0
- data/lib/nokogiri/xml/node_set.rb +238 -0
- data/lib/nokogiri/xml/notation.rb +6 -0
- data/lib/nokogiri/xml/parse_options.rb +80 -0
- data/lib/nokogiri/xml/processing_instruction.rb +8 -0
- data/lib/nokogiri/xml/reader.rb +66 -0
- data/lib/nokogiri/xml/relax_ng.rb +32 -0
- data/lib/nokogiri/xml/sax.rb +3 -0
- data/lib/nokogiri/xml/sax/document.rb +143 -0
- data/lib/nokogiri/xml/sax/parser.rb +101 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +60 -0
- data/lib/nokogiri/xml/schema.rb +65 -0
- data/lib/nokogiri/xml/syntax_error.rb +34 -0
- data/lib/nokogiri/xml/xpath.rb +10 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +8 -0
- data/lib/nokogiri/xml/xpath_context.rb +16 -0
- data/lib/nokogiri/xslt.rb +48 -0
- data/lib/nokogiri/xslt/stylesheet.rb +25 -0
- data/lib/xsd/xmlparser/nokogiri.rb +64 -0
- data/tasks/test.rb +161 -0
- data/test/css/test_nthiness.rb +160 -0
- data/test/css/test_parser.rb +277 -0
- data/test/css/test_tokenizer.rb +176 -0
- data/test/css/test_xpath_visitor.rb +76 -0
- data/test/ffi/test_document.rb +35 -0
- data/test/files/address_book.rlx +12 -0
- data/test/files/address_book.xml +10 -0
- data/test/files/dont_hurt_em_why.xml +422 -0
- data/test/files/exslt.xml +8 -0
- data/test/files/exslt.xslt +35 -0
- data/test/files/po.xml +32 -0
- data/test/files/po.xsd +66 -0
- data/test/files/staff.xml +59 -0
- data/test/files/staff.xslt +32 -0
- data/test/files/tlm.html +850 -0
- data/test/helper.rb +123 -0
- data/test/hpricot/files/basic.xhtml +17 -0
- data/test/hpricot/files/boingboing.html +2266 -0
- data/test/hpricot/files/cy0.html +3653 -0
- data/test/hpricot/files/immob.html +400 -0
- data/test/hpricot/files/pace_application.html +1320 -0
- data/test/hpricot/files/tenderlove.html +16 -0
- data/test/hpricot/files/uswebgen.html +220 -0
- data/test/hpricot/files/utf8.html +1054 -0
- data/test/hpricot/files/week9.html +1723 -0
- data/test/hpricot/files/why.xml +19 -0
- data/test/hpricot/load_files.rb +11 -0
- data/test/hpricot/test_alter.rb +68 -0
- data/test/hpricot/test_builder.rb +20 -0
- data/test/hpricot/test_parser.rb +426 -0
- data/test/hpricot/test_paths.rb +15 -0
- data/test/hpricot/test_preserved.rb +77 -0
- data/test/hpricot/test_xml.rb +30 -0
- data/test/html/sax/test_parser.rb +52 -0
- data/test/html/test_builder.rb +156 -0
- data/test/html/test_document.rb +361 -0
- data/test/html/test_document_encoding.rb +46 -0
- data/test/html/test_document_fragment.rb +97 -0
- data/test/html/test_element_description.rb +95 -0
- data/test/html/test_named_characters.rb +14 -0
- data/test/html/test_node.rb +165 -0
- data/test/test_convert_xpath.rb +186 -0
- data/test/test_css_cache.rb +56 -0
- data/test/test_gc.rb +15 -0
- data/test/test_memory_leak.rb +77 -0
- data/test/test_nokogiri.rb +127 -0
- data/test/test_reader.rb +316 -0
- data/test/test_xslt_transforms.rb +131 -0
- data/test/xml/node/test_save_options.rb +20 -0
- data/test/xml/node/test_subclass.rb +44 -0
- data/test/xml/sax/test_parser.rb +169 -0
- data/test/xml/sax/test_push_parser.rb +92 -0
- data/test/xml/test_attr.rb +38 -0
- data/test/xml/test_builder.rb +73 -0
- data/test/xml/test_cdata.rb +38 -0
- data/test/xml/test_comment.rb +23 -0
- data/test/xml/test_document.rb +397 -0
- data/test/xml/test_document_encoding.rb +26 -0
- data/test/xml/test_document_fragment.rb +76 -0
- data/test/xml/test_dtd.rb +42 -0
- data/test/xml/test_dtd_encoding.rb +31 -0
- data/test/xml/test_entity_reference.rb +21 -0
- data/test/xml/test_namespace.rb +43 -0
- data/test/xml/test_node.rb +808 -0
- data/test/xml/test_node_attributes.rb +34 -0
- data/test/xml/test_node_encoding.rb +84 -0
- data/test/xml/test_node_set.rb +368 -0
- data/test/xml/test_parse_options.rb +52 -0
- data/test/xml/test_processing_instruction.rb +30 -0
- data/test/xml/test_reader_encoding.rb +126 -0
- data/test/xml/test_relax_ng.rb +60 -0
- data/test/xml/test_schema.rb +65 -0
- data/test/xml/test_text.rb +18 -0
- data/test/xml/test_unparented_node.rb +381 -0
- data/test/xml/test_xpath.rb +106 -0
- metadata +409 -0
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
#
|
4
|
+
# to use this in your Rails view or controller tests, simply:
|
5
|
+
#
|
6
|
+
# require 'action-nokogiri'
|
7
|
+
#
|
8
|
+
# class KittehControllerTest < ActionController::TestCase
|
9
|
+
# def test_i_can_does_test_with_nokogiri
|
10
|
+
# get(:index, {:wants => "cheezburgers"})
|
11
|
+
# assert @response.html.at("h2.lolcats")
|
12
|
+
# end
|
13
|
+
#
|
14
|
+
module ActionController
|
15
|
+
module TestResponseBehavior # :nodoc:
|
16
|
+
|
17
|
+
###
|
18
|
+
# Get your response as a Nokogiri::XML::Document using the
|
19
|
+
# Nokogiri.HTML parser
|
20
|
+
def html(flavor=nil)
|
21
|
+
if flavor == :hpricot
|
22
|
+
@_nokogiri_html_hpricot ||= Nokogiri::Hpricot(body)
|
23
|
+
else
|
24
|
+
@_nokogiri_html_vanilla ||= Nokogiri::HTML(body)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
###
|
29
|
+
# Get your response as a Nokogiri::XML::Document using the
|
30
|
+
# Nokogiri.XML parser
|
31
|
+
def xml
|
32
|
+
@_nokogiri_xml ||= Nokogiri::XML(body)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
data/lib/nokogiri.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Modify the PATH on windows so that the external DLLs will get loaded.
|
3
|
+
ENV['PATH'] = [File.expand_path(
|
4
|
+
File.join(File.dirname(__FILE__), "..", "ext", "nokogiri")
|
5
|
+
), ENV['PATH']].compact.join(';') if RUBY_PLATFORM =~ /(mswin|mingw)/i
|
6
|
+
|
7
|
+
if ENV['NOKOGIRI_FFI'] || RUBY_PLATFORM =~ /java/
|
8
|
+
gem 'ffi', '>=0.4.0' unless RUBY_PLATFORM =~ /java/
|
9
|
+
require 'ffi'
|
10
|
+
require 'nokogiri/ffi/libxml'
|
11
|
+
else
|
12
|
+
require 'nokogiri/nokogiri'
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'nokogiri/version'
|
16
|
+
require 'nokogiri/version_warning'
|
17
|
+
require 'nokogiri/syntax_error'
|
18
|
+
require 'nokogiri/xml'
|
19
|
+
require 'nokogiri/xslt'
|
20
|
+
require 'nokogiri/html'
|
21
|
+
require 'nokogiri/decorators'
|
22
|
+
require 'nokogiri/css'
|
23
|
+
require 'nokogiri/html/builder'
|
24
|
+
require 'nokogiri/hpricot'
|
25
|
+
|
26
|
+
# Nokogiri parses and searches XML/HTML very quickly, and also has
|
27
|
+
# correctly implemented CSS3 selector support as well as XPath support.
|
28
|
+
#
|
29
|
+
# Parsing a document returns either a Nokogiri::XML::Document, or a
|
30
|
+
# Nokogiri::HTML::Document depending on the kind of document you parse.
|
31
|
+
#
|
32
|
+
# Here is an example:
|
33
|
+
#
|
34
|
+
# require 'nokogiri'
|
35
|
+
# require 'open-uri'
|
36
|
+
#
|
37
|
+
# # Get a Nokogiri::HTML:Document for the page we’re interested in...
|
38
|
+
#
|
39
|
+
# doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
|
40
|
+
#
|
41
|
+
# # Do funky things with it using Nokogiri::XML::Node methods...
|
42
|
+
#
|
43
|
+
# ####
|
44
|
+
# # Search for nodes by css
|
45
|
+
# doc.css('h3.r a.l').each do |link|
|
46
|
+
# puts link.content
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# See Nokogiri::XML::Node#css for more information about CSS searching.
|
50
|
+
# See Nokogiri::XML::Node#xpath for more information about XPath searching.
|
51
|
+
module Nokogiri
|
52
|
+
class << self
|
53
|
+
###
|
54
|
+
# Parse an HTML or XML document. +string+ contains the document.
|
55
|
+
def parse string, url = nil, encoding = nil, options = nil
|
56
|
+
doc =
|
57
|
+
if string =~ /^\s*<[^Hh>]*html/i # Probably html
|
58
|
+
Nokogiri::HTML::Document.parse(string, url, encoding, options || 2145)
|
59
|
+
else
|
60
|
+
Nokogiri::XML::Document.parse(string, url, encoding, options || 2159)
|
61
|
+
end
|
62
|
+
yield doc if block_given?
|
63
|
+
doc
|
64
|
+
end
|
65
|
+
|
66
|
+
###
|
67
|
+
# Create a new Nokogiri::XML::DocumentFragment
|
68
|
+
def make input = nil, opts = {}, &blk
|
69
|
+
if input
|
70
|
+
Nokogiri::HTML.fragment(input).children.first
|
71
|
+
else
|
72
|
+
Nokogiri(&blk)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
###
|
77
|
+
# Parse a document and add the Slop decorator. The Slop decorator
|
78
|
+
# implements method_missing such that methods may be used instead of CSS
|
79
|
+
# or XPath. For example:
|
80
|
+
#
|
81
|
+
# doc = Nokogiri::Slop(<<-eohtml)
|
82
|
+
# <html>
|
83
|
+
# <body>
|
84
|
+
# <p>first</p>
|
85
|
+
# <p>second</p>
|
86
|
+
# </body>
|
87
|
+
# </html>
|
88
|
+
# eohtml
|
89
|
+
# assert_equal('second', doc.html.body.p[1].text)
|
90
|
+
#
|
91
|
+
def Slop(*args, &block)
|
92
|
+
Nokogiri(*args, &block).slop!
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
###
|
98
|
+
# Parser a document contained in +args+. Nokogiri will try to guess what
|
99
|
+
# type of document you are attempting to parse. For more information, see
|
100
|
+
# Nokogiri.parse
|
101
|
+
#
|
102
|
+
# To specify the type of document, use Nokogiri.XML or Nokogiri.HTML.
|
103
|
+
def Nokogiri(*args, &block)
|
104
|
+
if block_given?
|
105
|
+
builder = Nokogiri::HTML::Builder.new(&block)
|
106
|
+
return builder.doc.root
|
107
|
+
else
|
108
|
+
Nokogiri.parse(*args)
|
109
|
+
end
|
110
|
+
end
|
Binary file
|
Binary file
|
data/lib/nokogiri/css.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'nokogiri/css/node'
|
2
|
+
require 'nokogiri/css/xpath_visitor'
|
3
|
+
require 'nokogiri/css/generated_parser'
|
4
|
+
require 'nokogiri/css/generated_tokenizer'
|
5
|
+
require 'nokogiri/css/tokenizer'
|
6
|
+
require 'nokogiri/css/parser'
|
7
|
+
require 'nokogiri/css/syntax_error'
|
8
|
+
|
9
|
+
module Nokogiri
|
10
|
+
module CSS
|
11
|
+
class << self
|
12
|
+
###
|
13
|
+
# Parse this CSS selector in +selector+. Returns an AST.
|
14
|
+
def parse selector
|
15
|
+
Parser.new.parse selector
|
16
|
+
end
|
17
|
+
|
18
|
+
###
|
19
|
+
# Get the XPath for +selector+.
|
20
|
+
def xpath_for selector, options={}
|
21
|
+
Parser.new(options[:ns] || {}).xpath_for selector, options
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,748 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.4.6
|
4
|
+
# from Racc grammer file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
|
9
|
+
|
10
|
+
module Nokogiri
|
11
|
+
module CSS
|
12
|
+
class GeneratedParser < Racc::Parser
|
13
|
+
##### State transition tables begin ###
|
14
|
+
|
15
|
+
racc_action_table = [
|
16
|
+
4, 22, 24, 26, 10, 62, 4, 72, 50, 1,
|
17
|
+
10, 21, 4, 23, 25, 1, 10, 10, 59, 18,
|
18
|
+
51, 1, 5, 10, 8, 18, 11, 14, 5, 10,
|
19
|
+
8, 18, 11, 14, 5, 5, 8, 8, 11, 14,
|
20
|
+
14, 5, 10, 8, 4, 57, 14, 5, 10, 8,
|
21
|
+
56, 40, 14, 46, 10, 33, 52, 40, 54, 58,
|
22
|
+
5, 77, 8, 18, 4, 14, 5, 78, 8, 64,
|
23
|
+
66, 14, 5, 34, 8, 35, 49, 14, 64, 66,
|
24
|
+
65, 67, 69, 18, 70, 60, 61, 56, 63, 65,
|
25
|
+
67, 69, 80, 70, 61, 33, 28, 63, 32, 33,
|
26
|
+
52, 5, 54, 33, 52, 82, 54, 83, 31, 33,
|
27
|
+
52, 40, 54, 87, 86, 42, -22, 88, 89, 90,
|
28
|
+
91 ]
|
29
|
+
|
30
|
+
racc_action_check = [
|
31
|
+
0, 2, 2, 2, 0, 33, 20, 35, 17, 0,
|
32
|
+
20, 2, 51, 2, 2, 20, 51, 3, 30, 0,
|
33
|
+
17, 51, 0, 40, 0, 20, 0, 0, 20, 15,
|
34
|
+
20, 51, 20, 20, 51, 3, 51, 3, 51, 51,
|
35
|
+
3, 40, 6, 40, 14, 28, 40, 15, 7, 15,
|
36
|
+
28, 38, 15, 14, 13, 18, 18, 6, 18, 29,
|
37
|
+
6, 49, 6, 14, 5, 6, 7, 50, 7, 34,
|
38
|
+
34, 7, 13, 5, 13, 5, 16, 13, 36, 36,
|
39
|
+
34, 34, 34, 5, 34, 32, 32, 52, 34, 36,
|
40
|
+
36, 36, 53, 36, 54, 4, 4, 36, 4, 62,
|
41
|
+
62, 12, 62, 61, 61, 57, 61, 60, 4, 56,
|
42
|
+
56, 9, 56, 68, 68, 8, 1, 71, 73, 76,
|
43
|
+
83 ]
|
44
|
+
|
45
|
+
racc_action_pointer = [
|
46
|
+
-2, 89, -6, 11, 85, 62, 36, 42, 104, 90,
|
47
|
+
nil, nil, 77, 48, 42, 23, 49, 8, 45, nil,
|
48
|
+
4, nil, nil, nil, nil, nil, nil, nil, 38, 36,
|
49
|
+
-5, nil, 74, -7, 66, -18, 75, nil, 30, nil,
|
50
|
+
17, nil, nil, nil, nil, nil, nil, nil, nil, 50,
|
51
|
+
67, 10, 75, 69, 82, nil, 99, 92, nil, nil,
|
52
|
+
100, 93, 89, nil, nil, nil, nil, nil, 103, nil,
|
53
|
+
nil, 92, nil, 93, nil, nil, 96, nil, nil, nil,
|
54
|
+
nil, nil, nil, 107, nil, nil, nil, nil, nil, nil,
|
55
|
+
nil, nil ]
|
56
|
+
|
57
|
+
racc_action_default = [
|
58
|
+
-23, -20, -17, -51, -65, -65, -43, -48, -65, -15,
|
59
|
+
-52, -21, -12, -50, -65, -49, -65, -65, -65, -2,
|
60
|
+
-23, -5, -3, -8, -4, -7, -6, -47, -36, -65,
|
61
|
+
-65, -27, -34, -35, -55, -65, -55, -9, -42, -11,
|
62
|
+
-65, -44, -18, -14, -13, -46, -41, -40, -45, -65,
|
63
|
+
-65, -23, -36, -65, -34, -16, -65, -65, -28, -29,
|
64
|
+
-39, -65, -65, -56, -61, -57, -62, -58, -65, -59,
|
65
|
+
-60, -65, -26, -65, -10, -64, -65, -19, 92, -1,
|
66
|
+
-30, -33, -38, -65, -31, -32, -53, -54, -24, -25,
|
67
|
+
-63, -37 ]
|
68
|
+
|
69
|
+
racc_goto_table = [
|
70
|
+
29, 27, 19, 39, 38, 41, 43, 36, 71, 17,
|
71
|
+
73, 45, 44, 48, 53, 37, 47, 20, 30, 76,
|
72
|
+
nil, nil, 55, nil, nil, nil, nil, nil, nil, nil,
|
73
|
+
nil, nil, nil, nil, nil, 74, nil, nil, 75, nil,
|
74
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
75
|
+
nil, nil, 81, 79, nil, nil, nil, 84, 85 ]
|
76
|
+
|
77
|
+
racc_goto_check = [
|
78
|
+
14, 7, 2, 8, 7, 7, 8, 9, 13, 1,
|
79
|
+
13, 7, 10, 7, 14, 6, 9, 3, 15, 19,
|
80
|
+
nil, nil, 2, nil, nil, nil, nil, nil, nil, nil,
|
81
|
+
nil, nil, nil, nil, nil, 8, nil, nil, 7, nil,
|
82
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
83
|
+
nil, nil, 14, 2, nil, nil, nil, 14, 14 ]
|
84
|
+
|
85
|
+
racc_goto_pointer = [
|
86
|
+
nil, 9, 2, 15, nil, nil, 9, -2, -3, 2,
|
87
|
+
0, nil, nil, -26, -4, 14, nil, nil, nil, -21 ]
|
88
|
+
|
89
|
+
racc_goto_default = [
|
90
|
+
nil, nil, nil, nil, 2, 6, nil, 9, nil, 12,
|
91
|
+
13, 15, 16, nil, nil, nil, 3, 7, 68, nil ]
|
92
|
+
|
93
|
+
racc_reduce_table = [
|
94
|
+
0, 0, :racc_error,
|
95
|
+
3, 31, :_reduce_1,
|
96
|
+
1, 31, :_reduce_2,
|
97
|
+
1, 33, :_reduce_3,
|
98
|
+
1, 33, :_reduce_4,
|
99
|
+
1, 33, :_reduce_5,
|
100
|
+
1, 33, :_reduce_6,
|
101
|
+
1, 33, :_reduce_7,
|
102
|
+
1, 33, :_reduce_8,
|
103
|
+
2, 34, :_reduce_9,
|
104
|
+
3, 34, :_reduce_10,
|
105
|
+
2, 34, :_reduce_11,
|
106
|
+
1, 34, :_reduce_none,
|
107
|
+
2, 34, :_reduce_13,
|
108
|
+
2, 34, :_reduce_14,
|
109
|
+
1, 34, :_reduce_15,
|
110
|
+
3, 32, :_reduce_16,
|
111
|
+
1, 32, :_reduce_none,
|
112
|
+
2, 41, :_reduce_18,
|
113
|
+
3, 35, :_reduce_19,
|
114
|
+
1, 35, :_reduce_20,
|
115
|
+
1, 35, :_reduce_21,
|
116
|
+
1, 42, :_reduce_22,
|
117
|
+
0, 42, :_reduce_none,
|
118
|
+
4, 40, :_reduce_24,
|
119
|
+
4, 40, :_reduce_25,
|
120
|
+
3, 40, :_reduce_26,
|
121
|
+
2, 39, :_reduce_27,
|
122
|
+
3, 39, :_reduce_28,
|
123
|
+
3, 39, :_reduce_29,
|
124
|
+
3, 39, :_reduce_30,
|
125
|
+
3, 44, :_reduce_31,
|
126
|
+
3, 44, :_reduce_32,
|
127
|
+
3, 44, :_reduce_33,
|
128
|
+
1, 44, :_reduce_none,
|
129
|
+
1, 44, :_reduce_none,
|
130
|
+
1, 44, :_reduce_36,
|
131
|
+
4, 45, :_reduce_37,
|
132
|
+
3, 45, :_reduce_38,
|
133
|
+
2, 45, :_reduce_39,
|
134
|
+
2, 46, :_reduce_40,
|
135
|
+
2, 46, :_reduce_41,
|
136
|
+
1, 36, :_reduce_none,
|
137
|
+
0, 36, :_reduce_none,
|
138
|
+
2, 37, :_reduce_44,
|
139
|
+
2, 37, :_reduce_45,
|
140
|
+
2, 37, :_reduce_46,
|
141
|
+
2, 37, :_reduce_47,
|
142
|
+
1, 37, :_reduce_none,
|
143
|
+
1, 37, :_reduce_none,
|
144
|
+
1, 37, :_reduce_none,
|
145
|
+
1, 37, :_reduce_none,
|
146
|
+
1, 47, :_reduce_52,
|
147
|
+
2, 43, :_reduce_53,
|
148
|
+
2, 43, :_reduce_54,
|
149
|
+
0, 43, :_reduce_none,
|
150
|
+
1, 48, :_reduce_56,
|
151
|
+
1, 48, :_reduce_57,
|
152
|
+
1, 48, :_reduce_58,
|
153
|
+
1, 48, :_reduce_59,
|
154
|
+
1, 48, :_reduce_60,
|
155
|
+
1, 48, :_reduce_61,
|
156
|
+
1, 48, :_reduce_62,
|
157
|
+
3, 38, :_reduce_63,
|
158
|
+
1, 49, :_reduce_none ]
|
159
|
+
|
160
|
+
racc_reduce_n = 65
|
161
|
+
|
162
|
+
racc_shift_n = 92
|
163
|
+
|
164
|
+
racc_token_table = {
|
165
|
+
false => 0,
|
166
|
+
:error => 1,
|
167
|
+
:FUNCTION => 2,
|
168
|
+
:INCLUDES => 3,
|
169
|
+
:DASHMATCH => 4,
|
170
|
+
:LBRACE => 5,
|
171
|
+
:HASH => 6,
|
172
|
+
:PLUS => 7,
|
173
|
+
:GREATER => 8,
|
174
|
+
:S => 9,
|
175
|
+
:STRING => 10,
|
176
|
+
:IDENT => 11,
|
177
|
+
:COMMA => 12,
|
178
|
+
:NUMBER => 13,
|
179
|
+
:PREFIXMATCH => 14,
|
180
|
+
:SUFFIXMATCH => 15,
|
181
|
+
:SUBSTRINGMATCH => 16,
|
182
|
+
:TILDE => 17,
|
183
|
+
:NOT_EQUAL => 18,
|
184
|
+
:SLASH => 19,
|
185
|
+
:DOUBLESLASH => 20,
|
186
|
+
:NOT => 21,
|
187
|
+
:EQUAL => 22,
|
188
|
+
:RPAREN => 23,
|
189
|
+
:LSQUARE => 24,
|
190
|
+
:RSQUARE => 25,
|
191
|
+
"." => 26,
|
192
|
+
"|" => 27,
|
193
|
+
"*" => 28,
|
194
|
+
":" => 29 }
|
195
|
+
|
196
|
+
racc_nt_base = 30
|
197
|
+
|
198
|
+
racc_use_result_var = true
|
199
|
+
|
200
|
+
Racc_arg = [
|
201
|
+
racc_action_table,
|
202
|
+
racc_action_check,
|
203
|
+
racc_action_default,
|
204
|
+
racc_action_pointer,
|
205
|
+
racc_goto_table,
|
206
|
+
racc_goto_check,
|
207
|
+
racc_goto_default,
|
208
|
+
racc_goto_pointer,
|
209
|
+
racc_nt_base,
|
210
|
+
racc_reduce_table,
|
211
|
+
racc_token_table,
|
212
|
+
racc_shift_n,
|
213
|
+
racc_reduce_n,
|
214
|
+
racc_use_result_var ]
|
215
|
+
|
216
|
+
Racc_token_to_s_table = [
|
217
|
+
"$end",
|
218
|
+
"error",
|
219
|
+
"FUNCTION",
|
220
|
+
"INCLUDES",
|
221
|
+
"DASHMATCH",
|
222
|
+
"LBRACE",
|
223
|
+
"HASH",
|
224
|
+
"PLUS",
|
225
|
+
"GREATER",
|
226
|
+
"S",
|
227
|
+
"STRING",
|
228
|
+
"IDENT",
|
229
|
+
"COMMA",
|
230
|
+
"NUMBER",
|
231
|
+
"PREFIXMATCH",
|
232
|
+
"SUFFIXMATCH",
|
233
|
+
"SUBSTRINGMATCH",
|
234
|
+
"TILDE",
|
235
|
+
"NOT_EQUAL",
|
236
|
+
"SLASH",
|
237
|
+
"DOUBLESLASH",
|
238
|
+
"NOT",
|
239
|
+
"EQUAL",
|
240
|
+
"RPAREN",
|
241
|
+
"LSQUARE",
|
242
|
+
"RSQUARE",
|
243
|
+
"\".\"",
|
244
|
+
"\"|\"",
|
245
|
+
"\"*\"",
|
246
|
+
"\":\"",
|
247
|
+
"$start",
|
248
|
+
"selector",
|
249
|
+
"simple_selector_1toN",
|
250
|
+
"combinator",
|
251
|
+
"simple_selector",
|
252
|
+
"element_name",
|
253
|
+
"hcap_0toN",
|
254
|
+
"hcap_1toN",
|
255
|
+
"negation",
|
256
|
+
"function",
|
257
|
+
"attrib",
|
258
|
+
"class",
|
259
|
+
"namespace",
|
260
|
+
"attrib_val_0or1",
|
261
|
+
"expr",
|
262
|
+
"an_plus_b",
|
263
|
+
"pseudo",
|
264
|
+
"attribute_id",
|
265
|
+
"eql_incl_dash",
|
266
|
+
"negation_arg" ]
|
267
|
+
|
268
|
+
Racc_debug_parser = false
|
269
|
+
|
270
|
+
##### State transition tables end #####
|
271
|
+
|
272
|
+
# reduce 0 omitted
|
273
|
+
|
274
|
+
module_eval(<<'.,.,', 'parser.y', 9)
|
275
|
+
def _reduce_1(val, _values, result)
|
276
|
+
result = [val.first, val.last].flatten
|
277
|
+
|
278
|
+
result
|
279
|
+
end
|
280
|
+
.,.,
|
281
|
+
|
282
|
+
module_eval(<<'.,.,', 'parser.y', 11)
|
283
|
+
def _reduce_2(val, _values, result)
|
284
|
+
result = val.flatten
|
285
|
+
result
|
286
|
+
end
|
287
|
+
.,.,
|
288
|
+
|
289
|
+
module_eval(<<'.,.,', 'parser.y', 14)
|
290
|
+
def _reduce_3(val, _values, result)
|
291
|
+
result = :DIRECT_ADJACENT_SELECTOR
|
292
|
+
result
|
293
|
+
end
|
294
|
+
.,.,
|
295
|
+
|
296
|
+
module_eval(<<'.,.,', 'parser.y', 15)
|
297
|
+
def _reduce_4(val, _values, result)
|
298
|
+
result = :CHILD_SELECTOR
|
299
|
+
result
|
300
|
+
end
|
301
|
+
.,.,
|
302
|
+
|
303
|
+
module_eval(<<'.,.,', 'parser.y', 16)
|
304
|
+
def _reduce_5(val, _values, result)
|
305
|
+
result = :PRECEDING_SELECTOR
|
306
|
+
result
|
307
|
+
end
|
308
|
+
.,.,
|
309
|
+
|
310
|
+
module_eval(<<'.,.,', 'parser.y', 17)
|
311
|
+
def _reduce_6(val, _values, result)
|
312
|
+
result = :DESCENDANT_SELECTOR
|
313
|
+
result
|
314
|
+
end
|
315
|
+
.,.,
|
316
|
+
|
317
|
+
module_eval(<<'.,.,', 'parser.y', 18)
|
318
|
+
def _reduce_7(val, _values, result)
|
319
|
+
result = :DESCENDANT_SELECTOR
|
320
|
+
result
|
321
|
+
end
|
322
|
+
.,.,
|
323
|
+
|
324
|
+
module_eval(<<'.,.,', 'parser.y', 19)
|
325
|
+
def _reduce_8(val, _values, result)
|
326
|
+
result = :CHILD_SELECTOR
|
327
|
+
result
|
328
|
+
end
|
329
|
+
.,.,
|
330
|
+
|
331
|
+
module_eval(<<'.,.,', 'parser.y', 23)
|
332
|
+
def _reduce_9(val, _values, result)
|
333
|
+
result = if val[1].nil?
|
334
|
+
val.first
|
335
|
+
else
|
336
|
+
Node.new(:CONDITIONAL_SELECTOR, [val.first, val[1]])
|
337
|
+
end
|
338
|
+
|
339
|
+
result
|
340
|
+
end
|
341
|
+
.,.,
|
342
|
+
|
343
|
+
module_eval(<<'.,.,', 'parser.y', 30)
|
344
|
+
def _reduce_10(val, _values, result)
|
345
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
346
|
+
[
|
347
|
+
val.first,
|
348
|
+
Node.new(:COMBINATOR, [val[1], val.last])
|
349
|
+
]
|
350
|
+
)
|
351
|
+
|
352
|
+
result
|
353
|
+
end
|
354
|
+
.,.,
|
355
|
+
|
356
|
+
module_eval(<<'.,.,', 'parser.y', 38)
|
357
|
+
def _reduce_11(val, _values, result)
|
358
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
359
|
+
|
360
|
+
result
|
361
|
+
end
|
362
|
+
.,.,
|
363
|
+
|
364
|
+
# reduce 12 omitted
|
365
|
+
|
366
|
+
module_eval(<<'.,.,', 'parser.y', 42)
|
367
|
+
def _reduce_13(val, _values, result)
|
368
|
+
result = Node.new(:CONDITIONAL_SELECTOR, val)
|
369
|
+
|
370
|
+
result
|
371
|
+
end
|
372
|
+
.,.,
|
373
|
+
|
374
|
+
module_eval(<<'.,.,', 'parser.y', 45)
|
375
|
+
def _reduce_14(val, _values, result)
|
376
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
377
|
+
[
|
378
|
+
Node.new(:ELEMENT_NAME, ['*']),
|
379
|
+
Node.new(:COMBINATOR, val)
|
380
|
+
]
|
381
|
+
)
|
382
|
+
|
383
|
+
result
|
384
|
+
end
|
385
|
+
.,.,
|
386
|
+
|
387
|
+
module_eval(<<'.,.,', 'parser.y', 53)
|
388
|
+
def _reduce_15(val, _values, result)
|
389
|
+
result = Node.new(:CONDITIONAL_SELECTOR,
|
390
|
+
[Node.new(:ELEMENT_NAME, ['*']), val.first]
|
391
|
+
)
|
392
|
+
|
393
|
+
result
|
394
|
+
end
|
395
|
+
.,.,
|
396
|
+
|
397
|
+
module_eval(<<'.,.,', 'parser.y', 60)
|
398
|
+
def _reduce_16(val, _values, result)
|
399
|
+
result = Node.new(val[1], [val.first, val.last])
|
400
|
+
|
401
|
+
result
|
402
|
+
end
|
403
|
+
.,.,
|
404
|
+
|
405
|
+
# reduce 17 omitted
|
406
|
+
|
407
|
+
module_eval(<<'.,.,', 'parser.y', 65)
|
408
|
+
def _reduce_18(val, _values, result)
|
409
|
+
result = Node.new(:CLASS_CONDITION, [val[1]])
|
410
|
+
result
|
411
|
+
end
|
412
|
+
.,.,
|
413
|
+
|
414
|
+
module_eval(<<'.,.,', 'parser.y', 69)
|
415
|
+
def _reduce_19(val, _values, result)
|
416
|
+
result = Node.new(:ELEMENT_NAME,
|
417
|
+
[[val.first, val.last].compact.join(':')]
|
418
|
+
)
|
419
|
+
|
420
|
+
result
|
421
|
+
end
|
422
|
+
.,.,
|
423
|
+
|
424
|
+
module_eval(<<'.,.,', 'parser.y', 74)
|
425
|
+
def _reduce_20(val, _values, result)
|
426
|
+
name = @namespaces.key?('xmlns') ? "xmlns:#{val.first}" : val.first
|
427
|
+
result = Node.new(:ELEMENT_NAME, [name])
|
428
|
+
|
429
|
+
result
|
430
|
+
end
|
431
|
+
.,.,
|
432
|
+
|
433
|
+
module_eval(<<'.,.,', 'parser.y', 77)
|
434
|
+
def _reduce_21(val, _values, result)
|
435
|
+
result = Node.new(:ELEMENT_NAME, val)
|
436
|
+
result
|
437
|
+
end
|
438
|
+
.,.,
|
439
|
+
|
440
|
+
module_eval(<<'.,.,', 'parser.y', 80)
|
441
|
+
def _reduce_22(val, _values, result)
|
442
|
+
result = val[0]
|
443
|
+
result
|
444
|
+
end
|
445
|
+
.,.,
|
446
|
+
|
447
|
+
# reduce 23 omitted
|
448
|
+
|
449
|
+
module_eval(<<'.,.,', 'parser.y', 85)
|
450
|
+
def _reduce_24(val, _values, result)
|
451
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
452
|
+
[Node.new(:ELEMENT_NAME, [val[1]])] + (val[2] || [])
|
453
|
+
)
|
454
|
+
|
455
|
+
result
|
456
|
+
end
|
457
|
+
.,.,
|
458
|
+
|
459
|
+
module_eval(<<'.,.,', 'parser.y', 90)
|
460
|
+
def _reduce_25(val, _values, result)
|
461
|
+
result = Node.new(:ATTRIBUTE_CONDITION,
|
462
|
+
[val[1]] + (val[2] || [])
|
463
|
+
)
|
464
|
+
|
465
|
+
result
|
466
|
+
end
|
467
|
+
.,.,
|
468
|
+
|
469
|
+
module_eval(<<'.,.,', 'parser.y', 95)
|
470
|
+
def _reduce_26(val, _values, result)
|
471
|
+
# Non standard, but hpricot supports it.
|
472
|
+
result = Node.new(:PSEUDO_CLASS,
|
473
|
+
[Node.new(:FUNCTION, ['nth-child(', val[1]])]
|
474
|
+
)
|
475
|
+
|
476
|
+
result
|
477
|
+
end
|
478
|
+
.,.,
|
479
|
+
|
480
|
+
module_eval(<<'.,.,', 'parser.y', 103)
|
481
|
+
def _reduce_27(val, _values, result)
|
482
|
+
result = Node.new(:FUNCTION, [val.first.strip])
|
483
|
+
|
484
|
+
result
|
485
|
+
end
|
486
|
+
.,.,
|
487
|
+
|
488
|
+
module_eval(<<'.,.,', 'parser.y', 106)
|
489
|
+
def _reduce_28(val, _values, result)
|
490
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
491
|
+
|
492
|
+
result
|
493
|
+
end
|
494
|
+
.,.,
|
495
|
+
|
496
|
+
module_eval(<<'.,.,', 'parser.y', 109)
|
497
|
+
def _reduce_29(val, _values, result)
|
498
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
499
|
+
|
500
|
+
result
|
501
|
+
end
|
502
|
+
.,.,
|
503
|
+
|
504
|
+
module_eval(<<'.,.,', 'parser.y', 112)
|
505
|
+
def _reduce_30(val, _values, result)
|
506
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
507
|
+
|
508
|
+
result
|
509
|
+
end
|
510
|
+
.,.,
|
511
|
+
|
512
|
+
module_eval(<<'.,.,', 'parser.y', 116)
|
513
|
+
def _reduce_31(val, _values, result)
|
514
|
+
result = [val.first, val.last]
|
515
|
+
result
|
516
|
+
end
|
517
|
+
.,.,
|
518
|
+
|
519
|
+
module_eval(<<'.,.,', 'parser.y', 117)
|
520
|
+
def _reduce_32(val, _values, result)
|
521
|
+
result = [val.first, val.last]
|
522
|
+
result
|
523
|
+
end
|
524
|
+
.,.,
|
525
|
+
|
526
|
+
module_eval(<<'.,.,', 'parser.y', 118)
|
527
|
+
def _reduce_33(val, _values, result)
|
528
|
+
result = [val.first, val.last]
|
529
|
+
result
|
530
|
+
end
|
531
|
+
.,.,
|
532
|
+
|
533
|
+
# reduce 34 omitted
|
534
|
+
|
535
|
+
# reduce 35 omitted
|
536
|
+
|
537
|
+
module_eval(<<'.,.,', 'parser.y', 123)
|
538
|
+
def _reduce_36(val, _values, result)
|
539
|
+
if val[0] == 'even'
|
540
|
+
val = ["2","n","+","0"]
|
541
|
+
result = Node.new(:AN_PLUS_B, val)
|
542
|
+
elsif val[0] == 'odd'
|
543
|
+
val = ["2","n","+","1"]
|
544
|
+
result = Node.new(:AN_PLUS_B, val)
|
545
|
+
else
|
546
|
+
# This is not CSS standard. It allows us to support this:
|
547
|
+
# assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
|
548
|
+
# assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
|
549
|
+
# assert_xpath("//a[foo(., a, 10)]", @parser.parse('a:foo(a, 10)'))
|
550
|
+
result = val
|
551
|
+
end
|
552
|
+
|
553
|
+
result
|
554
|
+
end
|
555
|
+
.,.,
|
556
|
+
|
557
|
+
module_eval(<<'.,.,', 'parser.y', 141)
|
558
|
+
def _reduce_37(val, _values, result)
|
559
|
+
if val[1] == 'n'
|
560
|
+
result = Node.new(:AN_PLUS_B, val)
|
561
|
+
else
|
562
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
563
|
+
end
|
564
|
+
|
565
|
+
result
|
566
|
+
end
|
567
|
+
.,.,
|
568
|
+
|
569
|
+
module_eval(<<'.,.,', 'parser.y', 147)
|
570
|
+
def _reduce_38(val, _values, result)
|
571
|
+
# n+3, -n+3
|
572
|
+
if val[0] == 'n'
|
573
|
+
val.unshift("1")
|
574
|
+
result = Node.new(:AN_PLUS_B, val)
|
575
|
+
elsif val[0] == '-n'
|
576
|
+
val[0] = 'n'
|
577
|
+
val.unshift("-1")
|
578
|
+
result = Node.new(:AN_PLUS_B, val)
|
579
|
+
else
|
580
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
581
|
+
end
|
582
|
+
|
583
|
+
result
|
584
|
+
end
|
585
|
+
.,.,
|
586
|
+
|
587
|
+
module_eval(<<'.,.,', 'parser.y', 161)
|
588
|
+
def _reduce_39(val, _values, result)
|
589
|
+
if val[1] == 'n'
|
590
|
+
val << "+"
|
591
|
+
val << "0"
|
592
|
+
result = Node.new(:AN_PLUS_B, val)
|
593
|
+
else
|
594
|
+
raise Racc::ParseError, "parse error on IDENT '#{val[1]}'"
|
595
|
+
end
|
596
|
+
|
597
|
+
result
|
598
|
+
end
|
599
|
+
.,.,
|
600
|
+
|
601
|
+
module_eval(<<'.,.,', 'parser.y', 172)
|
602
|
+
def _reduce_40(val, _values, result)
|
603
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
604
|
+
|
605
|
+
result
|
606
|
+
end
|
607
|
+
.,.,
|
608
|
+
|
609
|
+
module_eval(<<'.,.,', 'parser.y', 174)
|
610
|
+
def _reduce_41(val, _values, result)
|
611
|
+
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
612
|
+
result
|
613
|
+
end
|
614
|
+
.,.,
|
615
|
+
|
616
|
+
# reduce 42 omitted
|
617
|
+
|
618
|
+
# reduce 43 omitted
|
619
|
+
|
620
|
+
module_eval(<<'.,.,', 'parser.y', 182)
|
621
|
+
def _reduce_44(val, _values, result)
|
622
|
+
result = Node.new(:COMBINATOR, val)
|
623
|
+
|
624
|
+
result
|
625
|
+
end
|
626
|
+
.,.,
|
627
|
+
|
628
|
+
module_eval(<<'.,.,', 'parser.y', 185)
|
629
|
+
def _reduce_45(val, _values, result)
|
630
|
+
result = Node.new(:COMBINATOR, val)
|
631
|
+
|
632
|
+
result
|
633
|
+
end
|
634
|
+
.,.,
|
635
|
+
|
636
|
+
module_eval(<<'.,.,', 'parser.y', 188)
|
637
|
+
def _reduce_46(val, _values, result)
|
638
|
+
result = Node.new(:COMBINATOR, val)
|
639
|
+
|
640
|
+
result
|
641
|
+
end
|
642
|
+
.,.,
|
643
|
+
|
644
|
+
module_eval(<<'.,.,', 'parser.y', 191)
|
645
|
+
def _reduce_47(val, _values, result)
|
646
|
+
result = Node.new(:COMBINATOR, val)
|
647
|
+
|
648
|
+
result
|
649
|
+
end
|
650
|
+
.,.,
|
651
|
+
|
652
|
+
# reduce 48 omitted
|
653
|
+
|
654
|
+
# reduce 49 omitted
|
655
|
+
|
656
|
+
# reduce 50 omitted
|
657
|
+
|
658
|
+
# reduce 51 omitted
|
659
|
+
|
660
|
+
module_eval(<<'.,.,', 'parser.y', 199)
|
661
|
+
def _reduce_52(val, _values, result)
|
662
|
+
result = Node.new(:ID, val)
|
663
|
+
result
|
664
|
+
end
|
665
|
+
.,.,
|
666
|
+
|
667
|
+
module_eval(<<'.,.,', 'parser.y', 202)
|
668
|
+
def _reduce_53(val, _values, result)
|
669
|
+
result = [val.first, val[1]]
|
670
|
+
result
|
671
|
+
end
|
672
|
+
.,.,
|
673
|
+
|
674
|
+
module_eval(<<'.,.,', 'parser.y', 203)
|
675
|
+
def _reduce_54(val, _values, result)
|
676
|
+
result = [val.first, val[1]]
|
677
|
+
result
|
678
|
+
end
|
679
|
+
.,.,
|
680
|
+
|
681
|
+
# reduce 55 omitted
|
682
|
+
|
683
|
+
module_eval(<<'.,.,', 'parser.y', 207)
|
684
|
+
def _reduce_56(val, _values, result)
|
685
|
+
result = :equal
|
686
|
+
result
|
687
|
+
end
|
688
|
+
.,.,
|
689
|
+
|
690
|
+
module_eval(<<'.,.,', 'parser.y', 208)
|
691
|
+
def _reduce_57(val, _values, result)
|
692
|
+
result = :prefix_match
|
693
|
+
result
|
694
|
+
end
|
695
|
+
.,.,
|
696
|
+
|
697
|
+
module_eval(<<'.,.,', 'parser.y', 209)
|
698
|
+
def _reduce_58(val, _values, result)
|
699
|
+
result = :suffix_match
|
700
|
+
result
|
701
|
+
end
|
702
|
+
.,.,
|
703
|
+
|
704
|
+
module_eval(<<'.,.,', 'parser.y', 210)
|
705
|
+
def _reduce_59(val, _values, result)
|
706
|
+
result = :substring_match
|
707
|
+
result
|
708
|
+
end
|
709
|
+
.,.,
|
710
|
+
|
711
|
+
module_eval(<<'.,.,', 'parser.y', 211)
|
712
|
+
def _reduce_60(val, _values, result)
|
713
|
+
result = :not_equal
|
714
|
+
result
|
715
|
+
end
|
716
|
+
.,.,
|
717
|
+
|
718
|
+
module_eval(<<'.,.,', 'parser.y', 212)
|
719
|
+
def _reduce_61(val, _values, result)
|
720
|
+
result = :includes
|
721
|
+
result
|
722
|
+
end
|
723
|
+
.,.,
|
724
|
+
|
725
|
+
module_eval(<<'.,.,', 'parser.y', 213)
|
726
|
+
def _reduce_62(val, _values, result)
|
727
|
+
result = :dash_match
|
728
|
+
result
|
729
|
+
end
|
730
|
+
.,.,
|
731
|
+
|
732
|
+
module_eval(<<'.,.,', 'parser.y', 217)
|
733
|
+
def _reduce_63(val, _values, result)
|
734
|
+
result = Node.new(:NOT, [val[1]])
|
735
|
+
|
736
|
+
result
|
737
|
+
end
|
738
|
+
.,.,
|
739
|
+
|
740
|
+
# reduce 64 omitted
|
741
|
+
|
742
|
+
def _reduce_none(val, _values, result)
|
743
|
+
val[0]
|
744
|
+
end
|
745
|
+
|
746
|
+
end # class GeneratedParser
|
747
|
+
end # module CSS
|
748
|
+
end # module Nokogiri
|