diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2014-03-02 13:46:30 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2014-03-02 13:46:30 -0800 |
commit | cc12225142fbb0085dc4af935aa84a747384d717 (patch) | |
tree | 68b5dfe2b2f519b7a9fb465ac2cb348d55815667 /parser.h | |
parent | 6b3a37c59785872eb62112e9045e7cc2b2e2406e (diff) |
Clean up various block types and state as part of new parser
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 44 |
1 files changed, 4 insertions, 40 deletions
@@ -64,8 +64,7 @@ enum block_type_t SOURCE, /**< Block created by the . (source) builtin */ EVENT, /**< Block created on event notifier invocation */ BREAKPOINT, /**< Breakpoint block */ -} -; +}; /** block_t represents a block of commands. @@ -78,18 +77,11 @@ protected: private: const block_type_t block_type; /**< Type of block. */ - bool made_fake; public: block_type_t type() const { - return this->made_fake ? FAKE : this->block_type; - } - - /** Mark a block as fake; this is used by the return statement. */ - void mark_as_fake() - { - this->made_fake = true; + return this->block_type; } bool skip; /**< Whether execution of the commands in this block should be skipped */ @@ -122,11 +114,6 @@ public: struct if_block_t : public block_t { - bool if_expr_evaluated; // whether we've evaluated the if expression - bool is_elseif_entry; // whether we're at the beginning of an ELSEIF branch - bool any_branch_taken; // whether the clause of the if statement or any elseif has been found to be true - bool else_evaluated; // whether we've encountered a terminal else block - if_block_t(); }; @@ -151,22 +138,17 @@ struct source_block_t : public block_t struct for_block_t : public block_t { - wcstring variable; // the variable that will be assigned each value in the sequence - wcstring_list_t sequence; // the sequence of values - for_block_t(const wcstring &var); + for_block_t(); }; struct while_block_t : public block_t { - int status; while_block_t(); }; struct switch_block_t : public block_t { - bool switch_taken; - const wcstring switch_value; - switch_block_t(const wcstring &sv); + switch_block_t(); }; struct fake_block_t : public block_t @@ -174,12 +156,6 @@ struct fake_block_t : public block_t fake_block_t(); }; -struct function_def_block_t : public block_t -{ - function_data_t function_data; - function_def_block_t(); -}; - struct scope_block_t : public block_t { scope_block_t(block_type_t type); //must be BEGIN, TOP or SUBST @@ -202,18 +178,6 @@ enum loop_status /** - Possible states for a while block -*/ -enum while_status -{ - WHILE_TEST_FIRST, /**< This is the first command of the first lap of a while loop */ - WHILE_TEST_AGAIN, /**< This is not the first lap of the while loop, but it is the first command of the loop */ - WHILE_TESTED, /**< This is not the first command in the loop */ -} -; - - -/** Errors that can be generated by the parser */ enum parser_error |