git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@29653 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2009-05-13 09:56:02 +00:00
parent 35229a994e
commit c3cb9d0122
2 changed files with 12 additions and 8 deletions

View File

@ -166,28 +166,32 @@ void Parser::push_back(Token const & t)
}
Token const & Parser::prev_token() const
// We return a copy here because the tokens_ vector may get reallocated
Token const Parser::prev_token() const
{
static const Token dummy;
return pos_ > 1 ? tokens_[pos_ - 2] : dummy;
}
Token const & Parser::curr_token() const
// We return a copy here because the tokens_ vector may get reallocated
Token const Parser::curr_token() const
{
static const Token dummy;
return pos_ > 0 ? tokens_[pos_ - 1] : dummy;
}
Token const & Parser::next_token()
// We return a copy here because the tokens_ vector may get reallocated
Token const Parser::next_token()
{
static const Token dummy;
return good() ? tokens_[pos_] : dummy;
}
Token const & Parser::get_token()
// We return a copy here because the tokens_ vector may get reallocated
Token const Parser::get_token()
{
static const Token dummy;
//cerr << "looking at token " << tokens_[pos_] << " pos: " << pos_ << '\n';

View File

@ -180,13 +180,13 @@ public:
///
void push_back(Token const & t);
/// The previous token.
Token const & prev_token() const;
Token const prev_token() const;
/// The current token.
Token const & curr_token() const;
Token const curr_token() const;
/// The next token.
Token const & next_token();
Token const next_token();
/// Make the next token current and return that.
Token const & get_token();
Token const get_token();
/// \return whether the current token starts a new paragraph
bool isParagraph();
/// skips spaces (and comments if \p skip_comments is true)