コード例 #1
0
 public static Expression ComparisonFor(Expression local, IEnumerable<Expression> expressions)
 {
     BinaryExpression expression;
     IEnumerator<Expression> enumerator = expressions.GetEnumerator();
     if (!enumerator.MoveNext())
     {
         throw new AssertionFailedException("e.MoveNext()");
     }
     BinaryExpression expression1 = expression = new BinaryExpression(LexicalInfo.Empty);
     expression.set_Operator(11);
     expression.set_Left(Expression.Lift(local));
     expression.set_Right(Expression.Lift(enumerator.Current));
     Expression expression2 = expression;
     while (enumerator.MoveNext())
     {
         BinaryExpression expression3;
         BinaryExpression expression4;
         BinaryExpression expression11 = expression4 = new BinaryExpression(LexicalInfo.Empty);
         expression4.set_Operator(0x1c);
         expression4.set_Left(Expression.Lift(expression2));
         BinaryExpression expression12 = expression3 = new BinaryExpression(LexicalInfo.Empty);
         expression3.set_Operator(11);
         expression3.set_Left(Expression.Lift(local));
         expression3.set_Right(Expression.Lift(enumerator.Current));
         expression4.set_Right(expression3);
         expression2 = expression4;
     }
     return expression2;
 }
コード例 #2
0
 public void ApplyImplicitArrayConversion(BinaryExpression node)
 {
     IType expressionType = this.GetExpressionType(node.get_Left());
     if (expressionType.get_IsArray())
     {
         IType type2 = this.GetExpressionType(node.get_Right());
         if (type2 == this.UnityScriptLangArray())
         {
             node.set_Right(this.get_CodeBuilder().CreateCast(expressionType, this.get_CodeBuilder().CreateMethodInvocation(node.get_Right(), this.ResolveMethod(type2, "ToBuiltin"), this.get_CodeBuilder().CreateTypeofExpression(expressionType.get_ElementType()))));
         }
     }
 }
コード例 #3
0
 public ClassDefinition GetContextFieldDeclaration()
 {
     Field field;
     Field field2;
     ParameterDeclaration declaration;
     MemberReferenceExpression expression;
     ReferenceExpression expression2;
     BinaryExpression expression3;
     ReferenceExpression expression4;
     ReferenceExpression expression5;
     MemberReferenceExpression expression6;
     BinaryExpression expression7;
     Block block;
     Constructor constructor;
     ClassDefinition definition;
     Type type = this._evaluationContext.GetType();
     Type type2 = this._evaluationContext.ScriptContainer.GetType();
     ClassDefinition definition1 = definition = new ClassDefinition(LexicalInfo.Empty);
     definition.set_Name("_");
     TypeMember[] memberArray1 = new TypeMember[3];
     Field field1 = field = new Field(LexicalInfo.Empty);
     field.set_Modifiers(40);
     field.set_Name("ScriptContainer");
     field.set_Type(TypeReference.Lift(type2));
     field.set_IsVolatile(false);
     memberArray1[0] = field;
     Field field3 = field2 = new Field(LexicalInfo.Empty);
     field2.set_Name("EvaluationContext");
     field2.set_Type(TypeReference.Lift(type));
     field2.set_IsVolatile(false);
     memberArray1[1] = field2;
     Constructor constructor1 = constructor = new Constructor(LexicalInfo.Empty);
     constructor.set_Name("constructor");
     ParameterDeclaration[] declarationArray1 = new ParameterDeclaration[1];
     ParameterDeclaration declaration1 = declaration = new ParameterDeclaration(LexicalInfo.Empty);
     declaration.set_Name("context");
     declaration.set_Type(TypeReference.Lift(type));
     declarationArray1[0] = declaration;
     constructor.set_Parameters(ParameterDeclarationCollection.FromArray(false, declarationArray1));
     Block block1 = block = new Block(LexicalInfo.Empty);
     Statement[] statementArray1 = new Statement[2];
     BinaryExpression expression1 = expression3 = new BinaryExpression(LexicalInfo.Empty);
     expression3.set_Operator(15);
     MemberReferenceExpression expression14 = expression = new MemberReferenceExpression(LexicalInfo.Empty);
     expression.set_Name("EvaluationContext");
     expression.set_Target(new SelfLiteralExpression(LexicalInfo.Empty));
     expression3.set_Left(expression);
     ReferenceExpression expression15 = expression2 = new ReferenceExpression(LexicalInfo.Empty);
     expression2.set_Name("context");
     expression3.set_Right(expression2);
     statementArray1[0] = Statement.Lift(expression3);
     BinaryExpression expression16 = expression7 = new BinaryExpression(LexicalInfo.Empty);
     expression7.set_Operator(15);
     ReferenceExpression expression17 = expression4 = new ReferenceExpression(LexicalInfo.Empty);
     expression4.set_Name("ScriptContainer");
     expression7.set_Left(expression4);
     MemberReferenceExpression expression18 = expression6 = new MemberReferenceExpression(LexicalInfo.Empty);
     expression6.set_Name("ScriptContainer");
     ReferenceExpression expression19 = expression5 = new ReferenceExpression(LexicalInfo.Empty);
     expression5.set_Name("context");
     expression6.set_Target(expression5);
     expression7.set_Right(expression6);
     statementArray1[1] = Statement.Lift(expression7);
     block.set_Statements(StatementCollection.FromArray(statementArray1));
     constructor.set_Body(block);
     memberArray1[2] = constructor;
     definition.set_Members(TypeMemberCollection.FromArray(memberArray1));
     return definition;
 }
コード例 #4
0
        public Expression assignment_expression()
        {
            Expression expression = null;
            IToken token = null;
            IToken token2 = null;
            IToken token3 = null;
            IToken token4 = null;
            IToken token5 = null;
            IToken token6 = null;
            IToken token7 = null;
            IToken token8 = null;
            IToken token9 = null;
            IToken token10 = null;
            try
            {
                expression = this.conditional_expression();
                int num = this.LA(1);
                if ((((num == 0x34) || (num == 0x35)) || ((num == 0x36) || (num == 0x37))) || ((((num == 0x47) || (num == 0x4a)) || ((num == 0x4e) || (num == 0x5e))) || ((num == 0x62) || (num == 0x66))))
                {
                    IToken token11;
                    BinaryOperatorType type;
                    num = this.LA(1);
                    switch (num)
                    {
                        case 0x4e:
                            token = this.LT(1);
                            this.match(0x4e);
                            if (base.inputState.guessing == 0)
                            {
                                token11 = token;
                                type = 15;
                            }
                            break;

                        case 0x35:
                            token2 = this.LT(1);
                            this.match(0x35);
                            if (base.inputState.guessing == 0)
                            {
                                token11 = token2;
                                type = 0x10;
                            }
                            break;

                        case 0x36:
                            token3 = this.LT(1);
                            this.match(0x36);
                            if (base.inputState.guessing == 0)
                            {
                                token11 = token3;
                                type = 0x11;
                            }
                            break;

                        case 0x37:
                            token4 = this.LT(1);
                            this.match(0x37);
                            if (base.inputState.guessing == 0)
                            {
                                token11 = token4;
                                type = 0x12;
                            }
                            break;

                        case 0x34:
                            token5 = this.LT(1);
                            this.match(0x34);
                            if (base.inputState.guessing == 0)
                            {
                                token11 = token5;
                                type = 0x13;
                            }
                            break;

                        case 0x47:
                            token6 = this.LT(1);
                            this.match(0x47);
                            if (base.inputState.guessing == 0)
                            {
                                token11 = token6;
                                type = 0x16;
                            }
                            break;

                        case 0x4a:
                            token7 = this.LT(1);
                            this.match(0x4a);
                            if (base.inputState.guessing == 0)
                            {
                                token11 = token7;
                                type = 0x15;
                            }
                            break;

                        case 0x66:
                            token8 = this.LT(1);
                            this.match(0x66);
                            if (base.inputState.guessing == 0)
                            {
                                token11 = token8;
                                type = 0x21;
                            }
                            break;

                        case 0x5e:
                            token9 = this.LT(1);
                            this.match(0x5e);
                            if (base.inputState.guessing == 0)
                            {
                                token11 = token9;
                                type = 0x23;
                            }
                            break;

                        case 0x62:
                            token10 = this.LT(1);
                            this.match(0x62);
                            if (base.inputState.guessing == 0)
                            {
                                token11 = token10;
                                type = 0x25;
                            }
                            break;

                        default:
                            throw new NoViableAltException(this.LT(1), this.getFilename());
                    }
                    Expression expression2 = this.assignment_expression();
                    if (base.inputState.guessing == 0)
                    {
                        BinaryExpression expression3 = new BinaryExpression(ToLexicalInfo(token11));
                        expression3.set_Operator(type);
                        expression3.set_Left(expression);
                        expression3.set_Right(expression2);
                        expression = expression3;
                    }
                    return expression;
                }
                switch (num)
                {
                    case 1:
                    case 5:
                    case 7:
                    case 8:
                    case 9:
                    case 10:
                    case 11:
                    case 12:
                    case 13:
                    case 15:
                    case 0x10:
                    case 0x11:
                    case 0x12:
                    case 0x13:
                    case 20:
                    case 0x15:
                    case 0x19:
                    case 0x1b:
                    case 0x1d:
                    case 30:
                    case 0x1f:
                    case 0x20:
                    case 0x21:
                    case 0x23:
                    case 0x24:
                    case 0x25:
                    case 0x26:
                    case 0x27:
                    case 40:
                    case 0x29:
                    case 0x2a:
                    case 0x2b:
                    case 0x2c:
                    case 0x2d:
                    case 0x2e:
                    case 0x2f:
                    case 0x30:
                    case 0x31:
                    case 50:
                    case 0x33:
                    case 0x3b:
                    case 60:
                    case 0x3d:
                    case 0x3e:
                    case 0x3f:
                    case 0x40:
                    case 0x44:
                    case 0x4d:
                    case 0x4f:
                    case 80:
                    case 0x52:
                    case 0x58:
                    case 0x63:
                    case 0x67:
                    case 0x69:
                    case 0x6a:
                    case 0x6b:
                    case 0x6c:
                        return expression;

                    case 0x6d:
                        return expression;
                }
                throw new NoViableAltException(this.LT(1), this.getFilename());
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_51_);
                return expression;
            }
            return expression;
        }
コード例 #5
0
        public Expression term()
        {
            Expression expression = null;
            IToken token = null;
            IToken token2 = null;
            IToken token3 = null;
            BinaryOperatorType type = 0;
            try
            {
                expression = this.unary_expression();
                while (true)
                {
                    IToken token4;
                    if (((this.LA(1) != 0x53) && (this.LA(1) != 0x54)) && (this.LA(1) != 0x68))
                    {
                        return expression;
                    }
                    if (!tokenSet_16_.member(this.LA(2)))
                    {
                        return expression;
                    }
                    switch (this.LA(1))
                    {
                        case 0x54:
                            token = this.LT(1);
                            this.match(0x54);
                            if (base.inputState.guessing == 0)
                            {
                                type = 3;
                                token4 = token;
                            }
                            break;

                        case 0x68:
                            token2 = this.LT(1);
                            this.match(0x68);
                            if (base.inputState.guessing == 0)
                            {
                                type = 4;
                                token4 = token2;
                            }
                            break;

                        case 0x53:
                            token3 = this.LT(1);
                            this.match(0x53);
                            if (base.inputState.guessing == 0)
                            {
                                type = 5;
                                token4 = token3;
                            }
                            break;

                        default:
                            throw new NoViableAltException(this.LT(1), this.getFilename());
                    }
                    Expression expression2 = this.unary_expression();
                    if (base.inputState.guessing == 0)
                    {
                        BinaryExpression expression3 = new BinaryExpression(ToLexicalInfo(token4));
                        expression3.set_Operator(type);
                        expression3.set_Left(expression);
                        expression3.set_Right(expression2);
                        expression = expression3;
                    }
                }
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_20_);
                return expression;
            }
            return expression;
        }
コード例 #6
0
 public Expression logical_or()
 {
     Expression expression = null;
     IToken token = null;
     try
     {
         expression = this.logical_and();
         while ((this.LA(1) == 0x4b) && tokenSet_16_.member(this.LA(2)))
         {
             token = this.LT(1);
             this.match(0x4b);
             Expression expression2 = this.logical_and();
             if (base.inputState.guessing == 0)
             {
                 BinaryExpression expression3;
                 BinaryExpression expression1 = expression3 = new BinaryExpression(ToLexicalInfo(token));
                 expression3.set_Operator(0x1c);
                 expression3.set_Left(expression);
                 expression3.set_Right(expression2);
                 expression = expression3;
             }
         }
         return expression;
     }
     catch (RecognitionException exception)
     {
         if (base.inputState.guessing != 0)
         {
             throw;
         }
         this.reportError(exception);
         this.recover(exception, tokenSet_20_);
         return expression;
     }
     return expression;
 }
コード例 #7
0
        public Expression comparison()
        {
            Expression expression = null;
            IToken token = null;
            IToken token2 = null;
            IToken token3 = null;
            IToken token4 = null;
            IToken token5 = null;
            IToken token6 = null;
            IToken token7 = null;
            Expression expression2 = null;
            BinaryOperatorType type = 0;
            IToken token8 = null;
            try
            {
                expression = this.shift();
                while (true)
                {
                    if (!tokenSet_56_.member(this.LA(1)) || !tokenSet_57_.member(this.LA(2)))
                    {
                        return expression;
                    }
                    int num = this.LA(1);
                    if ((((num == 0x18) || (num == 0x1c)) || ((num == 0x5b) || (num == 0x5c))) || ((num == 0x5f) || (num == 0x60)))
                    {
                        num = this.LA(1);
                        switch (num)
                        {
                            case 0x1c:
                                token = this.LT(1);
                                this.match(0x1c);
                                this.match(0x18);
                                if (base.inputState.guessing == 0)
                                {
                                    type = 0x1b;
                                    token8 = token;
                                }
                                break;

                            case 0x18:
                                token2 = this.LT(1);
                                this.match(0x18);
                                if (base.inputState.guessing == 0)
                                {
                                    type = 0x1a;
                                    token8 = token2;
                                }
                                break;

                            case 0x5f:
                                token3 = this.LT(1);
                                this.match(0x5f);
                                if (base.inputState.guessing == 0)
                                {
                                    type = 9;
                                    token8 = token3;
                                }
                                break;

                            case 0x60:
                                token4 = this.LT(1);
                                this.match(0x60);
                                if (base.inputState.guessing == 0)
                                {
                                    type = 10;
                                    token8 = token4;
                                }
                                break;

                            case 0x5b:
                                token5 = this.LT(1);
                                this.match(0x5b);
                                if (base.inputState.guessing == 0)
                                {
                                    type = 7;
                                    token8 = token5;
                                }
                                break;

                            case 0x5c:
                                token6 = this.LT(1);
                                this.match(0x5c);
                                if (base.inputState.guessing == 0)
                                {
                                    type = 8;
                                    token8 = token6;
                                }
                                break;

                            default:
                                throw new NoViableAltException(this.LT(1), this.getFilename());
                        }
                        expression2 = this.shift();
                    }
                    else
                    {
                        if (num != 0x1a)
                        {
                            throw new NoViableAltException(this.LT(1), this.getFilename());
                        }
                        token7 = this.LT(1);
                        this.match(0x1a);
                        TypeReference reference = this.type_reference();
                        if (base.inputState.guessing == 0)
                        {
                            type = 0x19;
                            token8 = token7;
                            expression2 = new TypeofExpression(reference.get_LexicalInfo(), reference);
                        }
                    }
                    if (base.inputState.guessing == 0)
                    {
                        BinaryExpression expression3 = new BinaryExpression(ToLexicalInfo(token8));
                        expression3.set_Operator(type);
                        expression3.set_Left(expression);
                        expression3.set_Right(expression2);
                        expression = expression3;
                    }
                }
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_20_);
                return expression;
            }
            return expression;
        }
コード例 #8
0
 public Expression bitwise_or()
 {
     Expression expression = null;
     IToken token = null;
     try
     {
         expression = this.bitwise_xor();
         while ((this.LA(1) == 70) && tokenSet_16_.member(this.LA(2)))
         {
             BinaryOperatorType type;
             token = this.LT(1);
             this.match(70);
             if (base.inputState.guessing == 0)
             {
                 type = 30;
             }
             Expression expression2 = this.bitwise_xor();
             if (base.inputState.guessing == 0)
             {
                 BinaryExpression expression3;
                 BinaryExpression expression1 = expression3 = new BinaryExpression(ToLexicalInfo(token));
                 expression3.set_Operator(type);
                 expression3.set_Left(expression);
                 expression3.set_Right(expression2);
                 expression = expression3;
             }
         }
         return expression;
     }
     catch (RecognitionException exception)
     {
         if (base.inputState.guessing != 0)
         {
             throw;
         }
         this.reportError(exception);
         this.recover(exception, tokenSet_20_);
         return expression;
     }
     return expression;
 }