CBMC
cscanner.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: C Scanner
4
5
Author: Daniel Kroening, dkr@amazon.com
6
7
\*******************************************************************/
8
9
#include "
cscanner.h
"
10
11
cscannert
*
cscanner_ptr
;
12
13
int
yyclex
();
14
int
yyclex_destroy
();
15
void
initialize_yyc_scanner
();
16
17
cscannert::cscannert
(std::istream &_in) : in(_in)
18
{
19
initialize_yyc_scanner
();
20
}
21
22
cscannert::~cscannert
()
23
{
24
yyclex_destroy
();
25
}
26
27
ctokent
cscannert::operator()
()
28
{
29
cscanner_ptr
=
this
;
30
31
if
(
yyclex
() == 0)
// EOF
32
{
33
token
.
kind
= ctokent::END_OF_FILE;
34
token
.
text
.clear();
35
token
.
line_number
=
line_number
;
36
}
37
38
return
std::move(
token
);
39
}
40
41
std::vector<ctokent>
cscannert::get_tokens
()
42
{
43
std::vector<ctokent> result;
44
45
do
46
{
47
result.push_back(this->
operator
()());
48
}
while
(!
is_eof
(result.back()));
49
50
return
result;
51
}
cscannert
Definition:
cscanner.h:21
cscannert::line_number
std::size_t line_number
Definition:
cscanner.h:29
cscannert::~cscannert
~cscannert()
Definition:
cscanner.cpp:22
cscannert::get_tokens
std::vector< ctokent > get_tokens()
Definition:
cscanner.cpp:41
cscannert::cscannert
cscannert(std::istream &)
Definition:
cscanner.cpp:17
cscannert::operator()
ctokent operator()()
Definition:
cscanner.cpp:27
cscannert::token
ctokent token
Definition:
cscanner.h:43
ctokent
Definition:
ctoken.h:19
ctokent::line_number
std::size_t line_number
Definition:
ctoken.h:42
ctokent::kind
kindt kind
Definition:
ctoken.h:37
ctokent::text
std::string text
Definition:
ctoken.h:40
yyclex_destroy
int yyclex_destroy()
yyclex
int yyclex()
cscanner_ptr
cscannert * cscanner_ptr
Definition:
cscanner.cpp:11
initialize_yyc_scanner
void initialize_yyc_scanner()
cscanner.h
cscanner
is_eof
static bool is_eof(const ctokent &t)
Definition:
ctoken.h:88
src
crangler
cscanner.cpp
Generated by
1.9.1