public class EarleyResult extends java.lang.Object implements GearleyResult
| Modifier and Type | Method and Description | 
|---|---|
| EarleyResult | continueParsing()Continue parsing from the last successfully matched prefix. | 
| EarleyResult | continueParsing(GearleyParser newParser)Continue parsing from the last successfully matched prefix with a new parser. | 
| Arborist | getArborist()Get an arborist to extract trees from the forest. | 
| Arborist | getArborist(Axe axe)Get an arborist to extract trees from the forest. | 
| EarleyChart | getChart()Get the Earley chart for the parse. | 
| int | getColumnNumber()Returns the column number of the last character on the last line read by the parser. | 
| ParseForest | getForest()Return the parse forest created by the parser. | 
| Token | getLastToken()What was the last token parsed? | 
| int | getLineNumber()Returns the line number of the last line read by the parser. | 
| int | getOffset()Returns the last offset read by the parser. | 
| EarleyParser | getParser()Get the parser for this result. | 
| long | getParseTime()How long did the parse take? | 
| java.util.Set<TerminalSymbol> | getPredictedTerminals()Returns the symbols predicted as possibly next in the case where a parse fails. | 
| Token[] | getSuffix() | 
| int | getTokenCount()How many tokens were parsed? | 
| boolean | isAmbiguous()Returns true if the parse was ambiguous. | 
| boolean | isInfinitelyAmbiguous()Returns true if the parse was infinitely ambiguous. | 
| boolean | prefixSucceeded()Did the parse match the beginning of the input? | 
| boolean | succeeded()Did the parse succeed? | 
public long getParseTime()
Returns the number of milliseconds required to parse the input. Returns -1 if the timing is unavailable.
getParseTime in interface GearleyResultpublic EarleyParser getParser()
getParser in interface GearleyResultpublic EarleyChart getChart()
After a parse, the Earley chart isn't usually very useful. It's discarded unless the
 ParserOptions.getReturnChart() returnChart} option is enabled.
public ParseForest getForest()
GearleyResultThis method returns null if the parse was unsuccessful.
getForest in interface GearleyResultpublic Arborist getArborist()
GearleyResultThe default arborist is created with Arborist.getArborist(ParseForest).
getArborist in interface GearleyResultpublic Arborist getArborist(Axe axe)
GearleyResultThe arborist is created with Arborist.getArborist(ParseForest, Axe).
getArborist in interface GearleyResultaxe - the arborists axepublic boolean isAmbiguous()
GearleyResultisAmbiguous in interface GearleyResultpublic boolean isInfinitelyAmbiguous()
GearleyResultThe parse will only be infinitely ambiguous if the grqmmar contained a loop.
isInfinitelyAmbiguous in interface GearleyResultpublic boolean succeeded()
succeeded in interface GearleyResultpublic boolean prefixSucceeded()
Suppose you're looking for "abb" and you give "abbc" as the input. That parse will fail, but it did succeed on a prefix of the input. This method will return true if the input began with a string that could be successfully parsed.
Prefix parsing is only performed if the  prefixParsing option is
 enabled.
Note: if the whole parse succeeded, this method returns false.
prefixSucceeded in interface GearleyResultpublic Token[] getSuffix()
public EarleyResult continueParsing()
If prefix parsing is enabled, and a prefix was identified, this method will attempt to continue parsing from the next token after the previous prefix parse.
continueParsing in interface GearleyResultParseException - if this result doesn't indicate that a prefix parse was successfulpublic EarleyResult continueParsing(GearleyParser newParser)
If prefix parsing is enabled, and a prefix was identified, this method will attempt to continue parsing from the next token after the previous prefix parse.
continueParsing in interface GearleyResultnewParser - The (next) parser.ParseException - if this result doesn't indicate that a prefix parse was successfulpublic int getTokenCount()
In the case of an unsuccessful parse, restarting may occur before this position.
getTokenCount in interface GearleyResultpublic Token getLastToken()
In the case of an unsuccessful parse, restarting may reparse this token.
getLastToken in interface GearleyResultpublic int getOffset()
GearleyResultgetOffset in interface GearleyResultpublic int getLineNumber()
GearleyResultgetLineNumber in interface GearleyResultpublic int getColumnNumber()
GearleyResultgetColumnNumber in interface GearleyResultpublic java.util.Set<TerminalSymbol> getPredictedTerminals()
GearleyResultgetPredictedTerminals in interface GearleyResult