diff options
author | John Wiegley <johnw@newartisans.com> | 2007-05-19 02:58:48 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:53 -0400 |
commit | bf2c8c0f486926b3c86f5f619b1d4e26cdd92188 (patch) | |
tree | 27c1fe7a41191a6c5d738c3c6c197626225e7045 /src/main.cc | |
parent | b6ab7deb63d3e3e22ecd4d6c70c6249db2ba558c (diff) | |
download | fork-ledger-bf2c8c0f486926b3c86f5f619b1d4e26cdd92188.tar.gz fork-ledger-bf2c8c0f486926b3c86f5f619b1d4e26cdd92188.tar.bz2 fork-ledger-bf2c8c0f486926b3c86f5f619b1d4e26cdd92188.zip |
Everything is working again except for predicates.
Diffstat (limited to 'src/main.cc')
-rw-r--r-- | src/main.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/main.cc b/src/main.cc index bca16cb4..0b29e253 100644 --- a/src/main.cc +++ b/src/main.cc @@ -145,15 +145,27 @@ static int read_and_report(ledger::report_t& report, int argc, char * argv[], xml::xpath_t expr(*arg); xml::document_t temp(xml::LEDGER_NODE); - xml::xpath_t::document_scope_t doc_scope(report, temp); + xml::xpath_t::context_scope_t doc_scope(report, temp); IF_INFO() { std::cout << "Value expression tree:" << std::endl; expr.dump(std::cout); std::cout << std::endl; + std::cout << "Value expression parsed was:" << std::endl; expr.print(std::cout, doc_scope); std::cout << std::endl << std::endl; + + expr.compile(doc_scope); + + std::cout << "Value expression after compiling:" << std::endl; + expr.dump(std::cout); + std::cout << std::endl; + + std::cout << "Value expression is now:" << std::endl; + expr.print(std::cout, doc_scope); + std::cout << std::endl << std::endl; + std::cout << "Result of calculation: "; } @@ -248,7 +260,7 @@ static int read_and_report(ledger::report_t& report, int argc, char * argv[], // Are we handling the expr commands? Do so now. - xml::xpath_t::document_scope_t doc_scope(report, xml_document); + xml::xpath_t::context_scope_t doc_scope(report, xml_document); if (verb == "expr") { xml::xpath_t expr(*arg); @@ -268,14 +280,13 @@ static int read_and_report(ledger::report_t& report, int argc, char * argv[], return 0; } else if (verb == "xpath") { - std::cout << "XPath parsed:" << std::endl; + std::cout << "XPath parsed:"; xml::xpath_t xpath(*arg); xpath.print(*out, doc_scope); *out << std::endl; -#if 0 - foreach (const value_t& value, xpath.find_all(xml_document, report)) { + foreach (const value_t& value, xpath.find_all(doc_scope)) { if (value.is_xml_node()) { value.as_xml_node()->print(std::cout); } else { @@ -283,7 +294,6 @@ static int read_and_report(ledger::report_t& report, int argc, char * argv[], } std::cout << std::endl; } -#endif return 0; } |