]> git.draconx.ca Git - gob-dx.git/blobdiff - src/lexer.l
Release 2.0.20
[gob-dx.git] / src / lexer.l
index b3b2d596c3fde0348f0ae55534c88e8bdab2d78f..d59a3d96b4b2707de33df8041dbdbfd674303a7e 100644 (file)
@@ -1,5 +1,7 @@
 /* GOB C Preprocessor
- * Copyright (C) 1999 the Free Software Foundation.
+ * Copyright (C) 1999-2000 the Free Software Foundation.
+ * Copyright (C) 2000 Eazel, Inc.
+ * Copyright (C) 2001-2011 George (Jiri) Lebl
  *
  * Author: George Lebl
  *
@@ -20,7 +22,7 @@
  */
 %{
 
-#include "config.h"
+#include "config.h" 
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
@@ -93,9 +95,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
 
 %}
@@ -187,7 +190,7 @@ REJECT;
        g_free(str);
 }
 
-<C_CODE>^#[ \t]*include[ \t][<"][^\n">]*[>"] {
+<C_CODE>^#[ \t]*include[ \t][<"][^\n\r">]*[>"] {
        if(look_for_includes==1) {
                char *p;
                char *file;
@@ -344,6 +347,24 @@ 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;
+                       class_after_c = FALSE;
+                       code_type = ADCODE;
+                       clear_cbuf();
+                       ccode_line = line_no;
+               }
 <C_CODE>^\%\}  {
                        BEGIN(INITIAL);
                        yylval.cbuf = cbuf;
@@ -493,6 +514,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;}
@@ -523,6 +550,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; }
@@ -615,13 +643,14 @@ flags             { return FLAGS; }
 
 <CLASS_CODE,CLASS_CODE_I,INITIAL,PROPERTY_CODE,PROPERTY_CODE_I>[\f\t ] ;  /*ignore*/
 
+<*>[\n\r]      ;  /*ignore*/
+
+
 <*>.           {
                        yylval.line = line_no;
                        return yytext[0];
                }
 
-<*>[\n\r]      ;  /*ignore*/
-
 ^[ \t]*prealloc[ \t]+[0-9]+[ \t]*$ {
                        char *p;
                        int t;