1255570Strasz%{
2255570Strasz/*-
3255570Strasz * Copyright (c) 2012 The FreeBSD Foundation
4255570Strasz * All rights reserved.
5255570Strasz *
6255570Strasz * This software was developed by Edward Tomasz Napierala under sponsorship
7255570Strasz * from the FreeBSD Foundation.
8255570Strasz *
9255570Strasz * Redistribution and use in source and binary forms, with or without
10255570Strasz * modification, are permitted provided that the following conditions
11255570Strasz * are met:
12255570Strasz * 1. Redistributions of source code must retain the above copyright
13255570Strasz *    notice, this list of conditions and the following disclaimer.
14255570Strasz * 2. Redistributions in binary form must reproduce the above copyright
15255570Strasz *    notice, this list of conditions and the following disclaimer in the
16255570Strasz *    documentation and/or other materials provided with the distribution.
17255570Strasz *
18255570Strasz * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19255570Strasz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20255570Strasz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21255570Strasz * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22255570Strasz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23255570Strasz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24255570Strasz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25255570Strasz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26255570Strasz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27255570Strasz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28255570Strasz * SUCH DAMAGE.
29255570Strasz *
30255570Strasz * $FreeBSD: releng/11.0/usr.sbin/ctld/token.l 288310 2015-09-27 13:47:28Z mav $
31255570Strasz */
32255570Strasz
33255570Strasz#include <stdio.h>
34255570Strasz#include <stdint.h>
35255570Strasz#include <string.h>
36255570Strasz
37255570Strasz#include "y.tab.h"
38255570Strasz
39255570Straszint lineno;
40255570Strasz
41255570Strasz#define	YY_DECL int yylex(void)
42255570Straszextern int	yylex(void);
43255570Strasz
44255570Strasz%}
45255570Strasz
46255570Strasz%option noinput
47255570Strasz%option nounput
48255570Strasz
49255570Strasz%%
50255570Straszalias			{ return ALIAS; }
51255570Straszauth-group		{ return AUTH_GROUP; }
52261758Straszauth-type		{ return AUTH_TYPE; }
53255570Straszbackend			{ return BACKEND; }
54255570Straszblocksize		{ return BLOCKSIZE; }
55255570Straszchap			{ return CHAP; }
56255570Straszchap-mutual		{ return CHAP_MUTUAL; }
57287823Smavctl-lun			{ return CTL_LUN; }
58255570Straszdebug			{ return DEBUG; }
59255570Straszdevice-id		{ return DEVICE_ID; }
60288310Smavdevice-type		{ return DEVICE_TYPE; }
61255570Straszdiscovery-auth-group	{ return DISCOVERY_AUTH_GROUP; }
62273813Straszdiscovery-filter	{ return DISCOVERY_FILTER; }
63287534Smavforeign			{ return FOREIGN; }
64261754Straszinitiator-name		{ return INITIATOR_NAME; }
65261754Straszinitiator-portal	{ return INITIATOR_PORTAL; }
66255570Straszlisten			{ return LISTEN; }
67255570Straszlisten-iser		{ return LISTEN_ISER; }
68255570Straszlun			{ return LUN; }
69255570Straszmaxproc			{ return MAXPROC; }
70278331Straszoffload			{ return OFFLOAD; }
71255570Straszoption			{ return OPTION; }
72255570Straszpath			{ return PATH; }
73255570Straszpidfile			{ return PIDFILE; }
74273635Smavisns-server		{ return ISNS_SERVER; }
75273635Smavisns-period		{ return ISNS_PERIOD; }
76273635Smavisns-timeout		{ return ISNS_TIMEOUT; }
77278354Smavport			{ return PORT; }
78255570Straszportal-group		{ return PORTAL_GROUP; }
79274308Straszredirect		{ return REDIRECT; }
80255570Straszserial			{ return SERIAL; }
81255570Straszsize			{ return SIZE; }
82287534Smavtag			{ return TAG; }
83255570Strasztarget			{ return TARGET; }
84255570Strasztimeout			{ return TIMEOUT; }
85255570Strasz\"[^"]+\"		{ yylval.str = strndup(yytext + 1,
86255570Strasz			    strlen(yytext) - 2); return STR; }
87284542Strasz[a-zA-Z0-9\.\-@_/\:\[\]]+ { yylval.str = strdup(yytext); return STR; }
88255570Strasz\{			{ return OPENING_BRACKET; }
89255570Strasz\}			{ return CLOSING_BRACKET; }
90255570Strasz#.*$			/* ignore comments */;
91273822Strasz\r\n			{ lineno++; }
92255570Strasz\n			{ lineno++; }
93273820Strasz;			{ return SEMICOLON; }
94255570Strasz[ \t]+			/* ignore whitespace */;
95261766Strasz.			{ yylval.str = strdup(yytext); return STR; }
96255570Strasz%%
97