All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.parboiled1.grappa.backport.events.package-info Maven / Gradle / Ivy

There is a newer version: 2.0.0.1-sonar
Show newest version
/**
 * 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