Skip to content

Changes: 2.0.x 2.1.x

Francis Galiegue edited this page Mar 24, 2016 · 4 revisions

InputBuffer now implements CharSequence -- to the letter

This has the important consequence that .charAt() now throws an IndexOutOfBoundsException on an invalid index (therefore, Context's .getCurrentChar() as well).

Historically, Parboiled, and up to grappa 2.0.x, had a .charAt() method which confusingly returned 0xffff if ever the index specified was greater than (or equal to) the underlying text length.

Not anymore. This method now obeys the CharSequence contract, and specifying an invalid index will throw an exception.

This decision has been made because 0xffff, in spite of being a "non character", is a legal character in a CharSequence and possibly in an input which Grappa may parse. It also has the advantage to greatly simplify the character matchers construction.

If you wish to detect the end of input, you can use the new .atEnd() method available in Context and BaseParser (returns true if... Well... You've guessed it.) The .getCurrentCodePoint() still returns -1 if the end of input is reached, so you can also use that.

Add the ability to generate parsers on custom classloaders (IN DEVELOPMENT)

This was prompted by grappa-formal.

In this package, the source code of a parser is generated from a formal grammar, then compiled. However, this compilation generated a class which is not in the classloaders available at runtime.

Code now exists to be able to add one classloader (or more) to the parser generation process, and obtain a valid instance of a parser generated at runtime from one such classloader.

API changes

  • There is no more ListeningParser nor ValueBuilder. All of these have been replaced with a much more simple EventBusParser.
  • There is no more ListeningParseRunner. The base ParseRunner has everything that ListeningParseRunner had.
  • ParseRunnerListener has been renamed to ParseEventListener.