Metal 4.0.0
Changes in this version (1 and 2 are major changes):
ValueExpression
now returns a list of results instead of a single value. What this means is thatref("label")
now returns all items with the name 'label' instead of just the most recent match. Expressions such aslast()
andfirst()
have been adjusted to operate on lists, so what used to beref("label")
is equivalent tolast(ref("label"))
from this version on. AllValueExpressions
now operate only on lists. For example,add(x, y)
now adds the values with the same index in lists 'x' and 'y' (e.g.add([ 1, 2, 3 ], [ 4, 5, 6 ])
=>[ 5, 7, 9 ]
).Token
implementations now all have a name. So instead of having to use astr()
to add a name to a scope, eachToken
has a constructor with an optional first argument.- A new
ValueExpression
has been added:count()
, which returns the size of a list. Useful for counting the amount of times some value has been parsed withcount(ref("label"))
. - A lot of tests have been added, some small optimizations and cleanup of
toString()
implementations. Test code coverage is now at 99%! - All
Token
implementations now expose their fields as public members. This is possible since they are all immutable (except for the collections ofseq
andcho
, which return a copy of their collection field). - Fixed a bug in
nod
: it now checks whether the resulting size is negative. - Signedness is now encoded as an enum (
Sign
) instead of a boolean. ref
now accepts aToken
in addition to aString
for matching.
To use the Metal 4.0.0 core library, add the following dependency in Maven:
<dependency>
<groupId>io.parsingdata</groupId>
<artifactId>metal-core</artifactId>
<version>4.0.0</version>
</dependency>