public PftRefFunction(PftParser.RefFunctionContext node)
     : base(node)
 {
     Argument1 = new PftArithExpression(node.arg1);
     Children.Add(Argument1);
     Argument2 = PftNonGrouped.DispatchContext(node.arg2);
     Children.Add(Argument2);
 }
Exemple #2
0
        public PftArithCondition(PftParser.ConditionArithContext node)
            : base(node)
        {
            var context = node.arithCondition();

            Left = new PftArithExpression(context.left);
            Children.Add(Left);
            Op    = context.op.Text;
            Right = new PftArithExpression(context.right);
            Children.Add(Right);
        }
Exemple #3
0
 public PftFFunction(PftParser.FFunctionContext node)
     : base(node)
 {
     Argument1 = new PftArithExpression(node.arg1);
     Children.Add(Argument1);
     if (node.arg2 != null)
     {
         Argument2 = new PftArithExpression(node.arg2);
         Children.Add(Argument2);
     }
     if (node.arg3 != null)
     {
         Argument3 = new PftArithExpression(node.arg3);
         Children.Add(Argument3);
     }
 }
Exemple #4
0
 public PftArithExpression(PftParser.ArithExprContext node)
     : base(node)
 {
     if (node.value() != null)
     {
         SimpleValue = new PftValue(node.value());
     }
     else
     {
         Left = new PftArithExpression(node.left);
         Children.Add(Left);
         Op    = node.op.Text;
         Right = new PftArithExpression(node.right);
         Children.Add(Right);
     }
 }
        public PftValue(PftParser.ValueContext node)
            : base(node)
        {
            // ReSharper disable CanBeReplacedWithTryCastAndCheckForNull

            string text;

            if (node is PftParser.FloatValueContext)
            {
                text  = ((PftParser.FloatValueContext)node).FLOAT().GetText();
                Value = ExtractNumber(text);
            }
            else if (node is PftParser.UnsignedValueContext)
            {
                text  = ((PftParser.UnsignedValueContext)node).UNSIGNED().GetText();
                Value = ExtractNumber(text);
            }
            else if (node is PftParser.SignedValueContext)
            {
                text  = ((PftParser.SignedValueContext)node).SIGNED().GetText();
                Value = ExtractNumber(text);
            }
            else if (node is PftParser.MfnValueContext)
            {
                Expression = new PftMfnValue((PftParser.MfnValueContext)node);
            }
            else if (node is PftParser.MinusExpressionContext)
            {
                Minus      = true;
                Expression = new PftArithExpression(((PftParser.MinusExpressionContext)node).arithExpr());
            }
            else if (node is PftParser.ParenthesisExpressionContext)
            {
                Expression = new PftArithExpression(((PftParser.ParenthesisExpressionContext)node).arithExpr());
            }
            else if (node is PftParser.ArithFunctionOuterContext)
            {
                PftParser.ArithFunctionContext arithFunction
                    = ((PftParser.ArithFunctionOuterContext)node).arithFunction();
                if (arithFunction is PftParser.RsumFunctionContext)
                {
                    Expression = new PftRsumFunction((PftParser.RsumFunctionContext)arithFunction);
                }
                else if (arithFunction is PftParser.RmaxFunctionContext)
                {
                    Expression = new PftRmaxFunction((PftParser.RmaxFunctionContext)arithFunction);
                }
                else if (arithFunction is PftParser.RminFunctionContext)
                {
                    Expression = new PftRminFunction((PftParser.RminFunctionContext)arithFunction);
                }
                else if (arithFunction is PftParser.RavrFunctionContext)
                {
                    Expression = new PftRavrFunction((PftParser.RavrFunctionContext)arithFunction);
                }
                else if (arithFunction is PftParser.ValFunctionContext)
                {
                    Expression = new PftValFunction((PftParser.ValFunctionContext)arithFunction);
                }
                else if (arithFunction is PftParser.LFunctionContext)
                {
                    Expression = new PftLFunction((PftParser.LFunctionContext)arithFunction);
                }
                else
                {
                    throw new ApplicationException();
                }
            }
            else
            {
                throw new ApplicationException();
            }

            // ReSharper restore CanBeReplacedWithTryCastAndCheckForNull
        }