com.github.parboiled1.grappa.backport.events.package-info Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grappa-tracer-backport Show documentation
Show all versions of grappa-tracer-backport Show documentation
A backport of the trace parser for grappa 1.0.x/parboiled1
/**
* Events generated by an {@link
* com.github.parboiled1.grappa.backport.EventBasedParseRunner}
*
* You have hooks at five points in the parsing process:
*
*
* - before the parsing starts ({@link
* com.github.parboiled1.grappa.backport.events.PreParseEvent});
* - before each match is attempted ({@link
* com.github.parboiled1.grappa.backport.events.PreMatchEvent});
* - after a match has completed, if it is successful ({@link
* com.github.parboiled1.grappa.backport.events.MatchSuccessEvent});
* - after a match has completed, if it fails ({@link
* com.github.parboiled1.grappa.backport.events.MatchFailureEvent});
* - and finally, after the parsing has completed ({@link
* com.github.parboiled1.grappa.backport.events.PostParseEvent}).
*
*
* In order to create your own listener, you extend a {@link
* com.github.parboiled1.grappa.backport.ParseRunnerListener} and override the
* methods you need; once done, you initialize it and pass it to an instance of
* {@link com.github.parboiled1.grappa.backport.EventBasedParseRunner}
* before you parse your input.
*
* For instance, if you have a class named {@code MyParserListener}, you will
* do this:
*
*
* // Create the parser
* final MyParser parser = Parboiled.create(MyParser.class);
*
* // Create the listener
* final MyParserListener<Foo> listener
* = new MyParserListener<>();
*
* // Create the parse runner
* final EventBasedParseRunner<Foo> runner
* = new EventBasedParseRunner<>(parser.theRule());
*
* // Register the listener
* runner.registerListener(listener);
*
* // Run
* runner.run(someInput);
*
*/
package com.github.parboiled1.grappa.backport.events;
© 2015 - 2024 Weber Informatics LLC | Privacy Policy