aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.transmeta.com>2003-03-17 12:06:37 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 20:59:21 -0700
commit2540f9d534d34a6e4b018f94314d006ef3209d4c (patch)
tree033e5c8fe7ef6a940dfd1e802169023ed32d6c09 /token.h
parentImplement space-efficient allocator for small data structures. We (diff)
downloadsparse-2540f9d534d34a6e4b018f94314d006ef3209d4c.tar.gz
sparse-2540f9d534d34a6e4b018f94314d006ef3209d4c.tar.bz2
sparse-2540f9d534d34a6e4b018f94314d006ef3209d4c.zip
Add initial preprocessor pass (doesn't actually do much)
Make tokens know about newlines
Diffstat (limited to 'token.h')
-rw-r--r--token.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/token.h b/token.h
index f8b7637..83ff439 100644
--- a/token.h
+++ b/token.h
@@ -95,7 +95,8 @@ struct string {
struct token {
unsigned int type:8,
stream:8,
- pos:16;
+ pos:15,
+ newline:1;
unsigned int line;
struct token *next;
union {
@@ -127,5 +128,16 @@ extern struct token * tokenize(const char *, int);
extern void die(const char *, ...);
extern void warn(struct token *, const char *, ...);
extern void show_identifier_stats(void);
+extern struct token *preprocess(struct token *);
+
+static inline int match_op(struct token *token, int op)
+{
+ return token->type == TOKEN_SPECIAL && token->special == op;
+}
+
+static inline int match_ident(struct token *token, struct ident *id)
+{
+ return token->type == TOKEN_IDENT && token->ident == id;
+}
#endif