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