diff options
author | Martin Michlmayr <tbm@cyrius.com> | 2014-05-14 17:55:07 -0400 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2014-05-14 17:55:07 -0400 |
commit | ab921cca0c7953dbacd1bcd17058bdab4f514dda (patch) | |
tree | 3dd1c1bf19c5bd984fde9da9f3a66aacebd10045 /src/textual.cc | |
parent | 86fd99c9d0d8ed46f3eb89a7bf0d17eadef574e8 (diff) | |
download | fork-ledger-ab921cca0c7953dbacd1bcd17058bdab4f514dda.tar.gz fork-ledger-ab921cca0c7953dbacd1bcd17058bdab4f514dda.tar.bz2 fork-ledger-ab921cca0c7953dbacd1bcd17058bdab4f514dda.zip |
Ensure that high-levels directives have arguments if they need one
Ensure that high-levels directives, such as account, alias and
commodity, have arguments if they need one. Bug fix for #1036
Diffstat (limited to 'src/textual.cc')
-rw-r--r-- | src/textual.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/textual.cc b/src/textual.cc index a1b17c14..8d4db512 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -1268,6 +1268,14 @@ bool instance_t::general_directive(char * line) if (*p == '@' || *p == '!') p++; + // Ensure there's an argument for all directives that need one. + if (! arg && + std::strcmp(p, "comment") != 0 && std::strcmp(p, "end") != 0 + && std::strcmp(p, "python") != 0 && std::strcmp(p, "test") != 0 && + *p != 'Y') { + throw_(parse_error, _f("Directive '%1%' requires an argument") % p); + } + switch (*p) { case 'a': if (std::strcmp(p, "account") == 0) { |