kernel - Bring in dff23c692 from FreeBSD
[dragonfly.git] / usr.sbin / ndiscvt / inf-parse.y
blob250799021500a6c938f1685e57877aed845bb713
1 %{
2 /*
3 * Copyright (c) 2003
4 * Bill Paul <wpaul@windriver.com>. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Bill Paul.
17 * 4. Neither the name of the author nor the names of any co-contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
33 * $FreeBSD: src/usr.sbin/ndiscvt/inf-parse.y,v 1.2 2004/01/02 04:31:06 wpaul Exp $
36 #include <stdio.h>
37 #include <sys/types.h>
38 #include <sys/queue.h>
40 #include "inf.h"
42 extern int yylex (void);
43 extern void yyerror(const char *);
46 %token EQUALS COMMA EOL
47 %token <str> SECTION
48 %token <str> STRING
49 %token <str> WORD
51 %union {
52 char *str;
57 inf_file
58 : inf_list
62 inf_list
63 : inf
64 | inf_list inf
67 inf
68 : SECTION EOL
69 { section_add($1); }
70 | WORD EQUALS assign EOL
71 { assign_add($1); }
72 | WORD COMMA regkey EOL
73 { regkey_add($1); }
74 | WORD EOL
75 { define_add($1); }
76 | EOL
79 assign
80 : WORD
81 { push_word($1); }
82 | STRING
83 { push_word($1); }
84 | WORD COMMA assign
85 { push_word($1); }
86 | STRING COMMA assign
87 { push_word($1); }
88 | COMMA assign
89 { push_word(NULL); }
90 | COMMA
91 { push_word(NULL); }
95 regkey
96 : WORD
97 { push_word($1); }
98 | STRING
99 { push_word($1); }
100 | WORD COMMA regkey
101 { push_word($1); }
102 | STRING COMMA regkey
103 { push_word($1); }
104 | COMMA regkey
105 { push_word(NULL); }
106 | COMMA
107 { push_word(NULL); }