public override object VisitAdditionExpression([NotNull] DoshikParser.AdditionExpressionContext context)
        {
            SetWholeExpression(context);
            VisitChildren(context);
            _compilationContext.SetParsingAntlrContext(context);

            var node = new AdditionExpressionNode(context);

            node.Left  = Sequence.FindExpressionByAntlrContext(context.left);
            node.Right = Sequence.FindExpressionByAntlrContext(context.right);

            if ([email protected] == DoshikParser.ADD)
            {
                node.Operator = AdditionExpressionNode.OperatorOption.Plus;
            }
            else if ([email protected] == DoshikParser.SUB)
            {
                node.Operator = AdditionExpressionNode.OperatorOption.Minus;
            }
            else
            {
                throw new System.NotImplementedException();
            }

            Sequence.Sequence.Add(node);

            return(null);
        }
Exemple #2
0
        private IExpression HandleAdditionExpressionNode(AdditionExpressionNode node)
        {
            switch (node.Operator)
            {
            case AdditionExpressionNode.OperatorOption.Plus:
                return(CreateStaticMethodCallExpressionForBinaryOperator("op_Addition", node.Left, node.Right));

            case AdditionExpressionNode.OperatorOption.Minus:
                return(CreateStaticMethodCallExpressionForBinaryOperator("op_Subtraction", node.Left, node.Right));

            default:
                throw new NotImplementedException();
            }
        }