1255570Strasz%{
2255570Strasz/*-
3330449Seadler * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4330449Seadler *
5255570Strasz * Copyright (c) 2012 The FreeBSD Foundation
6255570Strasz * All rights reserved.
7255570Strasz *
8255570Strasz * This software was developed by Edward Tomasz Napierala under sponsorship
9255570Strasz * from the FreeBSD Foundation.
10255570Strasz *
11255570Strasz * Redistribution and use in source and binary forms, with or without
12255570Strasz * modification, are permitted provided that the following conditions
13255570Strasz * are met:
14255570Strasz * 1. Redistributions of source code must retain the above copyright
15255570Strasz *    notice, this list of conditions and the following disclaimer.
16255570Strasz * 2. Redistributions in binary form must reproduce the above copyright
17255570Strasz *    notice, this list of conditions and the following disclaimer in the
18255570Strasz *    documentation and/or other materials provided with the distribution.
19255570Strasz *
20255570Strasz * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21255570Strasz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22255570Strasz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23255570Strasz * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24255570Strasz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25255570Strasz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26255570Strasz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27255570Strasz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28255570Strasz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29255570Strasz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30255570Strasz * SUCH DAMAGE.
31255570Strasz *
32255570Strasz * $FreeBSD: stable/11/usr.sbin/ctld/token.l 352280 2019-09-13 07:21:06Z bapt $
33255570Strasz */
34255570Strasz
35255570Strasz#include <stdio.h>
36255570Strasz#include <stdint.h>
37255570Strasz#include <string.h>
38255570Strasz
39255570Strasz#include "y.tab.h"
40255570Strasz
41255570Straszint lineno;
42255570Strasz
43255570Strasz#define	YY_DECL int yylex(void)
44255570Straszextern int	yylex(void);
45255570Strasz
46255570Strasz%}
47255570Strasz
48352280Sbapt%option noyywrap
49255570Strasz%option noinput
50255570Strasz%option nounput
51255570Strasz
52255570Strasz%%
53255570Straszalias			{ return ALIAS; }
54255570Straszauth-group		{ return AUTH_GROUP; }
55261758Straszauth-type		{ return AUTH_TYPE; }
56255570Straszbackend			{ return BACKEND; }
57255570Straszblocksize		{ return BLOCKSIZE; }
58255570Straszchap			{ return CHAP; }
59255570Straszchap-mutual		{ return CHAP_MUTUAL; }
60287823Smavctl-lun			{ return CTL_LUN; }
61255570Straszdebug			{ return DEBUG; }
62255570Straszdevice-id		{ return DEVICE_ID; }
63288310Smavdevice-type		{ return DEVICE_TYPE; }
64255570Straszdiscovery-auth-group	{ return DISCOVERY_AUTH_GROUP; }
65273813Straszdiscovery-filter	{ return DISCOVERY_FILTER; }
66287534Smavforeign			{ return FOREIGN; }
67261754Straszinitiator-name		{ return INITIATOR_NAME; }
68261754Straszinitiator-portal	{ return INITIATOR_PORTAL; }
69255570Straszlisten			{ return LISTEN; }
70255570Straszlisten-iser		{ return LISTEN_ISER; }
71255570Straszlun			{ return LUN; }
72255570Straszmaxproc			{ return MAXPROC; }
73278331Straszoffload			{ return OFFLOAD; }
74255570Straszoption			{ return OPTION; }
75255570Straszpath			{ return PATH; }
76255570Straszpidfile			{ return PIDFILE; }
77273635Smavisns-server		{ return ISNS_SERVER; }
78273635Smavisns-period		{ return ISNS_PERIOD; }
79273635Smavisns-timeout		{ return ISNS_TIMEOUT; }
80278354Smavport			{ return PORT; }
81255570Straszportal-group		{ return PORTAL_GROUP; }
82274308Straszredirect		{ return REDIRECT; }
83255570Straszserial			{ return SERIAL; }
84255570Straszsize			{ return SIZE; }
85287534Smavtag			{ return TAG; }
86255570Strasztarget			{ return TARGET; }
87255570Strasztimeout			{ return TIMEOUT; }
88255570Strasz\"[^"]+\"		{ yylval.str = strndup(yytext + 1,
89255570Strasz			    strlen(yytext) - 2); return STR; }
90284542Strasz[a-zA-Z0-9\.\-@_/\:\[\]]+ { yylval.str = strdup(yytext); return STR; }
91255570Strasz\{			{ return OPENING_BRACKET; }
92255570Strasz\}			{ return CLOSING_BRACKET; }
93255570Strasz#.*$			/* ignore comments */;
94273822Strasz\r\n			{ lineno++; }
95255570Strasz\n			{ lineno++; }
96273820Strasz;			{ return SEMICOLON; }
97255570Strasz[ \t]+			/* ignore whitespace */;
98261766Strasz.			{ yylval.str = strdup(yytext); return STR; }
99255570Strasz%%
100