Example #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);
        }
Example #2
0
        public IOPrintNode CreateIOPrintNode(StatementsNode statementsNode, Token t)
        {
            IOPrintNode ioPrintNode = new IOPrintNode(t);

            statementsNode.Statement = ioPrintNode;

            return(ioPrintNode);
        }
Example #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);
        }
Example #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));
     }
 }
Example #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);
 }
Example #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));
 }