/* $Id: mod_tbl.y,v 1.2 2004/03/25 23:08:18 jmuelmen Exp $ */ %{ #include #include #include #include "mod_tbl.h" extern char *mod_yytext; int mod_yylex (); void mod_yyerror (const char *s); %} %token MODULE BOARD CHANNEL NEWLINE %start declaration_list %% module : MODULE { $$ = (unsigned long)mod_tbl_add(mod_yytext); } ; board : BOARD { $$ = (unsigned long)strncpy(board_name, mod_yytext, BOARD_NAME_LEN); board_name[BOARD_NAME_LEN - 1] = 0; } ; channel : CHANNEL { $$ = atoi(mod_yytext); } ; declaration : board channel module NEWLINE { struct mod_tbl_ent *mod = (struct mod_tbl_ent *)$3; mod_tbl_set_board(mod, board_name); mod_tbl_set_chan(mod, $2); } | NEWLINE ; declaration_list : /* empty */ | declaration declaration_list ; %% void mod_yyerror (const char *s) { printf("%s\n", s); }