Commit graph

59 commits

Author SHA1 Message Date
John Wiegley
2ea075dc4f Report error context in expressions more precisely 2010-06-13 18:39:26 -04:00
John Wiegley
ea1642b3f9 Completely reworked argument passing in expressions 2010-06-13 05:02:14 -04:00
John Wiegley
dcdd9c4a56 If a type context exists, confirm the result matches 2010-06-13 01:03:49 -04:00
John Wiegley
1bc5b894df Expression evaluations now have a "type context"
Thus, an expression can know if the context in which it's being
evaluated requires a string, and if so, determine it's output
accordingly.  For example:

  account       ; returns the full name of the posting's account
  account.total ; here the context is SCOPE, so account is an obj
2010-06-13 01:03:48 -04:00
John Wiegley
dea2aed0b5 Untabified all source files 2010-06-11 17:02:25 -04:00
John Wiegley
b848ace768 Allow opt -NDEBUG build to complete without warnings 2010-06-04 06:02:00 -04:00
John Wiegley
d5f8c3bc57 Added O_EXPAND operator, to handle macros 2010-05-08 02:02:10 -04:00
John Wiegley
ab416f759f Updated copyrights to 2003-2010 2010-03-05 22:14:10 -05:00
John Wiegley
4e30fcdf40 Many improvements to Ledger's Python bindings 2009-11-19 22:24:24 -05:00
John Wiegley
bf24b93818 Fixes to the value expression parser and evaluator 2009-11-10 02:26:20 -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
7ca80112fc Change the value_t::POINTER type to value_t::SCOPE
scope_t pointers are the only kind that are ever stored in value
objects, so there was no need to make it generic and use boost::any.
2009-10-30 17:57:29 -04:00
John Wiegley
5ddb0e9bfb Output pointer values correctly for 64-bit systems 2009-10-27 04:00:35 -04:00
John Wiegley
9b13e77ff5 Improved debug output of "--debug expr.calc" 2009-10-25 05:01:47 -04:00
John Wiegley
991e3a3eaf Split commodity.h/cc into three files
commodity.h - code for commodity_t
annotate.h  - commodity annotations
pool.h      - commodity pool management
2009-06-24 16:43:46 +01:00
John Wiegley
521b935aa8 Restored --percent option, added baseline test 2009-06-21 18:07:27 +01:00
John Wiegley
110f0b8023 Enabled use of pre-compiled headers by default 2009-03-10 17:02:03 -04:00
John Wiegley
c11d325712 Reduced the #include dependency tree to a minimum 2009-03-04 23:53:43 -04:00
John Wiegley
e2c30cf6e4 Added ; as a sequencing operator in valexprs 2009-03-03 16:05:04 -04:00
John Wiegley
098e3b0043 Fixed parsing of '(1, 2, (3, 4))' 2009-03-03 16:02:34 -04:00
John Wiegley
19cfd9e23b Fixed the printing of O_CONS nodes 2009-02-28 06:13:49 -04:00
John Wiegley
0efe0c63ce Corrected output of O_CALL nodes 2009-02-27 14:06:52 -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
e919f53c99 Renamed O_COMMA to O_CONS, and changed semantics
In the old scheme, nested values would simply flatten and concatenate,
so that '((1, 2), 3) = (1, 2, 3)'.  Now sublists are preserved, so that
sequences may be passed as arguments to functions.
2009-02-23 15:04:07 -04:00
John Wiegley
fc349389e3 Restored the --budget option 2009-02-20 23:12:23 -04:00
John Wiegley
6f7f87699c Parse '/' in an operator context as "div" 2009-02-15 16:34:34 -04:00
John Wiegley
94aa8e5a91 Changed debug category op.calc to expr.calc 2009-02-15 15:42:12 -04:00
John Wiegley
b53f844129 Removed an excessive error check. 2009-02-12 02:34:54 -04:00
John Wiegley
e777abe854 Revert "If a valexpr identifier is unknown at calc time, re-compile at that point."
This reverts commit 4a463aca3b.
2009-02-09 00:29:51 -04:00
John Wiegley
4a463aca3b If a valexpr identifier is unknown at calc time, re-compile at that point. 2009-02-09 00:02:59 -04:00
John Wiegley
d4d7090f3c Perhaps expr_t objects to remember their scope "context". 2009-02-08 21:15:22 -04:00
John Wiegley
2d5ad7dee8 Added support for value expression definitions.
Example:

  ] expr f(x) := x + 100
  ] expr f(100)
  200
2009-02-08 04:30:05 -04:00
John Wiegley
7594639581 Better semantics for the ?: ternary operator. 2009-02-08 03:01:51 -04:00
John Wiegley
aebfc92a4d Added debug code to the op_t calculation routine. 2009-02-07 23:30:53 -04:00
John Wiegley
0c8970584e Removed handling of the unnused INDEX operator. 2009-02-07 18:42:12 -04:00
John Wiegley
011f35b730 Implemented expr_context. 2009-02-07 04:27:28 -04:00
John Wiegley
682544ef17 Refer to empty expression operators as simply NULL. 2009-02-07 04:27:04 -04:00
John Wiegley
17c7037da9 Correction to debug output. 2009-02-07 00:08:08 -04:00
John Wiegley
4854cead4f When recompiled an expr_t, forget old definitions. 2009-02-05 02:45:29 -04:00
John Wiegley
2d941730b1 Largely removed all of Ledger's use of global variables, for the REPL's sake. 2009-02-04 19:55:27 -04:00
John Wiegley
f49dfce302 Fixed the processing of O_NOT operations. 2009-02-03 18:11:59 -04:00
John Wiegley
3434650848 Removed the binary caching code, and the XML, QIF and Gnucash parsers. 2009-02-03 12:22:10 -04:00
John Wiegley
bd9ffed9db Calculate the right-hand side O_MATCH, now that masks are values. 2009-02-02 15:17:02 -04:00
John Wiegley
9540406af1 Simplified error context handling. 2009-02-02 00:24:26 -04:00
John Wiegley
fb5428ce85 Added support for metadata and tagging, and made regexs a first-class type. 2009-02-01 22:10:32 -04:00
John Wiegley
cadb02c257 Fixed a display problem when dumping O_MATCH expressions. 2009-02-01 18:36:40 -04:00
John Wiegley
c5795c66c9 "div", or "//", is now the operator of division. 2009-01-31 01:21:14 -04:00
John Wiegley
00fdadedcc Removed extraneous parentheses. 2009-01-23 01:09:31 -04:00
John Wiegley
5ba81765ea Added some debug code. 2009-01-23 01:09:23 -04:00
John Wiegley
7b76ea5cbc Errors while calculating value expressions now display meaningful error
context.
2009-01-22 18:54:24 -04:00