示例#1
0
 public SimpleExpressionTail(Token token, TokenType operation, TermNode term, SimpleExpressionTail tail, Scope scope)
     : base(token, scope)
 {
     this.operation = operation;
     this.term      = term;
     this.tail      = tail;
 }
示例#2
0
        public void VisitTermNode(TermNode node)
        {
            if (node.HasAlreadyBeenEvaluated)
            {
                return;
            }

            node.Factor.Accept(this);
            TokenType factorEval = node.Factor.EvaluationType;

            if (node.TermTail != null)
            {
                node.TermTail.Accept(this);
                TokenType tailEval = node.TermTail.EvaluationType;

                if (!LegitOperationChecker.IsLegitOperationForEvaluations(node.TermTail.Operation, factorEval, tailEval))
                {
                    factorEval = TokenType.ERROR;
                }

                // MUST HANDLE CASES WHERE INT + REAL EVALUATED
            }

            node.EvaluationType = factorEval;
        }
示例#3
0
 public SimpleExpression(Token token, TermNode term, SimpleExpressionTail tail, bool additiveInverse, Scope scope)
     : base(token, scope)
 {
     this.term            = term;
     this.tail            = tail;
     this.additiveInverse = additiveInverse;
     this.evaluationType  = TokenType.UNDEFINED;
 }
示例#4
0
        public void VisitTermNode(TermNode node)
        {
            node.Accept(this.typeChecker);
            Factor   factor = node.Factor;
            TermTail tail   = node.TermTail;

            factor.Accept(this);

            if (tail != null)
            {
                tail.Accept(this);
            }

            if (node.EvaluationType == TokenType.ERROR)
            {
                analyzer.notifyError(new IllegalTypeError(node));
            }
        }