From b20d33c5c6fea8e392c26e9ab060efd14034f1f9 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 20 May 2010 22:27:07 -0700 Subject: 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. --- glcpp.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'glcpp.h') 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 -- cgit v1.2.3