CBMC
ctoken.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: C Token
4 
5 Author: Daniel Kroening, dkr@amazon.com
6 
7 \*******************************************************************/
8 
11 
12 #include "ctoken.h"
13 
14 #include <ostream>
15 
16 void ctokent::output(std::ostream &out) const
17 {
18  switch(kind)
19  {
20  case END_OF_FILE:
21  out << "END_OF_FILE";
22  break;
23  case INT_LIT:
24  out << "INT";
25  break;
26  case CHAR_LIT:
27  out << "CHAR_LIT";
28  break;
29  case FLOAT_LIT:
30  out << "FLOAT_LIT";
31  break;
32  case STRING_LIT:
33  out << "STRING_LIT";
34  break;
35  case C_COMMENT:
36  out << "C_COMMENT";
37  break;
38  case CPP_COMMENT:
39  out << "CPP_COMMENT";
40  break;
41  case IDENTIFIER:
42  out << "IDENTIFIER";
43  break;
44  case OPERATOR:
45  out << "OPERATOR";
46  break;
47  case WS:
48  out << "WS";
49  break;
50  case PREPROCESSOR_DIRECTIVE:
51  out << "PREPROCESSOR_DIRECTIVE";
52  break;
53  case SEPARATOR:
54  out << "SEPARATOR";
55  break;
56  case UNKNOWN:
57  out << "UNKNOWN";
58  break;
59  }
60 
61  out << ' ' << text;
62 }
63 
64 std::ostream &operator<<(std::ostream &out, const ctokent &t)
65 {
66  t.output(out);
67  return out;
68 }
Definition: ctoken.h:19
void output(std::ostream &) const
Definition: ctoken.cpp:16
kindt kind
Definition: ctoken.h:37
std::string text
Definition: ctoken.h:40
std::ostream & operator<<(std::ostream &out, const ctokent &t)
Definition: ctoken.cpp:64
ctoken