Revert "Lex XPath axes without a node test."

Upon further investigation this change turned out to be useless. Nokogiri/libxml
does not allow the use of long axes without tests, instead it ends up
lexing/parsing such a value as a simple node test.

This reverts commit f699b0d097.
This commit is contained in:
Yorick Peterse 2014-07-22 15:53:00 +02:00
parent c43c38fab9
commit 4142504101
2 changed files with 9 additions and 23 deletions

View File

@ -219,7 +219,11 @@ module Oga
| 'parent' | 'parent'
| 'preceding' | 'preceding'
| 'preceding-sibling' | 'preceding-sibling'
| 'self'); | 'self') '::';
action emit_axis_full {
emit(:T_AXIS, ts, te - 2)
}
# Short Axes # Short Axes
# #
@ -302,10 +306,7 @@ module Oga
string => emit_string; string => emit_string;
integer => emit_integer; integer => emit_integer;
float => emit_float; float => emit_float;
axis_full => emit_axis_full;
axis_full => { emit(:T_AXIS, ts, te) };
axis_full '::' => { emit(:T_AXIS, ts, te - 2) };
axis_short => emit_axis_short; axis_short => emit_axis_short;
identifier => emit_identifier; identifier => emit_identifier;
*|; *|;

View File

@ -44,21 +44,6 @@ describe Oga::XPath::Parser do
) )
end end
example 'parse the descendant-or-self axis without a test' do
parse_xpath('/descendant-or-self').should == s(
:absolute_path,
s(:axis, 'descendant-or-self')
)
end
example 'parse the descendant-or-self axis followed by an attribute axis' do
parse_xpath('/descendant-or-self/attribute::foo').should == s(
:absolute_path,
s(:axis, 'descendant-or-self'),
s(:axis, 'attribute', s(:test, nil, 'foo'))
)
end
example 'parse the following axis' do example 'parse the following axis' do
parse_xpath('/following::A').should == s( parse_xpath('/following::A').should == s(
:absolute_path, :absolute_path,