]> git.draconx.ca Git - gob-dx.git/blobdiff - src/lexer.l
Release 1.0.9
[gob-dx.git] / src / lexer.l
index a33eed0a7720e3a7113830fbc7f8413499e0b49d..95cbf52c0fd83b61bf479d9e44fb8cb69796d99c 100644 (file)
@@ -334,9 +334,8 @@ class               {
                        BEGIN(CLASS_CODE);
 
                        if(++found_classes > 1) {
-                               print_error(FALSE, 
-                                           "Only one class per file allowed",
-                                           line_no);
+                               error_print(GOB_ERROR, line_no,
+                                           "Only one class per file allowed");
                        }
 
                        return CLASS;
@@ -345,35 +344,49 @@ class             {
 ^[ \t]*requires[ \t]+[0-9]+\.[0-9]+\.[0-9]+[\t ]*$     {
                        int maj = 0,min = 0,pl = 0;
                        int rmaj = 0,rmin = 0,rpl = 0;
+                       int effective_maj = 0;
+                       int effective_rmaj = 0;
                        char *p;
                        
                        sscanf(VERSION,"%d.%d.%d",&rmaj,&rmin,&rpl);
+                       effective_rmaj = rmaj;
+                       if (rmin >= 90)
+                               effective_rmaj = rmaj + 1;
+
                        p = strchr(yytext,'r');
                        g_assert(p); /* we MUST have found it */
                        sscanf(p,"requires %d.%d.%d",&maj,&min,&pl);
+                       effective_maj = maj;
+                       if (min >= 90)
+                               effective_maj = maj + 1;
+
                        if(rmaj < maj ||
                           (rmaj == maj && rmin < min) ||
                           (rmaj == maj && rmin == min && rpl < pl)) {
-                               char *s;
-                               s = g_strdup_printf(
-                                   "GOB version %d.%d.%d required "
-                                   "(this is %s)\n"
-                                   "To upgrade your gob, see: "
-                                   "http://www.5z.com/jirka/gob.html",
-                                   maj,min,pl,VERSION);
-                               print_error(FALSE, s, line_no);
-                               g_free(s);
+                               error_printf(GOB_ERROR, line_no,
+                                            "GOB version at least %d.%d.%d required "
+                                            "(this is %s)\n"
+                                            "To upgrade your gob, see: "
+                                            "http://www.5z.com/jirka/gob.html",
+                                            maj, min, pl, VERSION);
+                       }
+
+                       if(effective_rmaj != effective_maj) {
+                               error_printf(GOB_ERROR, line_no,
+                                            "GOB major version %d required "
+                                            "(this is %s)\n"
+                                            "To upgrade your gob, see: "
+                                            "http://www.5z.com/jirka/gob.html",
+                                            maj, VERSION);
                        }
                }
 
 <CLASS_CODE,CLASS_CODE_I>class|this    {
                        if(for_cpp) {
-                               char *s;
-                               s = g_strdup_printf("'%s' keyword should not "
-                                                   "be used when generating "
-                                                   "C++ code", yytext);
-                               print_error(TRUE, s, line_no);
-                               g_free(s);
+                               error_printf(GOB_WARN, line_no,
+                                            "'%s' keyword should not "
+                                            "be used when generating "
+                                            "C++ code", yytext);
                        }
                        REJECT;
                }