Ejemplo n.º 1
0
 public TermTail(Token token, Scope scope, TokenType operation, Factor factor, TermTail termTail = null)
     : base(token, scope)
 {
     this.operation = operation;
     this.factor    = factor;
     this.termTail  = termTail;
 }
Ejemplo n.º 2
0
        public void VisitTermTailNode(TermTail node)
        {
            node.Accept(this.typeChecker);
            Factor   factor = node.Factor;
            TermTail tail   = node.ChildTermTail;

            factor.Accept(this);

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

            if (node.EvaluationType == TokenType.ERROR)
            {
                analyzer.notifyError(new IllegalTypeError(node));
            }
        }
Ejemplo n.º 3
0
        public void VisitTermTailNode(TermTail node)
        {
            if (node.HasAlreadyBeenEvaluated)
            {
                return;
            }

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

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

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

            node.EvaluationType = factorEval;
        }
Ejemplo n.º 4
0
 public TermNode(Token token, Scope scope, Factor factorNode, TermTail termTailNode = null)
     : base(token, scope)
 {
     this.factorNode   = factorNode;
     this.termTailNode = termTailNode;
 }