summaryrefslogtreecommitdiff
path: root/glcpp.h
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2010-05-20 22:27:07 -0700
committerCarl Worth <cworth@cworth.org>2010-05-20 22:27:07 -0700
commitb20d33c5c6fea8e392c26e9ab060efd14034f1f9 (patch)
tree0285aa21a9c693a155d02a1b1f715137b49f494c /glcpp.h
parentd8327e575dd20fe696f3a44ada4bd4001b15db27 (diff)
Implement #if, #else, #elif, and #endif with tests.
So far the only expression implemented is a single integer literal, but obviously that's easy to extend. Various things including nesting are tested here.
Diffstat (limited to 'glcpp.h')
-rw-r--r--glcpp.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/glcpp.h b/glcpp.h
index 1537109ada..33ece8f92b 100644
--- a/glcpp.h
+++ b/glcpp.h
@@ -95,12 +95,24 @@ typedef struct expansion_node {
struct expansion_node *next;
} expansion_node_t;
+typedef enum skip_type {
+ SKIP_NO_SKIP,
+ SKIP_TO_ELSE,
+ SKIP_TO_ENDIF
+} skip_type_t;
+
+typedef struct skip_node {
+ skip_type_t type;
+ struct skip_node *next;
+} skip_node_t;
+
struct glcpp_parser {
yyscan_t scanner;
struct hash_table *defines;
expansion_node_t *expansions;
int just_printed_separator;
int need_newline;
+ skip_node_t *skip_stack;
};
void