-
Notifications
You must be signed in to change notification settings - Fork 12
Changes: 2.0.x 2.1.x
This is 2016!
However: due to limitations in code generation, lambdas cannot be used as actions... Currently, an attempt at doing so will generate an IllegalAccessError
. This is due to the fact that invokedynamic
is not visited -- yet.
Prior to this version, a run would be declared a success even if the input was only partially matched. For instance, if you had a parser which matched, say, a sequence of a
s, then running against input aaab
would return a success.
Not anymore. In this situation, the run is now declared a failure. There are two reasons for this:
- the theory says so: if the chosen rule of your grammar doesn't match the whole input, then it is said that the input does not satisfy the grammar;
- this behaviour is more logical to the end user.
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.
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.
- There is no more
ListeningParser
norValueBuilder
. All of these have been replaced with a much more simpleEventBusParser
. - There is no more
ListeningParseRunner
. The baseParseRunner
has everything thatListeningParseRunner
had. -
ParseRunnerListener
has been renamed toParseEventListener
.