Commit graph

51 commits

Author SHA1 Message Date
Alexis Hildebrandt
2b9208e850 Bump copyright information to 2014 2014-02-02 12:36:22 +01:00
John Wiegley
0951bcebef Bump copyright information to 2013 2013-02-18 06:51:21 -06:00
John Wiegley
f4f3058b8c Switch to using Boost.Format 2012-05-14 21:44:00 -06:00
John Wiegley
4d01143400 Many improvements to lambdas and function calling 2012-03-08 00:44:40 -06:00
John Wiegley
ae4ef7a88d More work done on proper evaluation of lambdas 2012-03-07 21:22:07 -06:00
John Wiegley
acb5e1beea Generalized function call parsing
Directly calling a lambda now works:

  (x -> x + 10)(10) => 20
2012-03-05 22:01:41 -06:00
John Wiegley
e2afc783db Increased file copyrights to 2012 2012-02-29 22:32:23 -06:00
John Wiegley
c47350dce9 Corrected handling of nested definitions 2012-02-21 03:53:00 -06:00
John Wiegley
bc9ff7095f Introduced a new SCOPE expression terminal 2012-02-20 17:20:22 -06:00
John Wiegley
37e9ec8030 Report an error in the case of '(1' (missing rparen)
Fixes #557
2011-11-10 00:48:19 -06:00
John Wiegley
ab24901b9d Made -> have higher precedence than comma 2010-09-06 01:01:20 -04:00
John Wiegley
84780270f9 Added initial support for lambda functions 2010-09-06 00:56:00 -04:00
John Wiegley
e162455ebb Minor simplifications to valexpr parser
The most significant change is the way CONS sequences are parsed, and
that now instead of =/:=, the operators are ==/=.
2010-09-05 01:38:47 -04:00
John Wiegley
968a6f3c0a Changes for building with Visual Studio 2008 2010-06-15 05:14:00 -04:00
John Wiegley
ea1642b3f9 Completely reworked argument passing in expressions 2010-06-13 05:02:14 -04:00
John Wiegley
dea2aed0b5 Untabified all source files 2010-06-11 17:02:25 -04:00
John Wiegley
a3482606dc Improved error reporting in the expression parser
Fixes 15A80F68-F233-49D9-AF0C-9908BB6903BA
2010-05-22 21:35:03 -04:00
John Wiegley
4ec54b86f8 Added any() and all() value expression macros
any() matches an expression against every post in a transaction or
account, and returns true if any of them are true.  all() tests if all
are true.  For example:

  ledger -l 'account =~ /Expense/ & any(account =~ /MasterCard/)' reg

This reports every posting affecting an Expense account (regex match),
but only if some other posting in the same transaction affects the
MasterCard account.

Both functions also take a second boolean argument.  If it is false, the
"source" posting is not considered.  For example:

  ledger -l 'any(/x/, false)'

This matches any posting where a *different* posting in the same
transaction contains the letter 'x'.
2010-05-08 02:06:06 -04:00
John Wiegley
ab416f759f Updated copyrights to 2003-2010 2010-03-05 22:14:10 -05:00
John Wiegley
bf24b93818 Fixes to the value expression parser and evaluator 2009-11-10 02:26:20 -05:00
John Wiegley
c3535d06c8 Redesigned the expr_t, predicate_t, query_t classes 2009-11-09 02:06:06 -05:00
John Wiegley
588f2ef2f5 Fixed many compiler warnings from g++ 4.4 2009-10-25 05:01:39 -04:00
John Wiegley
7287aad336 Revert "Added % suffix operator, as in "$1.00 * 10%""
This reverts commit 0e9f782a05.
2009-06-21 17:49:38 +01:00
John Wiegley
0e9f782a05 Added % suffix operator, as in "$1.00 * 10%" 2009-05-26 23:45:44 -05:00
John Wiegley
110f0b8023 Enabled use of pre-compiled headers by default 2009-03-10 17:02:03 -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
67a45a0e3c Made error reporting while parsing more resilient 2009-03-03 14:42:46 -04:00
John Wiegley
0f9d919367 Added Python-style if/else expression keywords 2009-03-03 13:26:27 -04:00
John Wiegley
38122c2224 Corrected warnings g++-4.3.3 was complaining about 2009-02-28 04:54:54 -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
6f7f87699c Parse '/' in an operator context as "div" 2009-02-15 16:34:34 -04:00
John Wiegley
3925240c7b Fixed the operator precedence of several operators. 2009-02-09 18:02:05 -04:00
John Wiegley
47567307ce Removed reference to session_t from the iterators module. 2009-02-09 17:41:55 -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
fb5428ce85 Added support for metadata and tagging, and made regexs a first-class type. 2009-02-01 22:10:32 -04:00
John Wiegley
8b75b5cbfb Revised the way that parsing flags get passed around. 2009-01-29 02:24:25 -04:00
John Wiegley
52524ff2fb Removed some extraneous code. 2009-01-22 21:17:32 -04:00
John Wiegley
812d38c176 Correctly report the line context when there is a valexpr parsing error. 2009-01-22 21:16:43 -04:00
John Wiegley
9c164bd3dc Allow function calls without arguments in the parser. 2009-01-22 18:53:59 -04:00
John Wiegley
e95e8c3f79 Corrected a parse-time optimization of "! CONSTANT". 2009-01-22 18:53:44 -04:00
John Wiegley
0b9f22b4d2 Redid the way command-line arguments are processed. Before, Ledger used - and
-- to mean special things after the command verb was seen.  But now, what used
to be specified as this:

  ledger -n reg cash -payable -- shell

Is now specified as this:

  ledger reg -n cash not payable @shell

It could also be specified as:

  ledger -n reg \(cash and not payable\) and @shell
2009-01-22 16:27:24 -04:00
John Wiegley
887828a40c Increased copyright range to include 2009. 2009-01-20 01:53:31 -04:00
John Wiegley
01aa3800fb Fixes to the way that EXPR_PARSE_SINGLE behaves. 2008-09-15 02:37:04 -04:00
John Wiegley
50ee03e3f0 Fixed the way that nested caught exceptions are rethrown, and how value
expressions are displayed when errors are found in them.
2008-09-15 02:36:50 -04:00
John Wiegley
db9f891003 Added value expression parsing flag EXPR_PARSE_SINGLE, which means to read
only a single expression and then quit immediately.  Useful for parsing
expressions that begin with a left parenthesis and are known to end at the
right parenthesis.
2008-09-14 19:44:35 -04:00
John Wiegley
fd2e6c2502 Ledger now builds without any significant warnings, except for one file. Some
of the warnings had to be temporarily disabled, but will be checked again once
the code has moved into master.
2008-08-10 02:52:38 -04:00
John Wiegley
a42ecd5938 Removed all use of USE_BOOST_PYTHON from the main Ledger sources. When Python
support is enabled for use within Ledger, it will do so through the current
scoping mechanism.
2008-08-08 18:50:21 -04:00