summaryrefslogtreecommitdiff
path: root/parse.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2003-10-08 23:05:15 +0000
committerJohn Wiegley <johnw@newartisans.com>2003-10-08 23:05:15 +0000
commit072d5131b49ff64de40d1c9e44a0abcf3b0f1d73 (patch)
treeaa3425496ac09539bacb15991dca36657bdcbcfb /parse.cc
parent331f389cc68b9ca54c50dddb58cb2e7bb3523cf6 (diff)
downloadfork-ledger-072d5131b49ff64de40d1c9e44a0abcf3b0f1d73.tar.gz
fork-ledger-072d5131b49ff64de40d1c9e44a0abcf3b0f1d73.tar.bz2
fork-ledger-072d5131b49ff64de40d1c9e44a0abcf3b0f1d73.zip
*** empty log message ***
Diffstat (limited to 'parse.cc')
-rw-r--r--parse.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/parse.cc b/parse.cc
index 88042828..538b6ff4 100644
--- a/parse.cc
+++ b/parse.cc
@@ -24,7 +24,11 @@ static inline char * next_element(char * buf, bool variable = false)
*p = '\0';
return skip_ws(p + 1);
}
- else if (*(p + 1) == ' ' || *(p + 1) == '\t') {
+ else if (*p == '\t') {
+ *p = '\0';
+ return skip_ws(p + 1);
+ }
+ else if (*(p + 1) == ' ') {
*p = '\0';
return skip_ws(p + 2);
}
@@ -407,7 +411,7 @@ void parse_automated_transactions(std::istream& in, book * ledger)
{
static char line[MAX_LINE + 1];
- std::list<mask> * masks = NULL;
+ regexps_map * masks = NULL;
while (! in.eof() && in.peek() == '=') {
in.getline(line, MAX_LINE);
@@ -417,8 +421,8 @@ void parse_automated_transactions(std::istream& in, book * ledger)
p = skip_ws(p);
if (! masks)
- masks = new std::list<mask>;
- masks->push_back(mask(p));
+ masks = new regexps_map;
+ masks->push_back(new mask(p));
}
std::list<transaction *> * xacts = NULL;
@@ -490,7 +494,7 @@ book * parse_ledger(std::istream& in, regexps_map& regexps,
linenum++;
// Add the regexp to whatever masks currently exist
- regexps.push_back(mask(line));
+ regexps.push_back(new mask(line));
break;
case '=': // automated transactions