Chapter 4. Parsing
4.1. GearleyParser
The org.nineml.coffeegrinder.parser.GearleyParser interface.
4.1.1. Method summary
Public methods on the GearleyParser interface.
publicintgetColumnNumber()-
Returns the column number of the last character on the last line read by the parser.
publicParserGrammargetGrammar()-
The grammar used by this parser.
publicintgetLineNumber()-
Returns the line number of the last line read by the parser.
publicintgetOffset()-
Returns the last offset read by the parser.
publicParserTypegetParserType()-
The parser type.
publicNonterminalSymbolgetSeed()-
The seed used by this parser.
publicbooleanhasMoreInput()-
Returns true of the parse ended without consuming all input.
publicGearleyResultparse(String input)-
Parse a string.
publicGearleyResultparse(Iterator<Token> input)-
Parse a sequence of tokens provided by an iterator.
Note that the GLL parser only parses character tokens.
publicGearleyResultparse(Token[] input)-
Parse an array of tokens.
Note that the GLL parser only parses character tokens.
4.2. GearleyResult
The org.nineml.coffeegrinder.parser.GearleyResult interface.
4.2.1. Method summary
Public methods on the GearleyResult interface.
publicGearleyResultcontinueParsing()-
After a successful prefix parse, this method continues parsing.
publicGearleyResultcontinueParsing(GearleyParser parser)-
After a successful prefix parse, this method continues parsing with a new parser.
publicArboristgetArborist()-
Get an arborist to extract trees from the forest.
The default arborist is created with getArborist(ParseForest).
publicArboristgetArborist(Axe axe)-
Get an arborist to extract trees from the forest.
The arborist is created with getArborist(ParseForest, Axe).
publicintgetColumnNumber()-
Returns the column number of the last character on the last line read by the parser.
publicParseForestgetForest()-
Return the parse forest created by the parser.
This method returns
nullif the parse was unsuccessful. publicTokengetLastToken()-
Return the last token parsed.
publicintgetLineNumber()-
Returns the line number of the last line read by the parser.
publicintgetOffset()-
Returns the last offset read by the parser.
publiclonggetParseTime()-
Returns the number of milliseconds spent parsing.
publicGearleyParsergetParser()-
The parser used.
publicSet<TerminalSymbol>getPredictedTerminals()-
Returns the symbols predicted as possibly next in the case where a parse fails.
publicintgetTokenCount()-
Return the number of tokens parsed.
publicbooleanisAmbiguous()-
Returns true if the parse was ambiguous.
publicbooleanisInfinitelyAmbiguous()-
Returns true if the parse was infinitely ambiguous.
The parse will only be infinitely ambiguous if the grqmmar contained a loop.
publicbooleanprefixSucceeded()-
Returns true if the parser successfully processed a prefix of the input.
Note that the GLL parser does not support prefix parsing.
publicbooleansucceeded()-
Returns true of the parse was successful.