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
This commit is contained in:
arseny.kapoulkine 2009-08-31 12:28:20 +00:00
parent 0eb2da4686
commit 7797d49ed6

View File

@ -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;
}
};