com.singularsys.jep.parser
Class JccParser

java.lang.Object
  extended by com.singularsys.jep.parser.JccParser
All Implemented Interfaces:
JccParserConstants, JccParserTreeConstants

public class JccParser
extends java.lang.Object
implements JccParserTreeConstants, JccParserConstants


Field Summary
 Token jj_nt
          Next token.
protected  JJTJccParserState jjtree
           
 Token token
          Current token.
 JccParserTokenManager token_source
          Generated Token Manager.
 
Fields inherited from interface com.singularsys.jep.parser.JccParserTreeConstants
JJTCONSTANT, JJTFUNNODE, jjtNodeName, JJTOPNODE, JJTSTART, JJTVARNODE, JJTVOID
 
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, tokenImage
 
Constructor Summary
JccParser(java.io.InputStream stream)
          Constructor with InputStream.
JccParser(java.io.InputStream stream, java.lang.String encoding)
          Constructor with InputStream and supplied encoding
JccParser(JccParserTokenManager tm)
          Constructor with generated Token Manager.
JccParser(java.io.Reader stream)
          Constructor.
 
Method Summary
 void AdditiveExpression()
           
 void AndExpression()
           
 void AnyConstant()
           
 void ArgumentList(int reqArguments, java.lang.String functionName)
           
 void ArrayAccess()
           
 void AssignExpression()
           
 Node continueParse()
          Continue parsing without re-initializing the stream.
 void disable_tracing()
          Disable tracing.
 void enable_tracing()
          Enable tracing.
 void EqualExpression()
           
 void Expression()
           
 void Function()
           
 ParseException generateParseException()
          Generate ParseException.
 Token getNextToken()
          Get the next Token.
 Token getToken(int index)
          Get the specific Token.
 java.lang.String Identifier()
           
 void ListExpression()
           
 void LValue()
           
 void MultiplicativeExpression()
           
 void OrExpression()
           
 Node parseStream(java.io.Reader stream, Jep jep, java.util.ArrayList<java.lang.String> errorList)
           
 void PowerExpression()
           
 java.lang.Object RealConstant()
           
 void ReInit(java.io.InputStream stream)
          Reinitialise.
 void ReInit(java.io.InputStream stream, java.lang.String encoding)
          Reinitialise.
 void ReInit(JccParserTokenManager tm)
          Reinitialise.
 void ReInit(java.io.Reader stream)
          Reinitialise.
 void RelationalExpression()
           
 void restart(java.io.Reader stream, Jep jep, java.util.ArrayList<java.lang.String> errorList)
          Restart the parse with the given stream.
 void RightExpression()
           
 void setInitialTokenManagerState(int state)
          Sets the initial state that the token manager is in.
 ASTStart Start()
          GRAMMAR START
 void UnaryExpression()
           
 void UnaryExpressionNotPlusMinus()
           
 void Variable()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jjtree

protected JJTJccParserState jjtree

token_source

public JccParserTokenManager token_source
Generated Token Manager.


token

public Token token
Current token.


jj_nt

public Token jj_nt
Next token.

Constructor Detail

JccParser

public JccParser(java.io.InputStream stream)
Constructor with InputStream.


JccParser

public JccParser(java.io.InputStream stream,
                 java.lang.String encoding)
Constructor with InputStream and supplied encoding


JccParser

public JccParser(java.io.Reader stream)
Constructor.


JccParser

public JccParser(JccParserTokenManager tm)
Constructor with generated Token Manager.

Method Detail

parseStream

public Node parseStream(java.io.Reader stream,
                        Jep jep,
                        java.util.ArrayList<java.lang.String> errorList)
                 throws ParseException
Throws:
ParseException

restart

public void restart(java.io.Reader stream,
                    Jep jep,
                    java.util.ArrayList<java.lang.String> errorList)
Restart the parse with the given stream.

Since:
2.3.0 beta 1

continueParse

public Node continueParse()
                   throws ParseException
Continue parsing without re-initializing the stream. Allows reentrance 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) {}
 
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 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)
Reinitialise.


ReInit

public void ReInit(java.io.InputStream stream,
                   java.lang.String encoding)
Reinitialise.


ReInit

public void ReInit(java.io.Reader stream)
Reinitialise.


ReInit

public void ReInit(JccParserTokenManager tm)
Reinitialise.


getNextToken

public final Token getNextToken()
Get the next Token.


getToken

public final Token getToken(int index)
Get the specific Token.


generateParseException

public ParseException generateParseException()
Generate ParseException.


enable_tracing

public final void enable_tracing()
Enable tracing.


disable_tracing

public final void disable_tracing()
Disable tracing.



Copyright © 2010 Singular Systems http://www.singularsys.com/jep