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
Yorick Peterse
07b52fb48a
Added Ruby::Node#not
...
This is a shortcut for "!foo". Using this method one doesn't have to
worry about how the "!" operator binds. For example, this:
!foo.or(bar)
would be parsed/evaluated as this:
!(foo.or(bar))
when instead we want it to be this:
(!foo).or(bar)
Using explicit parenthesis leads to ugly code, so now we can do this
instead:
foo.not.or(bar)
2015-08-19 20:14:22 +02:00
Yorick Peterse
4da1c637bc
Cleaned up descendant-or-self compiler specs
2015-08-19 20:14:22 +02:00
Yorick Peterse
2eb12eced6
XPath compiler support for all operators
...
Some specs still fail due to true()/false() not being implemented but
the operators themselves should work just fine.
2015-08-19 20:14:21 +02:00
Yorick Peterse
3a18d23792
to_boolean support for truthy Ruby values
2015-08-19 20:14:21 +02:00
Yorick Peterse
06ae1503d4
nodes/attributes support in to_compatible_types
...
This extends XPath::Conversion.to_compatible_types so that it can also
take XML::Node and XML::Attribute objects as input.
2015-08-19 20:14:21 +02:00
Yorick Peterse
376d016acd
Expanded supported input for Conversion.to_float
...
This extends XPath::Conversion.to_float so it can also convert NodeSet
and Node instances.
2015-08-19 20:14:21 +02:00
Yorick Peterse
8a82cc3593
XPath compiler support for the "=" operator
2015-08-19 20:14:21 +02:00
Yorick Peterse
04aa8f6546
Ruby generator support for "begin" blocks
2015-08-19 20:14:21 +02:00
Yorick Peterse
92b43a7500
Renamed on_begin to on_followed_by
2015-08-19 20:14:21 +02:00
Yorick Peterse
c98ba21a87
Ruby generator support for mass assignments
2015-08-19 20:14:21 +02:00
Yorick Peterse
4f03bf19c1
XPath compiler support for "ancestor"
2015-08-19 20:14:21 +02:00
Yorick Peterse
52741a3b78
Added XML::Node#each_ancestor
...
This method can be used to walk through the ancestor tree of a Node.
2015-08-19 20:14:20 +02:00
Yorick Peterse
db39b25546
XPath compiler support for ancestor-or-self
...
This also comes with some changes to the specs as the old behaviour of
the Evaluator was incorrect. The Evaluator would bail after matching a
single node but instead it's meant to continue until it runs out of
parent nodes.
2015-08-19 20:14:20 +02:00
Yorick Peterse
d8fbaf75d8
Ruby generator support for while loops
2015-08-19 20:14:20 +02:00
Yorick Peterse
7fdf8d7460
Rewrote XPath compiler predicate specs
2015-08-19 20:14:20 +02:00
Yorick Peterse
6f6151fd52
Added Ruby generator support for Symbols
2015-08-19 20:14:20 +02:00
Yorick Peterse
cf2405998b
Ruby::Generator support for #[] methods
2015-08-19 20:14:20 +02:00
Yorick Peterse
2c1b4e7cbc
Support for generating "else" statements
2015-08-19 20:14:20 +02:00
Yorick Peterse
ac6c0d806e
Updated XPath variables spec to use the compiler
2015-08-19 20:14:20 +02:00
Yorick Peterse
94f7f85dc3
Added XML::Document#root_node
2015-08-19 20:14:20 +02:00
Yorick Peterse
a7744b7a5c
Use the XPath compiler for XPath/CSS specs
2015-08-19 20:14:20 +02:00
Yorick Peterse
3300a6df49
Added XPath::Compiler.compile_with_cache
2015-08-19 20:14:20 +02:00
Yorick Peterse
6d01adafc7
XPath compiler now actually returns a Proc
2015-08-19 20:14:20 +02:00
Yorick Peterse
6daff674d9
Use "parse" instead of "parse_xml"
2015-08-19 20:14:20 +02:00
Yorick Peterse
337d126264
Added Ruby::Generator class
...
This class will be used to serialize a Ruby AST back to valid Ruby
source code (as a String).
2015-08-19 20:14:20 +02:00
Yorick Peterse
6673f176d8
Added Oga::Ruby::Node
...
This class will be used for building Ruby ASTs that will be generated
based on XPath expressions.
2015-08-19 20:14:20 +02:00
Yorick Peterse
08c965bfbc
Basic specs for the XPath compiler
2015-08-19 20:14:19 +02:00
Daniel Fockler
496811a23f
Fixes #127
2015-08-14 16:15:49 -07:00
Jakub Pawlowicz
ed3cbe7975
Fixes #129 - lexing superfluous end tags.
...
Prevents a superfluous end tag of a self-closing HTML tag from
closing its parent element prematurely, for example:
```html
<object><param></param><param></param></object>
```
(note <param> is self closing) being turned into:
```html
<object><param/></object><param/>
```
2015-07-23 13:16:11 +01:00