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