aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.transmeta.com>2003-03-31 10:38:49 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 20:59:55 -0700
commitbdc6803647b8feb99bf35fa9d5b533351ae3dc4f (patch)
tree58cc00deeb16c86dfb481e1f32cee7dfc98630c3 /expression.h
parentStart doing constant strings right: do proper concatenation of strings, (diff)
downloadsparse-bdc6803647b8feb99bf35fa9d5b533351ae3dc4f.tar.gz
sparse-bdc6803647b8feb99bf35fa9d5b533351ae3dc4f.tar.bz2
sparse-bdc6803647b8feb99bf35fa9d5b533351ae3dc4f.zip
Parse initializers properly. We parsed them before, but we didn't
add them to the parse tree. We now do.
Diffstat (limited to 'expression.h')
-rw-r--r--expression.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/expression.h b/expression.h
index 21297b5..c0d701d 100644
--- a/expression.h
+++ b/expression.h
@@ -28,6 +28,9 @@ enum expression_type {
EXPR_COMMA,
EXPR_COMPARE,
EXPR_BITFIELD,
+ EXPR_INITIALIZER, // initializer list
+ EXPR_IDENTIFIER, // identifier in initializer
+ EXPR_INDEX, // index in initializer
};
struct expression {
@@ -85,6 +88,14 @@ struct expression {
unsigned char bitpos, nrbits;
struct expression *address;
};
+ // EXPR_INITIALIZER
+ struct expression_list *expr_list;
+ // EXPR_IDENTIFIER
+ struct ident *expr_ident;
+ // EXPR_INDEX
+ struct index_expr {
+ unsigned int idx_from, idx_to;
+ };
};
};
@@ -120,7 +131,7 @@ static inline int lookup_type(struct token *token)
/* Statement parsing */
struct statement *alloc_statement(struct token * token, int type);
-struct token *initializer(struct token *token, struct ctype *type);
+struct token *initializer(struct expression **tree, struct token *token);
struct token *compound_statement(struct token *, struct statement *);
/* The preprocessor calls this 'constant_expression()' */