/* Genotype Treatment (1996) */ /* */ /* Author : Marie Aimar */ /* File : parser_gen.y */ %{ #include #include #include "generic.h" #include "list.h" #include "family.h" #include "file.h" #include "parser_gen.h" #include "list.h" static int no_error_line=1; jmp_buf ENVIRONMENT_BUFFER ; char *name; t_genlist list; %} %union { char *t_nom; float t_float; t_genlist t_glist; } %start set_of_element %token IDENT %token RATIONAL %token FAMILY %token END_LINE %type ident_family %type identification %type gen %type list_gen %% set_of_element : /* empty */ | set_of_element element | error {yyerrok;} ; element : ident_family identification list_gen END_LINE {no_error_line++; add_info($2,$3);} ; ident_family : IDENT { name = (char *)malloc(1+strlen($1)); strcpy(name,$1); if (cmp_name(name,current_family)) change_family(name); } ; list_gen : /*empty*/{list = create_genlist(); }; | list_gen gen { add_in_list(list,$2); $$=list;} ; identification : IDENT { name = (char *)malloc(1+strlen($1)); strcpy(name,$1); $$=name; } ; gen : IDENT { name = (char *)malloc(1+strlen($1)); strcpy(name,$1); $$=name; } ; %% #include "lex.gen.c" int yyerror(char *s) { printf("%s dans la description du Genotype a la ligne %d \n Verifier le format du fichier \n ",s,no_error_line);exit (3); } void read_file_gen (FILE *fic_input) { yyin=fic_input; if (setjmp(ENVIRONMENT_BUFFER)==0) { yyparse(); printf("\n fin de lecture du fichier de description du Genotype \n"); } else { fclose(fic_input); } }