From 50237ec13398017ea1d12e78932efd0ffabfe9a4 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Fri, 29 Feb 2008 17:33:40 +0000 Subject: [PATCH] Added the "else" directive --- include/cpp.h | 1 + src/cpp.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/cpp.h b/include/cpp.h index 95fc003..270bfb9 100644 --- a/include/cpp.h +++ b/include/cpp.h @@ -33,6 +33,7 @@ typedef enum _CppCode CPP_CODE_COMMA = 0, CPP_CODE_DQUOTE, CPP_CODE_META_DEFINE, + CPP_CODE_META_ELSE, CPP_CODE_META_ENDIF, CPP_CODE_META_ERROR, CPP_CODE_META_IF, diff --git a/src/cpp.c b/src/cpp.c index 6437612..28a0ff7 100644 --- a/src/cpp.c +++ b/src/cpp.c @@ -62,6 +62,7 @@ struct _Cpp typedef enum _CppDirective { CPP_DIRECTIVE_DEFINE = 0, + CPP_DIRECTIVE_ELSE, CPP_DIRECTIVE_ENDIF, CPP_DIRECTIVE_ERROR, CPP_DIRECTIVE_IF, @@ -121,7 +122,7 @@ static const size_t _cpp_operators_cnt = sizeof(_cpp_operators) static const size_t _cpp_directives_cnt = CPP_DIRECTIVE_COUNT; static const char * _cpp_directives[CPP_DIRECTIVE_COUNT] = { - "define", "endif", "error", "if", "ifdef", "ifndef", "include", + "define", "else", "endif", "error", "if", "ifdef", "ifndef", "include", "pragma", "warning" }; @@ -432,6 +433,10 @@ static int _cpp_callback_directive(Parser * parser, Token * token, int c, /* FIXME implement */ token_set_code(token, CPP_CODE_META_DEFINE); break; + case CPP_DIRECTIVE_ELSE: + /* FIXME implement */ + token_set_code(token, CPP_CODE_META_ELSE); + break; case CPP_DIRECTIVE_ENDIF: /* FIXME implement */ token_set_code(token, CPP_CODE_META_ENDIF);