aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ndiscvt/inf-parse.y
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>2003-12-11 22:38:14 +0000
committerBill Paul <wpaul@FreeBSD.org>2003-12-11 22:38:14 +0000
commitd934c8b0dee15ae80a86115f468a1d52e07dd228 (patch)
tree7c2d5abaacdb24db0fe7ad5dd49024bfe7023096 /usr.sbin/ndiscvt/inf-parse.y
parentc854fc10923e591ed41cc3f76d240aebdbb3f396 (diff)
downloadsrc-d934c8b0dee15ae80a86115f468a1d52e07dd228.tar.gz
src-d934c8b0dee15ae80a86115f468a1d52e07dd228.zip
Commit the ndiscvt(8) utility too. (Missed it in the last import.)
Notes
Notes: svn path=/head/; revision=123475
Diffstat (limited to 'usr.sbin/ndiscvt/inf-parse.y')
-rw-r--r--usr.sbin/ndiscvt/inf-parse.y83
1 files changed, 83 insertions, 0 deletions
diff --git a/usr.sbin/ndiscvt/inf-parse.y b/usr.sbin/ndiscvt/inf-parse.y
new file mode 100644
index 000000000000..05be1264639c
--- /dev/null
+++ b/usr.sbin/ndiscvt/inf-parse.y
@@ -0,0 +1,83 @@
+%{
+/*
+ * $Id: inf-parse.y,v 1.3 2003/11/30 21:58:16 winter Exp $
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/queue.h>
+
+#include "inf.h"
+
+extern int yyparse (void);
+extern int yylex (void);
+extern void yyerror(const char *);
+%}
+
+%token EQUALS COMMA EOL
+%token <str> SECTION
+%token <str> STRING
+%token <str> WORD
+
+%union {
+ char *str;
+}
+
+%%
+
+inf_file
+ : inf_list
+ |
+ ;
+
+inf_list
+ : inf
+ | inf_list inf
+ ;
+
+inf
+ : SECTION EOL
+ { section_add($1); }
+ | WORD EQUALS assign EOL
+ { assign_add($1); }
+ | WORD COMMA regkey EOL
+ { regkey_add($1); }
+ | WORD EOL
+ { define_add($1); }
+ | EOL
+ ;
+
+assign
+ : WORD
+ { push_word($1); }
+ | STRING
+ { push_word($1); }
+ | WORD COMMA assign
+ { push_word($1); }
+ | STRING COMMA assign
+ { push_word($1); }
+ | COMMA assign
+ { push_word(NULL); }
+ | COMMA
+ { push_word(NULL); }
+ |
+ ;
+
+regkey
+ : WORD
+ { push_word($1); }
+ | STRING
+ { push_word($1); }
+ | WORD COMMA regkey
+ { push_word($1); }
+ | STRING COMMA regkey
+ { push_word($1); }
+ | COMMA regkey
+ { push_word(NULL); }
+ | COMMA
+ { push_word(NULL); }
+ ;
+%%