public void visitEqualityOperator(EqualityOperationNode node)
        {
            accessChildren(node);
            MiniPLTokenType left  = this.typeStack.Pop();
            MiniPLTokenType right = this.typeStack.Pop();

            if (left != right)
            {
                throw new SemanticException("Equality operator has different types on both sides.");
            }
            this.typeStack.Push(MiniPLTokenType.TYPE_IDENTIFIER_BOOL);
        }
 public void visitEqualityOperator(EqualityOperationNode node)
 {
     readValues(node);
     if (intType)
     {
         bool value = popInt() == popInt();
         this.boolStack.Push(value);
         this.intType = false;
     }
     else if (strType)
     {
         bool value = String.Equals(popString(), popString());
         this.boolStack.Push(value);
         this.strType = false;
     }
     else
     {
         bool lhs   = popBool();
         bool rhs   = popBool();
         bool value = lhs == rhs;
         this.boolStack.Push(value);
     }
 }
Ejemplo n.º 3
0
 private void Parsing(EqualityOperationNode node, string methodName)
 {
     CheckExistVars(node, methodName);
 }
 public void visitEqualityOperator(EqualityOperationNode node)
 {
 }