Ejemplo n.º 1
0
 private void ComputeCustomOperator(ICSharpWriter writer)
 {
     ComputedValue = CSharpQueryExpression.ComputeQueryResult(writer, Operator, FeatureCall);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new C# expression.
        /// </summary>
        /// <param name="context">The creation context.</param>
        /// <param name="source">The Easly expression from which the C# expression is created.</param>
        public static ICSharpExpression Create(ICSharpContext context, IExpression source)
        {
            ICSharpExpression Result = null;

            switch (source)
            {
            case IAgentExpression AsAgentExpression:
                Result = CSharpAgentExpression.Create(context, AsAgentExpression);
                break;

            case IAssertionTagExpression AsAssertionTagExpression:
                Result = CSharpAssertionTagExpression.Create(context, AsAssertionTagExpression);
                break;

            case IBinaryConditionalExpression AsBinaryConditionalExpression:
                Result = CSharpBinaryConditionalExpression.Create(context, AsBinaryConditionalExpression);
                break;

            case IBinaryOperatorExpression AsBinaryOperatorExpression:
                Result = CSharpBinaryOperatorExpression.Create(context, AsBinaryOperatorExpression);
                break;

            case IClassConstantExpression AsClassConstantExpression:
                Result = CSharpClassConstantExpression.Create(context, AsClassConstantExpression);
                break;

            case ICloneOfExpression AsCloneOfExpression:
                Result = CSharpCloneOfExpression.Create(context, AsCloneOfExpression);
                break;

            case IEntityExpression AsEntityExpression:
                Result = CSharpEntityExpression.Create(context, AsEntityExpression);
                break;

            case IEqualityExpression AsEqualityExpression:
                Result = CSharpEqualityExpression.Create(context, AsEqualityExpression);
                break;

            case IIndexQueryExpression AsIndexQueryExpression:
                Result = CSharpIndexQueryExpression.Create(context, AsIndexQueryExpression);
                break;

            case IInitializedObjectExpression AsInitializedObjectExpression:
                Result = CSharpInitializedObjectExpression.Create(context, AsInitializedObjectExpression);
                break;

            case IKeywordEntityExpression AsKeywordEntityExpression:
                Result = CSharpKeywordEntityExpression.Create(context, AsKeywordEntityExpression);
                break;

            case IKeywordExpression AsKeywordExpression:
                Result = CSharpKeywordExpression.Create(context, AsKeywordExpression);
                break;

            case IManifestCharacterExpression AsManifestCharacterExpression:
                Result = CSharpManifestCharacterExpression.Create(context, AsManifestCharacterExpression);
                break;

            case IManifestNumberExpression AsManifestNumberExpression:
                Result = CSharpManifestNumberExpression.Create(context, AsManifestNumberExpression);
                break;

            case IManifestStringExpression AsManifestStringExpression:
                Result = CSharpManifestStringExpression.Create(context, AsManifestStringExpression);
                break;

            case INewExpression AsNewExpression:
                Result = CSharpNewExpression.Create(context, AsNewExpression);
                break;

            case IOldExpression AsOldExpression:
                Result = CSharpOldExpression.Create(context, AsOldExpression);
                break;

            case IPrecursorExpression AsPrecursorExpression:
                Result = CSharpPrecursorExpression.Create(context, AsPrecursorExpression);
                break;

            case IPrecursorIndexExpression AsPrecursorIndexExpression:
                Result = CSharpPrecursorIndexExpression.Create(context, AsPrecursorIndexExpression);
                break;

            case IQueryExpression AsQueryExpression:
                Result = CSharpQueryExpression.Create(context, AsQueryExpression);
                break;

            case IResultOfExpression AsResultOfExpression:
                Result = CSharpResultOfExpression.Create(context, AsResultOfExpression);
                break;

            case IUnaryNotExpression AsUnaryNotExpression:
                Result = CSharpUnaryNotExpression.Create(context, AsUnaryNotExpression);
                break;

            case IUnaryOperatorExpression AsUnaryOperatorExpression:
                Result = CSharpUnaryOperatorExpression.Create(context, AsUnaryOperatorExpression);
                break;
            }

            Debug.Assert(Result != null);

            return(Result);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Runs the compiler to compute the value as a string.
 /// </summary>
 /// <param name="writer">The stream on which to write.</param>
 public void Compute(ICSharpWriter writer)
 {
     //TODO use the precusor instead
     ComputedValue = CSharpQueryExpression.ComputeQueryResult(writer, ParentFeature, FeatureCall);
 }