Class JccParser

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

public class JccParser extends Object implements JccParserTreeConstants, JccParserConstants
  • Field Details

  • Constructor Details

    • JccParser

      public JccParser(CharStream stream)
      Constructor with user supplied CharStream.
    • JccParser

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

    • parseStream

      public Node parseStream(CharStream stream, Jep jep, ArrayList<String> errorList) throws ParseException
      Throws:
      ParseException
    • restart

      public void restart(CharStream stream, Jep jep, ArrayList<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 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 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 <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

      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, String functionName) throws ParseException
      Throws:
      ParseException
    • Identifier

      public final String Identifier() throws ParseException
      Throws:
      ParseException
    • AnyConstant

      public final void AnyConstant() throws ParseException
      Throws:
      ParseException
    • RealConstant

      public final Object RealConstant() throws ParseException
      Throws:
      ParseException
    • ReInit

      public void ReInit(CharStream 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.
    • 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.