CBMC
cscanner.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: C Scanner
4 
5 Author: Daniel Kroening, dkr@amazon.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_CRANGLER_CSCANNER_H
13 #define CPROVER_CRANGLER_CSCANNER_H
14 
15 #include <iosfwd>
16 #include <vector>
17 
18 #include "ctoken.h"
19 
20 class cscannert
21 {
22 public:
23  explicit cscannert(std::istream &);
24  ~cscannert();
25 
27 
28  std::istream &in;
29  std::size_t line_number = 1;
30 
31  bool return_WS_and_comments = false;
32 
33  void set_token(std::string text, ctokent::kindt kind)
34  {
36  token.text = std::move(text);
37  token.kind = kind;
38  }
39 
40  std::vector<ctokent> get_tokens();
41 
42 protected:
44 };
45 
46 extern cscannert *cscanner_ptr;
47 
48 #endif // CPROVER_CRANGLER_CSCANNER_H
std::size_t line_number
Definition: cscanner.h:29
void set_token(std::string text, ctokent::kindt kind)
Definition: cscanner.h:33
~cscannert()
Definition: cscanner.cpp:22
std::istream & in
Definition: cscanner.h:28
bool return_WS_and_comments
Definition: cscanner.h:31
std::vector< ctokent > get_tokens()
Definition: cscanner.cpp:41
cscannert(std::istream &)
Definition: cscanner.cpp:17
ctokent operator()()
Definition: cscanner.cpp:27
ctokent token
Definition: cscanner.h:43
Definition: ctoken.h:19
std::size_t line_number
Definition: ctoken.h:42
kindt kind
Definition: ctoken.h:37
std::string text
Definition: ctoken.h:40
enum { END_OF_FILE, INT_LIT, CHAR_LIT, FLOAT_LIT, STRING_LIT, C_COMMENT, CPP_COMMENT, IDENTIFIER, OPERATOR, WS, SEPARATOR, PREPROCESSOR_DIRECTIVE, UNKNOWN } kindt
Definition: ctoken.h:35
cscannert * cscanner_ptr
Definition: cscanner.cpp:11
ctoken