1123475Swpaul%{
2123475Swpaul/*
3124060Swpaul * Copyright (c) 2003
4124060Swpaul *	Bill Paul <wpaul@windriver.com>.  All rights reserved.
5124060Swpaul *
6124060Swpaul * Redistribution and use in source and binary forms, with or without
7124060Swpaul * modification, are permitted provided that the following conditions
8124060Swpaul * are met:
9124060Swpaul * 1. Redistributions of source code must retain the above copyright
10124060Swpaul *    notice, this list of conditions and the following disclaimer.
11124060Swpaul * 2. Redistributions in binary form must reproduce the above copyright
12124060Swpaul *    notice, this list of conditions and the following disclaimer in the
13124060Swpaul *    documentation and/or other materials provided with the distribution.
14124060Swpaul * 3. All advertising materials mentioning features or use of this software
15124060Swpaul *    must display the following acknowledgement:
16124060Swpaul *	This product includes software developed by Bill Paul.
17124060Swpaul * 4. Neither the name of the author nor the names of any co-contributors
18124060Swpaul *    may be used to endorse or promote products derived from this software
19124060Swpaul *    without specific prior written permission.
20124060Swpaul *
21124060Swpaul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
22124060Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23124060Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24124060Swpaul * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
25124060Swpaul * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26124060Swpaul * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27124060Swpaul * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28124060Swpaul * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29124060Swpaul * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30124060Swpaul * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31124060Swpaul * THE POSSIBILITY OF SUCH DAMAGE.
32123475Swpaul */
33123475Swpaul
34123475Swpaul#include <sys/cdefs.h>
35123475Swpaul__FBSDID("$FreeBSD: releng/11.0/usr.sbin/ndiscvt/inf-parse.y 243906 2012-12-05 20:28:44Z bapt $");
36123475Swpaul
37123475Swpaul#include <stdio.h>
38123475Swpaul#include <sys/types.h>
39123475Swpaul#include <sys/queue.h>
40123475Swpaul
41123475Swpaul#include "inf.h"
42123475Swpaul
43123475Swpaulextern int yylex (void);
44123475Swpaulextern void yyerror(const char *);
45123475Swpaul%}
46123475Swpaul
47123475Swpaul%token	EQUALS COMMA EOL
48123475Swpaul%token	<str> SECTION
49123475Swpaul%token	<str> STRING
50123475Swpaul%token	<str> WORD
51123475Swpaul
52123475Swpaul%union {
53123475Swpaul	char *str;
54123475Swpaul}
55123475Swpaul
56123475Swpaul%%
57123475Swpaul
58123475Swpaulinf_file
59123475Swpaul	: inf_list
60123475Swpaul	|
61123475Swpaul	;
62123475Swpaul
63123475Swpaulinf_list
64123475Swpaul	: inf
65123475Swpaul	| inf_list inf
66123475Swpaul	;
67123475Swpaul
68123475Swpaulinf
69123475Swpaul	: SECTION EOL
70123475Swpaul		{ section_add($1); }
71123475Swpaul	| WORD EQUALS assign EOL
72123475Swpaul		{ assign_add($1); }
73123475Swpaul	| WORD COMMA regkey EOL
74123475Swpaul		{ regkey_add($1); }
75123475Swpaul	| WORD EOL
76123475Swpaul		{ define_add($1); }
77123475Swpaul	| EOL
78123475Swpaul	;
79123475Swpaul
80123475Swpaulassign
81123475Swpaul	: WORD
82123475Swpaul		{ push_word($1); }
83123475Swpaul	| STRING
84123475Swpaul		{ push_word($1); }
85123475Swpaul	| WORD COMMA assign
86123475Swpaul		{ push_word($1); }
87123475Swpaul	| STRING COMMA assign
88123475Swpaul		{ push_word($1); }
89123475Swpaul	| COMMA assign
90123475Swpaul		{ push_word(NULL); }
91123475Swpaul	| COMMA
92123475Swpaul		{ push_word(NULL); }
93123475Swpaul	|
94123475Swpaul	;
95123475Swpaul
96123475Swpaulregkey
97123475Swpaul	: WORD
98123475Swpaul		{ push_word($1); }
99123475Swpaul	| STRING
100123475Swpaul		{ push_word($1); }
101123475Swpaul	| WORD COMMA regkey
102123475Swpaul		{ push_word($1); }
103123475Swpaul	| STRING COMMA regkey
104123475Swpaul		{ push_word($1); }
105123475Swpaul	| COMMA regkey
106123475Swpaul		{ push_word(NULL); }
107123475Swpaul	| COMMA
108123475Swpaul		{ push_word(NULL); }
109123475Swpaul	;
110123475Swpaul%%
111