home *** CD-ROM | disk | FTP | other *** search
Lex Description | 1988-01-31 | 1.5 KB | 90 lines |
- %{
- static char rcsid[] = "$Header: parser.y,v 1.2 85/04/05 17:15:02 scooter Exp $";
-
- #include "backup.h"
-
- %}
-
- %start pgm
-
- %token COMMENT DAY STRING NUM FILESYS STAR DASH NEWLINE MONTH COMMA
-
- %%
-
- pgm : COMMENT NEWLINE
- { ignore = YES; YYACCEPT; }
- | day_spec week_spec month_spec level filesys end_spec NEWLINE
- { ignore = NO; YYACCEPT; }
- | error '\n'
- { yyerrok; }
- ;
-
- level: NUM
- { level = $1; }
- ;
-
- filesys: FILESYS
- { strcpy(filesys,yytext); }
- ;
-
- day_spec: STAR
- { days = ALL; }
- | day_list
- { days = LIST; }
- | DAY DASH DAY
- { days = RANGE; day_lst[0] = $1;
- day_lst[1] = $3; day_ptr = 2;}
- ;
-
- day_list: DAY
- { day_ptr = 0; day_lst[day_ptr++] = $1; }
- | day_list COMMA DAY
- { day_lst[day_ptr++] = $3; }
- ;
-
- week_spec:STAR
- { weeks = ALL; }
- | num_list
- { weeks = LIST; }
- | NUM DASH NUM
- { weeks = RANGE; week_lst[0] = $1;
- week_lst[1] = $3; week_ptr = 2;}
- ;
-
- num_list: NUM
- { week_ptr = 0; week_lst[week_ptr++] = $1; }
- | num_list COMMA NUM
- { week_lst[week_ptr++] = $3; }
- ;
-
- month_spec: STAR
- { months = ALL; }
- | month_list
- { months = LIST; }
- | MONTH DASH MONTH
- { months = RANGE; month_lst[0] = $1;
- month_lst[1] = $3; month_ptr = 2;}
- ;
-
- month_list: MONTH
- { month_ptr = 0; month_lst[month_ptr++] = $1; }
- | month_list COMMA MONTH
- { month_lst[month_ptr++] = $3; }
- ;
-
- end_spec: /* empty */
- | STRING
- | STRING COMMENT
- | COMMENT
- ;
-
- %%
-
- #include "lex.yy.c"
-
- yyerror(s)
- char *s;
- {
- fprintf(stderr,"%s:line = %d, char = %d\n",s,line_count,lineptr);
- }
-