summaryrefslogtreecommitdiff
path: root/src/textual.cc
diff options
context:
space:
mode:
authorPeter Feigl <craven@gmx.net>2014-02-25 22:50:20 +0100
committerPeter Feigl <craven@gmx.net>2014-02-25 22:50:20 +0100
commitc80b4955467a38a2be3aaaa60c9f49b33edef774 (patch)
treef83e871677be813384f68563d4da8bf83134a1a5 /src/textual.cc
parentbc08eed3cb1bdb4f67d1b77273f3254d0cf13be2 (diff)
downloadfork-ledger-c80b4955467a38a2be3aaaa60c9f49b33edef774.tar.gz
fork-ledger-c80b4955467a38a2be3aaaa60c9f49b33edef774.tar.bz2
fork-ledger-c80b4955467a38a2be3aaaa60c9f49b33edef774.zip
Adding support for recursive aliases.
Alias expansion is now a loop. If you define alias A=B:A alias B=C:B then A will expand to C:B:A. Also added a short section to the manual about this.
Diffstat (limited to 'src/textual.cc')
-rw-r--r--src/textual.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/textual.cc b/src/textual.cc
index d8648c93..627a1835 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -977,6 +977,11 @@ void instance_t::account_alias_directive(account_t * account, string alias)
// (account), add a reference to the account in the `account_aliases'
// map, which is used by the post parser to resolve alias references.
trim(alias);
+ // Ensure that no alias like "alias Foo=Foo" is registered.
+ if ( alias == account->fullname()) {
+ throw_(parse_error, _f("Illegal alias %1%=%2%")
+ % alias % account->fullname());
+ }
std::pair<accounts_map::iterator, bool> result =
context.journal->account_aliases.insert
(accounts_map::value_type(alias, account));