xref: /freebsd/usr.sbin/autofs/token.l (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
13914ddf8SEdward Tomasz Napierala %{
23914ddf8SEdward Tomasz Napierala /*-
3*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
4abdd3945SEdward Tomasz Napierala  *
53914ddf8SEdward Tomasz Napierala  * Copyright (c) 2014 The FreeBSD Foundation
63914ddf8SEdward Tomasz Napierala  *
73914ddf8SEdward Tomasz Napierala  * This software was developed by Edward Tomasz Napierala under sponsorship
83914ddf8SEdward Tomasz Napierala  * from the FreeBSD Foundation.
93914ddf8SEdward Tomasz Napierala  *
103914ddf8SEdward Tomasz Napierala  * Redistribution and use in source and binary forms, with or without
113914ddf8SEdward Tomasz Napierala  * modification, are permitted provided that the following conditions
123914ddf8SEdward Tomasz Napierala  * are met:
133914ddf8SEdward Tomasz Napierala  * 1. Redistributions of source code must retain the above copyright
143914ddf8SEdward Tomasz Napierala  *    notice, this list of conditions and the following disclaimer.
153914ddf8SEdward Tomasz Napierala  * 2. Redistributions in binary form must reproduce the above copyright
163914ddf8SEdward Tomasz Napierala  *    notice, this list of conditions and the following disclaimer in the
173914ddf8SEdward Tomasz Napierala  *    documentation and/or other materials provided with the distribution.
183914ddf8SEdward Tomasz Napierala  *
193914ddf8SEdward Tomasz Napierala  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
203914ddf8SEdward Tomasz Napierala  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
213914ddf8SEdward Tomasz Napierala  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
223914ddf8SEdward Tomasz Napierala  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
233914ddf8SEdward Tomasz Napierala  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
243914ddf8SEdward Tomasz Napierala  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
253914ddf8SEdward Tomasz Napierala  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
263914ddf8SEdward Tomasz Napierala  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
273914ddf8SEdward Tomasz Napierala  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
283914ddf8SEdward Tomasz Napierala  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
293914ddf8SEdward Tomasz Napierala  * SUCH DAMAGE.
303914ddf8SEdward Tomasz Napierala  */
313914ddf8SEdward Tomasz Napierala 
323914ddf8SEdward Tomasz Napierala #include <stdio.h>
333914ddf8SEdward Tomasz Napierala #include <stdint.h>
343914ddf8SEdward Tomasz Napierala #include <string.h>
353914ddf8SEdward Tomasz Napierala 
363914ddf8SEdward Tomasz Napierala #include "common.h"
373914ddf8SEdward Tomasz Napierala 
383914ddf8SEdward Tomasz Napierala int lineno;
393914ddf8SEdward Tomasz Napierala 
403914ddf8SEdward Tomasz Napierala #define	YY_DECL int yylex(void)
413914ddf8SEdward Tomasz Napierala extern int	yylex(void);
423914ddf8SEdward Tomasz Napierala 
433914ddf8SEdward Tomasz Napierala %}
443914ddf8SEdward Tomasz Napierala 
453914ddf8SEdward Tomasz Napierala %option noinput
463914ddf8SEdward Tomasz Napierala %option nounput
473914ddf8SEdward Tomasz Napierala %option noyywrap
483914ddf8SEdward Tomasz Napierala 
493914ddf8SEdward Tomasz Napierala %%
50a5e9e2beSEdward Tomasz Napierala \"[^"]+\"		{ yytext++; yytext[strlen(yytext) - 1] = '\0'; return STR; };
516392ec71SEdward Tomasz Napierala [a-zA-Z0-9\.\+-_/\:\[\]$&%{}]+ { return STR; }
523914ddf8SEdward Tomasz Napierala #.*\n			{ lineno++; return NEWLINE; };
533914ddf8SEdward Tomasz Napierala \\\n			{ lineno++; };
543914ddf8SEdward Tomasz Napierala \n			{ lineno++; return NEWLINE; }
553914ddf8SEdward Tomasz Napierala [ \t]+			/* ignore whitespace */;
563914ddf8SEdward Tomasz Napierala .			{ return STR; }
573914ddf8SEdward Tomasz Napierala %%
58