Changeset a378ca7


Ignore:
Timestamp:
Nov 30, 2017, 3:58:57 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
373d0b5
Parents:
61255ad
Message:

Build WithStmt? node in parser

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r61255ad ra378ca7  
    408408WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when );
    409409WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when, StatementNode * else_stmt, ExpressionNode * else_when );
     410WithStmt * build_with( ExpressionNode * exprs, StatementNode * stmt );
    410411
    411412//##############################################################################
  • src/Parser/StatementNode.cc

    r61255ad ra378ca7  
    282282        node->timeout.condition = notZeroExpr( maybeMoveBuild<Expression>( when ) );
    283283
    284         node->orelse.statement = maybeMoveBuild<Statement >( else_stmt );
     284        node->orelse.statement  = maybeMoveBuild<Statement >( else_stmt );
    285285        node->orelse.condition  = notZeroExpr( maybeMoveBuild<Expression>( else_when ) );
    286286
    287287        return node;
     288}
     289
     290WithStmt * build_with( ExpressionNode * exprs, StatementNode * stmt ) {
     291        std::list< Expression * > e;
     292        buildMoveList( exprs, e );
     293        Statement * s = maybeMoveBuild<Statement>( stmt );
     294        return new WithStmt( e, s );
    288295}
    289296
  • src/Parser/parser.yy

    r61255ad ra378ca7  
    10581058with_statement:
    10591059        WITH '(' tuple_expression_list ')' statement
    1060                 { throw SemanticError("With clause is currently unimplemented."); $$ = nullptr; } // FIX ME
     1060                {
     1061                        $$ = new StatementNode( build_with( $3, $5 ) );
     1062                }
    10611063        ;
    10621064
Note: See TracChangeset for help on using the changeset viewer.