Class JccParser

    • Constructor Detail

      • JccParser

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

      • restart

        public void restart​(CharStream 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 <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
      • ArgumentList

        public final void ArgumentList​(int reqArguments,
                                       java.lang.String functionName)
                                throws ParseException
        Throws:
        ParseException
      • ReInit

        public void ReInit​(CharStream stream)
        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.