Skip to content

Instantly share code, notes, and snippets.

@fge
Created January 24, 2015 11:22
Show Gist options
  • Select an option

  • Save fge/6174f50a3ed03eae061a to your computer and use it in GitHub Desktop.

Select an option

Save fge/6174f50a3ed03eae061a to your computer and use it in GitHub Desktop.
package com.github.parboiled1.grappa.samples;
import org.parboiled.Parboiled;
import org.parboiled.parserunners.BasicParseRunner;
import org.parboiled.parserunners.ParseRunner;
import org.parboiled.support.ParsingResult;
public final class SampleRun
{
public static void main(final String... args)
{
// 1. create a parser
final TestGrammar2 parser = Parboiled.createParser(TestGrammar2.class);
// 2. create a runner
final ParseRunner<String> runner
= new BasicParseRunner<String>(parser.oneLine());
// 3. collect the result
final ParsingResult<String> result
= runner.run("some input here");
// 4. success or not?
System.out.println(result.isSuccess());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment