cprover
Loading...
Searching...
No Matches
cpp_token_buffer.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: C++ Parser: Token Buffer
4
5Author: Daniel Kroening, kroening@cs.cmu.edu
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_CPP_CPP_TOKEN_BUFFER_H
13#define CPROVER_CPP_CPP_TOKEN_BUFFER_H
14
15#include "cpp_token.h"
16
17#include <list>
18
19#include <util/invariant.h>
20
22{
23public:
27
28 typedef unsigned int post;
29
30 int LookAhead(unsigned offset);
31 int get_token(cpp_tokent &token);
32 int get_token();
33 int LookAhead(unsigned offset, cpp_tokent &token);
34
35 post Save();
36 void Restore(post pos);
37 void Replace(const cpp_tokent &token);
38 void Insert(const cpp_tokent &token);
39
40 void clear()
41 {
42 tokens.clear();
45 }
46
47 // the token that is currently being read from the file
49 {
50 PRECONDITION(!tokens.empty());
51 return tokens.back();
52 }
53
54protected:
55 typedef std::list<cpp_tokent> tokenst;
57
58 std::vector<tokenst::iterator> token_vector;
59
61
62 // get another token from lexer
63 void read_token();
64};
65
66#endif // CPROVER_CPP_CPP_TOKEN_BUFFER_H
virtual void clear()
Reset the abstract state.
Definition ai.h:266
int LookAhead(unsigned offset)
std::list< cpp_tokent > tokenst
void Replace(const cpp_tokent &token)
std::vector< tokenst::iterator > token_vector
cpp_tokent & current_token()
void Insert(const cpp_tokent &token)
C++ Parser: Token.
literalt pos(literalt a)
Definition literal.h:194
#define PRECONDITION(CONDITION)
Definition invariant.h:463