Skip to content

Metal 4.0.0

Compare
Choose a tag to compare
@jvdb jvdb released this 26 Jul 13:16
· 991 commits to master since this release

Changes in this version (1 and 2 are major changes):

  1. ValueExpression now returns a list of results instead of a single value. What this means is that ref("label") now returns all items with the name 'label' instead of just the most recent match. Expressions such as last() and first() have been adjusted to operate on lists, so what used to be ref("label") is equivalent to last(ref("label")) from this version on. All ValueExpressions 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 ]).
  2. Token implementations now all have a name. So instead of having to use a str() to add a name to a scope, each Token has a constructor with an optional first argument.
  3. 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 with count(ref("label")).
  4. A lot of tests have been added, some small optimizations and cleanup of toString() implementations. Test code coverage is now at 99%!
  5. All Token implementations now expose their fields as public members. This is possible since they are all immutable (except for the collections of seq and cho, which return a copy of their collection field).
  6. Fixed a bug in nod: it now checks whether the resulting size is negative.
  7. Signedness is now encoded as an enum (Sign) instead of a boolean.
  8. ref now accepts a Token in addition to a String 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>