diff options
author | John Wiegley <johnw@newartisans.com> | 2008-07-24 09:02:47 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-07-24 09:02:47 -0400 |
commit | 643f2d33cf24bbae4a13acfbfc6af5fe8439f905 (patch) | |
tree | c694588e1b4bd03b0903764975fce65f15aba51c /parsexp.h | |
parent | 7409b050bee226fb7bb0b89a10d9c206d8797d70 (diff) | |
download | fork-ledger-643f2d33cf24bbae4a13acfbfc6af5fe8439f905.tar.gz fork-ledger-643f2d33cf24bbae4a13acfbfc6af5fe8439f905.tar.bz2 fork-ledger-643f2d33cf24bbae4a13acfbfc6af5fe8439f905.zip |
More work toward getting the textual parser working again. Since this means
that value expressions must work, there are a lot of details involved.
Diffstat (limited to 'parsexp.h')
-rw-r--r-- | parsexp.h | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -46,7 +46,7 @@ class parser_t #define EXPR_PARSE_RELAXED 0x02 #define EXPR_PARSE_NO_MIGRATE 0x04 #define EXPR_PARSE_NO_REDUCE 0x08 -#define EXPR_PARSE_ALLOW_DATE 0x10 +#define EXPR_PARSE_NO_DATES 0x10 public: typedef uint_least8_t flags_t; @@ -57,6 +57,13 @@ private: enum kind_t { VALUE, // any kind of literal value + SHORT_ACCOUNT_MASK, + CODE_MASK, + COMMODITY_MASK, + PAYEE_MASK, + NOTE_MASK, + ACCOUNT_MASK, + IDENT, // [A-Za-z_][-A-Za-z0-9_:]* DOLLAR, // $ AT_SYM, // @ @@ -98,7 +105,7 @@ private: UNKNOWN } kind; - char symbol[3]; + char symbol[3]; value_t value; std::size_t length; @@ -225,9 +232,8 @@ public: return parse_expr(in, empty_string, *global_scope, flags); } - value_expr& parse(std::istream& in, - const flags_t flags = EXPR_PARSE_RELAXED, - scope_t& scope) + value_expr& parse(std::istream& in, scope_t& scope, + const flags_t flags = EXPR_PARSE_RELAXED) { return parse_expr(in, empty_string, scope, flags); } @@ -238,8 +244,8 @@ public: return parse_expr(stream, str, *global_scope, flags); } - value_expr& parse(string& str, const flags_t flags = EXPR_PARSE_RELAXED, - scope_t& scope) + value_expr& parse(string& str, scope_t& scope, + const flags_t flags = EXPR_PARSE_RELAXED) { std::istringstream stream(str); return parse_expr(stream, str, scope, flags); |