aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/expression.h
diff options
authorLinus Torvalds <torvalds@penguin.transmeta.com>2003-03-24 11:26:02 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 20:59:40 -0700
commitdd70c1f2ceb662e396256e11b9edd44cc7f7724c (patch)
treec9bed7577d1b6da535589f096b94d0530f9e33ac /expression.h
parent6a9acf2316de67159f2a07eb61bdb96618f8af86 (diff)
downloadsparse-dev-dd70c1f2ceb662e396256e11b9edd44cc7f7724c.tar.gz
Move expression data structures to "expression.h", they got
left behind in "parse.h" when the files were split.
Diffstat (limited to 'expression.h')
-rw-r--r--expression.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/expression.h b/expression.h
index d3781843..0566fadd 100644
--- a/expression.h
+++ b/expression.h
@@ -8,6 +8,47 @@
* Declarations and helper functions for expression parsing.
*/
+enum expression_type {
+ EXPR_CONSTANT,
+ EXPR_SYMBOL,
+ EXPR_BINOP,
+ EXPR_DEREF,
+ EXPR_PREOP,
+ EXPR_POSTOP,
+ EXPR_CAST,
+ EXPR_SIZEOF,
+ EXPR_CONDITIONAL,
+ EXPR_STATEMENT,
+};
+
+struct expression {
+ int type, op;
+ struct token *token;
+ union {
+ struct expression *unop;
+ struct statement *statement;
+ struct symbol *symbol;
+ struct binop_arg {
+ struct expression *left, *right;
+ };
+ struct deref_arg {
+ struct expression *deref;
+ struct token *member;
+ };
+ struct cast_arg {
+ struct symbol *cast_type;
+ struct expression *cast_expression;
+ };
+ struct conditional_expr {
+ struct expression *conditional, *cond_true, *cond_false;
+ };
+ struct statement_struct {
+ struct symbol_list *syms;
+ struct statement_list *stmts;
+ };
+ };
+};
+
/* Constant expression values */
long long get_expression_value(struct expression *);