summaryrefslogtreecommitdiff
path: root/parsexp.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-24 09:02:47 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-24 09:02:47 -0400
commit643f2d33cf24bbae4a13acfbfc6af5fe8439f905 (patch)
treec694588e1b4bd03b0903764975fce65f15aba51c /parsexp.h
parent7409b050bee226fb7bb0b89a10d9c206d8797d70 (diff)
downloadfork-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.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/parsexp.h b/parsexp.h
index 9509b2fd..1ed71e66 100644
--- a/parsexp.h
+++ b/parsexp.h
@@ -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);