From ecd8d72ef5c734d1b03510d74fd0c2fdb275cd89 Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Tue, 26 Sep 2000 03:00:55 +0000 Subject: [PATCH] Modified the preprocessor to allow identifiers to start with "%". This is highly experimental (I may take it out), but I have this idea that you might be able to create new SWIG directives as C preprocessor macros. For example: #define %check(type) %typemap(check) type %check(int positive) { if ($source < 0) error("hey, what's with this?"); } (In reality, I think that this feature may allow me to reduce the parser to a smaller set of more primitive directives that will simplify some of the code maintenance). git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@891 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Preprocessor/cpp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index e72e6550b..610b1c8f7 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -173,7 +173,7 @@ DOHHash *Preprocessor_define(DOHString_or_char *str, int swigmacro) goto macro_error; } break; - } else if (isidchar(c)) { + } else if (isidchar(c) || (c == '%')) { Putc(c,macroname); } else if (isspace(c)) { break; @@ -513,7 +513,7 @@ Preprocessor_replace(DOH *s) while ((c = Getc(s)) != EOF) { switch (state) { case 0: - if (isidentifier(c)) { + if (isidentifier(c) || (c == '%')) { Clear(id); copy_location(s,id); Putc(c,id);