예제 #1
0
 /** Reinitialise. */
 public void ReInit(irParserTokenManager tm)
 {
     token_source = tm;
     token = new IrToken();
     jj_ntk = RegExpId.UNDEFINED;
     jj_gen = 0;
     for (int i = 0; i < 9; i++) jj_la1[i] = -1;
 }
예제 #2
0
 /** Constructor. */
 public irParser(/* java.io.Reader */ InputStreamReader stream)
 {
     if (jj_initialized_once)
     {
         Console.Out.WriteLine("ERROR: Second call to constructor of static parser. ");
         Console.Out.WriteLine("       You must either use ReInit() or set the JavaCC option STATIC to false");
         Console.Out.WriteLine("       during parser generation.");
         throw new Error();
     }
     jj_initialized_once = true;
     jj_input_stream = new SimpleCharStream(stream, 1, 1);
     token_source = new irParserTokenManager(jj_input_stream);
     token = new IrToken();
     jj_ntk = RegExpId.UNDEFINED;
     jj_gen = 0;
     for (int i = 0; i < 9; i++) jj_la1[i] = -1;
 }
예제 #3
0
 /** Constructor with generated Token Manager. */
 public irParser(irParserTokenManager tm)
 {
     if (jj_initialized_once)
     {
         Console.Out.WriteLine("ERROR: Second call to constructor of static parser. ");
         Console.Out.WriteLine("       You must either use ReInit() or set the JavaCC option STATIC to false");
         Console.Out.WriteLine("       during parser generation.");
         throw new Error();
     }
     jj_initialized_once = true;
     token_source = tm;
     token = new IrToken();
     jj_ntk = RegExpId.UNDEFINED;
     jj_gen = 0;
     for (int i = 0; i < 9; i++) jj_la1[i] = -1;
 }
예제 #4
0
        /** Constructor with InputStream and supplied encoding */
        public IrParser(Stream stream, Encoding encoding)
        {
            if (jj_initialized_once)
            {
                ReInit(stream, encoding);
                //Console.Out.WriteLine("ERROR: Second call to constructor of static parser.  ");
                //Console.Out.WriteLine("       You must either use ReInit() or set the JavaCC option STATIC to false");
                //Console.Out.WriteLine("       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 IrParserTokenManager(jj_input_stream);
            }

            token = new IrToken();
            jj_ntk = RegExpId.UNDEFINED;
            jj_gen = 0;
            for (int i = 0; i < 9; i++) jj_la1[i] = -1;
        }