Ejemplo n.º 1
0
 /** Reinitialise. */
 public static void ReInit(java.io.Reader stream)
 {
     jj_input_stream.ReInit(stream, 1, 1);
     token_source.ReInit(jj_input_stream);
     token = new AstToken();
     jj_ntk = AstRegExpId.UNDEFINED;
     jj_gen = 0;
     for (int i = 0; i < 14; i++) jj_la1[i] = -1;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 4
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;
 }
Ejemplo n.º 5
0
 private static AstRegExpId jj_ntk_fn()
 {
     if ((jj_nt=token.next) == null)
         return (jj_ntk = (token.next = AstParserTokenManager.getNextToken()).kind);
     else
         return (jj_ntk = jj_nt.kind);
 }
Ejemplo n.º 6
0
        /* throws ParseException */
        private static AstToken jj_consume_token(AstParserConstants.AstRegExpId kind)
        {
            AstToken oldToken;
            if ((oldToken = token).next != null)
                token = token.next;
            else
                token = token.next = AstParserTokenManager.getNextToken();
            jj_ntk = AstRegExpId.UNDEFINED;

            if (token.kind == kind)
            {
                jj_gen++;
                return token;
            }
            token = oldToken;
            jj_kind = kind;
            throw generateParseException();
        }
Ejemplo n.º 7
0
 /** Reinitialise. */
 public static void ReInit(Stream stream, Encoding encoding)
 {
     try
     {
         jj_input_stream.ReInit(stream, encoding, 1, 1);
     }
     catch(UnsupportedEncodingException e)
     {
         throw new RuntimeException(e);
     }
     AstParserTokenManager.ReInit(jj_input_stream);
     token = new AstToken();
     jj_ntk = AstRegExpId.UNDEFINED;
     jj_gen = 0;
     for (int i = 0; i < 14; i++) jj_la1[i] = -1;
 }
Ejemplo n.º 8
0
 /** Get the next Token. */
 /* final */
 public static AstToken getNextToken()
 {
     if (token.next != null)
         token = token.next;
     else
         token = token.next = AstParserTokenManager.getNextToken();
     jj_ntk = AstRegExpId.UNDEFINED;
     jj_gen++;
     return token;
 }
Ejemplo n.º 9
0
 /** Generate ParseException. */
 public static AstParseException generateParseException()
 {
     jj_expentries.Clear();
     bool[] la1tokens = new bool[71];
     if (jj_kind >= 0)
     {
         la1tokens[(int)jj_kind] = true;
         jj_kind = AstRegExpId.UNDEFINED;
     }
     for (int i = 0; i < 14; i++)
     {
         if (jj_la1[i] == jj_gen)
         {
             for (int j = 0; j < 32; j++)
             {
                 if ((jj_la1_0[i] & (1<<j)) != 0)
                 {
                     la1tokens[j] = true;
                 }
                 if ((jj_la1_1[i] & (1<<j)) != 0)
                 {
                     la1tokens[32+j] = true;
                 }
                 if ((jj_la1_2[i] & (1<<j)) != 0)
                 {
                     la1tokens[64+j] = true;
                 }
             }
         }
     }
     for (int i = 0; i < 71; i++)
     {
         if (la1tokens[i])
         {
             jj_expentry = new int[1];
             jj_expentry[0] = i;
             jj_expentries.Add(jj_expentry);
         }
     }
     int[][] exptokseq = new int[jj_expentries.Count][];
     for (int i = 0; i < jj_expentries.Count; i++)
     {
         exptokseq[i] = jj_expentries[i];
     }
     return new AstParseException(token, exptokseq, tokenImage);
 }