Class SentenceParser

java.lang.Object
org.projog.core.parser.SentenceParser

public class SentenceParser extends Object
Parses Prolog syntax representing rules including operators.

Note: not thread safe.

See Also:
  • Method Details

    • getInstance

      public static SentenceParser getInstance(String prologSyntax, Operands operands)
      Returns a new SentenceParser will parse the specified String using the specified Operands.
      Parameters:
      prologSyntax - the prolog syntax to be parsed
      operands - details of the operands to use during parsing
      Returns:
      a new SentenceParser
    • getInstance

      public static SentenceParser getInstance(Reader reader, Operands operands)
      Returns a new SentenceParser that will parse Prolog syntax read from the specified Reader using the specified Operands.
      Parameters:
      reader - the source of the prolog syntax to be parsed
      operands - details of the operands to use during parsing
      Returns:
      a new SentenceParser
    • getParsedTermVariables

      public Map<String,Variable> getParsedTermVariables()
      Returns collection of Variable instances created by this SentenceParser.

      Returns all Variables created by this SentenceParser either since it was created or since the last execution of parseSentence().

      Returns:
      collection of Variable instances created by this SentenceParser
    • parseSentence

      public Term parseSentence()
      Creates a Term from Prolog syntax, terminated by a ., read from this object's CharacterParser.
      Returns:
      a Term created from Prolog syntax read from this object's CharacterParser or null if the end of the underlying stream being parsed has been reached
      Throws:
      ParserException - if an error parsing the Prolog syntax occurs
    • hasNext

      public boolean hasNext()