The new XPath parser has been integrated, although I have removed the

XML-related bits -- I just wanted the better infrastructure that had been
created during the rewrite.  It doesn't work, but it compiles and links now.
This means that all of the previous 3.0 code has been moved over, although
there are still snippets of code in pending/old that need to be restored.
This commit is contained in:
John Wiegley 2008-07-20 23:12:04 -04:00
parent 689df61077
commit d86a91d45b
14 changed files with 2824 additions and 1329 deletions

View file

@ -48,6 +48,7 @@ libledger_la_SOURCES = \
mask.cc \
option.cc \
parser.cc \
parsexp.cc \
qif.cc \
reconcile.cc \
report.cc \
@ -94,6 +95,7 @@ pkginclude_HEADERS = \
mask.h \
option.h \
parser.h \
parsexp.h \
qif.h \
quotes.h \
reconcile.h \

View file

@ -354,13 +354,13 @@ inline void read_transaction(const char *& data, transaction_t * xact)
}
else if (flag == 1) {
read_amount(data, xact->amount);
read_string(data, xact->amount_expr.expr);
read_string(data, xact->amount_expr.expr_str);
}
else {
expr::ptr_op_t ptr = read_value_expr(data);
assert(ptr.get());
xact->amount_expr.reset(ptr);
read_string(data, xact->amount_expr.expr);
read_string(data, xact->amount_expr.expr_str);
}
if (read_bool(data)) {
@ -912,12 +912,12 @@ void write_transaction(std::ostream& out, transaction_t * xact,
else if (xact->amount_expr) {
write_number<unsigned char>(out, 2);
write_value_expr(out, xact->amount_expr.get());
write_string(out, xact->amount_expr.expr);
write_string(out, xact->amount_expr.expr_str);
}
else if (! xact->amount_expr.expr.empty()) {
else if (! xact->amount_expr.expr_str.empty()) {
write_number<unsigned char>(out, 1);
write_amount(out, xact->amount);
write_string(out, xact->amount_expr.expr);
write_string(out, xact->amount_expr.expr_str);
}
else {
write_number<unsigned char>(out, 0);
@ -928,7 +928,7 @@ void write_transaction(std::ostream& out, transaction_t * xact,
(! (ignore_calculated && xact->has_flags(TRANSACTION_CALCULATED)))) {
write_bool(out, true);
write_amount(out, *xact->cost);
write_string(out, xact->cost_expr->expr);
write_string(out, xact->cost_expr->expr_str);
} else {
write_bool(out, false);
}

View file

@ -463,13 +463,13 @@ void format_t::format(std::ostream& out_str, const details_t& details) const
if (details.xact->cost && details.xact->amount) {
std::ostringstream stream;
if (! details.xact->amount_expr.expr.empty())
stream << details.xact->amount_expr.expr;
if (! details.xact->amount_expr.expr_str.empty())
stream << details.xact->amount_expr.expr_str;
else
stream << details.xact->amount.strip_annotations();
if (details.xact->cost_expr)
stream << details.xact->cost_expr->expr;
stream << details.xact->cost_expr->expr_str;
else
stream << " @ " << amount_t(*details.xact->cost /
details.xact->amount).unround();
@ -498,8 +498,8 @@ void format_t::format(std::ostream& out_str, const details_t& details) const
}
if (! use_disp) {
if (! details.xact->amount_expr.expr.empty())
out << details.xact->amount_expr.expr;
if (! details.xact->amount_expr.expr_str.empty())
out << details.xact->amount_expr.expr_str;
else
out << details.xact->amount.strip_annotations();
} else {
@ -828,7 +828,7 @@ void print_entry(std::ostream& out, const entry_base_t& entry_base,
}
else if (const auto_entry_t * entry =
dynamic_cast<const auto_entry_t *>(&entry_base)) {
out << "= " << entry->predicate.predicate.expr << '\n';
out << "= " << entry->predicate.predicate.expr_str << '\n';
print_format = prefix + " %-34A %12o\n";
}
else if (const period_entry_t * entry =

View file

@ -52,6 +52,7 @@
#include <csv.h>
//#include <quotes.h>
#include <valexpr.h>
#include <parsexp.h>
#include <walk.h>
#include <derive.h>
#include <reconcile.h>

2142
parsexp.cc Normal file

File diff suppressed because it is too large Load diff

280
parsexp.h Normal file
View file

@ -0,0 +1,280 @@
/*
* Copyright (c) 2003-2007, John Wiegley. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of New Artisans LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _PARSEXP_H
#define _PARSEXP_H
#include "valexpr.h"
namespace ledger {
namespace expr {
DECLARE_EXCEPTION(error, parse_error);
class parser_t
{
#define EXPR_PARSE_NORMAL 0x00
#define EXPR_PARSE_PARTIAL 0x01
#define EXPR_PARSE_RELAXED 0x02
#define EXPR_PARSE_NO_MIGRATE 0x04
#define EXPR_PARSE_NO_REDUCE 0x08
#define EXPR_PARSE_ALLOW_DATE 0x10
public:
typedef uint_least8_t flags_t;
private:
struct token_t
{
enum kind_t {
VALUE, // any kind of literal value
IDENT, // [A-Za-z_][-A-Za-z0-9_:]*
DOLLAR, // $
AT_SYM, // @
DOT, // .
DOTDOT, // ..
SLASH, // /
LPAREN, // (
RPAREN, // )
LBRACKET, // [
RBRACKET, // ]
EQUAL, // =
NEQUAL, // !=
LESS, // <
LESSEQ, // <=
GREATER, // >
GREATEREQ, // >=
MINUS, // -
PLUS, // +
STAR, // *
KW_DIV,
EXCLAM, // !
KW_AND,
KW_OR,
KW_MOD,
#if 0
PIPE, // |
KW_UNION,
#endif
COMMA, // ,
TOK_EOF,
UNKNOWN
} kind;
char symbol[3];
value_t value;
std::size_t length;
explicit token_t() : kind(UNKNOWN), length(0) {
TRACE_CTOR(token_t, "");
}
token_t(const token_t& other) {
assert(false);
TRACE_CTOR(token_t, "copy");
*this = other;
}
~token_t() {
TRACE_DTOR(token_t);
}
token_t& operator=(const token_t& other) {
if (&other == this)
return *this;
assert(false);
return *this;
}
void clear() {
kind = UNKNOWN;
length = 0;
value = NULL_VALUE;
symbol[0] = '\0';
symbol[1] = '\0';
symbol[2] = '\0';
}
void parse_ident(std::istream& in);
void next(std::istream& in, flags_t flags);
void rewind(std::istream& in);
void unexpected();
static void unexpected(char c, char wanted = '\0');
};
mutable token_t lookahead;
mutable bool use_lookahead;
token_t& next_token(std::istream& in, flags_t tflags) const
{
if (use_lookahead)
use_lookahead = false;
else
lookahead.next(in, tflags);
return lookahead;
}
void push_token(const token_t& tok) const
{
assert(&tok == &lookahead);
use_lookahead = true;
}
void push_token() const
{
use_lookahead = true;
}
public:
value_expr expr;
private:
ptr_op_t parse_value_term(std::istream& in, scope_t& scope,
const flags_t flags) const;
#if 0
ptr_op_t parse_predicate_expr(std::istream& in, scope_t& scope,
const flags_t flags) const;
ptr_op_t parse_path_expr(std::istream& in, scope_t& scope,
const flags_t flags) const;
#endif
ptr_op_t parse_unary_expr(std::istream& in, scope_t& scope,
const flags_t flags) const;
#if 0
ptr_op_t parse_union_expr(std::istream& in, scope_t& scope,
const flags_t flags) const;
#endif
ptr_op_t parse_mul_expr(std::istream& in, scope_t& scope,
const flags_t flags) const;
ptr_op_t parse_add_expr(std::istream& in, scope_t& scope,
const flags_t flags) const;
ptr_op_t parse_logic_expr(std::istream& in, scope_t& scope,
const flags_t flags) const;
ptr_op_t parse_and_expr(std::istream& in, scope_t& scope,
const flags_t flags) const;
ptr_op_t parse_or_expr(std::istream& in, scope_t& scope,
const flags_t flags) const;
ptr_op_t parse_querycolon_expr(std::istream& in, scope_t& scope,
const flags_t flags) const;
ptr_op_t parse_value_expr(std::istream& in, scope_t& scope,
const flags_t flags) const;
void parse_expr(std::istream& in, string& str,
scope_t& scope, const flags_t flags) {
try {
ptr_op_t top_node = parse_value_expr(in, scope, flags);
expr = value_expr(top_node, str);
#if 0
// jww (2008-07-20): This code should no longer be needed, since we
// can't re-use parser_t anymore.
if (use_lookahead) {
use_lookahead = false;
#ifdef THREADSAFE
lookahead.rewind(in);
#else
lookahead->rewind(in);
#endif
}
#ifdef THREADSAFE
lookahead.clear();
#else
lookahead->clear();
#endif
#endif
}
catch (error * err) {
err->context.push_back
(new line_context(str, (long)in.tellg() - 1,
"While parsing value expression:"));
throw err;
}
}
public:
parser_t(std::istream& in, const flags_t flags = EXPR_PARSE_RELAXED)
: use_lookahead(false)
{
TRACE_CTOR(parser_t, "std::istream&, const flags_t");
parse_expr(in, empty_string, *global_scope, flags);
}
parser_t(std::istream& in, const flags_t flags = EXPR_PARSE_RELAXED, scope_t& scope)
: use_lookahead(false)
{
TRACE_CTOR(parser_t, "std::istream&, const flags_t, scope_t&");
parse_expr(in, empty_string, scope, flags);
}
parser_t(string& str, const flags_t flags = EXPR_PARSE_RELAXED)
: use_lookahead(false)
{
TRACE_CTOR(parser_t, "string&, const flags_t");
std::istringstream stream(str);
parse_expr(stream, str, *global_scope, flags);
}
parser_t(string& str, const flags_t flags = EXPR_PARSE_RELAXED, scope_t& scope)
: use_lookahead(false)
{
TRACE_CTOR(parser_t, "string&, const flags_t, scope_t&");
std::istringstream stream(str);
parse_expr(stream, str, scope, flags);
}
~parser_t() throw() {
TRACE_DTOR(parser_t);
}
operator value_expr() const {
return expr;
}
};
void dump(std::ostream& out, const ptr_op_t node, const int depth = 0);
bool print(std::ostream& out,
const ptr_op_t node,
const bool relaxed = true,
const ptr_op_t node_to_find = NULL,
unsigned long * start_pos = NULL,
unsigned long * end_pos = NULL);
} // namespace expr
} // namespace ledger
#endif // _PARESXP_H

View file

@ -30,6 +30,7 @@
*/
#include "session.h"
#include "parsexp.h"
namespace ledger {
@ -306,16 +307,10 @@ static void initialize()
{
amount_t::initialize();
value_t::initialize();
#if 0
expr::initialize();
#endif
}
static void shutdown()
{
#if 0
expr::shutdown();
#endif
value_t::shutdown();
amount_t::shutdown();
}

View file

@ -45,8 +45,8 @@ static value_expr parse_amount_expr(std::istream& in, amount_t& amount,
transaction_t * xact,
unsigned short flags = 0)
{
value_expr expr(expr::parse_value_expr(in, NULL, flags | PARSE_VALEXPR_RELAXED |
PARSE_VALEXPR_PARTIAL));
value_expr expr(expr::parser_t(in, flags | EXPR_PARSE_RELAXED |
EXPR_PARSE_PARTIAL));
DEBUG("ledger.textual.parse", "line " << linenum << ": " <<
"Parsed an amount expression");
@ -172,7 +172,7 @@ transaction_t * parse_transaction(char * line, account_t * account,
xact->amount_expr =
parse_amount_expr(in, xact->amount, xact.get(),
PARSE_VALEXPR_NO_REDUCE);
EXPR_PARSE_NO_REDUCE);
saw_amount = true;
xact->amount.reduce();
@ -180,7 +180,7 @@ transaction_t * parse_transaction(char * line, account_t * account,
"Reduced amount is " << xact->amount);
unsigned long end = (long)in.tellg();
xact->amount_expr.expr = string(line, beg, end - beg);
xact->amount_expr.expr_str = string(line, beg, end - beg);
}
catch (error * err) {
err_desc = "While parsing transaction amount:";
@ -215,7 +215,7 @@ transaction_t * parse_transaction(char * line, account_t * account,
unsigned long beg = (long)in.tellg();
if (parse_amount_expr(in, *xact->cost, xact.get(),
PARSE_VALEXPR_NO_MIGRATE))
EXPR_PARSE_NO_MIGRATE))
throw new parse_error
("A transaction's cost must evaluate to a constant value");
@ -845,8 +845,8 @@ unsigned int textual_parser_t::parse(std::istream& in,
#if 0
if (! expr::global_scope.get())
init_value_expr();
#endif
parse_value_definition(p);
#endif
}
break;
}
@ -984,7 +984,7 @@ void write_textual_journal(journal_t& journal, path pathname,
base = *el++;
}
else if (al != journal.auto_entries.end() && pos == (*al)->beg_pos) {
out << "= " << (*al)->predicate.predicate.expr << '\n';
out << "= " << (*al)->predicate.predicate.expr_str << '\n';
base = *al++;
}
else if (pl != journal.period_entries.end() && pos == (*pl)->beg_pos) {

View file

@ -124,8 +124,10 @@ datetime_t interval_t::first(const datetime_t& moment) const
{
datetime_t quant(begin);
if (! advanced)
advanced = true;
#if 0
// jww (2008-05-08): Implement
if (is_valid(moment) && moment > quant) {
// Find an efficient starting point for the upcoming while loop.
// We want a date early enough that the range will be correct, but
@ -162,7 +164,6 @@ datetime_t interval_t::increment(const datetime_t& moment) const
#if 0
struct std::tm * desc = std::localtime(&moment.when);
// jww (2008-05-08): Implement
if (years)
desc->tm_year += years;
if (months)

19
times.h
View file

@ -72,23 +72,33 @@ struct interval_t
unsigned short minutes;
unsigned short seconds;
datetime_t begin;
datetime_t end;
datetime_t begin;
datetime_t end;
mutable bool advanced;
interval_t(int _days = 0, int _months = 0, int _years = 0,
const datetime_t& _begin = datetime_t(),
const datetime_t& _end = datetime_t())
: years(_years), months(_months), days(_days),
hours(0), minutes(0), seconds(0),
begin(_begin), end(_end) {}
begin(_begin), end(_end), advanced(false) {
TRACE_CTOR(interval_t,
"int, int, int, const datetime_t&, const datetime_t&");
}
interval_t(const string& desc)
: years(0), months(0), days(0),
hours(0), minutes(0), seconds(0) {
hours(0), minutes(0), seconds(0), advanced(false) {
TRACE_CTOR(interval_t, "const string&");
std::istringstream stream(desc);
parse(stream);
}
~interval_t() throw() {
TRACE_DTOR(interval_t);
}
operator bool() const {
return (years > 0 || months > 0 || days > 0 ||
hours > 0 || minutes > 0 || seconds > 0);
@ -98,6 +108,7 @@ struct interval_t
begin = first(moment);
}
datetime_t first(const datetime_t& moment = datetime_t()) const;
datetime_t increment(const datetime_t&) const;
void parse(std::istream& in);

View file

@ -423,6 +423,8 @@ string::~string() {
#endif // VERIFY_ON
ledger::string empty_string("");
/**********************************************************************
*
* Logging

View file

@ -242,6 +242,8 @@ inline bool operator!=(const string& __lhs, const char* __rhs)
#endif // VERIFY_ON
extern ledger::string empty_string;
#define IF_VERIFY() if (DO_VERIFY())
/**********************************************************************

1474
valexpr.cc

File diff suppressed because it is too large Load diff

181
valexpr.h
View file

@ -1,3 +1,34 @@
/*
* Copyright (c) 2003-2007, John Wiegley. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of New Artisans LLC nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _VALEXPR_H
#define _VALEXPR_H
@ -5,8 +36,6 @@
#include "utils.h"
#include "mask.h"
#include <memory>
namespace ledger {
class entry_t;
@ -15,7 +44,6 @@ class account_t;
namespace expr {
DECLARE_EXCEPTION(error, parse_error);
DECLARE_EXCEPTION(error, compile_error);
DECLARE_EXCEPTION(error, calc_error);
@ -375,7 +403,7 @@ struct op_t : public noncopyable
O_OR,
O_QUES,
O_COL,
O_COM,
O_COMMA,
O_DEF,
O_REF,
O_ARG,
@ -632,60 +660,11 @@ class value_expr_error : public error {
extern std::auto_ptr<symbol_scope_t> global_scope;
extern datetime_t terminus;
extern bool initialized;
void init_value_expr();
bool compute_amount(const ptr_op_t expr, amount_t& amt,
const transaction_t * xact,
const ptr_op_t context = NULL);
#define PARSE_VALEXPR_NORMAL 0x00
#define PARSE_VALEXPR_PARTIAL 0x01
#define PARSE_VALEXPR_RELAXED 0x02
#define PARSE_VALEXPR_NO_MIGRATE 0x04
#define PARSE_VALEXPR_NO_REDUCE 0x08
ptr_op_t parse_boolean_expr(std::istream& in, scope_t * scope,
const short flags);
ptr_op_t parse_value_expr(std::istream& in,
scope_t * scope = NULL,
const short flags = PARSE_VALEXPR_RELAXED);
inline ptr_op_t
parse_value_expr(const string& str,
scope_t * scope = NULL,
const short flags = PARSE_VALEXPR_RELAXED) {
std::istringstream stream(str);
try {
return parse_value_expr(stream, scope, flags);
}
catch (error * err) {
err->context.push_back
(new line_context(str, (long)stream.tellg() - 1,
"While parsing value expression:"));
throw err;
}
}
inline ptr_op_t
parse_value_expr(const char * p,
scope_t * scope = NULL,
const short flags = PARSE_VALEXPR_RELAXED) {
return parse_value_expr(string(p), scope, flags);
}
void dump_value_expr(std::ostream& out, const ptr_op_t node,
const int depth = 0);
bool print_value_expr(std::ostream& out,
const ptr_op_t node,
const bool relaxed = true,
const ptr_op_t node_to_find = NULL,
unsigned long * start_pos = NULL,
unsigned long * end_pos = NULL);
//////////////////////////////////////////////////////////////////////
inline void guarded_compute(const ptr_op_t expr,
@ -769,6 +748,40 @@ inline ptr_op_t op_t::wrap_functor(const function_t& fobj) {
return temp;
}
#if 0
class xpath_t
{
public:
public:
void parse(const string& _expr, flags_t _flags = XPATH_PARSE_RELAXED) {
expr = _expr;
flags = _flags;
ptr = parse_expr(_expr, _flags);
}
void parse(std::istream& in, flags_t _flags = XPATH_PARSE_RELAXED) {
expr = "";
flags = _flags;
ptr = parse_expr(in, _flags);
}
void compile(scope_t& scope) {
if (ptr.get())
ptr = ptr->compile(scope);
}
value_t calc(scope_t& scope) const {
if (ptr.get())
return ptr->calc(scope);
return NULL_VALUE;
}
static value_t eval(const string& _expr, scope_t& scope) {
return xpath_t(_expr).calc(scope);
}
};
#endif
} // namespace expr
//////////////////////////////////////////////////////////////////////
@ -778,60 +791,46 @@ class value_expr
expr::ptr_op_t ptr;
public:
string expr;
string expr_str;
typedef expr::details_t details_t;
value_expr() : ptr(NULL) {}
value_expr() {}
value_expr(const string& _expr) : expr(_expr) {
DEBUG("ledger.memory.ctors", "ctor value_expr");
if (! _expr.empty())
ptr = expr::parse_value_expr(expr);
else
ptr = expr::ptr_op_t();
value_expr(const string& _expr_str);
value_expr(const expr::ptr_op_t _ptr, const string& _expr_str = "")
: ptr(_ptr), expr_str(_expr_str) {
TRACE_CTOR(value_expr, "const expr::ptr_op_t");
}
value_expr(const expr::ptr_op_t _ptr) : ptr(_ptr) {
DEBUG("ledger.memory.ctors", "ctor value_expr");
}
value_expr(const value_expr& other) : ptr(other.ptr), expr(other.expr) {
DEBUG("ledger.memory.ctors", "ctor value_expr");
}
virtual ~value_expr() {
DEBUG("ledger.memory.dtors", "dtor value_expr");
if (ptr)
ptr->release();
}
value_expr& operator=(const string& _expr) {
expr = _expr;
reset(expr::parse_value_expr(expr));
return *this;
}
value_expr& operator=(expr::ptr_op_t _expr) {
expr = "";
reset(_expr);
return *this;
value_expr(const value_expr& other)
: ptr(other.ptr), expr_str(other.expr_str) {
TRACE_CTOR(value_expr, "copy");
}
value_expr& operator=(const value_expr& _expr) {
expr = _expr.expr;
expr_str = _expr.expr_str;
reset(_expr.get());
return *this;
}
virtual ~value_expr() throw() {
TRACE_DTOR(value_expr);
}
operator bool() const throw() {
return ptr != NULL;
}
operator string() const throw() {
return expr;
return expr_str;
}
operator const expr::ptr_op_t() const throw() {
return ptr;
}
#if 0
const expr::op_t& operator*() const throw() {
return *ptr;
}
#endif
const expr::ptr_op_t operator->() const throw() {
return ptr;
}
@ -892,14 +891,6 @@ inline value_t compute_total(const details_t& details = details_t()) {
return total_expr->compute(details);
}
inline void parse_value_definition(const string& str,
expr::scope_t * scope = NULL) {
std::istringstream def(str);
value_expr expr
(expr::parse_boolean_expr(def, scope ? scope : expr::global_scope.get(),
PARSE_VALEXPR_RELAXED));
}
//////////////////////////////////////////////////////////////////////
template <typename T>
@ -909,13 +900,13 @@ public:
value_expr predicate;
item_predicate() {
TRACE_CTOR(item_predicate, "ctor item_predicate<T>()");
TRACE_CTOR(item_predicate, "");
}
item_predicate(const value_expr& _predicate) : predicate(_predicate) {
TRACE_CTOR(item_predicate, "ctor item_predicate<T>(const value_expr&)");
TRACE_CTOR(item_predicate, "const value_expr&");
}
item_predicate(const string& _predicate) : predicate(_predicate) {
TRACE_CTOR(item_predicate, "ctor item_predicate<T>(const string&)");
TRACE_CTOR(item_predicate, "const string&");
}
~item_predicate() {