]> git.draconx.ca Git - gob-dx.git/blobdiff - src/lexer.l
Rename "prealloc" global variable.
[gob-dx.git] / src / lexer.l
index 1a58a9ccd6f929f8fddb7a79f5aa49f9b9a3ce97..d33965db2119190c474205bc44ddaafbb210bff8 100644 (file)
@@ -1,7 +1,9 @@
-/* GOB C Preprocessor
+%top{
+/*
+ * GOB C Preprocessor
  * Copyright (C) 1999-2000 the Free Software Foundation.
  * Copyright (C) 2000 Eazel, Inc.
- * Copyright (C) 2001-2009 George (Jiri) Lebl
+ * Copyright (C) 2001-2011 George (Jiri) Lebl
  *
  * Author: George Lebl
  *
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  * USA.
  */
-%{
+#include <config.h>
+}
 
-#include "config.h"
+%{
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
@@ -95,9 +98,10 @@ add_gtk_doc_func(void)
        gtk_doc_func = NULL;
 }
 
-/* Ugly warning avoiding */
+/* Ugly warning / error avoidings */
 #ifdef FLEX_SCANNER
 int yylex(void);
+int yywrap(void) { return 1; }
 #endif
 
 %}
@@ -346,6 +350,16 @@ REJECT;
                        if(look_for_includes==0)
                                look_for_includes=1;
                }
+^\%(ct|ctop)\{         {
+                       BEGIN(C_CODE);
+                       parenth_depth = 1;
+                       class_after_c = FALSE;
+                       code_type = CTCODE;
+                       clear_cbuf();
+                       ccode_line = line_no;
+                       if(look_for_includes==0)
+                               look_for_includes=1;
+               }
 ^\%(ad|afterdecls)\{           {
                        BEGIN(C_CODE);
                        parenth_depth = 1;
@@ -503,6 +517,12 @@ flags              { return FLAGS; }
 <CLASS_STRING>.        { add_to_cbuf(yytext); }
 <CLASS_STRING>\n       { add_to_cbuf(yytext); }
 
+<CLASS_CODE_I>\"       {
+                       BEGIN(CLASS_STRING);
+                       before_string = CLASS_CODE_I;
+                       add_to_cbuf(yytext);
+               }
+
 <CLASS_CODE_I,PROPERTY_CODE_I>void     {return VOID;}
 <CLASS_CODE_I,PROPERTY_CODE_I>struct   {return STRUCT;}
 <CLASS_CODE_I,PROPERTY_CODE_I>union    {return UNION;}
@@ -533,6 +553,7 @@ flags               { return FLAGS; }
                                return PROPERTY;
                        }
 <PROPERTY_CODE_I>nick  { yylval.line = line_no; return NICK; }
+<PROPERTY_CODE_I>name  { yylval.line = line_no; return NAME; }
 <PROPERTY_CODE_I>blurb { yylval.line = line_no; return BLURB; }
 <PROPERTY_CODE_I>maximum       { yylval.line = line_no; return MAXIMUM; }
 <PROPERTY_CODE_I>minimum       { yylval.line = line_no; return MINIMUM; }
@@ -639,7 +660,7 @@ flags               { return FLAGS; }
                        p = strchr (yytext,'p');
                        g_assert (p); /* we MUST have found it */
                        sscanf (p, "prealloc %d", &t);
-                       prealloc=t;
+                       npreallocs=t;
                }
 
 %%