Commit Graph

815 Commits

Author SHA1 Message Date
Yorick Peterse d67f43508d Use #each_line instead of #lines.
IO#each_line is deprecated so lets not rely on it.
2014-09-03 22:31:54 +02:00
Yorick Peterse bd31379c85 Fixed processing of nested predicates.
This ensures that nested predicates and functions that depend on predicates are
processed correctly.
2014-09-03 20:56:07 +02:00
Yorick Peterse 3196050978 Specs for nested predicates & self axis. 2014-09-03 20:55:55 +02:00
Yorick Peterse e858b54c58 Use nested node stacks for predicates.
This ensures the current context node is set correctly when using the "self"
axis inside a path that's inside a predicate, e.g.

    foo/bar[baz/. = "something"]

Here the "self" axis should refer to foo/bar/baz, _not_ foo/bar.
2014-09-03 19:54:16 +02:00
Yorick Peterse 2b96d65103 XPath "self" axis inside predicates.
The "self" axis should use the current context node when inside a predicate.
2014-09-03 09:40:17 +02:00
Yorick Peterse 71f2b42074 Convenience methods for parsing XML/HTML. 2014-09-03 09:31:48 +02:00
Yorick Peterse efc3827865 Extended the inline JS lexer spec. 2014-09-03 09:26:12 +02:00
Yorick Peterse 49ddebf358 Tighten lexing of T_TEXT nodes.
Thanks to some heavy rubberducking with @whitequark the lexer is now a little
bit better at lexing T_TEXT nodes. For example, previously the following could
not be lexed properly:

    "foo < bar"

There might still be some tweaking to do but we're getting there.
2014-09-03 00:51:13 +02:00
Yorick Peterse 145315c26a Spec for inline JS and CDATA tags. 2014-09-03 00:34:10 +02:00
Yorick Peterse f268af5bc6 Fixed token position in the inline JS spec. 2014-09-03 00:30:27 +02:00
Yorick Peterse 868df603ab Added spec for inline JS + comments. 2014-09-03 00:26:45 +02:00
Yorick Peterse 07617a9c47 Failing spec for lexing inline Javascript. 2014-09-02 22:50:36 +02:00
Yorick Peterse 96b7296910 Ragel variable of element closing tags. 2014-09-02 22:50:21 +02:00
Yorick Peterse d92133ef43 Benchmark Oga XPath evaluation without the parser.
This gives better insight in the performance of the evaluator itself.
2014-09-02 20:55:42 +02:00
Yorick Peterse 84d6ba96c2 Benchmarks for comparing Oga with others.
This includes two benchmarks: one for parsing XML and one for evaluating XPath.
2014-09-02 20:45:23 +02:00
Benjamin Klotz 0b096dfe25 Use proper create_makefile
Using create_makefile('liboga/liboga') will compile liboga.so into
path-to-gem/lib/liboga/ and therefore require_relative in oga.rb will fail.
Therefore the right parameter for create_makefile is 'liboga' ->
path-to-gem/lib/liboga.so
2014-09-02 20:27:20 +02:00
Yorick Peterse 9649b50cc9 XML module for more easily querying using XPath. 2014-09-02 20:16:52 +02:00
Yorick Peterse ad34ab47a0 Support for binding/evaluating XPath variables. 2014-09-02 19:04:02 +02:00
Yorick Peterse 5a0e8c5480 Lexing/parsing of XPath variable references. 2014-09-02 10:52:08 +02:00
Yorick Peterse 3dcd0e4584 Compare results of the XML pull parser benchmark. 2014-09-02 10:06:09 +02:00
Yorick Peterse adb125c647 Compare results of the XML parser benchmark. 2014-09-02 10:05:11 +02:00
Yorick Peterse aad9279048 Removed a useless XML parser benchmark. 2014-09-02 10:04:20 +02:00
Yorick Peterse 69f1cd0a40 Compare results of the lexer benchmark. 2014-09-02 10:03:41 +02:00
Yorick Peterse 8bab5c70d8 Removed two useless XML lexer benchmarks. 2014-09-02 10:03:30 +02:00
Yorick Peterse c69d77109b Require benchmark-ips 2.0 or newer. 2014-09-02 09:58:14 +02:00
Yorick Peterse 5de37bdf81 Support for the XPath ">=" operator. 2014-09-01 22:45:01 +02:00
Yorick Peterse 099227901a Support for the XPath "<=" operator. 2014-09-01 22:40:50 +02:00
Yorick Peterse 6eacf74da4 Fixed comparing node equality in XPath expressions
Previously this would take the text of the entire node set, not of the first
node in the set.
2014-09-01 22:34:18 +02:00
Yorick Peterse 8884db8cb6 Support for the XPath ">" operator. 2014-09-01 22:23:35 +02:00
Yorick Peterse 6b45a03cb4 Support for the XPath "<" operator. 2014-09-01 22:20:32 +02:00
Yorick Peterse e1d9e62b72 Support for the XPath "!=" operator. 2014-09-01 20:48:11 +02:00
Yorick Peterse 9e5f15787d Support for the XPath "=" operator. 2014-09-01 18:57:12 +02:00
Yorick Peterse 1a6c0f0d35 Renamed various XPath operator specs. 2014-09-01 18:50:13 +02:00
Yorick Peterse a70645fb89 Support for the XPath sub/- operator. 2014-08-29 09:41:17 +02:00
Yorick Peterse 89686b6cff Support for the XPath mul/* operator. 2014-08-29 09:36:40 +02:00
Yorick Peterse 034b360d13 Support for the XPath "mod" operator. 2014-08-29 09:31:11 +02:00
Yorick Peterse 78c8cd1323 Support for the XPath "div" operator. 2014-08-28 23:05:12 +02:00
Yorick Peterse ced7f739fc Support for the XPath "add" / "+" operator. 2014-08-28 21:18:09 +02:00
Yorick Peterse 4fa40b58cf Support for the XPath "or" operator. 2014-08-28 21:01:12 +02:00
Yorick Peterse 4f189d9218 Support for the XPath "and" operator. 2014-08-28 09:42:55 +02:00
Yorick Peterse 809ed9bfa6 Handle boolean values in the boolean() function. 2014-08-28 09:36:21 +02:00
Yorick Peterse 8fb8fb17b6 Clarified docs for floor(), ceiling() and round(). 2014-08-28 00:01:33 +02:00
Yorick Peterse 543112dcdc Support for the XPath round() function. 2014-08-28 00:00:25 +02:00
Yorick Peterse a2b8e3c954 Support for the XPath ceiling() function. 2014-08-27 23:56:43 +02:00
Yorick Peterse c8fb1ad202 Support for the XPath floor() function. 2014-08-27 23:52:23 +02:00
Yorick Peterse 27d2b6c2c3 number() spec for converting empty strings. 2014-08-27 23:52:12 +02:00
Yorick Peterse 7c68f2a49b Raise for non node sets in the sum() function.
According to the XPath spec this function *can only* take node sets, nothing
else. Lets actually enforce that.
2014-08-27 23:47:19 +02:00
Yorick Peterse ac06670c24 Better conversion of types to numbers.
The XPath number() function should also be capable of converting booleans to
numbers, something it previously was not able to do. In order to do this
reliably we can't rely on the string() function as this would make it impossible
to distinguish between literal string values and booleans. This is due to
true(), which returns a TrueClass, being converted to the string "true". This
string in turn can't be converted to a float.
2014-08-27 23:38:47 +02:00
Yorick Peterse fcb28d5ae8 Specs for various XPath evaluator helper methods. 2014-08-27 23:37:12 +02:00
Yorick Peterse 022d8e0ada Extra test for sum() for default return values. 2014-08-27 23:07:38 +02:00