Package org.nineml.coffeegrinder.gll
Class GllResult
- java.lang.Object
-
- org.nineml.coffeegrinder.gll.GllResult
-
- All Implemented Interfaces:
GearleyResult
public class GllResult extends java.lang.Object implements GearleyResult
The results of a GLL parse.
-
-
Field Summary
Fields Modifier and Type Field Description booleansuccess
-
Constructor Summary
Constructors Constructor Description GllResult(GllParser parser, BinarySubtree bsr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GearleyResultcontinueParsing()After a successful prefix parse, this method continues parsing.GearleyResultcontinueParsing(GearleyParser parser)After a successful prefix parse, this method continues parsing with a new parser.ArboristgetArborist()Get an arborist to extract trees from the forest.ArboristgetArborist(Axe axe)Get an arborist to extract trees from the forest.intgetColumnNumber()Returns the column number of the last character on the last line read by the parser.ParseForestgetForest()Return the parse forest created by the parser.TokengetLastToken()Return the last token parsed.intgetLineNumber()Returns the line number of the last line read by the parser.intgetOffset()Returns the last offset read by the parser.GearleyParsergetParser()The parser used.longgetParseTime()Returns the number of milliseconds spent parsing.java.util.Set<TerminalSymbol>getPredictedTerminals()Returns the symbols predicted as possibly next in the case where a parse fails.intgetTokenCount()Return the number of tokens parsed.booleanisAmbiguous()Returns true if the parse was ambiguous.booleanisInfinitelyAmbiguous()Returns true if the parse was infinitely ambiguous.booleanprefixSucceeded()Returns true if the parser successfully processed a prefix of the input.booleansucceeded()Returns true of the parse was successful.
-
-
-
Constructor Detail
-
GllResult
public GllResult(GllParser parser, BinarySubtree bsr)
-
-
Method Detail
-
continueParsing
public GearleyResult continueParsing()
Description copied from interface:GearleyResultAfter a successful prefix parse, this method continues parsing.- Specified by:
continueParsingin interfaceGearleyResult- Returns:
- The (next) parse result.
-
continueParsing
public GearleyResult continueParsing(GearleyParser parser)
Description copied from interface:GearleyResultAfter a successful prefix parse, this method continues parsing with a new parser.- Specified by:
continueParsingin interfaceGearleyResult- Parameters:
parser- The (next) parser.- Returns:
- The (next) parse result.
-
getForest
public ParseForest getForest()
Description copied from interface:GearleyResultReturn the parse forest created by the parser.This method returns
nullif the parse was unsuccessful.- Specified by:
getForestin interfaceGearleyResult- Returns:
- The parse forest.
-
getArborist
public Arborist getArborist()
Description copied from interface:GearleyResultGet an arborist to extract trees from the forest.The default arborist is created with
Arborist.getArborist(ParseForest).- Specified by:
getArboristin interfaceGearleyResult- Returns:
- the arborist
-
getArborist
public Arborist getArborist(Axe axe)
Description copied from interface:GearleyResultGet an arborist to extract trees from the forest.The arborist is created with
Arborist.getArborist(ParseForest, Axe).- Specified by:
getArboristin interfaceGearleyResult- Parameters:
axe- the arborists axe- Returns:
- the arborist
-
isAmbiguous
public boolean isAmbiguous()
Description copied from interface:GearleyResultReturns true if the parse was ambiguous.- Specified by:
isAmbiguousin interfaceGearleyResult- Returns:
- true if the parse was ambiguous.
-
isInfinitelyAmbiguous
public boolean isInfinitelyAmbiguous()
Description copied from interface:GearleyResultReturns true if the parse was infinitely ambiguous.The parse will only be infinitely ambiguous if the grqmmar contained a loop.
- Specified by:
isInfinitelyAmbiguousin interfaceGearleyResult- Returns:
- true if the parse was infinitely ambiguous.
-
getTokenCount
public int getTokenCount()
Description copied from interface:GearleyResultReturn the number of tokens parsed.- Specified by:
getTokenCountin interfaceGearleyResult- Returns:
- the number of tokens.
-
getLastToken
public Token getLastToken()
Description copied from interface:GearleyResultReturn the last token parsed.- Specified by:
getLastTokenin interfaceGearleyResult- Returns:
- The last token.
-
getOffset
public int getOffset()
Description copied from interface:GearleyResultReturns the last offset read by the parser.- Specified by:
getOffsetin interfaceGearleyResult- Returns:
- The offset.
-
getLineNumber
public int getLineNumber()
Description copied from interface:GearleyResultReturns the line number of the last line read by the parser.- Specified by:
getLineNumberin interfaceGearleyResult- Returns:
- The line number.
-
getColumnNumber
public int getColumnNumber()
Description copied from interface:GearleyResultReturns the column number of the last character on the last line read by the parser.- Specified by:
getColumnNumberin interfaceGearleyResult- Returns:
- The column number.
-
getPredictedTerminals
public java.util.Set<TerminalSymbol> getPredictedTerminals()
Description copied from interface:GearleyResultReturns the symbols predicted as possibly next in the case where a parse fails.- Specified by:
getPredictedTerminalsin interfaceGearleyResult- Returns:
- The set of terminals.
-
getParser
public GearleyParser getParser()
Description copied from interface:GearleyResultThe parser used.- Specified by:
getParserin interfaceGearleyResult- Returns:
- The parser.
-
prefixSucceeded
public boolean prefixSucceeded()
Description copied from interface:GearleyResultReturns true if the parser successfully processed a prefix of the input.Note that the GLL parser does not support prefix parsing.
- Specified by:
prefixSucceededin interfaceGearleyResult- Returns:
- true if a prefix of the input was parsed successfully.
-
getParseTime
public long getParseTime()
Description copied from interface:GearleyResultReturns the number of milliseconds spent parsing.- Specified by:
getParseTimein interfaceGearleyResult- Returns:
- the number of milliseconds
-
succeeded
public boolean succeeded()
Description copied from interface:GearleyResultReturns true of the parse was successful.- Specified by:
succeededin interfaceGearleyResult- Returns:
- true if the parse was successful.
-
-