CBMC
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
17
#include <list>
18
19
#include <
util/invariant.h
>
20
21
class
cpp_token_buffert
22
{
23
public
:
24
cpp_token_buffert
():
current_pos
(0)
25
{
26
}
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();
43
token_vector
.clear();
44
current_pos
=0;
45
}
46
47
// the token that is currently being read from the file
48
cpp_tokent
&
current_token
()
49
{
50
PRECONDITION
(!
tokens
.empty());
51
return
tokens
.back();
52
}
53
54
protected
:
55
typedef
std::list<cpp_tokent>
tokenst
;
56
tokenst
tokens
;
57
58
std::vector<tokenst::iterator>
token_vector
;
59
60
post
current_pos
;
61
62
// get another token from lexer
63
void
read_token
();
64
};
65
66
#endif // CPROVER_CPP_CPP_TOKEN_BUFFER_H
cpp_token_buffert::LookAhead
int LookAhead(unsigned offset)
Definition:
cpp_token_buffer.cpp:16
pos
literalt pos(literalt a)
Definition:
literal.h:194
cpp_token_buffert::tokens
tokenst tokens
Definition:
cpp_token_buffer.h:56
cpp_token_buffert::tokenst
std::list< cpp_tokent > tokenst
Definition:
cpp_token_buffer.h:55
invariant.h
cpp_token_buffert::current_token
cpp_tokent & current_token()
Definition:
cpp_token_buffer.h:48
cpp_token_buffert::Replace
void Replace(const cpp_tokent &token)
Definition:
cpp_token_buffer.cpp:108
cpp_tokent
Definition:
cpp_token.h:19
cpp_token_buffert::cpp_token_buffert
cpp_token_buffert()
Definition:
cpp_token_buffer.h:24
cpp_token_buffert::Insert
void Insert(const cpp_tokent &token)
Definition:
cpp_token_buffer.cpp:118
cpp_token_buffert::current_pos
post current_pos
Definition:
cpp_token_buffer.h:60
PRECONDITION
#define PRECONDITION(CONDITION)
Definition:
invariant.h:463
cpp_token_buffert
Definition:
cpp_token_buffer.h:21
cpp_token_buffert::clear
void clear()
Definition:
cpp_token_buffer.h:40
cpp_token_buffert::Save
post Save()
Definition:
cpp_token_buffer.cpp:98
cpp_token_buffert::post
unsigned int post
Definition:
cpp_token_buffer.h:28
cpp_token_buffert::Restore
void Restore(post pos)
Definition:
cpp_token_buffer.cpp:103
cpp_token_buffert::get_token
int get_token()
Definition:
cpp_token_buffer.cpp:42
cpp_token.h
cpp_token_buffert::token_vector
std::vector< tokenst::iterator > token_vector
Definition:
cpp_token_buffer.h:58
cpp_token_buffert::read_token
void read_token()
Definition:
cpp_token_buffer.cpp:73
src
cpp
cpp_token_buffer.h
Generated by
1.8.17