xref: /freebsd/usr.sbin/ctld/token.l (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
1009ea47eSEdward Tomasz Napierala %{
2009ea47eSEdward Tomasz Napierala /*-
3*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
41de7b4b8SPedro F. Giffuni  *
5009ea47eSEdward Tomasz Napierala  * Copyright (c) 2012 The FreeBSD Foundation
6009ea47eSEdward Tomasz Napierala  *
7009ea47eSEdward Tomasz Napierala  * This software was developed by Edward Tomasz Napierala under sponsorship
8009ea47eSEdward Tomasz Napierala  * from the FreeBSD Foundation.
9009ea47eSEdward Tomasz Napierala  *
10009ea47eSEdward Tomasz Napierala  * Redistribution and use in source and binary forms, with or without
11009ea47eSEdward Tomasz Napierala  * modification, are permitted provided that the following conditions
12009ea47eSEdward Tomasz Napierala  * are met:
13009ea47eSEdward Tomasz Napierala  * 1. Redistributions of source code must retain the above copyright
14009ea47eSEdward Tomasz Napierala  *    notice, this list of conditions and the following disclaimer.
15009ea47eSEdward Tomasz Napierala  * 2. Redistributions in binary form must reproduce the above copyright
16009ea47eSEdward Tomasz Napierala  *    notice, this list of conditions and the following disclaimer in the
17009ea47eSEdward Tomasz Napierala  *    documentation and/or other materials provided with the distribution.
18009ea47eSEdward Tomasz Napierala  *
19009ea47eSEdward Tomasz Napierala  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20009ea47eSEdward Tomasz Napierala  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21009ea47eSEdward Tomasz Napierala  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22009ea47eSEdward Tomasz Napierala  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23009ea47eSEdward Tomasz Napierala  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24009ea47eSEdward Tomasz Napierala  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25009ea47eSEdward Tomasz Napierala  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26009ea47eSEdward Tomasz Napierala  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27009ea47eSEdward Tomasz Napierala  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28009ea47eSEdward Tomasz Napierala  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29009ea47eSEdward Tomasz Napierala  * SUCH DAMAGE.
30009ea47eSEdward Tomasz Napierala  */
31009ea47eSEdward Tomasz Napierala 
32009ea47eSEdward Tomasz Napierala #include <stdio.h>
33009ea47eSEdward Tomasz Napierala #include <stdint.h>
34009ea47eSEdward Tomasz Napierala #include <string.h>
35009ea47eSEdward Tomasz Napierala 
36009ea47eSEdward Tomasz Napierala #include "y.tab.h"
37009ea47eSEdward Tomasz Napierala 
38009ea47eSEdward Tomasz Napierala int lineno;
39009ea47eSEdward Tomasz Napierala 
40009ea47eSEdward Tomasz Napierala #define	YY_DECL int yylex(void)
41009ea47eSEdward Tomasz Napierala extern int	yylex(void);
42009ea47eSEdward Tomasz Napierala 
43009ea47eSEdward Tomasz Napierala %}
44009ea47eSEdward Tomasz Napierala 
4558aad230SBaptiste Daroussin %option noyywrap
46009ea47eSEdward Tomasz Napierala %option noinput
47009ea47eSEdward Tomasz Napierala %option nounput
48009ea47eSEdward Tomasz Napierala 
49009ea47eSEdward Tomasz Napierala %%
50009ea47eSEdward Tomasz Napierala alias			{ return ALIAS; }
51009ea47eSEdward Tomasz Napierala auth-group		{ return AUTH_GROUP; }
52df9900fbSEdward Tomasz Napierala auth-type		{ return AUTH_TYPE; }
53009ea47eSEdward Tomasz Napierala backend			{ return BACKEND; }
54009ea47eSEdward Tomasz Napierala blocksize		{ return BLOCKSIZE; }
55009ea47eSEdward Tomasz Napierala chap			{ return CHAP; }
56009ea47eSEdward Tomasz Napierala chap-mutual		{ return CHAP_MUTUAL; }
573933f7b1SAlexander Motin ctl-lun			{ return CTL_LUN; }
58009ea47eSEdward Tomasz Napierala debug			{ return DEBUG; }
59009ea47eSEdward Tomasz Napierala device-id		{ return DEVICE_ID; }
6091be33dcSAlexander Motin device-type		{ return DEVICE_TYPE; }
61009ea47eSEdward Tomasz Napierala discovery-auth-group	{ return DISCOVERY_AUTH_GROUP; }
6205374883SEdward Tomasz Napierala discovery-filter	{ return DISCOVERY_FILTER; }
6364ffe6d4SRichard Scheffenegger dscp			{ return DSCP; }
64ea8f1280SRichard Scheffenegger pcp			{ return PCP; }
65db7bf2baSAlexander Motin foreign			{ return FOREIGN; }
668cb2e958SEdward Tomasz Napierala initiator-name		{ return INITIATOR_NAME; }
678cb2e958SEdward Tomasz Napierala initiator-portal	{ return INITIATOR_PORTAL; }
68009ea47eSEdward Tomasz Napierala listen			{ return LISTEN; }
69009ea47eSEdward Tomasz Napierala listen-iser		{ return LISTEN_ISER; }
70009ea47eSEdward Tomasz Napierala lun			{ return LUN; }
71009ea47eSEdward Tomasz Napierala maxproc			{ return MAXPROC; }
7207b49a3eSEdward Tomasz Napierala offload			{ return OFFLOAD; }
73009ea47eSEdward Tomasz Napierala option			{ return OPTION; }
74009ea47eSEdward Tomasz Napierala path			{ return PATH; }
75009ea47eSEdward Tomasz Napierala pidfile			{ return PIDFILE; }
76829603e2SAlexander Motin isns-server		{ return ISNS_SERVER; }
77829603e2SAlexander Motin isns-period		{ return ISNS_PERIOD; }
78829603e2SAlexander Motin isns-timeout		{ return ISNS_TIMEOUT; }
79057abcb0SAlexander Motin port			{ return PORT; }
80009ea47eSEdward Tomasz Napierala portal-group		{ return PORTAL_GROUP; }
816dbdbf82SEdward Tomasz Napierala redirect		{ return REDIRECT; }
82009ea47eSEdward Tomasz Napierala serial			{ return SERIAL; }
83009ea47eSEdward Tomasz Napierala size			{ return SIZE; }
84db7bf2baSAlexander Motin tag			{ return TAG; }
85009ea47eSEdward Tomasz Napierala target			{ return TARGET; }
86009ea47eSEdward Tomasz Napierala timeout			{ return TIMEOUT; }
8764ffe6d4SRichard Scheffenegger af11			{ return AF11; }
8864ffe6d4SRichard Scheffenegger af12			{ return AF12; }
8964ffe6d4SRichard Scheffenegger af13			{ return AF13; }
9064ffe6d4SRichard Scheffenegger af21			{ return AF21; }
9164ffe6d4SRichard Scheffenegger af22			{ return AF22; }
9264ffe6d4SRichard Scheffenegger af23			{ return AF23; }
9364ffe6d4SRichard Scheffenegger af31			{ return AF31; }
9464ffe6d4SRichard Scheffenegger af32			{ return AF32; }
9564ffe6d4SRichard Scheffenegger af33			{ return AF33; }
9664ffe6d4SRichard Scheffenegger af41			{ return AF41; }
9764ffe6d4SRichard Scheffenegger af42			{ return AF42; }
9864ffe6d4SRichard Scheffenegger af43			{ return AF43; }
9964ffe6d4SRichard Scheffenegger be			{ return CS0;  }
10064ffe6d4SRichard Scheffenegger ef			{ return EF;   }
10164ffe6d4SRichard Scheffenegger cs0			{ return CS0;  }
10264ffe6d4SRichard Scheffenegger cs1			{ return CS1;  }
10364ffe6d4SRichard Scheffenegger cs2			{ return CS2;  }
10464ffe6d4SRichard Scheffenegger cs3			{ return CS3;  }
10564ffe6d4SRichard Scheffenegger cs4			{ return CS4;  }
10664ffe6d4SRichard Scheffenegger cs5			{ return CS5;  }
10764ffe6d4SRichard Scheffenegger cs6			{ return CS6;  }
10864ffe6d4SRichard Scheffenegger cs7			{ return CS7;  }
109009ea47eSEdward Tomasz Napierala \"[^"]+\"		{ yylval.str = strndup(yytext + 1,
110009ea47eSEdward Tomasz Napierala 			    strlen(yytext) - 2); return STR; }
111a66d51f3SEdward Tomasz Napierala [a-zA-Z0-9\.\-@_/\:\[\]]+ { yylval.str = strdup(yytext); return STR; }
112009ea47eSEdward Tomasz Napierala \{			{ return OPENING_BRACKET; }
113009ea47eSEdward Tomasz Napierala \}			{ return CLOSING_BRACKET; }
114009ea47eSEdward Tomasz Napierala #.*$			/* ignore comments */;
1151cb587dcSEdward Tomasz Napierala \r\n			{ lineno++; }
116009ea47eSEdward Tomasz Napierala \n			{ lineno++; }
117f9488580SEdward Tomasz Napierala ;			{ return SEMICOLON; }
118009ea47eSEdward Tomasz Napierala [ \t]+			/* ignore whitespace */;
119e0fccc98SEdward Tomasz Napierala .			{ yylval.str = strdup(yytext); return STR; }
120009ea47eSEdward Tomasz Napierala %%
121