Commit graph

69 commits

Author SHA1 Message Date
John Wiegley
f0791bbd72 Cleanup whitespace 2011-08-18 14:48:38 -04:00
John Wiegley
1292eec17b Improved an assert 2011-02-12 17:55:55 -05:00
John Wiegley
7e2547b1e4 A metadata key must occur at the beginning
Before, this was valid:

  ; Today Yesterday: Tomorrow

Which would set the key Yesterday to the value Tomorrow.  Now, it is
just an ordinary comment.
2010-06-18 02:21:02 -04:00
John Wiegley
b80be82b8d has_tag and get_tag now take an 'inherit' parameter 2010-06-18 02:19:39 -04:00
John Wiegley
805a78c121 Only look for [date] outside of metadata entries 2010-06-18 00:46:37 -04:00
John Wiegley
dcffd218a1 Revised how Ledger handles the "current year"
Now when the Y directive sets the current year for a region, it affects
everything, as if the clock really were set back to that year.
2010-06-14 03:23:09 -04:00
John Wiegley
ea1642b3f9 Completely reworked argument passing in expressions 2010-06-13 05:02:14 -04:00
John Wiegley
b1b4e2aadf Add support for typed metadata
The metadata construct 'Key: Value' is now just a special case for
'Key:: "Value"'.  Another after a :: in metadata setting is parsed as a
full value expression and typed as such.  For example:

  ; Key:: $400 + $500

  ledger -l 'tag("Key") < $1000'
2010-06-12 15:43:00 -04:00
John Wiegley
28c65cda51 Store metadata values as value_t instead of string 2010-06-12 14:55:18 -04:00
John Wiegley
dea2aed0b5 Untabified all source files 2010-06-11 17:02:25 -04:00
John Wiegley
fc09b69fb7 Fixed interaction with -V/X and grouped postings
With -s, -M/Y/D, -n, and a few other flags, postings get "grouped" into
meta-transactions that contain more postings than before.  In all these
cases, -V use the date of the *earliest* posting in that group, which
makes little sense and caused breakages with -J.  It now uses the latest
date.

Fixes #197 / 68EAF363-D0FE-4127-866E-A5AEBACB65D6
2010-06-09 02:22:50 -04:00
John Wiegley
3a0f096cb6 Added new "addr" value expression function
It returns the address of the given object as an integer.  This can be
used to uniquely compare entities.
2010-06-03 05:37:21 -04:00
John Wiegley
4f3b39e22c Empty notes and tags now return null values 2010-05-30 03:01:11 -06:00
John Wiegley
d7b8095c3d Tags were not being set properly on postings 2010-03-17 02:18:46 -04:00
John Wiegley
75b7294a6d Rewrite the "print" command as a custom function
There ended up being too many corner cases for the generalized formatter
to handle.
2010-03-08 01:11:48 -05:00
John Wiegley
ab416f759f Updated copyrights to 2003-2010 2010-03-05 22:14:10 -05:00
John Wiegley
9d61d3d621 Added actual_date() methods for items 2010-02-05 00:00:29 -05:00
John Wiegley
b78e22d52b Added a "seq" sequence property for all items
This indicates the absolute parsing order of every transaction and
posting.  It is 0 for generated items.
2010-02-04 18:23:52 -05:00
John Wiegley
1413085977 Added a --pivot=TAG option
This is equivalent to the following:

  --account='"TAG:" + tag(/TAG/)'
2010-02-02 17:07:05 -05:00
John Wiegley
67ce17e249 Guard against using an uninitialized value
Fixes DDB54BB8-8C1C-4129-A137-07A38068F3BE
2010-01-18 03:41:20 -05:00
John Wiegley
68c3a9cfb7 Whitespace fix 2009-11-24 01:27:54 -05:00
John Wiegley
38e165a994 Made the transaction date parser a bit more strict 2009-11-15 05:49:52 -05:00
John Wiegley
a461e17eee Added historical support for single-letter valexprs 2009-11-14 03:11:48 -05:00
John Wiegley
ab9fc6f9f0 Changed the type being throw of some exceptions 2009-11-05 05:11:01 -05:00
John Wiegley
78e6770c4c Segregated symbols into 5 separate namespaces
The different namespaces are:

  Function      Value expression functions, which receive a "context"
  Option        Command-line options
  Precommand    Commands which are invoked before reading the journal
  Command       Commands which are invoked after reading the journal
  Directive     Directives that occur at column 0 in a data file

This greatly eases the ability for Python uses to add intercept hooks to
change how the basic Ledger module functions.  An example of what should
be possible soon:

  import ledger

  def my_foo_handler(value):
      print "--foo received:", value

  ledger.add_handler(ledger.Option, "foo=", my_foo_handler)
2009-11-04 20:40:48 -05:00
John Wiegley
a0a91a61c4 If an item doesn't have a given tag, return "" 2009-11-01 21:16:47 -05:00
John Wiegley
4427016b1b Improved arg checking for several valexpr functions 2009-10-31 04:07:33 -04:00
John Wiegley
cb6f7cd54e Add a position_t object for tracking item positions
It is also optional, which is useful for generated items.
2009-10-30 17:54:54 -04:00
John Wiegley
f3565495b1 Added missing check in item_t::get_actual 2009-10-30 17:48:28 -04:00
John Wiegley
588f2ef2f5 Fixed many compiler warnings from g++ 4.4 2009-10-25 05:01:39 -04:00
John Wiegley
f161aea8ce Removed reliance on strptime/strftime
The code now uses Boost's input and output facets for times and dates.
This ensures completely consistency regarding timezones and times, and
fixes the regression test that was broken while I was away coding in
London (where it was GMT-0 and I didn't notice the difference between
local and GMT).
2009-10-11 05:19:01 -04:00
John Wiegley
521b935aa8 Restored --percent option, added baseline test 2009-06-21 18:07:27 +01:00
John Wiegley
0e64207757 If a posting comment is very short, let it hang
This applies when using the "print" report, or the "comment" variable.
2009-06-14 18:26:26 +01:00
Andrew Potter
684a9c6cbf Fix pointer const-ness in parse_tags() 2009-05-26 22:47:07 -05:00
John Wiegley
110f0b8023 Enabled use of pre-compiled headers by default 2009-03-10 17:02:03 -04:00
John Wiegley
9d4e888ef5 Cured several harmless compiler warnings 2009-03-04 04:31:34 -04:00
John Wiegley
ad42447475 Changed how comments are output to be more logical 2009-03-01 05:40:44 -04:00
John Wiegley
38122c2224 Corrected warnings g++-4.3.3 was complaining about 2009-02-28 04:54:54 -04:00
John Wiegley
645e43ef75 The print command now prints xact's effective date 2009-02-27 03:49:59 -04:00
John Wiegley
69e2c733b9 If an item tag is already set, don't overwrite it 2009-02-26 05:33:06 -04:00
John Wiegley
fbb734689b Added a new source_context function 2009-02-26 04:41:38 -04:00
John Wiegley
238bd7f8a5 Marked all strings needing internationalization
These strings are now collected automagically in the file po/ledger.pot.
If you'd like to produce a translation, just run this command after
building Ledger:

    msginit -l LOCALE -o LANG.po -i po/ledger.pot

Where LOCALE is a string like de or en_GB, and LANG is a short
descriptive word for your language.

Then send me this .po file so I can commit it to the Ledger sources
(alternatively, you could maintain the file in a fork on GitHub), and
setup the build script to format and install your new message catalog
during a "make install".
2009-02-25 03:51:42 -04:00
John Wiegley
625b94cf04 Switched from using POST_AUTO to ITEM_GENERATED 2009-02-24 02:23:20 -04:00
John Wiegley
a577e8c48e Added a new --raw option, for use with print 2009-02-21 19:45:13 -04:00
John Wiegley
d67c9fee0f Added valexpr vars for accessing item position
- filename
 - beg_line
 - beg_pos
 - end_line
 - end_pos
2009-02-19 16:22:31 -04:00
John Wiegley
d0a664d102 Fixed several unused value and param warnings 2009-02-16 16:55:18 -04:00
John Wiegley
ee5e0600aa xact metadata searches get passed up to the entry
That is, if a metadata tag cannot be found in a transaction, look in the
parent entry to see if it was set there.  Transactions "inherit"
notational details from their entries.
2009-02-14 05:37:53 -04:00
John Wiegley
1a030da55d Rewrote the "entry" command. It's ALIVE! 2009-02-11 19:14:23 -04:00
John Wiegley
6ca01af594 Fixed the use of --effective and --date-format (-y). 2009-02-09 17:27:54 -04:00
John Wiegley
623c57a623 Terminate the buffer used to read in item context. 2009-02-08 21:16:43 -04:00