Esempio n. 1
0
        /// <summary>
        /// Checks the static semantic constraints of an IOPrintNode.
        /// </summary>
        /// <returns>An ISemanticCheckValue.</returns>
        /// <param name="node">Node.</param>
        public ISemanticCheckValue VisitIOPrintNode(IOPrintNode node)
        {
            // check the expression of this node
            node.Expression.Accept(this.typeChecker).asProperty();

            return(voidProperty);
        }
Esempio n. 2
0
        public IOPrintNode CreateIOPrintNode(StatementsNode statementsNode, Token t)
        {
            IOPrintNode ioPrintNode = new IOPrintNode(t);

            statementsNode.Statement = ioPrintNode;

            return(ioPrintNode);
        }
Esempio n. 3
0
        /// <summary>
        /// Visits the IO print node.
        /// </summary>
        /// <returns>An ISemanticCheckValue.</returns>
        /// <param name="node">Node.</param>
        public ISemanticCheckValue VisitIOPrintNode(IOPrintNode node)
        {
            // evaluate the expression and the print it
            IProperty evaluation = node.Expression.Accept(this).asProperty();

            printer.print(evaluation.asString());

            return(voidProperty);
        }
Esempio n. 4
0
 /// <summary>
 /// Parses a print statement into an IOPrintNode
 /// </summary>
 /// <returns>The next token.</returns>
 /// <param name="token">Token.</param>
 /// <param name="statementsNode">A StatementsNode.</param>
 private Token ParsePrint(Token token, StatementsNode statementsNode)
 {
     try {
         // build the print statement node
         IOPrintNode printNode = nodeBuilder.CreateIOPrintNode(statementsNode, token);
         // parse the expression to print
         return(ParseExpression(scanner.getNextToken(token), printNode));
     } catch (UnexpectedTokenException ex) {
         return(FastForwardToStatementEnd(ex));
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Visits the IO print node.
 /// </summary>
 /// <returns>An ISemanticCheckValue.</returns>
 /// <param name="node">Node.</param>
 public ISemanticCheckValue VisitIOPrintNode(IOPrintNode node)
 {
     // nothing to evaluate here, it's done from the ExecutionVisitor
     return(voidProperty);
 }
Esempio n. 6
0
 /// <summary>
 /// Visits the IO print node.
 /// </summary>
 /// <returns>An ISemanticCheckValue.</returns>
 /// <param name="node">Node.</param>
 public ISemanticCheckValue VisitIOPrintNode(IOPrintNode node)
 {
     // return the node's expression's evaluation
     return(node.Expression.Accept(this));
 }