From 7797d49ed6165785a9264e1d7266c3b63e534ee2 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Mon, 31 Aug 2009 12:28:20 +0000 Subject: XPath fixes (now it should fail to compile incorrect queries) git-svn-id: http://pugixml.googlecode.com/svn/trunk@123 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixpath.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp index 8111b23..de166f4 100644 --- a/src/pugixpath.cpp +++ b/src/pugixpath.cpp @@ -1070,6 +1070,10 @@ namespace pugi m_cur_lexeme = lex_string; } + else + { + throw xpath_exception("Unrecognized token"); + } } } @@ -3496,7 +3500,15 @@ namespace pugi xpath_ast_node* parse() { - return parse_expression(); + xpath_ast_node* result = parse_expression(); + + if (m_lexer.current() != lex_none) + { + // there are still unparsed tokens left, error + throw xpath_exception("Incorrect query"); + } + + return result; } }; -- cgit v1.2.3