summaryrefslogtreecommitdiff
path: root/parse.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2003-09-30 07:02:31 +0000
committerJohn Wiegley <johnw@newartisans.com>2003-09-30 07:02:31 +0000
commit5bd2401bc7cde0e01cd5b9d18cf077e255c4bd45 (patch)
treebcc3d57e446c3c7b9c91888bda2fa02d61423e96 /parse.cc
parentff57781f1fc80024ae6387f29b2f06278acadb3b (diff)
downloadfork-ledger-5bd2401bc7cde0e01cd5b9d18cf077e255c4bd45.tar.gz
fork-ledger-5bd2401bc7cde0e01cd5b9d18cf077e255c4bd45.tar.bz2
fork-ledger-5bd2401bc7cde0e01cd5b9d18cf077e255c4bd45.zip
*** empty log message ***
Diffstat (limited to 'parse.cc')
-rw-r--r--parse.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/parse.cc b/parse.cc
index 749e3cbd..579bc432 100644
--- a/parse.cc
+++ b/parse.cc
@@ -8,12 +8,7 @@
namespace ledger {
-//////////////////////////////////////////////////////////////////////
-//
-// Ledger parser
-//
-
-char * next_element(char * buf, bool variable = false)
+static char * next_element(char * buf, bool variable = false)
{
char * p;
@@ -34,7 +29,8 @@ char * next_element(char * buf, bool variable = false)
static int linenum = 0;
-inline void finalize_entry(entry * curr) {
+static inline void finalize_entry(entry * curr)
+{
if (curr) {
if (! curr->validate()) {
std::cerr << "Failed to balance the following transaction, "
@@ -46,6 +42,11 @@ inline void finalize_entry(entry * curr) {
}
}
+//////////////////////////////////////////////////////////////////////
+//
+// Ledger parser
+//
+
bool parse_ledger(std::istream& in)
{
static std::time_t now = std::time(NULL);
@@ -150,6 +151,7 @@ bool parse_ledger(std::istream& in)
// If there is no amount given, it is intended as an implicit
// amount; we must use the opposite of the value of the
// preceding transaction.
+
if (! cost_str || *cost_str == ';') {
if (cost_str) {
while (*cost_str == ';' || std::isspace(*cost_str))