Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : proto

Dir     : e17/proto/edje_cc


Modified Files:
        edje.y main.c 


Log Message:
- add in getopt to allow for -y handing to turn on yydebug
- broken item parsing

===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/edje.y,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- edje.y      7 Sep 2004 23:46:43 -0000       1.2
+++ edje.y      7 Sep 2004 23:54:32 -0000       1.3
@@ -50,8 +50,18 @@
        ;
 images:  IMAGES OPEN_BRACE statement CLOSE_BRACE
        ;
-data:  DATA OPEN_BRACE statement CLOSE_BRACE 
+data:  DATA OPEN_BRACE data_statement CLOSE_BRACE 
        ;
+
+data_statement: item 
+       | item data_statement
+       ;
+
+item: ITEM ':' '"' STRING '"' '"' STRING '"' ';' {
+               printf("got item %s :: %s\n", $4, $7);
+       }
+       ;
+
 statement: STRING 
        |
        ;
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/main.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- main.c      7 Sep 2004 23:29:00 -0000       1.1
+++ main.c      7 Sep 2004 23:54:32 -0000       1.2
@@ -1,12 +1,38 @@
 #include <stdio.h>
+#include <getopt.h>
 
 int main(int argc, char ** argv)
 {
+       int c;
+       char *file = NULL;
        extern FILE *yyin;
        extern int yydebug;
 
+       static struct option long_opts[] = {
+               {"yydebug", no_argument, NULL, 'y'},
+               {0, 0, 0, 0}
+       };
+
        yydebug = 0;
-       yyin = fopen(argv[1], "r");
+       while((c = getopt_long(argc, argv, "y", long_opts, NULL)) != -1) {
+               switch(c) {
+                       case 'y':
+                               yydebug = 1;
+                               break;
+
+                       default:
+                               printf("Unknown option\n");
+                               break;
+               }
+       }
+
+       if (argv[optind] == NULL) {
+               printf("need input file\n");
+               return 1;
+       }
+       file = (char *)strdup(argv[optind]);
+
+       yyin = fopen(file, "r");
        yyparse();
        fclose(yyin);
 




-------------------------------------------------------
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