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
This commit is contained in:
parent
8413325366
commit
ecd8d72ef5
1 changed files with 2 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue