Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : proto

Dir     : e17/proto/edje_cc


Modified Files:
        Etcher.h edje.l edje.y etcher_parse.c main.c 


Log Message:

ignore "script" in comments
allow empty braces (parts{})

===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/Etcher.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- Etcher.h    8 Sep 2004 21:49:18 -0000       1.7
+++ Etcher.h    8 Sep 2004 22:37:22 -0000       1.8
@@ -118,6 +118,8 @@
   Evas_List *parts;
   Evas_List *programs;
   Evas_List *data;
+
+  char *script;
 };
 
 struct _Etcher_Part
@@ -155,7 +157,8 @@
   
   Etcher_Action action;
   Etcher_Transition transition;
-  
+ 
+  char *script;
 };
 
 struct _Etcher_Part_State
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/edje.l,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- edje.l      8 Sep 2004 21:49:18 -0000       1.20
+++ edje.l      8 Sep 2004 22:37:22 -0000       1.21
@@ -17,7 +17,7 @@
                             if (comment <= 0) { comment = 0; BEGIN(INITIAL); }
     #define CPP_COMMENT()   comment = 1; cpp_comment = 1;
 
-    #define SCRIPT_START()  BEGIN(SC_SCRIPT); 
+    #define SCRIPT_START()  if (!comment && !cpp_comment) BEGIN(SC_SCRIPT);
 
     #define SCRIPT_END()    BEGIN(INITIAL); \
                                if (script) { \
@@ -43,7 +43,7 @@
     #define SCRIPT_OPEN_BRACE() script_level++; \
                                 if (script_level > 1) SCRIPT_PIECE();
 
-    #define SCRIPT_CLOSE_BRACE() script_level--;\
+    #define SCRIPT_CLOSE_BRACE() script_level--; \
                                  if (script_level > 0) { SCRIPT_PIECE();}\
                                  else {script_level = 0; SCRIPT_END();}\
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/edje.y,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- edje.y      8 Sep 2004 21:49:18 -0000       1.20
+++ edje.y      8 Sep 2004 22:37:22 -0000       1.21
@@ -70,7 +70,8 @@
 fonts:  FONTS { section = FONTS; } OPEN_BRACE font_statement CLOSE_BRACE { section = 
BASE; }
        ;
 
-font_statement: font
+font_statement: /* empty */
+        | font
        | font font_statement
        ;
 
@@ -83,7 +84,8 @@
 images:  IMAGES { section = IMAGES; } OPEN_BRACE image_statement CLOSE_BRACE { 
section = BASE; }
        ;
 
-image_statement: image
+image_statement: /* empty */
+        | image
        | image image_statement
        ;
 
@@ -105,10 +107,10 @@
 
 /* don't set a section here yet (since BASE and GROUP have data sects) */
 data:  DATA OPEN_BRACE data_statement CLOSE_BRACE
-        | DATA OPEN_BRACE CLOSE_BRACE
        ;
 
-data_statement: item 
+data_statement: /* empty */
+        | item 
        | item data_statement
        ;
 
@@ -131,7 +133,8 @@
 programs: PROGRAMS { section = PROGRAMS; } OPEN_BRACE program_statement CLOSE_BRACE { 
section = BASE; }
        ;
 
-program_statement: program
+program_statement: /* empty */
+        | program
        | program program_statement
        ;
 
@@ -237,7 +240,8 @@
        }
        ;
 
-collection_statement: group
+collection_statement: /* empty */
+        | group
        | group collection_statement
        ;
 
@@ -256,7 +260,20 @@
        ;
 
 script: SCRIPT {
+                switch (section)
+                {
+                  case GROUP:
+                    etcher_parse_group_script(yylval.string);
+                    break;
+                  case PROGRAM:
+                    etcher_parse_program_script(yylval.string);
+                    break;
+                  default:
+                    break;
+                }
                printf("script\n--%s\n--\n", yylval.string);
+                free(yylval.string);
+                yylval.string = NULL;
        }
        ;
 
@@ -307,7 +324,8 @@
 parts: PARTS { section = PARTS; } OPEN_BRACE parts_statement CLOSE_BRACE { section = 
BASE; }
        ;
 
-parts_statement: part
+parts_statement: /* empty */
+        | part
        | part parts_statement
        ;
 
@@ -400,7 +418,8 @@
 dragable: DRAGABLE { section = DRAGABLE; } OPEN_BRACE dragable_statement CLOSE_BRACE 
{ section = PART; }
        ;
 
-dragable_statement: dragable_body
+dragable_statement: /* empty */
+        | dragable_body
        | dragable_body dragable_statement
        ;
 
@@ -515,7 +534,8 @@
 rel2: REL2 {section = REL2;} OPEN_BRACE rel_statement CLOSE_BRACE {section = STATE;}
        ;
 
-rel_statement: rel_body
+rel_statement: /* empty */ 
+        | rel_body
        | rel_body rel_statement
        ;
 
@@ -623,7 +643,8 @@
 image: IMAGE { section = IMAGE; } OPEN_BRACE image_statement CLOSE_BRACE { section = 
STATE; }
        ;
 
-image_statement: image_body
+image_statement: /* empty */ 
+        | image_body
        | image_body image_statement
        ;
 
@@ -652,7 +673,8 @@
 fill: FILL OPEN_BRACE { section = FILL; } fill_statement CLOSE_BRACE { section = 
STATE; }
        ;
 
-fill_statement: fill_body
+fill_statement: /* empty */
+        | fill_body
        | fill_body fill_statement
        ;
 
@@ -670,7 +692,8 @@
 origin: ORIGIN { section = ORIGIN; } OPEN_BRACE origin_statement CLOSE_BRACE { 
section = FILL; }
        ;
 
-origin_statement: origin_body
+origin_statement: /* empty */
+        | origin_body
        | origin_statement origin_body
        ;
 
@@ -708,7 +731,8 @@
 text: TEXT { section = TEXT; } OPEN_BRACE text_statement CLOSE_BRACE { section = 
STATE; }
        ;
 
-text_statement: text_body
+text_statement: /* empty */
+        | text_body
        | text_body text_statement
        ;
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/etcher_parse.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- etcher_parse.c      8 Sep 2004 21:49:18 -0000       1.2
+++ etcher_parse.c      8 Sep 2004 22:37:22 -0000       1.3
@@ -54,7 +54,6 @@
 {
   Etcher_Group *group;
   group = (Etcher_Group *)calloc(1, sizeof(Etcher_Group));
-
   etcher_file->groups = evas_list_append(etcher_file->groups, group);
   return;
 }
@@ -65,6 +64,8 @@
   Etcher_Group *group;
   Etcher_Data *data;
 
+  group = evas_list_data(evas_list_last(etcher_file->groups));
+
   data = (Etcher_Data *)calloc(1, sizeof(Etcher_Data));
   data->key = (char *)strdup(key);
   data->value = (char *)strdup(value);
@@ -73,7 +74,18 @@
 
   group = evas_list_data(evas_list_last(etcher_file->groups));
 
-  group->data = evas_list_append(group->data, data);;
+  group->data = evas_list_append(group->data, data);
+}
+
+void
+etcher_parse_group_script(char *script)
+{
+  Etcher_Group *group;
+
+  group = evas_list_data(evas_list_last(etcher_file->groups));
+  
+  if (group->script) free(group->script);
+  group->script = (char *)strdup(script); 
 }
 
 void
@@ -855,6 +867,18 @@
   group->programs = evas_list_append(group->programs, program);
 }
 
+void
+etcher_parse_program_script(char *script)
+{
+  Etcher_Group *group;
+  Etcher_Program *program;
+
+  group = evas_list_data(evas_list_last(etcher_file->groups));
+  program = evas_list_data(evas_list_last(group->programs));
+
+  if(program->script) free(program->script);
+  program->script = (char *)strdup(script);
+}
 
 void
 etcher_parse_program_name(char *name)
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/main.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- main.c      8 Sep 2004 21:49:18 -0000       1.4
+++ main.c      8 Sep 2004 22:37:22 -0000       1.5
@@ -44,15 +44,40 @@
         /* FIXME: make this a complete test suite */
         {
           Evas_List *l;
+
+          printf("-------------------------------------\n");
+
+          printf("Done parsing, print out data keys:\n");
           l = etcher_file->data;
           while (l)
           {
             Etcher_Data *d = l->data;
-            printf("-------------------------------------\n");
-            printf("Done parsing, print out data keys:\n");
             printf("key: %s, value: %s\n", d->key, d->value);
             l = l->next;
           }
+          
+          printf("Groups:\n");
+
+          l = etcher_file->groups;
+          while (l)
+          {
+            Etcher_Group *g = l->data;
+            Evas_List *ll;
+
+            printf("  name: %s\n", g->name);
+
+            printf("  group data:\n";);
+            ll = g->data;
+            while(ll)
+            {
+              Etcher_Data *d = ll->data;
+              printf("    key: %s, value: %s\n", d->key, d->value);
+              ll = ll->next;
+            }
+            if (g->script)
+              printf("  script:\n-----\n%s\n-----\n", g->script);
+            l = l->next;
+          }
         }
        return 0;
 }




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to