commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/geas/lib/classdefs yparser.y


From: Neil Tiffin
Subject: gnue/geas/lib/classdefs yparser.y
Date: Fri, 04 May 2001 08:19:25 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Neil Tiffin <address@hidden>    01/05/04 08:19:22

Modified files:
        geas/lib/classdefs: yparser.y 

Log message:
        Remove tabs and replace with spaces preserving indentation. No code 
changes, I hope.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/yparser.y.diff?cvsroot=OldCVS&tr1=1.21&tr2=1.22&r1=text&r2=text

Patches:
Index: gnue/geas/lib/classdefs/yparser.y
diff -u gnue/geas/lib/classdefs/yparser.y:1.21 
gnue/geas/lib/classdefs/yparser.y:1.22
--- gnue/geas/lib/classdefs/yparser.y:1.21      Sun Apr 15 08:38:27 2001
+++ gnue/geas/lib/classdefs/yparser.y   Fri May  4 08:19:21 2001
@@ -8,23 +8,27 @@
 #include "gcdparser.h"
 #include "classdata.h"
 
-/* use the more useful verbose error messages */
+      /* use the more useful verbose error messages */
 #define YYERROR_VERBOSE 1
 
-/* defaults to everything public */
+      /* defaults to everything public */
 unsigned long int current_access = ODL_ACCESS_PUBLIC;
 
-/* from lparser.l */
+      /* from lparser.l */
 #include "lparser.h"
 
-/* error checking function prototypes */
+      /* error checking function prototypes */
 void dtype_unsigned_check( gboolean isunsigned , const char *datatype );
 
 int indent = 0;
-void doindent() {
-   int i;
-   /* printf( "%2d: " , indent ); */
-   for( i=0 ; i<indent ; i++ ) printf(" ");
+void doindent()
+{
+  int i;
+      /* printf( "%2d: " , indent ); */
+  for( i=0 ; i<indent ; i++ )
+    {
+      printf(" ");
+    }
 }
 
 struct _odl_container *yycurrent_container = NULL;
@@ -77,97 +81,97 @@
 %%
 
 file: /* empty */  { yywarn("File is empty"); }
- |    unit_list
- ;
+  |    unit_list
+  ;
 
 dt_on: /* dummy rule, modifies expecting_* */ { expecting_datatype=1; 
/*printf("on\n");*/ }
- ;
+  ;
 
 dt_off: /* dummy rule, modifies expecting_* */ { expecting_datatype=0; 
/*printf("off\n");*/ }
- ;
+  ;
 
- /* 'fake' rules to cause the tree to have items added */
+             /* 'fake' rules to cause the tree to have items added */
 push_module: /* */   {
                        if( current_pass == 1 ) {
                          odl_module *newone =
                              odl_new_module($<uint>-2,$<string>0);
                          odl_container_insert_container( yycurrent_container ,
-                                                 (odl_container *)newone );
-                        newone->base.parent = (odl_base *)yycurrent_container;
-                        yycurrent_container = newone;
+                                                  (odl_container *)newone );
+                         newone->base.parent = (odl_base *)yycurrent_container;
+                         yycurrent_container = newone;
                          /* doindent(); printf( "push module\n" ); indent+=4; 
*/
-                      }
-                      else {
-                          yycurrent_container = (odl_container *)
-                              odl_find_in_container( (odl_base 
*)yycurrent_container,
-                              $<string>0);
-                      }
-                      lastpushed = yycurrent_container;
-                    }
+                       }
+                       else {
+                           yycurrent_container = (odl_container *)
+                               odl_find_in_container( (odl_base 
*)yycurrent_container,
+                               $<string>0);
+                       }
+                       lastpushed = yycurrent_container;
+                     }
   ;
 
 pop_module:  /* */   {
                        if( current_pass == 1 ) {
                          yycurrent_container = (odl_container *)
-                            odl_container_get_parent(yycurrent_container);
+                             odl_container_get_parent(yycurrent_container);
                          /* indent-=4; doindent(); printf( "pop module\n" ); */
-                      }
-                      else {
-                          yycurrent_container = (odl_container 
*)yycurrent_container->base.parent;
-                      }
-                    }
+                       }
+                       else {
+                           yycurrent_container = (odl_container 
*)yycurrent_container->base.parent;
+                       }
+                     }
   ;
 
 push_class:  /* */   {
                        if( current_pass == 1 ) {
-                        odl_class *newone;
-                        newone =
+                         odl_class *newone;
+                         newone =
                              odl_new_class($<uint>-4,$<string>0);
                          odl_container_insert_container( yycurrent_container ,
-                                               (odl_container *)newone );
-                        newone->base.parent = (odl_base *)yycurrent_container;
-                        yycurrent_container = newone;
-                        /* doindent(); printf( "push class\n" ); indent += 4; 
*/
-                      }
-                      else {
-                          yycurrent_container = (odl_container *)
-                              odl_find_in_container( (odl_base 
*)yycurrent_container,
-                              $<string>0);
-                      }
-                      lastpushed = yycurrent_container;
-                    }
+                                                (odl_container *)newone );
+                         newone->base.parent = (odl_base *)yycurrent_container;
+                         yycurrent_container = newone;
+                         /* doindent(); printf( "push class\n" ); indent += 4; 
*/
+                       }
+                       else {
+                           yycurrent_container = (odl_container *)
+                               odl_find_in_container( (odl_base 
*)yycurrent_container,
+                               $<string>0);
+                       }
+                       lastpushed = yycurrent_container;
+                     }
   ;
 
 pop_class:   /* */   {
-               GList *l;
+                GList *l;
                 odl_class *c = NULL;
-               if( current_pass == 1 ) {
-                        c = (odl_class *)yycurrent_container;
+                if( current_pass == 1 ) {
+                         c = (odl_class *)yycurrent_container;
                          yycurrent_container = (odl_container *)
-                            odl_container_get_parent(yycurrent_container);
-                        /* indent-=4; doindent(); printf( "pop class\n" ); */
+                             odl_container_get_parent(yycurrent_container);
+                         /* indent-=4; doindent(); printf( "pop class\n" ); */
 
                 /* add all the class's info to yycurrent_container */
 
-               /* add fields in the class (any subclasses already added) */
-               if( $<list>-1 ) {
-                   if( c->contents ) {
-                     c->contents = g_list_concat( c->contents , $<list>-1 );
-                   }
-                   else {
-                     c->contents = $<list>-1;
-                   }
-               }
+                /* add fields in the class (any subclasses already added) */
+                if( $<list>-1 ) {
+                    if( c->contents ) {
+                      c->contents = g_list_concat( c->contents , $<list>-1 );
+                    }
+                    else {
+                      c->contents = $<list>-1;
+                    }
+                }
 
                 /* add parents */
                 c->parents = $<list>-4;
                 }
 
                 else { /* current_pass == 2 */
-                   odl_standardise_parents( (odl_class *)yycurrent_container );
-                   yycurrent_container = (odl_container 
*)yycurrent_container->base.parent;
-               }
-        }
+                    odl_standardise_parents( (odl_class *)yycurrent_container 
);
+                    yycurrent_container = (odl_container 
*)yycurrent_container->base.parent;
+                }
+         }
   ;
 
 unit_list: unit
@@ -229,26 +233,26 @@
 
 enum: new_container_name '{' enum_body  '}' dt_on {
                        if( current_pass == 1 )
-                      {
+                       {
                            odl_item *e = odl_new_enum( current_access , $1 );
-                          if( e )
-                          {
-                              GList *l;
-                              e->base.parent = (odl_base *)yycurrent_container;
-                              l = $3;
-                              while( l )
-                              {
-                                  odl_enum_add_element( e , l->data );
-                                  l = g_list_next( l );
-                              }
+                           if( e )
+                           {
+                               GList *l;
+                               e->base.parent = (odl_base 
*)yycurrent_container;
+                               l = $3;
+                               while( l )
+                               {
+                                   odl_enum_add_element( e , l->data );
+                                   l = g_list_next( l );
+                               }
 
                                yycurrent_container->contents =
-                              g_list_append( yycurrent_container->contents,
-                                e );
-                          }
-                      }
-                      odl_namelist_free( $3 );
-                  }
+                               g_list_append( yycurrent_container->contents,
+                                 e );
+                           }
+                       }
+                       odl_namelist_free( $3 );
+                   }
   ;
 
 enum_body: SYMBOL               { $$ = g_list_append(NULL,$1); }
@@ -266,21 +270,21 @@
 class_body: class_body_item            { $$ = $1; }
   |         class_body class_body_item {
                                           /* if 2 lists, concat them,
-                                            otherwise pass both on
-                                            otherwise an empty class */
+                                             otherwise pass both on
+                                             otherwise an empty class */
                                           if( $1 && $2 ) {
-                                            $$ = g_list_concat($1,$2);
-                                         }
-                                         else if( $1 != NULL ) {
-                                            $$ = $1;
-                                         }
-                                         else if( $2 != NULL ) {
-                                            $$ = $2;
-                                         }
-                                         else {
-                                            $$ = $1;
-                                         }
-                                      }
+                                             $$ = g_list_concat($1,$2);
+                                          }
+                                          else if( $1 != NULL ) {
+                                             $$ = $1;
+                                          }
+                                          else if( $2 != NULL ) {
+                                             $$ = $2;
+                                          }
+                                          else {
+                                             $$ = $1;
+                                          }
+                                       }
   ;
 
 class_body_item: access ':' dt_on         { current_access = $1; $$ = NULL; }
@@ -306,9 +310,9 @@
 
 index: '(' index_item_list ')' { if(current_pass == 2)
                                      
odl_make_index(yycurrent_container,$<bool_value>-1,$2);
-                                else
-                                    odl_namelist_free($2);
-                              }
+                                 else
+                                     odl_namelist_free($2);
+                               }
   ;
 
 index_item_list: existing_field_name                      { $$ = 
g_list_append(NULL,$1); }
@@ -351,16 +355,16 @@
 
 new_field: new_field_name opt_format opt_default opt_properties {
                $$ = alloc_odl_item();
-              if( $$ )
-              {
-                  $$->base.parent = (odl_base *)yycurrent_container;
-                  $$->base.access = current_access;
-                  $$->base.name   = $1;
-                  $$->base.type   = IT_field;
-                  $$->fieldtype   = FT_basic;
-                  $$->format      = $2;
-                  $$->defaultval  = $3;
-              }
+               if( $$ )
+               {
+                   $$->base.parent = (odl_base *)yycurrent_container;
+                   $$->base.access = current_access;
+                   $$->base.name   = $1;
+                   $$->base.type   = IT_field;
+                   $$->fieldtype   = FT_basic;
+                   $$->format      = $2;
+                   $$->defaultval  = $3;
+               }
            }
   ;
 
@@ -373,16 +377,16 @@
 
 method: new_field_name '(' dt_on opt_argument_list ')' dt_off  {
               odl_item *i = alloc_odl_item();
-             if( i )
-             {
-                 i->base.parent = (odl_base *)yycurrent_container;
-                 i->base.type   = IT_field;
-                 i->base.name   = $1;
-                 i->base.access = current_access;
-                 i->fieldtype   = FT_method;
-                 i->arguments   = $4;
-             }
-             $$ = i;
+              if( i )
+              {
+                  i->base.parent = (odl_base *)yycurrent_container;
+                  i->base.type   = IT_field;
+                  i->base.name   = $1;
+                  i->base.access = current_access;
+                  i->fieldtype   = FT_method;
+                  i->arguments   = $4;
+              }
+              $$ = i;
           }
   ;
 
@@ -392,8 +396,8 @@
 
 argument: datatype SYMBOL dt_on   { $$ = alloc_odl_argument();
                                     $$->name = $2;
-                                   $$->datatype = $1->dt;
-                                 }
+                                    $$->datatype = $1->dt;
+                                  }
   ;
 
 argument_list: argument                    { $$ = g_list_append(NULL,$1); }
@@ -421,122 +425,122 @@
 
 lookup_data_source: list_data_source '.' qualified_name {
                $$ = $1;
-              $$->field = $3;
+               $$->field = $3;
            }
   ;
 
 reference_data_source:  qualified_name '(' source_field_list ')'  {
           _odl_datasource *d = alloc_odl_datasource();
-         if( d )
-         {
-             d->classname = $1;
-             d->fields = $3;
-             d->field = NULL;
-         }
-         else yyerror( "Out of memory." );
-         $$ = d;
+          if( d )
+          {
+              d->classname = $1;
+              d->fields = $3;
+              d->field = NULL;
+          }
+          else yyerror( "Out of memory." );
+          $$ = d;
       }
   ;
 
 list_data_source:  qualified_name '(' source_field_list ')'   {
           _odl_datasource *d = alloc_odl_datasource();
-         if( d )
-         {
-             d->classname = $1;
-             d->fields = $3;
-             d->field = NULL;
-         }
-         else yyerror( "Out of memory." );
-         $$ = d;
+          if( d )
+          {
+              d->classname = $1;
+              d->fields = $3;
+              d->field = NULL;
+          }
+          else yyerror( "Out of memory." );
+          $$ = d;
       }
   ;
 
 lookup: new_field_name ':' lookup_data_source '=' search_fields  {
             odl_item *i = alloc_odl_item();
-           if( i )
-           {
-               i->base.parent   = (odl_base *)yycurrent_container;
+            if( i )
+            {
+                i->base.parent   = (odl_base *)yycurrent_container;
                 i->base.type     = IT_field;
-               i->base.name     = $1;
+                i->base.name     = $1;
                 i->base.access   = current_access;
                 i->fieldtype     = FT_lookup;
                 i->source_fields = $3->fields;
                 i->this_fields   = $5;
                 i->sourceclass   = $3->classname;
-               i->sourcefield   = $3->field;
+                i->sourcefield   = $3->field;
 
-               $3->classname = NULL;
-               $3->fields = NULL;
-               $3->field  = NULL;
-               free_odl_datasource($3);
+                $3->classname = NULL;
+                $3->fields = NULL;
+                $3->field  = NULL;
+                free_odl_datasource($3);
 
                 $$ = i;
             }
-           else {
-               yyerror("Out of memory");
+            else {
+                yyerror("Out of memory");
                 $$ = NULL;
-           }
-       }
+            }
+        }
   ;
 
 list: new_field_name ':' list_data_source '=' search_fields   {
             odl_item *i = NULL;
-           
-           if( current_pass == 1 ) i = alloc_odl_item();
-           if( i )
-           {
-               i->base.parent   = (odl_base *)yycurrent_container;
+            
+            if( current_pass == 1 ) i = alloc_odl_item();
+            if( i )
+            {
+                i->base.parent   = (odl_base *)yycurrent_container;
                 i->base.type     = IT_field;
-               i->base.name     = $1;
+                i->base.name     = $1;
                 i->base.access   = current_access;
                 i->fieldtype     = FT_list;
                 i->source_fields = $3->fields;
                 i->this_fields   = $5;
                 i->sourceclass   = $3->classname;
-               i->datatype      = DT_class;
-               i->datatypeclass = g_strdup( i->sourceclass );
+                i->datatype      = DT_class;
+                i->datatypeclass = g_strdup( i->sourceclass );
 
-               $3->classname = NULL;
-               $3->fields = NULL;
-               free_odl_datasource($3);
+                $3->classname = NULL;
+                $3->fields = NULL;
+                free_odl_datasource($3);
 
                 $$ = i;
             }
-           else if( current_pass == 1 ) {
-               yyerror("Out of memory");
+            else if( current_pass == 1 ) {
+                yyerror("Out of memory");
                 $$ = NULL;
-           }
-       }
+            }
+        }
   ;
 
 reference: new_field_name ':' reference_data_source '=' search_fields   {
             odl_item *i = NULL;
-           
-           if( current_pass == 1 ) i = alloc_odl_item();
-           if( i )
-           {
-               i->base.parent   = (odl_base *)yycurrent_container;
+            
+            if( current_pass == 1 ) i = alloc_odl_item();
+            if( i )
+            {
+                i->base.parent   = (odl_base *)yycurrent_container;
                 i->base.type     = IT_field;
-               i->base.name     = $1;
+                i->base.name     = $1;
                 i->base.access   = current_access;
                 i->fieldtype     = FT_reference;
                 i->source_fields = $3->fields;
                 i->this_fields   = $5;
                 i->sourceclass   = $3->classname;
-               i->datatype      = DT_class;
-               i->datatypeclass = g_strdup( i->sourceclass );
+                i->datatype      = DT_class;
+                i->datatypeclass = g_strdup( i->sourceclass );
 
-               $3->classname = NULL;
-               $3->fields = NULL;
-               free_odl_datasource($3);
+                $3->classname = NULL;
+                $3->fields = NULL;
+                free_odl_datasource($3);
 
                 $$ = i;
             }
-           else if( current_pass == 1 ) {
-               yyerror("Out of memory");
+            else if( current_pass == 1 ) {
+                yyerror("Out of memory");
                 $$ = NULL;
-           }
-       }
+            }
+        }
   ;
 
 calculated: /* */
@@ -567,5 +571,5 @@
 
 orderby: SYMBOL    { if( yycurrent_container->orderby )
                          g_free( yycurrent_container->orderby );
-                    yycurrent_container->orderby = $1;
-                  }
+                     yycurrent_container->orderby = $1;
+                   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]