aboutsummaryrefslogtreecommitdiffstatshomepage
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
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.
-rw-r--r--expression.h41
-rw-r--r--lib.c1
-rw-r--r--parse.h41
-rw-r--r--pre-process.c1
4 files changed, 43 insertions, 41 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 *);
diff --git a/lib.c b/lib.c
index 86e48fa3..277e43f2 100644
--- a/lib.c
+++ b/lib.c
@@ -13,6 +13,7 @@
#include "token.h"
#include "parse.h"
#include "symbol.h"
+#include "expression.h"
struct token *skip_to(struct token *token, int op)
{
diff --git a/parse.h b/parse.h
index 7828b46f..065ac4a9 100644
--- a/parse.h
+++ b/parse.h
@@ -8,47 +8,6 @@
#include "symbol.h"
-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;
- };
- };
-};
-
enum statement_type {
STMT_NONE,
STMT_EXPRESSION,
diff --git a/pre-process.c b/pre-process.c
index 36dc5021..df1ddd2f 100644
--- a/pre-process.c
+++ b/pre-process.c
@@ -20,6 +20,7 @@
#include "parse.h"
#include "token.h"
#include "symbol.h"
+#include "expression.h"
#define MAXNEST (16)
static int true_nesting = 0;