public Void VisitSequentialCommand(SequentialCommand ast, Frame frame)
        {
            ast.FirstCommand.Visit(this, frame);
            ast.SecondCommand.Visit(this, frame);

            return(null);
        }
Example #2
0
        ///////////////////////////////////////////////////////////////////////////////
        //
        // COMMANDS
        //
        ///////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Parses the command, and constructs an AST to represent its phrase
        /// structure.
        /// </summary>
        /// <returns>
        /// a <link>Triangle.SyntaxTrees.Commands.Command</link>
        /// </returns>
        /// <throws type="SyntaxError">
        /// a syntactic error
        /// </throws>
        Command ParseCommand()
        {
            var startLocation = _currentToken.Start;
            var command       = ParseSingleCommand();

            while (_currentToken.Kind == TokenKind.Semicolon)
            {
                AcceptIt();
                var command2        = ParseSingleCommand();
                var commandPosition = new SourcePosition(startLocation, _currentToken.Finish);
                command = new SequentialCommand(command, command2, commandPosition);
            }
            return(command);
        }
Example #3
0
        ///////////////////////////////////////////////////////////////////////////////
        // COMMANDS
        ///////////////////////////////////////////////////////////////////////////////
        /// Parses the command, and constructs an AST to represent its phrase structure.
        /// @return	a <link>Triangle.SyntaxTrees.Commands.Command</link>
        /// @throw	SyntaxError
        private Command ParseCommand()
        {
            Compiler.WriteDebuggingInfo("Parsing Command");
            Location startLocation = tokens.Current.Start;
            Command  command       = ParseSingleCommand();

            while (tokens.Current.Kind == TokenKind.Semicolon)
            {
                AcceptIt();
                Command        command2        = ParseSingleCommand();
                SourcePosition commandPosition = new SourcePosition(startLocation, tokens.Current.Finish);
                command = new SequentialCommand(command, command2, commandPosition);
            }
            return(command);
        }
 public Void VisitSequentialCommand(SequentialCommand ast, Void arg)
 {
     ast.FirstCommand.Visit(this);
     ast.SecondCommand.Visit(this);
     return(null);
 }
 public Void VisitSequentialCommand(SequentialCommand ast, Void arg)
 {
     System.Console.WriteLine("Visiting SequentialCommand");
     ast.FirstCommand.Visit(this, null);
     return(ast.SecondCommand.Visit(this, null));
 }