Interface GearleyResult

  • All Known Implementing Classes:
    EarleyResult, GllResult

    public interface GearleyResult
    The result of a parse with an Earley or GLL parser.
    • Method Detail

      • getParser

        GearleyParser getParser()
        The parser used.
        Returns:
        The parser.
      • succeeded

        boolean succeeded()
        Returns true of the parse was successful.
        Returns:
        true if the parse was successful.
      • prefixSucceeded

        boolean prefixSucceeded()
        Returns true if the parser successfully processed a prefix of the input.

        Note that the GLL parser does not support prefix parsing.

        Returns:
        true if a prefix of the input was parsed successfully.
      • getParseTime

        long getParseTime()
        Returns the number of milliseconds spent parsing.
        Returns:
        the number of milliseconds
      • continueParsing

        GearleyResult continueParsing()
        After a successful prefix parse, this method continues parsing.
        Returns:
        The (next) parse result.
      • continueParsing

        GearleyResult continueParsing​(GearleyParser parser)
        After a successful prefix parse, this method continues parsing with a new parser.
        Parameters:
        parser - The (next) parser.
        Returns:
        The (next) parse result.
      • getForest

        ParseForest getForest()
        Return the parse forest created by the parser.

        This method returns null if the parse was unsuccessful.

        Returns:
        The parse forest.
      • isAmbiguous

        boolean isAmbiguous()
        Returns true if the parse was ambiguous.
        Returns:
        true if the parse was ambiguous.
      • isInfinitelyAmbiguous

        boolean isInfinitelyAmbiguous()
        Returns true if the parse was infinitely ambiguous.

        The parse will only be infinitely ambiguous if the grqmmar contained a loop.

        Returns:
        true if the parse was infinitely ambiguous.
      • getTokenCount

        int getTokenCount()
        Return the number of tokens parsed.
        Returns:
        the number of tokens.
      • getLastToken

        Token getLastToken()
        Return the last token parsed.
        Returns:
        The last token.
      • getOffset

        int getOffset()
        Returns the last offset read by the parser.
        Returns:
        The offset.
      • getLineNumber

        int getLineNumber()
        Returns the line number of the last line read by the parser.
        Returns:
        The line number.
      • getColumnNumber

        int getColumnNumber()
        Returns the column number of the last character on the last line read by the parser.
        Returns:
        The column number.
      • getPredictedTerminals

        java.util.Set<TerminalSymbol> getPredictedTerminals()
        Returns the symbols predicted as possibly next in the case where a parse fails.
        Returns:
        The set of terminals.