diff options
author | Johan Dahlin <johan@gnome.org> | 2008-08-31 16:10:18 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-08-31 16:10:18 +0000 |
commit | 0745eb0c9920523471afedf058de4fdee573e1b1 (patch) | |
tree | dbacde2bccd57d4b9c80ea98c129f7979f69542a /giscanner/scannerlexer.l | |
parent | a80f4a68ea3d66dd87732da00ee3cd3c6e42b1de (diff) | |
download | gobject-introspection-0745eb0c9920523471afedf058de4fdee573e1b1.tar.gz |
Parse GCC extensions in the parser instead of just undeffing them in the
2008-08-31 Johan Dahlin <johan@gnome.org>
* giscanner/scannerlexer.l:
* giscanner/scannerparser.y:
* giscanner/sourcescanner.h:
* giscanner/sourcescanner.py:
Parse GCC extensions in the parser instead of just undeffing them
in the pre-processor.
svn path=/trunk/; revision=553
Diffstat (limited to 'giscanner/scannerlexer.l')
-rw-r--r-- | giscanner/scannerlexer.l | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/giscanner/scannerlexer.l b/giscanner/scannerlexer.l index c4eb1d41..45a47ab1 100644 --- a/giscanner/scannerlexer.l +++ b/giscanner/scannerlexer.l @@ -44,7 +44,7 @@ static int yywrap (void); static void parse_comment (GISourceScanner *scanner); static void process_directive (GISourceScanner *scanner); static int check_identifier (GISourceScanner *scanner, const char *); -static int parse_attribute (void); +static int parse_ignored_macro (void); %} intsuffix ([uU][lL]?[lL]?)|([lL][lL]?[uU]?) @@ -118,7 +118,12 @@ stringtext ([^\"])|(\\.) "," { return ','; } "->" { return ARROW; } -"__attribute__" { if (!parse_attribute()) REJECT; } +"__attribute__" { if (!parse_ignored_macro()) REJECT; } +"__const" { return CONST; } +"__extension__" { return EXTENSION; } +"__inline" { return INLINE; } +"__nonnull" { if (!parse_ignored_macro()) REJECT; } +"__restrict" { return RESTRICT; } [a-zA-Z_][a-zA-Z_0-9]* { if (scanner->macro_scan) return IDENTIFIER; else REJECT; } @@ -409,8 +414,12 @@ process_directive (GISourceScanner *scanner) g_string_free (filename_builder, TRUE); } +/* + * This parses a macro which is ignored, such as + * __attribute__(x) + */ static int -parse_attribute (void) +parse_ignored_macro (void) { int c; int nest; |