summaryrefslogtreecommitdiff
path: root/token.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-08-01 01:56:13 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-08-01 01:56:13 -0400
commitc98be731733176c9e9afb690619d806630ec9090 (patch)
treeaedd210699a652a2b77b2a1985c14a1bdd9c227a /token.h
parent567902b1731db6f1ace85a7bc384b55ffd0948ab (diff)
downloadledger-c98be731733176c9e9afb690619d806630ec9090.tar.gz
ledger-c98be731733176c9e9afb690619d806630ec9090.tar.bz2
ledger-c98be731733176c9e9afb690619d806630ec9090.zip
Re-implemented ?: parsing in value expressions. "a ? b : c" is implemented by
translating it into the equivalent syntax tree "(a & b) | c", since this expression evaluates to the value of b if a is true, otherwise c.
Diffstat (limited to 'token.h')
-rw-r--r--token.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/token.h b/token.h
index df08b6bc..cc3ec988 100644
--- a/token.h
+++ b/token.h
@@ -71,6 +71,9 @@ struct expr_t::token_t : public noncopyable, public supports_flags<>
KW_OR, // |
KW_MOD, // %
+ QUERY, // ?
+ COLON, // :
+
COMMA, // ,
TOK_EOF,
@@ -111,7 +114,7 @@ struct expr_t::token_t : public noncopyable, public supports_flags<>
void rewind(std::istream& in);
void unexpected();
- static void unexpected(char c, char wanted = '\0');
+ static void expected(char wanted, char c = '\0');
};
} // namespace ledger