Fix stringify that got broken by other changes
[smatch.git] / parse.h
blob7828b46f5f73d3f8874a31a68fe17d4fbb120cd5
1 #ifndef PARSE_H
2 #define PARSE_H
3 /*
4 * Basic parsing data structures. Statements and symbols.
6 * Copyright (C) 2003 Linus Torvalds, all rights reserved.
7 */
9 #include "symbol.h"
11 enum expression_type {
12 EXPR_CONSTANT,
13 EXPR_SYMBOL,
14 EXPR_BINOP,
15 EXPR_DEREF,
16 EXPR_PREOP,
17 EXPR_POSTOP,
18 EXPR_CAST,
19 EXPR_SIZEOF,
20 EXPR_CONDITIONAL,
21 EXPR_STATEMENT,
24 struct expression {
25 int type, op;
26 struct token *token;
27 union {
28 struct expression *unop;
29 struct statement *statement;
30 struct symbol *symbol;
31 struct binop_arg {
32 struct expression *left, *right;
34 struct deref_arg {
35 struct expression *deref;
36 struct token *member;
38 struct cast_arg {
39 struct symbol *cast_type;
40 struct expression *cast_expression;
42 struct conditional_expr {
43 struct expression *conditional, *cond_true, *cond_false;
45 struct statement_struct {
46 struct symbol_list *syms;
47 struct statement_list *stmts;
52 enum statement_type {
53 STMT_NONE,
54 STMT_EXPRESSION,
55 STMT_COMPOUND,
56 STMT_IF,
57 STMT_RETURN,
58 STMT_BREAK,
59 STMT_CONTINUE,
60 STMT_CASE,
61 STMT_SWITCH,
62 STMT_FOR,
63 STMT_WHILE,
64 STMT_DO,
65 STMT_LABEL,
66 STMT_GOTO,
67 STMT_ASM,
70 struct statement {
71 int type;
72 struct token *token;
73 struct statement *next;
74 union {
75 struct label_arg {
76 struct token *label;
77 struct statement *label_statement;
79 struct expression *expression;
80 struct if_statement {
81 struct expression *if_conditional;
82 struct statement *if_true;
83 struct statement *if_false;
85 struct compound_struct {
86 struct symbol_list *syms;
87 struct statement_list *stmts;
89 struct labeled_struct {
90 struct token *label_identifier;
91 struct statement *label_statement;
93 struct case_struct {
94 struct expression *case_expression;
95 struct expression *case_to;
96 struct statement *case_statement;
98 struct switch_struct {
99 struct expression *switch_expression;
100 struct statement *switch_statement;
102 struct iteration_struct {
103 struct expression *e1, *e2, *e3;
104 struct statement *iterate;
106 struct goto_struct {
107 struct token *goto_label;
108 struct expression *goto_expression;
113 extern struct token *parse_expression(struct token *, struct expression **);
114 extern struct token *statement_list(struct token *, struct statement_list **);
116 extern void show_statement(struct statement *);
117 extern void show_statement_list(struct statement_list *, const char *);
118 extern void show_expression(struct expression *);
119 extern void translation_unit(struct token *, struct symbol_list **);
121 #endif /* PARSE_H */