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.
This commit is contained in:
parent
a440d3f003
commit
d2f15e37d0
|
@ -12,8 +12,10 @@ options no_result_var
|
||||||
|
|
||||||
prechigh
|
prechigh
|
||||||
left T_PIPE T_MOD T_DIV T_MUL T_SUB T_ADD
|
left T_PIPE T_MOD T_DIV T_MUL T_SUB T_ADD
|
||||||
left T_GT T_GTE T_LT T_LTE T_NEQ T_EQ
|
left T_LT T_LTE T_GT T_GTE
|
||||||
left T_AND T_OR
|
left T_EQ T_NEQ
|
||||||
|
left T_AND
|
||||||
|
left T_OR
|
||||||
preclow
|
preclow
|
||||||
|
|
||||||
rule
|
rule
|
||||||
|
|
|
@ -94,9 +94,9 @@ describe Oga::XPath::Parser do
|
||||||
parse_xpath('A or B and C').should == s(
|
parse_xpath('A or B and C').should == s(
|
||||||
:path,
|
:path,
|
||||||
s(
|
s(
|
||||||
:and,
|
:or,
|
||||||
s(:or, s(:test, nil, 'A'), s(:test, nil, 'B')),
|
s(:test, nil, 'A'),
|
||||||
s(:test, nil, 'C')
|
s(:and, s(:test, nil, 'B'), s(:test, nil, 'C'))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -116,9 +116,9 @@ describe Oga::XPath::Parser do
|
||||||
parse_xpath('A = B < C').should == s(
|
parse_xpath('A = B < C').should == s(
|
||||||
:path,
|
:path,
|
||||||
s(
|
s(
|
||||||
:lt,
|
:eq,
|
||||||
s(:eq, s(:test, nil, 'A'), s(:test, nil, 'B')),
|
s(:test, nil, 'A'),
|
||||||
s(:test, nil, 'C')
|
s(:lt, s(:test, nil, 'B'), s(:test, nil, 'C'))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue