summaryrefslogtreecommitdiffstats
path: root/sbin/devd/parse.y
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2002-12-07 08:04:36 +0000
committerimp <imp@FreeBSD.org>2002-12-07 08:04:36 +0000
commita536ab821b9ea241e31d101e54da3e7d33e9211b (patch)
tree9e4f2dc42ade56bf73aaf3d7752d018a5c1abda8 /sbin/devd/parse.y
parent4af7578bb83cb753b88567e1d0866203e4583db5 (diff)
downloadFreeBSD-src-a536ab821b9ea241e31d101e54da3e7d33e9211b.zip
FreeBSD-src-a536ab821b9ea241e31d101e54da3e7d33e9211b.tar.gz
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)
Diffstat (limited to 'sbin/devd/parse.y')
-rw-r--r--sbin/devd/parse.y43
1 files changed, 21 insertions, 22 deletions
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 <stdio.h>
+#include <string.h>
%}
%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 <str> id
-%type <i> number
-%type <str> string
+%type <eventproc> match_or_action_list
+%type <eps> 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; }
-
%%
OpenPOWER on IntegriCloud