From a536ab821b9ea241e31d101e54da3e7d33e9211b Mon Sep 17 00:00:00 2001 From: imp Date: Sat, 7 Dec 2002 08:04:36 +0000 Subject: MFp4 (imp_freebsd branch): snapshot of devd work: o improve parsing and lexing o create data structures based on the parsed file now. o Still need to rewrite main loop and add regex (still uses hard coded devd-generic) o minor man page updates. # There should be one more commit before rc2 Approved by: re (blanket) --- sbin/devd/parse.y | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'sbin/devd/parse.y') diff --git a/sbin/devd/parse.y b/sbin/devd/parse.y index 53c9a05..4a8f4dd 100644 --- a/sbin/devd/parse.y +++ b/sbin/devd/parse.y @@ -31,12 +31,15 @@ #include "devd.h" #include +#include %} %union { char *str; int i; + struct eps *eps; /* EventProcStatement */ + struct event_proc *eventproc; } %token SEMICOLON BEGINBLOCK ENDBLOCK COMMA @@ -46,14 +49,14 @@ %token OPTIONS SET DIRECTORY PID_FILE DEVICE_NAME ACTION MATCH %token ATTACH DETACH NOMATCH -%type id -%type number -%type string +%type match_or_action_list +%type match_or_action match action %% config_file : config_list + | ; config_list @@ -83,32 +86,36 @@ option ; directory_option - : DIRECTORY string SEMICOLON { add_directory($2); } + : DIRECTORY STRING SEMICOLON { add_directory($2); } ; pid_file_option - : PID_FILE string SEMICOLON + : PID_FILE STRING SEMICOLON { set_pidfile($2); } ; set_option - : SET id string SEMICOLON + : SET ID STRING SEMICOLON { set_variable($2, $3); } ; attach_block - : ATTACH number BEGINBLOCK match_or_action_list ENDBLOCK SEMICOLON + : ATTACH NUMBER BEGINBLOCK match_or_action_list ENDBLOCK SEMICOLON + { add_attach($2, $4); } ; detach_block - : DETACH number BEGINBLOCK match_or_action_list ENDBLOCK SEMICOLON + : DETACH NUMBER BEGINBLOCK match_or_action_list ENDBLOCK SEMICOLON + { add_detach($2, $4); } ; nomatch_block - : NOMATCH number BEGINBLOCK match_or_action_list ENDBLOCK SEMICOLON + : NOMATCH NUMBER BEGINBLOCK match_or_action_list ENDBLOCK SEMICOLON + { add_nomatch($2, $4); } ; match_or_action_list - : match_or_action + : match_or_action { $$ = add_to_event_proc( NULL, $1); } | match_or_action_list match_or_action + { $$ = add_to_event_proc($1, $2); } ; match_or_action @@ -117,21 +124,13 @@ match_or_action ; match - : MATCH string string SEMICOLON - | DEVICE_NAME string SEMICOLON + : MATCH STRING STRING SEMICOLON { $$ = new_match($2, $3); } + | DEVICE_NAME STRING SEMICOLON + { $$ = new_match(strdup("device-name"), $2); } ; action - : ACTION string SEMICOLON + : ACTION STRING SEMICOLON { $$ = new_action($2); } ; -number - : NUMBER { $$ = $1; } - -string - : STRING { $$ = $1; } - -id - : ID { $$ = $1; } - %% -- cgit v1.1