Changes in src/Parser/ParseNode.h [8cc5cb0:777bfcf]
- File:
-
- 1 edited
-
src/Parser/ParseNode.h (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
r8cc5cb0 r777bfcf 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 11 12:24:11201613 // Update Count : 4 4312 // Last Modified On : Sun Aug 14 16:29:20 2016 13 // Update Count : 483 14 14 // 15 15 … … 45 45 virtual ~ParseNode(); 46 46 47 ParseNode *get_link() const { return next; } 47 ParseNode *get_next() const { return next; } 48 ParseNode *set_next( ParseNode *newlink ) { next = newlink; return this; } 48 49 ParseNode *get_last(); 49 ParseNode *set_link( ParseNode * ); 50 void set_next( ParseNode *newlink ) { next = newlink; } 50 ParseNode *set_last( ParseNode * ); 51 51 52 52 virtual ParseNode *clone() const { return 0; }; … … 92 92 ExpressionNode *expr; 93 93 bool aggregate; 94 ExpressionNode *designator; // may be list94 ExpressionNode *designator; // may be list 95 95 InitializerNode *kids; 96 96 bool maybeConstructed; … … 336 336 337 337 StatementNode(); 338 StatementNode( const std::string *name );339 StatementNode( Type t, ExpressionNode *control = 0, StatementNode *block = 0 );340 StatementNode( Type t, std::string *target );341 338 StatementNode( DeclarationNode *decl ); 342 343 339 ~StatementNode(); 344 345 static StatementNode *newCatchStmt( DeclarationNode *d = 0, StatementNode *s = 0, bool catchRestP = false );346 347 StatementNode *set_block( StatementNode *b ) { block = b; return this; }348 StatementNode *get_block() const { return block; }349 350 void set_control( ExpressionNode *c ) { control = c; }351 ExpressionNode *get_control() const { return control; }352 340 353 341 StatementNode::Type get_type() const { return type; } … … 357 345 358 346 void addDeclaration( DeclarationNode *newDecl ) { decl = newDecl; } 359 void setCatchRest( bool newVal ) { isCatchRest = newVal; } 360 361 std::string get_target() const; 362 363 // StatementNode *add_controlexp( ExpressionNode * ); 364 StatementNode *append_block( StatementNode * ); 347 365 348 virtual StatementNode *append_last_case( StatementNode * ); 366 349 367 v oid print( std::ostream &os, int indent = 0) const;350 virtual void print( std::ostream &os, int indent = 0) const {} 368 351 virtual StatementNode *clone() const; 369 352 virtual Statement *build() const; 370 p rivate:353 public: 371 354 static const char *StType[]; 372 355 Type type; 373 ExpressionNode *control;374 StatementNode *block;375 356 std::list<std::string> labels; 376 std::string *target; // target label for jump statements377 357 DeclarationNode *decl; 378 bool isCatchRest;379 358 }; // StatementNode 380 359 381 360 class StatementNode2 : public StatementNode { 382 361 public: 383 StatementNode2() { }362 StatementNode2() { stmt = nullptr; } 384 363 StatementNode2( Statement *stmt ) : stmt( stmt ) {} 364 StatementNode2( DeclarationNode *decl ); 385 365 virtual ~StatementNode2() {} 386 366 … … 392 372 return this; 393 373 } 374 virtual std::list<std::string> get_labels() const { assert( false ); return StatementNode::get_labels(); } 375 394 376 virtual StatementNode *append_last_case( StatementNode * ); 395 virtual std::list<std::string> get_labels() const { assert( false ); return StatementNode::get_labels(); }396 377 397 378 virtual void print( std::ostream &os, int indent = 0 ) {} … … 401 382 }; // StatementNode 402 383 384 Statement *build_expr( ExpressionNode *ctl ); 385 403 386 struct ForCtl { 404 387 ForCtl( ExpressionNode *expr, ExpressionNode *condition, ExpressionNode *change ) : 405 init( new StatementNode ( StatementNode::Exp, expr) ), condition( condition ), change( change ) {}388 init( new StatementNode2( build_expr( expr ) ) ), condition( condition ), change( change ) {} 406 389 ForCtl( DeclarationNode *decl, ExpressionNode *condition, ExpressionNode *change ) : 407 init( new StatementNode ( decl ) ), condition( condition ), change( change ) {}390 init( new StatementNode2( decl ) ), condition( condition ), change( change ) {} 408 391 409 392 StatementNode *init; … … 412 395 }; 413 396 414 Statement *build_expr( ExpressionNode *ctl );415 397 Statement *build_if( ExpressionNode *ctl, StatementNode *then_stmt, StatementNode *else_stmt ); 416 398 Statement *build_switch( ExpressionNode *ctl, StatementNode *stmt ); … … 423 405 Statement *build_return( ExpressionNode *ctl ); 424 406 Statement *build_throw( ExpressionNode *ctl ); 407 Statement *build_try( StatementNode *try_stmt, StatementNode *catch_stmt, StatementNode *finally_stmt ); 408 Statement *build_catch( DeclarationNode *decl, StatementNode *stmt, bool catchAny = false ); 409 Statement *build_finally( StatementNode *stmt ); 425 410 426 411 //############################################################################## … … 429 414 public: 430 415 CompoundStmtNode(); 431 CompoundStmtNode( const std::string * );432 416 CompoundStmtNode( StatementNode * ); 433 417 ~CompoundStmtNode(); … … 445 429 class AsmStmtNode : public StatementNode { 446 430 public: 447 AsmStmtNode( Type,bool voltile, ConstantExpr *instruction, ExpressionNode *output = 0, ExpressionNode *input = 0, ExpressionNode *clobber = 0, LabelNode *gotolabels = 0 );431 AsmStmtNode( bool voltile, ConstantExpr *instruction, ExpressionNode *output = 0, ExpressionNode *input = 0, ExpressionNode *clobber = 0, LabelNode *gotolabels = 0 ); 448 432 ~AsmStmtNode(); 449 433 450 void print( std::ostream &os, int indent = 0 ) const ;434 void print( std::ostream &os, int indent = 0 ) const {} 451 435 Statement *build() const; 452 436 private: … … 477 461 errors.append( e ); 478 462 } // try 479 cur = dynamic_cast< NodeType *>( cur->get_ link() );463 cur = dynamic_cast< NodeType *>( cur->get_next() ); 480 464 } // while 481 465 if ( ! errors.isEmpty() ) {
Note:
See TracChangeset
for help on using the changeset viewer.