summaryrefslogtreecommitdiff
path: root/src/pugixpath.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-29 15:10:08 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-08-29 15:10:08 +0000
commit4662bc9e74ab8077e9252c11df3976dcb7b591bd (patch)
treeb9003e45c98c148be73647d076c438c2995ca362 /src/pugixpath.cpp
parent9b6dc1a5856229a0dfe1fb5838c1a1e2ea02cb6d (diff)
XPath: Minor parsing refactoring
git-svn-id: http://pugixml.googlecode.com/svn/trunk@641 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src/pugixpath.cpp')
-rw-r--r--src/pugixpath.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp
index e0ab730..f6b0875 100644
--- a/src/pugixpath.cpp
+++ b/src/pugixpath.cpp
@@ -3369,6 +3369,18 @@ namespace pugi
return result;
}
+
+ static xpath_ast_node* parse(const char_t* query, xpath_allocator& alloc, xpath_parse_result* result)
+ {
+ result->error = 0;
+ result->offset = 0;
+
+ xpath_parser parser(query, alloc, result);
+
+ int error = setjmp(parser.m_error_handler);
+
+ return (error == 0) ? parser.parse() : 0;
+ }
};
const char* xpath_parse_result::description() const
@@ -3379,23 +3391,11 @@ namespace pugi
xpath_query::xpath_query(const char_t* query): m_alloc(0), m_root(0)
{
m_alloc = new xpath_allocator;
+ m_root = xpath_parser::parse(query, *m_alloc, &_result);
- xpath_parser parser(query, *m_alloc, &_result);
-
- int error = setjmp(parser.m_error_handler);
-
- if (error == 0)
- {
- m_root = parser.parse();
-
- _result.error = 0;
- _result.offset = 0;
- }
- else
+ if (!m_root)
{
delete m_alloc;
-
- m_root = 0;
m_alloc = 0;
#ifndef PUGIXML_NO_EXCEPTIONS