Yorick Peterse
c713f6250f
Lexer/parser specs for CSS axes without whitespace
2015-09-04 15:13:38 +02:00
Yorick Peterse
08bc23905e
Specs for lexing CSS operators with whitespace
2015-09-04 15:08:26 +02:00
Yorick Peterse
f5425b07e0
Added magic encoding comments for Ruby 1.9
2015-09-03 11:31:02 +02:00
Yorick Peterse
37c5b819fa
Unicode support for CSS/XPath
...
Fixes #140
2015-09-03 11:21:45 +02:00
Yorick Peterse
44630c27ff
Support escaping dots in CSS identifiers
...
Escaping hash characters and whitespace is _not_ supported as neither
are valid element/attribute names (e.g. <foo#bar /> is invalid
XML/HTML).
Escaping single/double quotes also won't be supported for the time
being. It's quite a pain to get this to work right in not just CSS but
also XPath and XML/HTML, for very little gain. Should there be enough
users with an actual use case (other than "But the spec says ...!") I'll
look into this again.
Fixes #124
2015-09-02 20:18:52 +02:00
Yorick Peterse
aef7c510c2
Basic support for the CSS :not pseudo class
...
This does _not_ support element states such as DISABLED, nor does it
support the special handling of namespaces (e.g. *|*:not(*)). Instead
this selector basically acts as a negation, some examples:
:not(foo) # All but any "foo" nodes
:not(#foo) # Skips nodes with id="foo"
:not(.foo) # Skips nodes with a class "foo"
Fixes #125
2015-09-01 22:05:46 +02:00
Yorick Peterse
8b2455679f
Revamp a few more XPath compiler specs
2015-08-31 09:39:33 +02:00
Yorick Peterse
604d0d9337
Case insensitive matching of nodes
...
This re-applies the patch added in #134 to the new XPath compiler.
Fixes #135 .
2015-08-30 18:30:04 +02:00
Yorick Peterse
bb8b328f5e
Revamp compiler specs for regular paths
2015-08-30 18:26:52 +02:00
Yorick Peterse
b74f8dc1a3
Removed compiler arity spec
...
This spec isn't very useful and breaks on 1.9 due to it apparently
handling arity values differently.
2015-08-30 01:55:31 +02:00
Yorick Peterse
1b62dd3256
Revamped compiler type test specs
2015-08-30 01:45:51 +02:00
Yorick Peterse
c6df73d031
Fix eq spec to not depend on at_xpath
2015-08-30 01:20:08 +02:00
Yorick Peterse
4ad4b89860
Revamp compiler specs for "self"
...
This also includes a fix for node() so that it matches attributes.
2015-08-28 16:57:24 +02:00
Yorick Peterse
3a04b1da06
Root element spec for "preceding-sibling"
2015-08-28 16:50:34 +02:00
Yorick Peterse
e8377b360a
Revamp compiler "preceding" specs
...
This also includes some fixes to make this axis behave correctly when
evaluate relative to a document.
2015-08-28 16:49:59 +02:00
Yorick Peterse
6b2874c507
Revamped compiler "preceding-sibling" specs
2015-08-28 16:30:26 +02:00
Yorick Peterse
84a9315b24
Revamped compiler specs for "parent"
2015-08-28 16:22:49 +02:00
Yorick Peterse
07658dadb1
Added Attribute#parent
2015-08-28 16:22:42 +02:00
Yorick Peterse
d0177633f8
Revamp namespace compiler specs
2015-08-28 15:58:42 +02:00
Yorick Peterse
a1e7d2d07f
Revamp compiler "following" specs
2015-08-28 15:53:57 +02:00
Yorick Peterse
824c897467
Revamp compiler specs for following-sibling
2015-08-28 15:48:03 +02:00
Yorick Peterse
aa3fbcf522
Revamp descendant compiler specs
2015-08-28 15:29:09 +02:00
Yorick Peterse
70bea2071c
Fixed ancestor-or-self relative to attributes
...
Per libxml behaviour this axis shouldn't match attributes when using
"ancestor-or-self::*".
2015-08-27 10:49:32 +02:00
Yorick Peterse
d5aad9c1c9
Revamp descendant-or-self compiler specs
2015-08-27 10:34:25 +02:00
Yorick Peterse
8f341b40d6
Revamp child axis compiler specs
2015-08-27 09:30:53 +02:00
Yorick Peterse
ed31b9f1d3
Revamp compiler specs for the attribute axis
2015-08-26 22:51:04 +02:00
Yorick Peterse
4fb7e2f6ce
Revamped ancestor/ancestor-or-self axis specs
...
This makes it easier to get more natural spec descriptions without
having to write them entirely by hand.
2015-08-26 22:35:13 +02:00
Yorick Peterse
9899a419b7
Added Attribute#each_ancestor
2015-08-26 22:26:46 +02:00
Yorick Peterse
365a9e9fa9
Replace (path) nodes with nested nodes
...
This changes the XPath AST so that every segment in a path (e.g.
foo/bar) is parsed as a child node of the node that precedes it. For
example, take the following expression:
foo/bar
This used to be parsed into the following AST:
(path
(axis "child" (test nil "foo"))
(axis "child" (test nil "bar")))
This is now parsed into the following AST:
(axis "child"
(test nil "foo")
(axis "child"
(test nil "bar")))
This new AST is much easier to deal with in the XPath::Compiler class,
especially when trying to ensure that each segment operates on the
correct input.
This commit also fixes parsing of type tests with predicates, such as:
comment()[10]
This used to throw a parser error.
2015-08-26 10:16:48 +02:00
Yorick Peterse
37ac844ebe
Fixed spec for sum() in a predicate
...
The return value of sum() should be used as a NodeSet index, not merely
just a truthy value.
2015-08-20 00:54:06 +02:00
Yorick Peterse
94ec1b5f5d
Corrected the last() compiler spec
...
This spec didn't match the correct nodes due to `1 < last()` always
evaluating to true in this particular case.
2015-08-20 00:23:58 +02:00
Yorick Peterse
7a4cb76d39
Cleaned up XPath last() specs a bit
2015-08-19 23:05:25 +02:00
Yorick Peterse
f41f6ff0c8
Only wrap followed_by nodes in begin/end
2015-08-19 20:14:24 +02:00
Yorick Peterse
a30cdba8d0
Fixed XPath compiler support for not()
2015-08-19 20:14:24 +02:00
Yorick Peterse
8e60c69def
Added spec for not() in a predicate
2015-08-19 20:14:24 +02:00
Yorick Peterse
0dcee637d3
Added Ruby::Node#if_false
2015-08-19 20:14:24 +02:00
Yorick Peterse
4b50a161ed
Wrap all compiler assignments in begin/end
...
This is much safer than having to explicitly call "wrap" in a potential
large amount of places.
2015-08-19 20:14:24 +02:00
Yorick Peterse
aaba0049ab
Updated XPath compiler arity spec
2015-08-19 20:14:24 +02:00
Yorick Peterse
b217aab2cb
XPath compiler support for translate()
2015-08-19 20:14:24 +02:00
Yorick Peterse
106d83e780
XPath compiler support for sum()
2015-08-19 20:14:24 +02:00
Yorick Peterse
e7e5b123cf
XPath compiler support for substring()
2015-08-19 20:14:24 +02:00
Yorick Peterse
be05008be9
Added substring-after() spec for a predicate
2015-08-19 20:14:24 +02:00
Yorick Peterse
b60ed03bb4
Added substring-before() spec for a predicate
2015-08-19 20:14:24 +02:00
Yorick Peterse
32dba554d7
Ruby generator support for Ranges
2015-08-19 20:14:23 +02:00
Yorick Peterse
0e3451881b
Specs for contains/starts-with in a predicate
2015-08-19 20:14:23 +02:00
Yorick Peterse
58aa8f0833
Boolean support for Conversion.to_float
2015-08-19 20:14:23 +02:00
Yorick Peterse
d408989499
Added expanded_name for Element and Attribute
2015-08-19 20:14:23 +02:00
Yorick Peterse
c026244f6e
XPath compiler support for id() in predicates
2015-08-19 20:14:23 +02:00
Yorick Peterse
54473d9865
Allow followed_by to take a block
...
This removes the need for a lot of local variables in the Compiler
class, at the cost of some extra indentation levels.
2015-08-19 20:14:22 +02:00
Yorick Peterse
e3b45fddfc
to_float support for non String values
2015-08-19 20:14:22 +02:00