Add a backend generic pointer to the symbol. Not that
[smatch.git] / parse.h
blob4d3a519299e9195873cfd7d9e1011b3d6b67e4d1
1 #ifndef PARSE_H
2 #define PARSE_H
3 /*
4 * Basic parsing data structures. Statements and symbols.
6 * Copyright (C) 2003 Transmeta Corp.
8 * Licensed under the Open Software License version 1.1
9 */
11 #include "symbol.h"
13 enum statement_type {
14 STMT_NONE,
15 STMT_EXPRESSION,
16 STMT_COMPOUND,
17 STMT_IF,
18 STMT_RETURN,
19 STMT_CASE,
20 STMT_SWITCH,
21 STMT_ITERATOR,
22 STMT_LABEL,
23 STMT_GOTO,
24 STMT_ASM,
27 struct statement {
28 enum statement_type type;
29 struct position pos;
30 struct statement *next;
31 union {
32 struct label_arg {
33 struct symbol *label;
34 struct statement *label_statement;
36 struct expression *expression;
37 struct if_statement {
38 struct expression *if_conditional;
39 struct statement *if_true;
40 struct statement *if_false;
42 struct compound_struct {
43 struct symbol_list *syms;
44 struct statement_list *stmts;
46 struct labeled_struct {
47 struct symbol *label_identifier;
48 struct statement *label_statement;
50 struct case_struct {
51 struct expression *case_expression;
52 struct expression *case_to;
53 struct statement *case_statement;
55 struct switch_struct {
56 struct expression *switch_expression;
57 struct statement *switch_statement;
58 struct symbol *switch_break, *switch_case;
60 struct iterator_struct {
61 struct symbol *iterator_break;
62 struct symbol *iterator_continue;
63 struct statement *iterator_pre_statement;
64 struct expression *iterator_pre_condition;
66 struct statement *iterator_statement;
68 struct statement *iterator_post_statement;
69 struct expression *iterator_post_condition;
71 struct goto_struct {
72 struct symbol *goto_label;
73 struct expression *goto_expression;
78 extern struct token *parse_expression(struct token *, struct expression **);
79 extern struct token *statement_list(struct token *, struct statement_list **);
81 extern int show_statement(struct statement *);
82 extern void show_statement_list(struct statement_list *, const char *);
83 extern int show_expression(struct expression *);
84 extern void translation_unit(struct token *, struct symbol_list **);
86 extern struct symbol *ctype_integer(unsigned int spec);
87 extern struct symbol *ctype_fp(unsigned int spec);
89 extern int match_string_ident(struct ident *, const char *);
91 #endif /* PARSE_H */