summaryrefslogtreecommitdiff
path: root/src/global.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-01 03:31:28 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-03-01 03:31:28 -0600
commit944e580825f0d9ce060b6dcdffe8990b6c2cca20 (patch)
treee2651b0df622d9b8d3831f35743e7dbd31c16897 /src/global.cc
parente2afc783db0dff1927b00dc506390353d9e3bbd2 (diff)
downloadfork-ledger-944e580825f0d9ce060b6dcdffe8990b6c2cca20.tar.gz
fork-ledger-944e580825f0d9ce060b6dcdffe8990b6c2cca20.tar.bz2
fork-ledger-944e580825f0d9ce060b6dcdffe8990b6c2cca20.zip
Refactored the notion of "the current parsing context"
Diffstat (limited to 'src/global.cc')
-rw-r--r--src/global.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/global.cc b/src/global.cc
index ee921fc5..5b7bb1c1 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -112,9 +112,12 @@ void global_scope_t::read_init()
if (exists(init_file)) {
TRACE_START(init, 1, "Read initialization file");
- ifstream init(init_file);
+ parse_context_stack_t parsing_context;
+ parsing_context.push(init_file);
+ parsing_context.get_current().journal = session().journal.get();
+ parsing_context.get_current().scope = &report();
- if (session().journal->read(init_file, NULL, &report()) > 0 ||
+ if (session().journal->read(parsing_context) > 0 ||
session().journal->auto_xacts.size() > 0 ||
session().journal->period_xacts.size() > 0) {
throw_(parse_error, _("Transactions found in initialization file '%1'")