xo-reader: split: exprstatestack to own .*pp files
This commit is contained in:
parent
bdf75d5620
commit
bcb2af4a56
16 changed files with 152 additions and 117 deletions
|
|
@ -171,59 +171,6 @@ namespace xo {
|
|||
x.print(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
// ----- exprstatestack -----
|
||||
|
||||
/** @class exprstatestack
|
||||
* @brief A stack of exprstate objects
|
||||
**/
|
||||
class exprstatestack {
|
||||
public:
|
||||
exprstatestack() {}
|
||||
|
||||
bool empty() const { return stack_.empty(); }
|
||||
std::size_t size() const { return stack_.size(); }
|
||||
|
||||
exprstate & top_exprstate();
|
||||
void push_exprstate(std::unique_ptr<exprstate> exs);
|
||||
std::unique_ptr<exprstate> pop_exprstate();
|
||||
|
||||
/** relative to top-of-stack.
|
||||
* 0 -> top (last in), z-1 -> bottom (first in)
|
||||
**/
|
||||
std::unique_ptr<exprstate> & operator[](std::size_t i) {
|
||||
std::size_t z = stack_.size();
|
||||
|
||||
assert(i < z);
|
||||
|
||||
return stack_[z - i - 1];
|
||||
}
|
||||
|
||||
const std::unique_ptr<exprstate> & operator[](std::size_t i) const {
|
||||
std::size_t z = stack_.size();
|
||||
|
||||
assert(i < z);
|
||||
|
||||
return stack_[z - i - 1];
|
||||
}
|
||||
|
||||
void print (std::ostream & os) const;
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<exprstate>> stack_;
|
||||
};
|
||||
|
||||
inline std::ostream &
|
||||
operator<< (std::ostream & os, const exprstatestack & x) {
|
||||
x.print(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
inline std::ostream &
|
||||
operator<< (std::ostream & os, const exprstatestack * x) {
|
||||
x->print(os);
|
||||
return os;
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue