|
|||||||||
Home >> All >> alice >> [ tuprolog overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
alice.tuprolog
Class Parser

java.lang.Objectalice.tuprolog.Parser
- All Implemented Interfaces:
- java.io.Serializable
- class Parser
- extends java.lang.Object
- implements java.io.Serializable
- extends java.lang.Object
prolog terms and sentences parser
Field Summary | |
(package private) static OperatorManager |
defaultOperatorManager
the parser use a default operator manager if none is provided |
static int |
EOF
|
static int |
ERROR
|
(package private) boolean |
keepVariables
|
(package private) OperatorManager |
opManager
operator manager actually used |
private Term |
term
the term parsed |
static int |
TERM
|
private Tokenizer |
tokenizer
tokenizer used by the parser |
private int |
type
parsing state indicator: (OK,EOF,ERROR) |
private alice.util.LinkedList |
varList
list of distinct variables found parsing. |
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 | |
private alice.util.LinkedList |
expr0_arglist()
|
private Term |
expr0_list()
|
private Term |
expr0()
refer to grammar in tuProlog documentation to understand following method |
private Term |
exprA_inStruct(int prior)
refer to grammar in tuProlog documentation to understand following method |
private Term |
exprA(int prior)
refer to grammar in tuProlog documentation to understand following method |
private Term |
exprB_inStruct(int prior)
refer to grammar in tuProlog documentation to understand following method |
private Term |
exprB(int prior)
refer to grammar in tuProlog documentation to understand following method |
private Var |
findIn(java.lang.String name,
alice.util.LinkedList l)
finds a var already present in a list |
int |
getCurrentLine()
|
int |
getCurrentPos()
|
Term |
getCurrentTerm()
|
int |
getCurrentTermType()
|
alice.util.LinkedList |
getCurrentVarList()
|
Tokenizer |
getTokenizer()
|
int |
readTerm(boolean endNeeded)
parses next term from the stream built on string. |
void |
setCurrentVarList(alice.util.LinkedList l)
|
void |
setKeepVariables(boolean b)
|
void |
skip()
goes to EOF |
Methods inherited from class java.lang.Object |
clone, equals, finalize, 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
tokenizer
private Tokenizer tokenizer
- tokenizer used by the parser
varList
private alice.util.LinkedList varList
- list of distinct variables found parsing.
this list could be reset every time a new term is parsed (default mode) or could be maintained through multiple parsing stages (using method setKeepVariables)
keepVariables
boolean keepVariables
term
private Term term
- the term parsed
type
private int type
- parsing state indicator: (OK,EOF,ERROR)
defaultOperatorManager
static OperatorManager defaultOperatorManager
- the parser use a default operator manager
if none is provided
opManager
OperatorManager opManager
- operator manager actually used
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
getCurrentPos
public int getCurrentPos()
getCurrentLine
public int getCurrentLine()
getCurrentTerm
public Term getCurrentTerm()
getCurrentTermType
public int getCurrentTermType()
setCurrentVarList
public void setCurrentVarList(alice.util.LinkedList l)
getCurrentVarList
public alice.util.LinkedList getCurrentVarList()
setKeepVariables
public void setKeepVariables(boolean b)
getTokenizer
public Tokenizer getTokenizer()
skip
public void skip()
- goes to EOF
exprA
private Term exprA(int prior) throws java.lang.Exception
- refer to grammar in tuProlog documentation to understand
following method
exprB
private Term exprB(int prior) throws java.lang.Exception
- refer to grammar in tuProlog documentation to understand
following method
expr0
private Term expr0() throws java.lang.Exception
- refer to grammar in tuProlog documentation to understand
following method
expr0_list
private Term expr0_list() throws java.lang.Exception
expr0_arglist
private alice.util.LinkedList expr0_arglist() throws java.lang.Exception
exprA_inStruct
private Term exprA_inStruct(int prior) throws java.lang.Exception
- refer to grammar in tuProlog documentation to understand
following method
exprB_inStruct
private Term exprB_inStruct(int prior) throws java.lang.Exception
- refer to grammar in tuProlog documentation to understand
following method
findIn
private Var findIn(java.lang.String name, alice.util.LinkedList l)
- finds a var already present in a list
|
|||||||||
Home >> All >> alice >> [ tuprolog overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |