void iparserdocstream::putback(char_type c)
{
- s_ += c;
+ s_ = c + s_;
}
-void iparserdocstream::put_almost_back(docstring s)
+void iparserdocstream::putback(docstring s)
{
s_ = s + s_;
}
if (s_.empty())
is_.get(c);
else {
+ //cerr << "unparsed: " << to_utf8(s_) <<endl;
c = s_[0];
s_.erase(0,1);
}
for(size_type i = pos_ ; i < tokens_.size() ; ++i) {
s += tokens_[i].asInput();
}
- is_.put_almost_back(from_utf8(s));
+ is_.putback(from_utf8(s));
tokens_.erase(tokens_.begin() + pos_, tokens_.end());
// make sure that next token is read
tokenize_one();
{
pos_ = positions_.back();
positions_.pop_back();
+ deparse();
+}
+
+
+void Parser::dropPosition()
+{
+ positions_.pop_back();
}
// the stream
void putback(char_type c);
- // add before the list of characters to read before actually reading
+ // add to the list of characters to read before actually reading
// the stream
- void put_almost_back(docstring s);
+ void putback(docstring s);
/// Like std::istream::get()
iparserdocstream & get(char_type &c);
void pushPosition();
/// restore previous position
void popPosition();
+ /// forget last saved position
+ void dropPosition();
/// dump contents to screen
void dump() const;