alice.tuprolog
Class Parser

java.lang.Object
  extended byalice.tuprolog.Parser
All Implemented Interfaces:
java.io.Serializable

public class Parser
extends java.lang.Object
implements java.io.Serializable

This class defines a parser of prolog terms and sentences.

See Also:
Serialized Form

Field Summary
static int EOF
           
static int ERROR
           
static int TERM
           
 
Constructor Summary
Parser(OperatorManager op, java.lang.String theoryText)
          creating a Parser specifing how to handle operators and what text to parse
Parser(java.lang.String theoryText)
          creating a parser with default operator interpretation
 
Method Summary
 int getCurrentLine()
           
 int getCurrentPos()
           
 Term getCurrentTerm()
           
 int getCurrentTermType()
           
 alice.tuprolog.Tokenizer getTokenizer()
           
 int readTerm(boolean endNeeded)
          Parses next term from the stream built on string.
 void skip()
          goes to EOF
static Term toTerm(java.lang.String st)
          Static service to get a term from its string representation
static Term toTerm(java.lang.String st, OperatorManager op)
          Static service to get a term from its string representation, providing a specific operator manager
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TERM

public static final int TERM
See Also:
Constant Field Values

EOF

public static final int EOF
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values
Constructor Detail

Parser

public Parser(OperatorManager op,
              java.lang.String theoryText)
creating a Parser specifing how to handle operators and what text to parse


Parser

public Parser(java.lang.String theoryText)
creating a parser with default operator interpretation

Method Detail

readTerm

public int readTerm(boolean endNeeded)
Parses next term from the stream built on string. if (endNeeded) then term+"." is required, else only term


toTerm

public static Term toTerm(java.lang.String st)
                   throws InvalidTermException
Static service to get a term from its string representation

Throws:
InvalidTermException

toTerm

public static Term toTerm(java.lang.String st,
                          OperatorManager op)
                   throws InvalidTermException
Static service to get a term from its string representation, providing a specific operator manager

Throws:
InvalidTermException

getCurrentPos

public int getCurrentPos()

getCurrentLine

public int getCurrentLine()

getCurrentTerm

public Term getCurrentTerm()

getCurrentTermType

public int getCurrentTermType()

getTokenizer

public alice.tuprolog.Tokenizer getTokenizer()

skip

public void skip()
goes to EOF



DEIS, Universita' di Bologna, Sede di Cesena