nokogiri 1.5.2 → 1.5.3.rc2

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.

@@ -1,3 +1,18 @@
1
+ == 1.5.3 / unreleased
2
+
3
+ * Bugfixes
4
+
5
+ * Custom xpath functions with empty nodeset arguments cause a segfault. #634.
6
+ * Nokogiri::XML::Node#css now works for XML documents with default
7
+ namespaces when the rule contains attribute selector without
8
+ namespace.
9
+
10
+
11
+ == 1.5.2 / 2012-03-09
12
+
13
+ Repackaging of 1.5.1 with a gemspec that is compatible with older Rubies. #631, #632.
14
+
15
+
1
16
  == 1.5.1 / 2012年3月9日
2
17
 
3
18
  * 新機能
@@ -1,7 +1,18 @@
1
+ == 1.5.3 / unreleased
2
+
3
+ * Bugfixes
4
+
5
+ * Custom xpath functions with empty nodeset arguments cause a segfault. #634.
6
+ * Nokogiri::XML::Node#css now works for XML documents with default
7
+ namespaces when the rule contains attribute selector without
8
+ namespace.
9
+
10
+
1
11
  == 1.5.2 / 2012-03-09
2
12
 
3
13
  Repackaging of 1.5.1 with a gemspec that is compatible with older Rubies. #631, #632.
4
14
 
15
+
5
16
  == 1.5.1 / 2012-03-09
6
17
 
7
18
  * Features
@@ -2,11 +2,16 @@
2
2
  .gemtest
3
3
  CHANGELOG.ja.rdoc
4
4
  CHANGELOG.rdoc
5
+ C_CODING_STYLE.rdoc
5
6
  Manifest.txt
6
7
  README.ja.rdoc
7
8
  README.rdoc
9
+ ROADMAP.md
8
10
  Rakefile
11
+ STANDARD_RESPONSES.md
12
+ Y_U_NO_GEMSPEC.md
9
13
  bin/nokogiri
14
+ build_all
10
15
  ext/java/nokogiri/EncodingHandler.java
11
16
  ext/java/nokogiri/HtmlDocument.java
12
17
  ext/java/nokogiri/HtmlElementDescription.java
@@ -198,7 +203,6 @@ lib/nokogiri/xslt.rb
198
203
  lib/nokogiri/xslt/stylesheet.rb
199
204
  lib/xercesImpl.jar
200
205
  lib/xsd/xmlparser/nokogiri.rb
201
- nokogiri_help_responses.md
202
206
  tasks/cross_compile.rb
203
207
  tasks/nokogiri.org.rb
204
208
  tasks/test.rb
@@ -228,7 +232,9 @@ test/files/staff.dtd
228
232
  test/files/staff.xml
229
233
  test/files/staff.xslt
230
234
  test/files/tlm.html
235
+ test/files/to_be_xincluded.xml
231
236
  test/files/valid_bar.xml
237
+ test/files/xinclude.xml
232
238
  test/helper.rb
233
239
  test/html/sax/test_parser.rb
234
240
  test/html/sax/test_parser_context.rb
@@ -256,6 +262,7 @@ test/xml/sax/test_push_parser.rb
256
262
  test/xml/test_attr.rb
257
263
  test/xml/test_attribute_decl.rb
258
264
  test/xml/test_builder.rb
265
+ test/xml/test_c14n.rb
259
266
  test/xml/test_cdata.rb
260
267
  test/xml/test_comment.rb
261
268
  test/xml/test_document.rb
@@ -271,9 +278,9 @@ test/xml/test_namespace.rb
271
278
  test/xml/test_node.rb
272
279
  test/xml/test_node_attributes.rb
273
280
  test/xml/test_node_encoding.rb
281
+ test/xml/test_node_inheritance.rb
274
282
  test/xml/test_node_reparenting.rb
275
283
  test/xml/test_node_set.rb
276
- test/xml/test_node_inheritance.rb
277
284
  test/xml/test_parse_options.rb
278
285
  test/xml/test_processing_instruction.rb
279
286
  test/xml/test_reader_encoding.rb
@@ -282,6 +289,8 @@ test/xml/test_schema.rb
282
289
  test/xml/test_syntax_error.rb
283
290
  test/xml/test_text.rb
284
291
  test/xml/test_unparented_node.rb
292
+ test/xml/test_xinclude.rb
285
293
  test/xml/test_xpath.rb
286
294
  test/xslt/test_custom_functions.rb
287
295
  test/xslt/test_exception_handling.rb
296
+ test_all
@@ -0,0 +1,65 @@
1
+ # Roadmap for 2.0
2
+
3
+ ## overhaul serialize/pretty printing API
4
+
5
+ * https://github.com/tenderlove/nokogiri/issues/530
6
+ XHTML formatting can't be turned off
7
+
8
+ * https://github.com/tenderlove/nokogiri/issues/415
9
+ XML formatting should be no formatting
10
+
11
+
12
+ ## overhaul and optimize the SAX parsing
13
+
14
+ * see fairy wing throwdown - SAX parsing is wicked slow.
15
+
16
+
17
+ ## improve CSS query parsing
18
+
19
+ * https://github.com/tenderlove/nokogiri/issues/528
20
+ support `:not()` with a nontrivial argument, like `:not(div p.c)`
21
+
22
+ * https://github.com/tenderlove/nokogiri/issues/451
23
+ chained :not pseudoselectors
24
+
25
+ * better jQuery selector support:
26
+ * https://github.com/tenderlove/nokogiri/issues/621
27
+ * https://github.com/tenderlove/nokogiri/issues/342
28
+ * https://github.com/tenderlove/nokogiri/issues/628
29
+
30
+ * https://github.com/tenderlove/nokogiri/issues/394
31
+ nth-of-type is wrong, and possibly other selectors as well
32
+
33
+ * https://github.com/tenderlove/nokogiri/issues/309
34
+ incorrect query being executed
35
+
36
+ * https://github.com/tenderlove/nokogiri/issues/350
37
+ :has is wrong?
38
+
39
+
40
+ ## DocumentFragment
41
+
42
+ * there are a few tickets about searches not working properly if you
43
+ use or do not use the context node as part of the search.
44
+ - https://github.com/tenderlove/nokogiri/issues/213
45
+ - https://github.com/tenderlove/nokogiri/issues/370
46
+ - https://github.com/tenderlove/nokogiri/issues/454
47
+ - https://github.com/tenderlove/nokogiri/issues/572
48
+
49
+
50
+ ## Better Syntax for custom XPath function handler
51
+
52
+ * https://github.com/tenderlove/nokogiri/pull/464
53
+
54
+
55
+ ## Encoding
56
+
57
+ We have a lot of issues open around encoding. Is this really an issue?
58
+ Somebody who knows something about encoding, and cares, should point
59
+ this one.
60
+
61
+
62
+ ## Reader
63
+
64
+ It's fundamentally broken, in that we can't stop people from crashing
65
+ their application if they want to use object reference unsafely.
@@ -1,4 +1,10 @@
1
- # not-enough-information
1
+ # Standard Responses to Requests
2
+
3
+ These responses are needed often enough that I figured, let's just
4
+ check them in for future reference and use.
5
+
6
+
7
+ # Not enough information to help
2
8
 
3
9
  Hello!
4
10
 
@@ -22,7 +28,8 @@ take a look at http://bit.ly/nokohelp
22
28
 
23
29
  Thank you so much!
24
30
 
25
- # not-a-bug
31
+
32
+ # Not a bug
26
33
 
27
34
  Hello!
28
35
 
@@ -0,0 +1,155 @@
1
+ (note: this was originally a blog post published at http://blog.flavorjon.es/2012/03/y-u-no-gemspec.html)
2
+
3
+ ## tl;dr
4
+
5
+ 1. Team Nokogiri are not 10-foot-tall code-crunching robots, so `master` is usually unstable.
6
+ 2. Unstable code can corrupt your data and crash your application, which would make everybody look bad.
7
+ 3. Therefore, the _risk_ associated with using unstable code is severe; for you _and_ for Team Nokogiri.
8
+ 4. The absence of a gemspec is a risk mitigation tactic.
9
+ 5. You can always ask for an RC release.
10
+
11
+
12
+ ## Why Isn't There a Gemspec!?
13
+
14
+ OHAI! Thank you for asking this question!
15
+
16
+ Team Nokogiri gets asked this pretty frequently. Just a sample from
17
+ the historical record:
18
+
19
+ * [Issue #274](https://github.com/tenderlove/nokogiri/issues/274)
20
+ * [Issue #371](https://github.com/tenderlove/nokogiri/issues/371)
21
+ * [A commit removing nokogiri.gemspec](https://github.com/tenderlove/nokogiri/commit/7f17a643a05ca381d65131515b54d4a3a61ca2e1#commitcomment-667477)
22
+ * [A nokogiri-talk thread](http://groups.google.com/group/nokogiri-talk/browse_thread/thread/4706b002e492d23f)
23
+ * [Another nokogiri-talk thread](http://groups.google.com/group/nokogiri-talk/browse_thread/thread/0b201bb80ea3eea0)
24
+
25
+ Sometimes people imply that we've forgotten, or that we don't how to
26
+ properly manage our codebase. Those people are super fun to respond
27
+ to!
28
+
29
+ We've gone back and forth a couple of times over the past few years,
30
+ but the current policy of Team Nokogiri is to **not** provide a
31
+ gemspec in the Github repo. This is a conscious choice, not an
32
+ oversight.
33
+
34
+
35
+ ## But You Didn't Answer the Question!
36
+
37
+ Ah, I was hoping you wouldn't notice. Well, OK, let's do this, if
38
+ you're serious about it.
39
+
40
+ I'd like to start by talking about _risk_. Specifically, the risk
41
+ associated with using a known-unstable version of Nokogiri.
42
+
43
+
44
+ ### Risk
45
+
46
+ One common way to evaluate the _risk_ of an incident is:
47
+
48
+ risk = probability x impact
49
+
50
+ You can read more about this on [the internets](http://en.wikipedia.org/wiki/Risk_Matrix).
51
+
52
+ The _risk_ associated with a Nokogiri bug could be loosely defined by
53
+ answering the questions:
54
+
55
+ * "How likely is it that a bug exists?" (probability)
56
+ * "How severe will the consequences of a bug be?" (impact)
57
+
58
+
59
+ ### Probability
60
+
61
+ The `master` branch should be considered unstable. Team Nokogiri are
62
+ not 10-foot-tall code-crunching robots; we are humans. We make
63
+ mistakes, and as a result, any arbitrary commit on `master` is likely
64
+ to contain bugs.
65
+
66
+ Just as an example, Nokogiri `master` was unstable for about five
67
+ months between November 2011 and March 2012. It was unstable not
68
+ because we were sloppy, or didn't care, but because the fixes were
69
+ hard and unobvious.
70
+
71
+ When we release Nokogiri, we test for memory leaks and invalid memory
72
+ access on all kinds of platforms with many flavors of Ruby and lots of
73
+ versions of libxml2. Because these tests are time-consuming, we don't
74
+ run them on every commit. We run them often when preparing a release.
75
+
76
+ If we're releasing Nokogiri, it means we think it's rock solid.
77
+
78
+ And if we're not releasing it, it means there are probably bugs.
79
+
80
+
81
+ ### Impact
82
+
83
+ Nokogiri is a gem with native extensions. This means it's not pure
84
+ Ruby -- there's C or Java code being compiled and run, which means
85
+ that there's always a chance that the gem will crash your application,
86
+ or worse. Possible outcomes include:
87
+
88
+ * leaking memory
89
+ * corrupting data
90
+ * making benign code crash (due to memory corruption)
91
+
92
+ So, then, a bug in a native extension can have much worse downside
93
+ than you might think. It's not just going to do something unexpected;
94
+ it's possibly going to do terrible, awful things to your application
95
+ and data.
96
+
97
+ **Nobody** wants that to happen. Especially Team Nokogiri.
98
+
99
+
100
+ ### Risk, Redux
101
+
102
+ So, if you accept the equation
103
+
104
+ risk = probability x impact
105
+
106
+ and you believe me when I say that:
107
+
108
+ * the probablility of a bug in unreleased code is high, and
109
+ * the impact of a bug is likely to be severe,
110
+
111
+ then you should easily see that the _risk_ associated with a bug in
112
+ Nokogiri is quite high.
113
+
114
+ Part of Team Nokogiri's job is to try to mitigate this risk. We have a
115
+ number of tactics that we use to accomplish this:
116
+
117
+ * we respond quickly to bug reports, particularly when they are possible memory issues
118
+ * we review each others' commits
119
+ * we have a thorough test suite, and we test-drive new features
120
+ * we discuss code design and issues on a core developer mailing list
121
+ * we use valgrind to test for memory issues (leaks and invalid
122
+ access) on multiple combinations of OS, libxml2 and Ruby
123
+ * we package release candidates, and encourage devs to use them
124
+ * **we do NOT commit a gemspec in our git repository**
125
+
126
+ Yes, that's right, the absence of a gemspec is a risk mitigation
127
+ tactic. Not only does Team Nokogiri not want to imply support for
128
+ `master`, we want to **actively discourage** people from using
129
+ it. Because it's not stable.
130
+
131
+
132
+ ## But I Want to Do It Anyway
133
+
134
+ Another option, is to email the [nokogiri-talk
135
+ list](http://groups.google.com/group/nokogiri-talk) and ask for a
136
+ release candidate to be built. We're pretty accommodating if there's a
137
+ bugfix that's a blocker for you. And if we can't release an RC, we'll
138
+ tell you why.
139
+
140
+ And in the end, nothing is stopping you from cloning the repo and
141
+ generating a private gemspec. This is an extra step or two, but it has
142
+ the benefit of making sure developers have thought through the costs
143
+ and risks involved; and it tends to select for developers who know
144
+ what they're doing.
145
+
146
+
147
+ ## In Conclusion
148
+
149
+ Team Nokogiri takes stability very seriously. We want everybody who
150
+ uses Nokogiri to have a pleasant experience. And so we want to make
151
+ sure that you're using the best software we can make.
152
+
153
+ Please keep in mind that we're trying very hard to do the right thing
154
+ for all Nokogiri users out there in Rubyland. Nokogiri loves you very
155
+ much, and we hope you love it back.
@@ -0,0 +1,58 @@
1
+ #! /usr/bin/env bash
2
+ #
3
+ # script to build gems for all relevant platforms:
4
+ # - MRI et al (standard gem)
5
+ # - windows (x86-mingw32 and x86-msin32-60)
6
+ # - jruby
7
+ #
8
+ # prerequisite is the mingw32 packages.
9
+ # on ubuntu, `sudo apt-get install mingw32`
10
+ # for others, read up at https://github.com/luislavena/rake-compiler
11
+ #
12
+
13
+ # Load RVM into a shell session *as a function*
14
+ if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
15
+ source "$HOME/.rvm/scripts/rvm"
16
+ elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
17
+ source "/usr/local/rvm/scripts/rvm"
18
+ else
19
+ echo "ERROR: An RVM installation was not found.\n"
20
+ fi
21
+
22
+ function rvm_use {
23
+ current_ruby=$1
24
+ rvm use "${1}@nokogiri" --create
25
+ }
26
+
27
+ set -o errexit
28
+
29
+ # initialize
30
+ rvm_use 1.8.7
31
+ rm -rf tmp pkg
32
+ bundle exec rake clean clobber
33
+
34
+ # holding pen
35
+ rm -rf gems
36
+ mkdir -p gems
37
+
38
+ # MRI
39
+ rvm_use 1.8.7
40
+ bundle exec rake gem
41
+ cp -v pkg/nokogiri*.gem gems # should only be one at this point in the script
42
+
43
+ # windows
44
+ rvm_use 1.8.7
45
+ bundle exec rake-compiler cross-ruby VERSION=1.8.7-p330
46
+ bundle exec rake-compiler cross-ruby VERSION=1.9.2-p136
47
+ bundle exec rake cross
48
+ rake gem:windows # don't use bundler here. it blows up. *shrug*
49
+ cp -v pkg/nokogiri*x86-{mingw32,mswin32}*.gem gems
50
+
51
+ # jruby
52
+ rvm_use jruby-1.6.5
53
+ bundle exec rake clean clobber
54
+ rvm_use 1.8.7
55
+ bundle exec rake generate
56
+ rvm_use jruby-1.6.5
57
+ bundle exec rake gem
58
+ cp -v pkg/nokogiri*java.gem gems
@@ -427,7 +427,7 @@ VALUE Nokogiri_wrap_xml_node_set(xmlNodeSetPtr node_set, VALUE document)
427
427
  rb_funcall(document, decorate, 1, new_set);
428
428
  }
429
429
 
430
- if (node_set->nodeTab) {
430
+ if (node_set && node_set->nodeTab) {
431
431
  for (i = 0; i < node_set->nodeNr; i++) {
432
432
  cur = node_set->nodeTab[i];
433
433
  if (cur && cur->type == XML_NAMESPACE_DECL) {
@@ -14,92 +14,94 @@ module Nokogiri
14
14
  ##### State transition tables begin ###
15
15
 
16
16
  racc_action_table = [
17
- 5, 57, 28, 23, 13, 25, 61, 58, 5, 1,
18
- 6, 60, 13, 58, 66, 24, 17, 1, 83, 20,
19
- 94, 93, 6, 13, 9, 11, 14, 20, 17, 42,
20
- 6, 5, 9, 11, 14, 13, 17, 76, 42, 5,
21
- 1, 6, 65, 13, 11, 62, 63, 17, 1, 60,
22
- 20, 5, 63, 6, 84, 9, 11, 14, 20, 17,
23
- 1, 6, 30, 9, 11, 14, 13, 17, 13, 85,
24
- 20, 1, 64, 13, 59, 9, 88, 13, 13, 89,
25
- 28, 54, 13, 55, 6, 42, 6, 11, 14, 11,
26
- 17, 6, 17, 45, 11, 6, 6, 17, 11, 11,
27
- 6, 17, 17, 11, 5, 92, 17, 69, 71, 28,
28
- 54, 22, 55, 50, 28, 54, 95, 55, 70, 72,
29
- 73, -24, 75, 20, 69, 71, 67, 97, 9, 98,
30
- nil, nil, 34, 36, 38, 70, 72, 73, nil, 75,
31
- nil, nil, 33, 67, 35, 37, 28, 54, nil, 55 ]
17
+ 5, 59, 28, 23, 12, 25, 63, 60, 5, 1,
18
+ 6, 62, 12, 60, 69, 24, 17, 1, 86, 20,
19
+ 98, 97, 6, 12, 9, 10, 14, 20, 17, 70,
20
+ 6, 5, 9, 10, 14, 12, 17, -24, 44, 5,
21
+ 1, 6, 44, 12, 10, 64, 65, 17, 1, 68,
22
+ 20, 5, 67, 6, 62, 9, 10, 14, 20, 17,
23
+ 29, 6, 31, 9, 10, 14, 12, 17, 12, 65,
24
+ 20, 1, 87, 12, 88, 9, 66, 12, 12, 61,
25
+ 28, 56, 12, 57, 6, 91, 6, 10, 14, 10,
26
+ 17, 6, 17, 92, 10, 6, 6, 17, 10, 10,
27
+ 6, 17, 17, 10, 5, 44, 17, 72, 75, 28,
28
+ 56, 46, 57, 52, 28, 56, 95, 57, 73, 76,
29
+ 77, 96, 78, 20, 72, 75, 71, 22, 9, 99,
30
+ -24, 101, 36, 38, 40, 73, 76, 77, 102, 78,
31
+ nil, nil, 35, 71, 37, 39, 28, 56, nil, 57 ]
32
32
 
33
33
  racc_action_check = [
34
- 0, 21, 5, 5, 0, 5, 23, 43, 9, 0,
35
- 15, 23, 9, 21, 28, 5, 15, 9, 43, 0,
36
- 74, 74, 0, 8, 0, 0, 0, 9, 0, 40,
37
- 9, 32, 9, 9, 9, 32, 9, 30, 8, 58,
38
- 32, 8, 27, 58, 8, 25, 25, 8, 58, 54,
39
- 32, 6, 55, 32, 56, 32, 32, 32, 58, 32,
40
- 6, 58, 6, 58, 58, 58, 42, 58, 80, 57,
41
- 6, 42, 26, 10, 22, 6, 61, 19, 18, 62,
42
- 60, 60, 16, 60, 42, 12, 80, 42, 42, 80,
43
- 42, 10, 80, 11, 10, 19, 18, 10, 19, 18,
44
- 16, 19, 18, 16, 17, 68, 16, 31, 31, 20,
45
- 20, 4, 20, 17, 63, 63, 77, 63, 31, 31,
46
- 31, 1, 31, 17, 29, 29, 31, 82, 17, 89,
47
- nil, nil, 7, 7, 7, 29, 29, 29, nil, 29,
48
- nil, nil, 7, 29, 7, 7, 66, 66, nil, 66 ]
34
+ 0, 21, 5, 5, 0, 5, 23, 45, 9, 0,
35
+ 15, 23, 9, 21, 30, 5, 15, 9, 45, 0,
36
+ 79, 79, 0, 8, 0, 0, 0, 9, 0, 31,
37
+ 9, 34, 9, 9, 9, 34, 9, 29, 8, 60,
38
+ 34, 8, 42, 60, 8, 25, 25, 8, 60, 28,
39
+ 34, 6, 27, 34, 56, 34, 34, 34, 60, 34,
40
+ 6, 60, 6, 60, 60, 60, 44, 60, 83, 57,
41
+ 6, 44, 58, 19, 59, 6, 26, 18, 13, 22,
42
+ 62, 62, 16, 62, 44, 63, 83, 44, 44, 83,
43
+ 44, 19, 83, 64, 19, 18, 13, 19, 18, 13,
44
+ 16, 18, 13, 16, 17, 11, 16, 32, 32, 20,
45
+ 20, 10, 20, 17, 65, 65, 69, 65, 32, 32,
46
+ 32, 74, 32, 17, 33, 33, 32, 4, 17, 80,
47
+ 1, 85, 7, 7, 7, 33, 33, 33, 92, 33,
48
+ nil, nil, 7, 33, 7, 7, 68, 68, nil, 68 ]
49
49
 
50
50
  racc_action_pointer = [
51
- -2, 92, nil, nil, 82, -8, 49, 125, 17, 6,
52
- 67, 82, 64, nil, nil, -14, 76, 102, 72, 71,
53
- 99, 1, 63, -1, nil, 34, 49, 19, 2, 121,
54
- 12, 104, 29, nil, nil, nil, nil, nil, nil, nil,
55
- 8, nil, 60, -5, nil, nil, nil, nil, nil, nil,
56
- nil, nil, nil, nil, 37, 40, 31, 69, 37, nil,
57
- 70, 63, 72, 104, nil, nil, 136, nil, 80, nil,
58
- nil, nil, nil, nil, 10, nil, nil, 91, nil, nil,
59
- 62, nil, 104, nil, nil, nil, nil, nil, nil, 116,
60
- nil, nil, nil, nil, nil, nil, nil, nil, nil ]
51
+ -2, 101, nil, nil, 98, -8, 49, 125, 17, 6,
52
+ 100, 84, nil, 72, nil, -14, 76, 102, 71, 67,
53
+ 99, 1, 68, -1, nil, 34, 53, 29, 37, 8,
54
+ -15, 4, 104, 121, 29, nil, nil, nil, nil, nil,
55
+ nil, nil, 21, nil, 60, -5, nil, nil, nil, nil,
56
+ nil, nil, nil, nil, nil, nil, 42, 57, 49, 74,
57
+ 37, nil, 70, 72, 86, 104, nil, nil, 136, 105,
58
+ nil, nil, nil, nil, 96, nil, nil, nil, nil, 10,
59
+ 104, nil, nil, 62, nil, 108, nil, nil, nil, nil,
60
+ nil, nil, 125, nil, nil, nil, nil, nil, nil, nil,
61
+ nil, nil, nil ]
61
62
 
62
63
  racc_action_default = [
63
- -25, -23, -20, -2, -70, -70, -25, -18, -46, -25,
64
- -51, -70, -16, -55, -21, -12, -54, -70, -53, -52,
65
- -70, -70, -70, -39, -29, -37, -70, -70, -38, -58,
66
- -70, -58, -25, -5, -3, -8, -4, -7, -6, -9,
67
- -45, -11, -25, -70, -47, -19, -15, -13, -14, -50,
68
- -44, -43, -49, -48, -39, -37, -70, -70, -25, -22,
69
- -70, -70, -42, -70, -30, -31, -70, -59, -70, -64,
70
- -60, -65, -61, -62, -70, -63, -28, -70, -17, -10,
71
- -67, -69, -70, -33, -32, 99, -1, -36, -41, -70,
72
- -34, -35, -26, -56, -57, -27, -68, -66, -40 ]
64
+ -25, -23, -20, -2, -72, -72, -25, -18, -48, -25,
65
+ -72, -16, -57, -53, -21, -12, -56, -72, -55, -54,
66
+ -72, -72, -72, -41, -31, -39, -72, -72, -40, -30,
67
+ -72, -72, -60, -60, -25, -5, -3, -8, -4, -7,
68
+ -6, -9, -47, -11, -25, -72, -19, -15, -49, -13,
69
+ -14, -52, -46, -45, -51, -50, -41, -39, -72, -72,
70
+ -25, -22, -72, -72, -44, -72, -32, -33, -72, -72,
71
+ -28, -61, -66, -62, -72, -67, -63, -64, -65, -72,
72
+ -72, -17, -10, -69, -71, -72, -35, -34, 103, -1,
73
+ -38, -43, -72, -36, -37, -29, -26, -58, -59, -27,
74
+ -70, -68, -42 ]
73
75
 
74
76
  racc_goto_table = [
75
- 40, 26, 44, 41, 78, 21, 31, 46, 49, 29,
76
- 52, 53, 47, 68, 43, 77, 56, 51, 48, 39,
77
- 80, 32, 27, 82, nil, nil, nil, nil, nil, nil,
78
- 86, nil, nil, nil, 81, 79, nil, nil, nil, nil,
77
+ 42, 26, 81, 43, 33, 48, 47, 49, 51, 21,
78
+ 54, 55, 74, 80, 41, 53, 58, 50, 45, 30,
79
+ 32, 83, 34, 27, 85, nil, nil, nil, 89, nil,
80
+ nil, nil, nil, nil, nil, nil, 84, 82, nil, nil,
79
81
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
80
- nil, nil, nil, nil, nil, nil, 87, nil, nil, 90,
81
- nil, nil, 91, nil, nil, nil, nil, nil, nil, nil,
82
- nil, nil, 96 ]
82
+ nil, nil, nil, nil, nil, nil, nil, nil, 90, nil,
83
+ nil, 93, nil, nil, 94, nil, nil, nil, nil, nil,
84
+ nil, nil, nil, nil, nil, 100 ]
83
85
 
84
86
  racc_goto_check = [
85
- 7, 16, 7, 8, 2, 1, 9, 8, 7, 13,
86
- 7, 7, 10, 15, 1, 15, 16, 9, 11, 6,
87
- 5, 3, 17, 20, nil, nil, nil, nil, nil, nil,
88
- 2, nil, nil, nil, 7, 8, nil, nil, nil, nil,
87
+ 7, 17, 2, 8, 9, 7, 8, 10, 7, 1,
88
+ 7, 7, 16, 16, 6, 9, 17, 11, 1, 14,
89
+ 15, 5, 3, 18, 21, nil, nil, nil, 2, nil,
90
+ nil, nil, nil, nil, nil, nil, 7, 8, nil, nil,
89
91
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
90
- nil, nil, nil, nil, nil, nil, 16, nil, nil, 16,
91
- nil, nil, 16, nil, nil, nil, nil, nil, nil, nil,
92
- nil, nil, 7 ]
92
+ nil, nil, nil, nil, nil, nil, nil, nil, 17, nil,
93
+ nil, 17, nil, nil, 17, nil, nil, nil, nil, nil,
94
+ nil, nil, nil, nil, nil, 7 ]
93
95
 
94
96
  racc_goto_pointer = [
95
- nil, 5, -28, 14, nil, -22, 11, -8, -5, 0,
96
- -3, 3, nil, 3, nil, -16, -4, 17, nil, nil,
97
- -19 ]
97
+ nil, 9, -32, 15, nil, -23, 6, -8, -5, -2,
98
+ -8, 2, nil, nil, 13, 14, -20, -4, 18, nil,
99
+ nil, -20 ]
98
100
 
99
101
  racc_goto_default = [
100
- nil, nil, 3, nil, 7, 8, nil, 12, nil, 15,
101
- 16, 18, 19, 2, 4, nil, nil, nil, 10, 74,
102
- nil ]
102
+ nil, nil, 3, nil, 7, 8, nil, 11, nil, 15,
103
+ 16, 18, 19, 2, 4, nil, nil, nil, nil, 13,
104
+ 79, nil ]
103
105
 
104
106
  racc_reduce_table = [
105
107
  0, 0, :racc_error,
@@ -131,51 +133,53 @@ racc_reduce_table = [
131
133
  4, 42, :_reduce_26,
132
134
  4, 42, :_reduce_27,
133
135
  3, 42, :_reduce_28,
134
- 2, 40, :_reduce_29,
135
- 3, 40, :_reduce_30,
136
- 3, 40, :_reduce_31,
136
+ 3, 46, :_reduce_29,
137
+ 1, 46, :_reduce_30,
138
+ 2, 40, :_reduce_31,
137
139
  3, 40, :_reduce_32,
138
140
  3, 40, :_reduce_33,
139
- 3, 47, :_reduce_34,
140
- 3, 47, :_reduce_35,
141
- 3, 47, :_reduce_36,
142
- 1, 47, :_reduce_none,
143
- 1, 47, :_reduce_none,
144
- 1, 47, :_reduce_39,
145
- 4, 48, :_reduce_40,
146
- 3, 48, :_reduce_41,
147
- 2, 48, :_reduce_42,
148
- 2, 41, :_reduce_43,
149
- 2, 41, :_reduce_44,
141
+ 3, 40, :_reduce_34,
142
+ 3, 40, :_reduce_35,
143
+ 3, 48, :_reduce_36,
144
+ 3, 48, :_reduce_37,
145
+ 3, 48, :_reduce_38,
146
+ 1, 48, :_reduce_none,
147
+ 1, 48, :_reduce_none,
148
+ 1, 48, :_reduce_41,
149
+ 4, 49, :_reduce_42,
150
+ 3, 49, :_reduce_43,
151
+ 2, 49, :_reduce_44,
152
+ 2, 41, :_reduce_45,
153
+ 2, 41, :_reduce_46,
150
154
  1, 37, :_reduce_none,
151
155
  0, 37, :_reduce_none,
152
- 2, 38, :_reduce_47,
153
- 2, 38, :_reduce_48,
154
156
  2, 38, :_reduce_49,
155
157
  2, 38, :_reduce_50,
158
+ 2, 38, :_reduce_51,
159
+ 2, 38, :_reduce_52,
156
160
  1, 38, :_reduce_none,
157
161
  1, 38, :_reduce_none,
158
162
  1, 38, :_reduce_none,
159
163
  1, 38, :_reduce_none,
160
- 1, 49, :_reduce_55,
161
- 2, 46, :_reduce_56,
162
- 2, 46, :_reduce_57,
163
- 0, 46, :_reduce_none,
164
- 1, 50, :_reduce_59,
165
- 1, 50, :_reduce_60,
166
- 1, 50, :_reduce_61,
167
- 1, 50, :_reduce_62,
168
- 1, 50, :_reduce_63,
169
- 1, 50, :_reduce_64,
170
- 1, 50, :_reduce_65,
171
- 3, 39, :_reduce_66,
172
- 1, 51, :_reduce_none,
173
- 2, 51, :_reduce_none,
174
- 1, 51, :_reduce_none ]
175
-
176
- racc_reduce_n = 70
177
-
178
- racc_shift_n = 99
164
+ 1, 50, :_reduce_57,
165
+ 2, 47, :_reduce_58,
166
+ 2, 47, :_reduce_59,
167
+ 0, 47, :_reduce_none,
168
+ 1, 51, :_reduce_61,
169
+ 1, 51, :_reduce_62,
170
+ 1, 51, :_reduce_63,
171
+ 1, 51, :_reduce_64,
172
+ 1, 51, :_reduce_65,
173
+ 1, 51, :_reduce_66,
174
+ 1, 51, :_reduce_67,
175
+ 3, 39, :_reduce_68,
176
+ 1, 52, :_reduce_none,
177
+ 2, 52, :_reduce_none,
178
+ 1, 52, :_reduce_none ]
179
+
180
+ racc_reduce_n = 72
181
+
182
+ racc_shift_n = 103
179
183
 
180
184
  racc_token_table = {
181
185
  false => 0,
@@ -277,6 +281,7 @@ Racc_token_to_s_table = [
277
281
  "class",
278
282
  "namespaced_ident",
279
283
  "namespace",
284
+ "attrib_name",
280
285
  "attrib_val_0or1",
281
286
  "expr",
282
287
  "an_plus_b",
@@ -459,19 +464,23 @@ def _reduce_28(val, _values, result)
459
464
  end
460
465
 
461
466
  def _reduce_29(val, _values, result)
462
- result = Node.new(:FUNCTION, [val.first.strip])
467
+ result = Node.new(:ELEMENT_NAME,
468
+ [[val.first, val.last].compact.join(':')]
469
+ )
463
470
 
464
471
  result
465
472
  end
466
473
 
467
474
  def _reduce_30(val, _values, result)
468
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
475
+ # Default namespace is not applied to attributes.
476
+ # So we don't add prefix "xmlns:" as in namespaced_ident.
477
+ result = Node.new(:ELEMENT_NAME, [val.first])
469
478
 
470
479
  result
471
480
  end
472
481
 
473
482
  def _reduce_31(val, _values, result)
474
- result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
483
+ result = Node.new(:FUNCTION, [val.first.strip])
475
484
 
476
485
  result
477
486
  end
@@ -489,12 +498,14 @@ def _reduce_33(val, _values, result)
489
498
  end
490
499
 
491
500
  def _reduce_34(val, _values, result)
492
- result = [val.first, val.last]
501
+ result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
502
+
493
503
  result
494
504
  end
495
505
 
496
506
  def _reduce_35(val, _values, result)
497
- result = [val.first, val.last]
507
+ result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
508
+
498
509
  result
499
510
  end
500
511
 
@@ -503,11 +514,21 @@ def _reduce_36(val, _values, result)
503
514
  result
504
515
  end
505
516
 
506
- # reduce 37 omitted
517
+ def _reduce_37(val, _values, result)
518
+ result = [val.first, val.last]
519
+ result
520
+ end
521
+
522
+ def _reduce_38(val, _values, result)
523
+ result = [val.first, val.last]
524
+ result
525
+ end
526
+
527
+ # reduce 39 omitted
507
528
 
508
- # reduce 38 omitted
529
+ # reduce 40 omitted
509
530
 
510
- def _reduce_39(val, _values, result)
531
+ def _reduce_41(val, _values, result)
511
532
  if val[0] == 'even'
512
533
  val = ["2","n","+","0"]
513
534
  result = Node.new(:AN_PLUS_B, val)
@@ -525,7 +546,7 @@ def _reduce_39(val, _values, result)
525
546
  result
526
547
  end
527
548
 
528
- def _reduce_40(val, _values, result)
549
+ def _reduce_42(val, _values, result)
529
550
  if val[1] == 'n'
530
551
  result = Node.new(:AN_PLUS_B, val)
531
552
  else
@@ -535,7 +556,7 @@ def _reduce_40(val, _values, result)
535
556
  result
536
557
  end
537
558
 
538
- def _reduce_41(val, _values, result)
559
+ def _reduce_43(val, _values, result)
539
560
  # n+3, -n+3
540
561
  if val[0] == 'n'
541
562
  val.unshift("1")
@@ -551,7 +572,7 @@ def _reduce_41(val, _values, result)
551
572
  result
552
573
  end
553
574
 
554
- def _reduce_42(val, _values, result)
575
+ def _reduce_44(val, _values, result)
555
576
  if val[1] == 'n'
556
577
  val << "+"
557
578
  val << "0"
@@ -563,116 +584,116 @@ def _reduce_42(val, _values, result)
563
584
  result
564
585
  end
565
586
 
566
- def _reduce_43(val, _values, result)
587
+ def _reduce_45(val, _values, result)
567
588
  result = Node.new(:PSEUDO_CLASS, [val[1]])
568
589
 
569
590
  result
570
591
  end
571
592
 
572
- def _reduce_44(val, _values, result)
593
+ def _reduce_46(val, _values, result)
573
594
  result = Node.new(:PSEUDO_CLASS, [val[1]])
574
595
  result
575
596
  end
576
597
 
577
- # reduce 45 omitted
598
+ # reduce 47 omitted
578
599
 
579
- # reduce 46 omitted
600
+ # reduce 48 omitted
580
601
 
581
- def _reduce_47(val, _values, result)
602
+ def _reduce_49(val, _values, result)
582
603
  result = Node.new(:COMBINATOR, val)
583
604
 
584
605
  result
585
606
  end
586
607
 
587
- def _reduce_48(val, _values, result)
608
+ def _reduce_50(val, _values, result)
588
609
  result = Node.new(:COMBINATOR, val)
589
610
 
590
611
  result
591
612
  end
592
613
 
593
- def _reduce_49(val, _values, result)
614
+ def _reduce_51(val, _values, result)
594
615
  result = Node.new(:COMBINATOR, val)
595
616
 
596
617
  result
597
618
  end
598
619
 
599
- def _reduce_50(val, _values, result)
620
+ def _reduce_52(val, _values, result)
600
621
  result = Node.new(:COMBINATOR, val)
601
622
 
602
623
  result
603
624
  end
604
625
 
605
- # reduce 51 omitted
606
-
607
- # reduce 52 omitted
608
-
609
626
  # reduce 53 omitted
610
627
 
611
628
  # reduce 54 omitted
612
629
 
613
- def _reduce_55(val, _values, result)
630
+ # reduce 55 omitted
631
+
632
+ # reduce 56 omitted
633
+
634
+ def _reduce_57(val, _values, result)
614
635
  result = Node.new(:ID, val)
615
636
  result
616
637
  end
617
638
 
618
- def _reduce_56(val, _values, result)
639
+ def _reduce_58(val, _values, result)
619
640
  result = [val.first, val[1]]
620
641
  result
621
642
  end
622
643
 
623
- def _reduce_57(val, _values, result)
644
+ def _reduce_59(val, _values, result)
624
645
  result = [val.first, val[1]]
625
646
  result
626
647
  end
627
648
 
628
- # reduce 58 omitted
649
+ # reduce 60 omitted
629
650
 
630
- def _reduce_59(val, _values, result)
651
+ def _reduce_61(val, _values, result)
631
652
  result = :equal
632
653
  result
633
654
  end
634
655
 
635
- def _reduce_60(val, _values, result)
656
+ def _reduce_62(val, _values, result)
636
657
  result = :prefix_match
637
658
  result
638
659
  end
639
660
 
640
- def _reduce_61(val, _values, result)
661
+ def _reduce_63(val, _values, result)
641
662
  result = :suffix_match
642
663
  result
643
664
  end
644
665
 
645
- def _reduce_62(val, _values, result)
666
+ def _reduce_64(val, _values, result)
646
667
  result = :substring_match
647
668
  result
648
669
  end
649
670
 
650
- def _reduce_63(val, _values, result)
671
+ def _reduce_65(val, _values, result)
651
672
  result = :not_equal
652
673
  result
653
674
  end
654
675
 
655
- def _reduce_64(val, _values, result)
676
+ def _reduce_66(val, _values, result)
656
677
  result = :includes
657
678
  result
658
679
  end
659
680
 
660
- def _reduce_65(val, _values, result)
681
+ def _reduce_67(val, _values, result)
661
682
  result = :dash_match
662
683
  result
663
684
  end
664
685
 
665
- def _reduce_66(val, _values, result)
686
+ def _reduce_68(val, _values, result)
666
687
  result = Node.new(:NOT, [val[1]])
667
688
 
668
689
  result
669
690
  end
670
691
 
671
- # reduce 67 omitted
692
+ # reduce 69 omitted
672
693
 
673
- # reduce 68 omitted
694
+ # reduce 70 omitted
674
695
 
675
- # reduce 69 omitted
696
+ # reduce 71 omitted
676
697
 
677
698
  def _reduce_none(val, _values, result)
678
699
  val[0]