Package com.singularsys.jep.parser
Class JccParser
java.lang.Object
com.singularsys.jep.parser.JccParser
- All Implemented Interfaces:
JccParserConstants,JccParserTreeConstants
-
Field Summary
FieldsModifier and TypeFieldDescriptionNext token.protected JJTJccParserStateCurrent token.Generated Token Manager.Fields inherited from interface com.singularsys.jep.parser.JccParserConstants
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, tokenImageFields inherited from interface com.singularsys.jep.parser.JccParserTreeConstants
JJTCONSTANT, JJTFUNNODE, jjtNodeName, JJTOPNODE, JJTSTART, JJTVARNODE, JJTVOID -
Constructor Summary
ConstructorsConstructorDescriptionJccParser(CharStream stream) Constructor with user supplied CharStream.Constructor with generated Token Manager. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidfinal voidfinal voidfinal voidArgumentList(int reqArguments, String functionName) final voidfinal voidContinue parsing without re-initializing the stream.final voidDisable tracing.final voidEnable tracing.final voidfinal voidfinal voidFunction()Generate ParseException.final TokenGet the next Token.final TokengetToken(int index) Get the specific Token.final Stringfinal voidfinal voidLValue()final voidfinal voidparseStream(CharStream stream, Jep jep, ArrayList<String> errorList) final voidfinal ObjectvoidReInit(CharStream stream) Reinitialise.voidReinitialise.final voidvoidrestart(CharStream stream, Jep jep, ArrayList<String> errorList) Restart the parse with the given stream.final voidvoidsetInitialTokenManagerState(int state) Sets the initial state that the token manager is in.final ASTStartStart()GRAMMAR STARTfinal booleanTrace enabled.final voidfinal voidfinal voidVariable()
-
Field Details
-
jjtree
-
token_source
Generated Token Manager. -
token
Current token. -
jj_nt
Next token.
-
-
Constructor Details
-
JccParser
Constructor with user supplied CharStream. -
JccParser
Constructor with generated Token Manager.
-
-
Method Details
-
parseStream
public Node parseStream(CharStream stream, Jep jep, ArrayList<String> errorList) throws ParseException - Throws:
ParseException
-
restart
Restart the parse with the given stream.- Since:
- 2.3.0 beta 1
-
continueParse
Continue parsing without re-initializing the stream. Allows re-entrance 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 exampleXJep 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) {}Empty expressions, such as the middle one in "x=1;;y=2" are returned as an ASTStart node, the end of file is returned as null.- 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 asx <DOT> 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
GRAMMAR START- Throws:
ParseException
-
Expression
- Throws:
ParseException
-
AssignExpression
- Throws:
ParseException
-
RightExpression
- Throws:
ParseException
-
OrExpression
- Throws:
ParseException
-
AndExpression
- Throws:
ParseException
-
EqualExpression
- Throws:
ParseException
-
RelationalExpression
- Throws:
ParseException
-
AdditiveExpression
- Throws:
ParseException
-
MultiplicativeExpression
- Throws:
ParseException
-
UnaryExpression
- Throws:
ParseException
-
PowerExpression
- Throws:
ParseException
-
UnaryExpressionNotPlusMinus
- Throws:
ParseException
-
ListExpression
- Throws:
ParseException
-
LValue
- Throws:
ParseException
-
ArrayAccess
- Throws:
ParseException
-
Variable
- Throws:
ParseException
-
Function
- Throws:
ParseException
-
ArgumentList
- Throws:
ParseException
-
Identifier
- Throws:
ParseException
-
AnyConstant
- Throws:
ParseException
-
RealConstant
- Throws:
ParseException
-
ReInit
Reinitialise. -
ReInit
Reinitialise. -
getNextToken
Get the next Token. -
getToken
Get the specific Token. -
generateParseException
Generate ParseException. -
trace_enabled
public final boolean trace_enabled()Trace enabled. -
enable_tracing
public final void enable_tracing()Enable tracing. -
disable_tracing
public final void disable_tracing()Disable tracing.
-