org.nfunk.jep
Class Parser
java.lang.Object
org.nfunk.jep.Parser
- All Implemented Interfaces:
- ParserConstants, ParserTreeConstants
public class Parser
- extends java.lang.Object
- implements ParserTreeConstants, ParserConstants
Fields inherited from interface org.nfunk.jep.ParserConstants |
AND, ASSIGN, COLON, COMMA, CROSS, DECIMAL_LITERAL, DEFAULT, DIGIT1, DIGIT2, DIV, DOT, EOF, EQ, EXPONENT, FLOATING_POINT_LITERAL, GE, GT, INDENTIFIER1, INDENTIFIER2, INTEGER_LITERAL, LE, LETTER1, LETTER2, LRND, LSQ, LT, MINUS, MOD, MUL, NE, NO_DOT_IN_IDENTIFIERS, NOT, OR, PLUS, POWER, RRND, RSQ, SEMI, STRING_LITERAL, tokenImage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
jjtree
protected org.nfunk.jep.JJTParserState jjtree
token_source
public ParserTokenManager token_source
token
public Token token
jj_nt
public Token jj_nt
lookingAhead
public boolean lookingAhead
Parser
public Parser(java.io.InputStream stream)
Parser
public Parser(java.io.Reader stream)
Parser
public Parser(ParserTokenManager tm)
parseStream
public Node parseStream(java.io.Reader stream,
JEP jep_in)
throws ParseException
- Throws:
ParseException
restart
public void restart(java.io.Reader stream,
JEP jep_in)
- Restart the parse with the given stream.
- Since:
- 2.3.0 beta 1
continueParse
public Node continueParse()
throws ParseException
- Continue parsing without re-initilising stream.
Allows renetrancy of parser so that strings like
"x=1; y=2; z=3;" can be parsed.
When a semi colon is encountered parsing finishes leaving the rest of the string unparsed.
Parsing can be resumed from the current position by using this method.
For example
XJep j = new XJep();
Parser parse = j.getParse();
StringReader sr = new StringReader("x=1; y=2; z=3;");
parse.restart(sr,j);
Node node;
try {
while((node = j.continueParse())!=null) {
j.println(node);
} }catch(ParseException e) {}
- Throws:
ParseException
setInitialTokenManagerState
public void setInitialTokenManagerState(int state)
- Sets the initial state that the token manager is in.
Can be used to change how x.x is interpreted, either as a single
identifier (DEFAULT) or as x x (NO_DOT_IN_IDENTIFIERS)
- Parameters:
state
- the state to be in. Currently the only legal values are DEFAULT and NO_DOT_IN_IDENTIFIER
Start
public final ASTStart Start()
throws ParseException
- GRAMMAR START
- Throws:
ParseException
Expression
public final void Expression()
throws ParseException
- Throws:
ParseException
AssignExpression
public final void AssignExpression()
throws ParseException
- Throws:
ParseException
RightExpression
public final void RightExpression()
throws ParseException
- Throws:
ParseException
OrExpression
public final void OrExpression()
throws ParseException
- Throws:
ParseException
AndExpression
public final void AndExpression()
throws ParseException
- Throws:
ParseException
EqualExpression
public final void EqualExpression()
throws ParseException
- Throws:
ParseException
RelationalExpression
public final void RelationalExpression()
throws ParseException
- Throws:
ParseException
AdditiveExpression
public final void AdditiveExpression()
throws ParseException
- Throws:
ParseException
MultiplicativeExpression
public final void MultiplicativeExpression()
throws ParseException
- Throws:
ParseException
UnaryExpression
public final void UnaryExpression()
throws ParseException
- Throws:
ParseException
PowerExpression
public final void PowerExpression()
throws ParseException
- Throws:
ParseException
UnaryExpressionNotPlusMinus
public final void UnaryExpressionNotPlusMinus()
throws ParseException
- Throws:
ParseException
ListExpression
public final void ListExpression()
throws ParseException
- Throws:
ParseException
LValue
public final void LValue()
throws ParseException
- Throws:
ParseException
ArrayAccess
public final void ArrayAccess()
throws ParseException
- Throws:
ParseException
Variable
public final void Variable()
throws ParseException
- Throws:
ParseException
Function
public final void Function()
throws ParseException
- Throws:
ParseException
ArgumentList
public final void ArgumentList(int reqArguments,
java.lang.String functionName)
throws ParseException
- Throws:
ParseException
Identifier
public final java.lang.String Identifier()
throws ParseException
- Throws:
ParseException
AnyConstant
public final void AnyConstant()
throws ParseException
- Throws:
ParseException
RealConstant
public final java.lang.Object RealConstant()
throws ParseException
- Throws:
ParseException
ReInit
public void ReInit(java.io.InputStream stream)
ReInit
public void ReInit(java.io.Reader stream)
ReInit
public void ReInit(ParserTokenManager tm)
getNextToken
public final Token getNextToken()
getToken
public final Token getToken(int index)
generateParseException
public ParseException generateParseException()
enable_tracing
public final void enable_tracing()
disable_tracing
public final void disable_tracing()
http://www.singularsys.com/jep Copyright © 2007 Singular Systems