Exemplo n.º 1
0
        public int VisitSequentialDeclaration(SequentialDeclaration ast, Frame frame)
        {
            int extraSize1 = ast.FirstDeclaration.Visit(this, frame);
            int extraSize2 = ast.SecondDeclaration.Visit(this, frame.Expand(extraSize1));

            return(extraSize1 + extraSize2);
        }
Exemplo n.º 2
0
 public Void VisitSequentialDeclaration(SequentialDeclaration ast, Void arg)
 {
     //0
     ast.firstDeclaration.Visit(this);
     ast.secondDeclaration.Visit(this);
     return(null);
 }
Exemplo n.º 3
0
        public Void VisitSequentialDeclaration(SequentialDeclaration ast, Void arg)
        {
            ast.FirstDeclaration.Visit(this, null);
            ast.SecondDeclaration.Visit(this, null);

            return(null);
        }
        ///////////////////////////////////////////////////////////////////////////////
        //
        // DECLARATIONS
        //
        ///////////////////////////////////////////////////////////////////////////////

        /**
         * Parses the declaration, and constructs an AST to represent its phrase
         * structure.
         *
         * @return a {@link triangle.compiler.syntax.trees.declarations.Declaration}
         *
         * @throws SyntaxError
         *           a syntactic error
         *
         */
        Declaration ParseDeclaration()
        {
            var startLocation = _currentToken.Start;
            var declaration   = ParseSingleDeclaration();

            while (_currentToken.Kind == TokenKind.Semicolon)
            {
                AcceptIt();
                var declaration2        = ParseSingleDeclaration();
                var declarationPosition = new SourcePosition(startLocation, _currentToken.Finish);
                declaration = new SequentialDeclaration(declaration, declaration2, declarationPosition);
            }
            return(declaration);
        }
Exemplo n.º 5
0
        ///////////////////////////////////////////////////////////////////////////////
        //
        // DECLARATIONS
        //
        ///////////////////////////////////////////////////////////////////////////////

        /**
         * Parses the declaration, and constructs an AST to represent its phrase
         * structure.
         *
         * @return a {@link triangle.compiler.syntax.trees.declarations.Declaration}
         *
         * @throws SyntaxError
         *           a syntactic error
         *
         */
        Declaration ParseDeclaration()
        {
            Compiler.WriteDebuggingInfo("Parsing Declaration");
            Location    startLocation = tokens.Current.Start;
            Declaration declaration   = ParseSingleDeclaration();

            while (tokens.Current.Kind == TokenKind.Semicolon)
            {
                AcceptIt();
                Declaration    declarationinWhile  = ParseSingleDeclaration();
                SourcePosition declarationPosition = new SourcePosition(startLocation, tokens.Current.Finish);
                declaration = new SequentialDeclaration(declaration, declarationinWhile, declarationPosition);
            }
            return(declaration);
        }
Exemplo n.º 6
0
 public object visitSequentialDeclaration(SequentialDeclaration declaration, object arg)
 {
     declaration._declaration1.visit(this, null);
     declaration._declaration2.visit(this, null);
     return(null);
 }