cprover
cpp_token_buffer.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: C++ Parser: Token Buffer
4 
5 Author: 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 
18 {
19 public:
21  {
22  }
23 
24  typedef unsigned int post;
25 
26  int LookAhead(unsigned offset);
27  int get_token(cpp_tokent &token);
28  int get_token();
29  int LookAhead(unsigned offset, cpp_tokent &token);
30 
31  post Save();
32  void Restore(post pos);
33  void Replace(const cpp_tokent &token);
34  void Insert(const cpp_tokent &token);
35 
36  void clear()
37  {
38  tokens.clear();
39  token_vector.clear();
40  current_pos=0;
41  }
42 
43  // the token that is currently being read from the file
45  {
46  assert(!tokens.empty());
47  return tokens.back();
48  }
49 
50 protected:
51  typedef std::list<cpp_tokent> tokenst;
52  tokenst tokens;
53 
54  std::vector<tokenst::iterator> token_vector;
55 
57 
58  // get another token from lexer
59  void read_token();
60 };
61 
62 #endif // CPROVER_CPP_CPP_TOKEN_BUFFER_H
void Replace(const cpp_tokent &token)
literalt pos(literalt a)
Definition: literal.h:193
std::vector< tokenst::iterator > token_vector
void Insert(const cpp_tokent &token)
C++ Parser: Token.
cpp_tokent & current_token()
int LookAhead(unsigned offset)
void Restore(post pos)
std::list< cpp_tokent > tokenst