cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
ctokenit.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: C Token Iterator
4
5
Author: Daniel Kroening, dkr@amazon.com
6
7
\*******************************************************************/
8
11
12
#ifndef CPROVER_CRANGLER_CTOKENIT_H
13
#define CPROVER_CRANGLER_CTOKENIT_H
14
15
#include "
ctoken.h
"
16
17
#include <vector>
18
19
class
ctokenitt
20
{
21
public
:
22
using
tokenst
= std::vector<ctokent>;
23
24
explicit
ctokenitt
(
const
tokenst
&__tokens) :
tokens
(__tokens)
25
{
26
}
27
28
explicit
operator
bool()
const
29
{
30
return
!
eof
();
31
}
32
33
bool
eof
()
const
34
{
35
return
pos
>=
tokens
.size();
36
}
37
38
ctokenitt
&
operator+=
(std::size_t offset)
39
{
40
pos
+= offset;
41
return
*
this
;
42
}
43
44
ctokenitt
operator++
(
int
);
// postfix ++
45
46
const
ctokent
&
operator*
()
const
;
47
48
const
ctokent
*
operator->
()
const
49
{
50
return
&**
this
;
51
}
52
53
tokenst::const_iterator
cit
()
const
54
{
55
return
tokens
.begin() +
pos
;
56
}
57
58
bool
operator!=
(
const
ctokenitt
&other)
const
59
{
60
return
pos
!= other.
pos
;
61
}
62
63
protected
:
64
const
tokenst
&
tokens
;
65
std::size_t
pos
= 0;
66
};
67
68
ctokenitt
match_bracket
(
ctokenitt
,
char
open,
char
close);
69
ctokenitt
70
match_bracket
(
ctokenitt
,
char
open,
char
close,
ctokenitt::tokenst
&dest);
71
72
#endif
// CPROVER_CRANGLER_CTOKENIT_H
ctokenitt
Definition
ctokenit.h:20
ctokenitt::cit
tokenst::const_iterator cit() const
Definition
ctokenit.h:53
ctokenitt::operator->
const ctokent * operator->() const
Definition
ctokenit.h:48
ctokenitt::pos
std::size_t pos
Definition
ctokenit.h:65
ctokenitt::operator+=
ctokenitt & operator+=(std::size_t offset)
Definition
ctokenit.h:38
ctokenitt::eof
bool eof() const
Definition
ctokenit.h:33
ctokenitt::operator++
ctokenitt operator++(int)
Definition
ctokenit.cpp:25
ctokenitt::operator*
const ctokent & operator*() const
Definition
ctokenit.cpp:19
ctokenitt::tokenst
std::vector< ctokent > tokenst
Definition
ctokenit.h:22
ctokenitt::operator!=
bool operator!=(const ctokenitt &other) const
Definition
ctokenit.h:58
ctokenitt::tokens
const tokenst & tokens
Definition
ctokenit.h:64
ctokenitt::ctokenitt
ctokenitt(const tokenst &__tokens)
Definition
ctokenit.h:24
ctokent
Definition
ctoken.h:19
ctoken.h
ctoken
match_bracket
ctokenitt match_bracket(ctokenitt, char open, char close)
Definition
ctokenit.cpp:33
crangler
ctokenit.h
Generated by
1.17.0