Commit Graph

993 Commits

Author SHA1 Message Date
Yorick Peterse e71fe3d6fa Indexing of NodeSet instances.
Similar to arrays the NodeSet class now allows one to retrieve nodes for a
given index.
2014-06-29 23:59:27 +02:00
Yorick Peterse 253575dc37 Basic docs for the NodeSet class. 2014-06-29 21:34:18 +02:00
Yorick Peterse d2e74d8a0b Specs for the NodeSet class. 2014-06-26 19:52:03 +02:00
Yorick Peterse eb9d4fbccc Changed NodeSet to behave more like an Array. 2014-06-26 09:37:54 +02:00
Yorick Peterse a98f50b63b NodeSet#push should not take node ownership. 2014-06-26 09:37:30 +02:00
Yorick Peterse 15fa7a2068 Remove explicit index tracking of NodeSet.
Instead the various nodes can use NodeSet#index (aka Array#index) instead. This
has a slight performance overhead on very large (millions) of nodes but should
be fine in most other cases.
2014-06-25 09:41:58 +02:00
Yorick Peterse 884dbd9563 Rough sketch for a NodeSet class. 2014-06-24 19:06:45 +02:00
Yorick Peterse 76d4b86525 Removed unused link from the README. 2014-06-24 00:30:40 +02:00
Yorick Peterse 9bda9dac19 Basic benchmark for the XPath parser. 2014-06-23 20:50:07 +02:00
Yorick Peterse 5259c31b36 Re-organized/cleaned up the benchmarks directory. 2014-06-23 20:49:11 +02:00
Yorick Peterse b8cc6b5031 XPath::Parser#parse returns a XPath::Node instance 2014-06-23 20:23:08 +02:00
Yorick Peterse 03be9f241c Docs on Racc operator precedence. 2014-06-23 10:36:42 +02:00
Yorick Peterse 21a0f50457 Added groups for code coverage results. 2014-06-23 09:43:41 +02:00
Yorick Peterse 96a7a40fdc Disable code coverage for JRuby specific code. 2014-06-23 09:42:14 +02:00
Yorick Peterse c840a33667 Extra tests for parsing XPath function calls. 2014-06-23 09:37:26 +02:00
Yorick Peterse d2f15e37d0 Corrected XPath operator precedence.
The previous commit didn't fully change the operator precedence according to
the XPath 1.0 specification. Also thanks to @whitequark for clearing up a few
things about Racc's operator precedence system.
2014-06-23 00:30:42 +02:00
Yorick Peterse a440d3f003 Fixed XPath operator precedence.
Apparently using multiple `left` rules with T_AND and T_OR being separate
solves this problem. Riiiiight....
2014-06-23 00:15:43 +02:00
Yorick Peterse 6a2f4fa82d Parsing support for more XPath operators.
This still messes up some tests due to botched token precedence (by the looks
of it).
2014-06-22 21:27:53 +02:00
Yorick Peterse 514c342cab Lex wildcards as T_IDENT instead of T_STAR. 2014-06-20 20:37:34 +02:00
Yorick Peterse 45db337c76 Use Array#unshift for multiple xpath call args. 2014-06-17 20:12:25 +02:00
Yorick Peterse b3ffc28cc7 Removed shift/reduce conflict in the xpath parser. 2014-06-17 20:09:44 +02:00
Yorick Peterse 497f57ccd2 Basic parser setup for XPath function calls. 2014-06-17 19:57:17 +02:00
Yorick Peterse 894de7f909 Lex all XPath expressions in a single machine.
This allows literal values such as strings and numbers to be used as function
arguments.
2014-06-17 19:56:57 +02:00
Yorick Peterse a222bccd43 Only run Travis on the master branch. 2014-06-17 19:32:02 +02:00
Yorick Peterse bb7af98257 Updated used ASTs for all XPath parser specs. 2014-06-17 18:51:33 +02:00
Yorick Peterse 2298ef618b Reworked handling of relative vs absolute XPaths. 2014-06-16 20:19:39 +02:00
Yorick Peterse a733869f53 Use (name) nodes for @foo axes. 2014-06-13 18:00:55 +02:00
Yorick Peterse ce23cce9bd Added XPath parser specs for all axes. 2014-06-13 16:20:53 +02:00
Yorick Peterse 3ff9057858 Renamed the XPath axes_spec file. 2014-06-13 09:32:46 +02:00
Yorick Peterse 99615d72f9 Simple benchmarks for the XPath lexer. 2014-06-13 00:49:24 +02:00
Yorick Peterse e75cd0ede8 Namespaced the profile directories. 2014-06-13 00:33:53 +02:00
Yorick Peterse 61d553be34 Namespaced benchmarks per parser category. 2014-06-13 00:25:39 +02:00
Yorick Peterse f557aaef76 Lexer specs for the various XPath axes. 2014-06-13 00:16:40 +02:00
Yorick Peterse eba2d9954d Support for parsing basic XPath expressions. 2014-06-12 00:20:46 +02:00
Yorick Peterse 70f3b7fa92 Lex XPath operators using individual tokens.
Instead of lexing every operator as T_OP they now use individual tokens such as
T_EQ and T_LT.
2014-06-09 23:35:54 +02:00
Yorick Peterse 7244e28eec Corrected docs of the xpath lexer. 2014-06-04 19:33:46 +02:00
Yorick Peterse 114bc0d6e8 Upgrade to RSpec 3.0.
For this I've enabled both the old expectation and stubbing/mocking syntax. The
old syntax is much more compact and to me reads nicer. For example, consider
the following:

    lex('<foo></foo>').should == [...]

To me this reads much nicer than this:

    expect(lex('<foo></foo>')).to eq([...])
2014-06-02 12:09:38 +02:00
Yorick Peterse 1d2f9e6db6 Added T_STAR as an XPath parser token. 2014-06-02 09:27:25 +02:00
Yorick Peterse e11b9ed32c Basic XPath parser setup. 2014-06-01 23:02:28 +02:00
Yorick Peterse 54de2df0c7 Support for lexing XPath wildcard expressions.
To support this we need to require whitespace around the "*" operator. This is
not ideal but it will do for now.
2014-06-01 23:01:24 +02:00
Yorick Peterse 48bf1a0628 Tweak Gemspec file list a bit.
This ensures it also takes files such as "Rakefile" into account when needed.
2014-06-01 22:16:55 +02:00
Yorick Peterse b7855c124f XPath lexer test for predicates using axes. 2014-06-01 19:49:37 +02:00
Yorick Peterse 88b06e247d Added a few more XPath lexer tests. 2014-06-01 19:43:36 +02:00
Yorick Peterse 8dd8d7a519 Basic working XPath lexer.
This doesn't lex everything of the XPath specification just yet and needs more
tests.
2014-06-01 19:24:35 +02:00
Yorick Peterse a50b76a2d8 Cleaned up XPath lexer boilerplate a bit. 2014-05-29 19:25:49 +02:00
Yorick Peterse e0b07332d9 Boilerplate for the XPath lexer. 2014-05-29 19:25:49 +02:00
Yorick Peterse be3f8fb494 Removed the on_newline XML lexer callback. 2014-05-29 14:21:48 +02:00
Yorick Peterse ead5c71fee Cleaned up the XML parser grammar.
This resolves all shift/reduce and reduce/reduce conflicts that were previously
present.
2014-05-29 01:37:19 +02:00
Yorick Peterse 49780e2b04 Fix for useless XML parser rules.
Something tells me that using : and | in your syntax might not be the best
decision.
2014-05-28 21:36:06 +02:00
Yorick Peterse 28edc7726f Rewind IO input upon resetting the lexer. 2014-05-26 00:33:20 +02:00