mirror of
https://github.com/zeux/pugixml.git
synced 2025-01-14 09:57:57 +08:00
XPath: Improve error message for expressions like .[1]
W3C specification does not allow predicates after abbreviated steps. Currently this results in parsing terminating at the step, which leads to confusing error messages like "Invalid query" or "Unmatched braces".
This commit is contained in:
parent
bc1e444694
commit
1ed6d2102b
@ -11398,12 +11398,18 @@ PUGI__NS_BEGIN
|
||||
{
|
||||
_lexer.next();
|
||||
|
||||
if (_lexer.current() == lex_open_square_brace)
|
||||
return error("Predicates are not allowed after an abbreviated step");
|
||||
|
||||
return alloc_node(ast_step, set, axis_self, nodetest_type_node, 0);
|
||||
}
|
||||
else if (_lexer.current() == lex_double_dot)
|
||||
{
|
||||
_lexer.next();
|
||||
|
||||
if (_lexer.current() == lex_open_square_brace)
|
||||
return error("Predicates are not allowed after an abbreviated step");
|
||||
|
||||
return alloc_node(ast_step, set, axis_parent, nodetest_type_node, 0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user