Commit Graph

1135 Commits

Author SHA1 Message Date
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 ec19875530 XPath compiler support for substring-before() 2015-08-19 20:14:23 +02:00
Yorick Peterse eeab14af4d XPath compiler support for substring-after() 2015-08-19 20:14:23 +02:00
Yorick Peterse d6b3461a9a XPath compiler support for string() 2015-08-19 20:14:23 +02:00
Yorick Peterse 728bd45e48 XPath compiler support for string-length() 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 37a410a012 XPath compiler support for starts-with() 2015-08-19 20:14:23 +02:00
Yorick Peterse 64d9ecfd53 XPath compiler support for number() 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 43dab548e9 XPath compiler support for not() 2015-08-19 20:14:23 +02:00
Yorick Peterse 2585fbd0b7 XPath compiler support for normalize-space() 2015-08-19 20:14:23 +02:00
Yorick Peterse e677a5abdf XPath compiler support for namespace-uri() 2015-08-19 20:14:23 +02:00
Yorick Peterse 9cb589cb34 XPath compiler support for name() 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 25e2f57a8d XPath compiler support for local-name() 2015-08-19 20:14:23 +02:00
Yorick Peterse 49a7c2c782 Fixed incorrect spelling of "predicate" 2015-08-19 20:14:23 +02:00
Yorick Peterse db93f845f3 Renamed on_predicate methods
This ensures they all start with "on_predicate".
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 49196c285f XPath compiler support for lang() 2015-08-19 20:14:23 +02:00
Yorick Peterse eb6cf68140 Tidied up YARD documentation of the XPath compiler 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 7bcd462e22 XPath compiler support for id()
This has been largely ported over from the Evaluator implementation.
2015-08-19 20:14:22 +02:00
Yorick Peterse 2ff1f9ab4f XPath compiler support for a bucket of functions
This includes the following functions:

* boolean()
* ceiling()
* floor()
* round()
* concat()
* contains()
* count()
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 f3f3c7d31c Cleaned up literal usage in the XPath compiler 2015-08-19 20:14:22 +02:00
Yorick Peterse 44bd0751bc Removed commented out code
Something something I should just get a decent debugging mode.
2015-08-19 20:14:22 +02:00
Yorick Peterse e4e777ac4a XPath compiler support for preceding-sibling 2015-08-19 20:14:22 +02:00
Yorick Peterse 7362a783b8 XPath compiler support for the preceding axis 2015-08-19 20:14:22 +02:00
Yorick Peterse 67bc338474 XPath compiler support for the namespace axis 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 4698e98632 XPath compiler support for the following axis 2015-08-19 20:14:22 +02:00
Yorick Peterse e04ca9be35 XPath compiler Support for following-sibling
This is a direct port of the same handler used in the Evaluator class.
The code is a bit rough on the edges but this will be cleaned up in
upcoming commits.
2015-08-19 20:14:22 +02:00
Yorick Peterse 02ee35122a XPath compiler support for the self axis 2015-08-19 20:14:22 +02:00
Yorick Peterse bc49af02a2 XPath compiler support for the parent axis 2015-08-19 20:14:22 +02:00
Yorick Peterse ca7930cbf4 XPath compiler support for "descendant" 2015-08-19 20:14:22 +02:00
Yorick Peterse f8671a96b7 Fixed compiler support for descendant-or-self 2015-08-19 20:14:22 +02:00
Yorick Peterse 23379d6467 Fixed node() type test for the XPath compiler
This ensures the handler behaves the same as in the old XPath evaluator.
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 8a49d9c0ee Basic compiler support for descendant-or-self
The generated code isn't entirely correct which considering the tests do
pass means the tests need to be fixed too.
2015-08-19 20:14:22 +02:00
Yorick Peterse d50f89cdf1 Use "node" for axis variables
This ensures that any nested code uses the right variables.
2015-08-19 20:14:22 +02:00
Yorick Peterse 045cfe4ab8 XPath compiler support for operators in predicates
Previously the operator methods would ignore any blocks set by the
on_predicate family of methods.
2015-08-19 20:14:22 +02:00
Yorick Peterse aa8386e6f3 Cleaned up compiler handling of axes/calls
Function call handlers don't receive a single AST node, instead they
receive the XPath arguments as separate method arguments.
2015-08-19 20:14:21 +02:00
Yorick Peterse bfc970a95a XPath compiler support for type tests 2015-08-19 20:14:21 +02:00
Yorick Peterse ef59f160c7 XPath compiler support for true()/false() 2015-08-19 20:14:21 +02:00