コード例 #1
0
ファイル: irParser.cs プロジェクト: robin5/DemiTasse
 /* throws ParseException */
 private static IrToken jj_consume_token(IrParserConstants.RegExpId kind)
 {
     IrToken oldToken;
     if ((oldToken = token).next != null)
         token = token.next;
     else
     {
         //token = token.next = token_source.getNextToken();
         token.next = IrParserTokenManager.getNextToken();
         token = token.next;
     }
     jj_ntk = RegExpId.UNDEFINED;
     if (token.kind == kind)
     {
         jj_gen++;
         return token;
     }
     token = oldToken;
     jj_kind = kind;
     throw generateParseException();
 }
コード例 #2
0
ファイル: IrToken.cs プロジェクト: robin5/DemiTasse
 /**
 * Constructs a new token for the specified Image and Kind.
 */
 public IrToken(IrParserConstants.RegExpId kind, String image)
 {
     this.kind = kind;
     this.image = image;
 }
コード例 #3
0
ファイル: irParser.cs プロジェクト: robin5/DemiTasse
        /** Generate ParseException. */
        public static IrParseException generateParseException()
        {
            jj_expentries.Clear();
            bool[] la1tokens = new bool[52];

            if (jj_kind >= 0)
            {
                la1tokens[(int)jj_kind] = true;
                jj_kind = IrParserConstants.RegExpId.UNDEFINED;
            }

            for (int i = 0; i < 9; 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;
                        }
                    }
                }
            }

            for (int i = 0; i < 52; 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 IrParseException(token, exptokseq, tokenImage);
        }