1%{ 2/*- 3 * SPDX-License-Identifier: BSD-2-Clause 4 * 5 * Copyright (c) 2012 The FreeBSD Foundation 6 * 7 * This software was developed by Edward Tomasz Napierala under sponsorship 8 * from the FreeBSD Foundation. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32#include <stdio.h> 33#include <stdint.h> 34#include <string.h> 35 36#include "y.tab.h" 37 38int lineno; 39 40#define YY_DECL int yylex(void) 41extern int yylex(void); 42 43%} 44 45%option noyywrap 46%option noinput 47%option nounput 48 49%% 50alias { return ALIAS; } 51auth-group { return AUTH_GROUP; } 52auth-type { return AUTH_TYPE; } 53backend { return BACKEND; } 54blocksize { return BLOCKSIZE; } 55chap { return CHAP; } 56chap-mutual { return CHAP_MUTUAL; } 57ctl-lun { return CTL_LUN; } 58debug { return DEBUG; } 59device-id { return DEVICE_ID; } 60device-type { return DEVICE_TYPE; } 61discovery-auth-group { return DISCOVERY_AUTH_GROUP; } 62discovery-filter { return DISCOVERY_FILTER; } 63dscp { return DSCP; } 64pcp { return PCP; } 65foreign { return FOREIGN; } 66initiator-name { return INITIATOR_NAME; } 67initiator-portal { return INITIATOR_PORTAL; } 68listen { return LISTEN; } 69listen-iser { return LISTEN_ISER; } 70lun { return LUN; } 71maxproc { return MAXPROC; } 72offload { return OFFLOAD; } 73option { return OPTION; } 74path { return PATH; } 75pidfile { return PIDFILE; } 76isns-server { return ISNS_SERVER; } 77isns-period { return ISNS_PERIOD; } 78isns-timeout { return ISNS_TIMEOUT; } 79port { return PORT; } 80portal-group { return PORTAL_GROUP; } 81redirect { return REDIRECT; } 82serial { return SERIAL; } 83size { return SIZE; } 84tag { return TAG; } 85target { return TARGET; } 86timeout { return TIMEOUT; } 87af11 { return AF11; } 88af12 { return AF12; } 89af13 { return AF13; } 90af21 { return AF21; } 91af22 { return AF22; } 92af23 { return AF23; } 93af31 { return AF31; } 94af32 { return AF32; } 95af33 { return AF33; } 96af41 { return AF41; } 97af42 { return AF42; } 98af43 { return AF43; } 99be { return CS0; } 100ef { return EF; } 101cs0 { return CS0; } 102cs1 { return CS1; } 103cs2 { return CS2; } 104cs3 { return CS3; } 105cs4 { return CS4; } 106cs5 { return CS5; } 107cs6 { return CS6; } 108cs7 { return CS7; } 109\"[^"]+\" { yylval.str = strndup(yytext + 1, 110 strlen(yytext) - 2); return STR; } 111[a-zA-Z0-9\.\-@_/\:\[\]]+ { yylval.str = strdup(yytext); return STR; } 112\{ { return OPENING_BRACKET; } 113\} { return CLOSING_BRACKET; } 114#.*$ /* ignore comments */; 115\r\n { lineno++; } 116\n { lineno++; } 117; { return SEMICOLON; } 118[ \t]+ /* ignore whitespace */; 119. { yylval.str = strdup(yytext); return STR; } 120%% 121