]> git.draconx.ca Git - gob-dx.git/blobdiff - src/parse.y
Release 0.91.2
[gob-dx.git] / src / parse.y
index b5d9f104f3018ced3241b370caff9817b87f74b4..4cdb6a06d9a83d93fe262967d0fc628edc615c36 100644 (file)
@@ -223,6 +223,11 @@ class:             classdec '{' classcode '}'      {
                        class_nodes = NULL;
                        nodes = g_list_append(nodes,class);
                                                }
+       |       classdec '{' '}'                {
+                       ((Class *)class)->nodes = NULL;
+                       class_nodes = NULL;
+                       nodes = g_list_append(nodes,class);
+                                               }
        ;
 
 classdec:      CLASS TYPETOKEN FROM TYPETOKEN  {
@@ -410,6 +415,10 @@ stars:             '*' stars                       { stars++; }
        |       '*'                             { stars++; }
        ;
 
+optpublic:                     { ; }
+       |       PUBLIC          { ; }
+       ;
+
 fullsigtype:   PRIVATE TOKEN sigtype   {
                        if(strcmp($<id>2,"first")==0)
                                $<sigtype>$ = PRIVATE_SIGNAL_FIRST_METHOD;
@@ -437,7 +446,31 @@ fullsigtype:       PRIVATE TOKEN sigtype   {
        |       PRIVATE sigtype         {
                        $<sigtype>$ = PRIVATE_SIGNAL_LAST_METHOD;
                                        }
-       |       TOKEN sigtype           {
+       |       TOKEN sigtype   {
+                       if(strcmp($<id>1,"first")==0)
+                               $<sigtype>$ = SIGNAL_FIRST_METHOD;
+                       else if(strcmp($<id>1,"last")==0)
+                               $<sigtype>$ = SIGNAL_LAST_METHOD;
+                       else {
+                               yyerror(_("signal must be 'first' or 'last'"));
+                               g_free($<id>1);
+                               YYERROR;
+                       }
+                       g_free($<id>1);
+                                       }
+       |       PUBLIC TOKEN sigtype    {
+                       if(strcmp($<id>2,"first")==0)
+                               $<sigtype>$ = SIGNAL_FIRST_METHOD;
+                       else if(strcmp($<id>2,"last")==0)
+                               $<sigtype>$ = SIGNAL_LAST_METHOD;
+                       else {
+                               yyerror(_("signal must be 'first' or 'last'"));
+                               g_free($<id>2);
+                               YYERROR;
+                       }
+                       g_free($<id>2);
+                                       }
+       |       TOKEN PUBLIC sigtype    {
                        if(strcmp($<id>1,"first")==0)
                                $<sigtype>$ = SIGNAL_FIRST_METHOD;
                        else if(strcmp($<id>1,"last")==0)
@@ -449,6 +482,9 @@ fullsigtype:        PRIVATE TOKEN sigtype   {
                        }
                        g_free($<id>1);
                                        }
+       |       PUBLIC sigtype          {
+                       $<sigtype>$ = SIGNAL_LAST_METHOD;
+                                       }
        |       sigtype                 {
                        $<sigtype>$ = SIGNAL_LAST_METHOD;
                                        }
@@ -492,14 +528,14 @@ method:           SIGNAL fullsigtype type TOKEN '(' funcargs ')' onerror codenocode {
                                      $<id>8, $<cbuf>9,$<line>1,
                                      ccode_line,vararg);
                                                                        }
-       |       VIRTUAL type TOKEN '(' funcargs ')' onerror codenocode  {
+       |       VIRTUAL optpublic type TOKEN '(' funcargs ')' onerror codenocode        {
                        if(!has_self) {
                                yyerror(_("virtual method without 'self' as "
                                          "first parameter"));
                                YYERROR;
                        }
-                       push_function(VIRTUAL_METHOD, NULL, $<id>3,
-                                     $<id>7, $<cbuf>8,$<line>1,
+                       push_function(VIRTUAL_METHOD, NULL, $<id>4,
+                                     $<id>8, $<cbuf>9,$<line>1,
                                      ccode_line,vararg);
                                                                        }
        |       OVERRIDE '(' TYPETOKEN ')' type TOKEN '(' funcargs ')' onerror '{' CCODE        {