Go to the documentation of this file.
65 return token ==
"auto" || token ==
"extern" || token ==
"static" ||
66 token ==
"register" || token ==
"_Thread_local";
71 return token ==
"const" || token ==
"volatile" || token ==
"restrict" ||
100 out <<
"DECLARATOR: ";
142 std::size_t bracket_count = 0;
149 dest.push_back(token);
152 else if(token == close)
155 if(bracket_count == 0)
176 auto &token =
peek();
180 token ==
"int" || token ==
"signed" || token.text ==
"unsigned" ||
181 token ==
"char" || token ==
"short" || token ==
"long" ||
182 token ==
"float" || token ==
"double" || token ==
"inline" ||
187 else if(token ==
"enum" || token ==
"struct" || token ==
"union")
202 else if(token ==
"__attribute__")
213 std::size_t index = 1;
216 const auto &next_token =
peek(index);
225 auto &next_token =
peek(index);
234 else if(token ==
';')
236 else if(token ==
'(')
243 "expected a declaration but got '" + token.text +
"'", loc);
285 std::size_t open_parentheses = 0;
298 else if(open_parentheses > 0)
317 else if(
peek() ==
'=')
325 result.push_back(token);
330 else if(
peek() ==
';')
335 else if(
peek() ==
'{')
339 std::size_t bracket_count = 0;
345 result.push_back(token);
348 else if(token ==
'}')
351 if(bracket_count == 0)
std::ostream & operator<<(std::ostream &out, const c_declarationt &declaration)
const ctokent & peek() const
static bool is_identifier(const ctokent &t)
static bool is_eof(const ctokent &t)
std::vector< ctokent > get_tokens()
static bool is_type_qualifier(const ctokent &token)
void print(std::ostream &) const
std::vector< ctokent > tokenst
Thrown when we can't handle something in an input source file.
static bool is_ws(const ctokent &t)
tokenst parse_post_declarator()
tokenst parse_declarator()
static bool is_comment(const ctokent &t)
void set_line(const irep_idt &line)
c_declarationt parse_declaration()
void parse_brackets(char open, char close, tokenst &dest)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
c_translation_unitt parse_c(std::istream &in)
static bool is_storage_class(const ctokent &token)
tokenst parse_pre_declarator()
nonstd::optional< T > optionalt
const ctokent & peek(std::size_t how_many) const
static bool is_preprocessor_directive(const ctokent &t)
bool return_WS_and_comments
std::vector< c_declarationt > c_translation_unitt
tokenst parse_initializer()
c_translation_unitt parse(std::istream &)
const ctokent & consume_token()
optionalt< ctokent > declared_identifier() const