Example #1
0
 /** Constructor with generated Token Manager. */
 public astParser(astParserTokenManager tm)
 {
     if (jj_initialized_once)
     {
         System.Out.println("ERROR: Second call to constructor of static parser. ");
         System.Out.println("       You must either use ReInit() or set the JavaCC option STATIC to false");
         System.Out.println("       during parser generation.");
         throw new Error();
     }
     jj_initialized_once = true;
     token_source = tm;
     token = new AstToken();
     jj_ntk = AstRegExpId.UNDEFINED;
     jj_gen = 0;
     for (int i = 0; i < 14; i++)
         jj_la1[i] = -1;
 }
Example #2
0
 /** Reinitialise. */
 public void ReInit(astParserTokenManager tm)
 {
     token_source = tm;
     token = new AstToken();
     jj_ntk = AstRegExpId.UNDEFINED;
     jj_gen = 0;
     for (int i = 0; i < 14; i++)
         jj_la1[i] = -1;
 }
Example #3
0
        /** Constructor with InputStream and supplied encoding */
        public AstParser(Stream stream, Encoding encoding)
        {
            if (jj_initialized_once)
            {
                ReInit(stream, encoding);
                //System.Out.println("ERROR: Second call to constructor of static parser.  ");
                //System.Out.println("       You must either use ReInit() or set the JavaCC option STATIC to false");
                //System.Out.println("       during parser generation.");
                //throw new Error();
            }
            else
            {
                jj_initialized_once = true;
                try
                {
                    jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1);
                }
                catch (UnsupportedEncodingException e)
                {
                    throw new RuntimeException(e);
                }
                token_source = new AstParserTokenManager(jj_input_stream);
            }

            token = new AstToken();
            jj_ntk = AstRegExpId.UNDEFINED;
            jj_gen = 0;

            for (int i = 0; i < 14; i++)
                jj_la1[i] = -1;
        }