xref: /dflybsd-src/usr.sbin/autofs/token.l (revision 63bc498493e0888c7c5cc0b504fac8c967c31e74)
1e2950f41STomohiro Kusumi %{
2e2950f41STomohiro Kusumi /*-
3*63bc4984STomohiro Kusumi  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4*63bc4984STomohiro Kusumi  *
5e2950f41STomohiro Kusumi  * Copyright (c) 2016 The DragonFly Project
6e2950f41STomohiro Kusumi  * Copyright (c) 2014 The FreeBSD Foundation
7e2950f41STomohiro Kusumi  * All rights reserved.
8e2950f41STomohiro Kusumi  *
9e2950f41STomohiro Kusumi  * This software was developed by Edward Tomasz Napierala under sponsorship
10e2950f41STomohiro Kusumi  * from the FreeBSD Foundation.
11e2950f41STomohiro Kusumi  *
12e2950f41STomohiro Kusumi  * Redistribution and use in source and binary forms, with or without
13e2950f41STomohiro Kusumi  * modification, are permitted provided that the following conditions
14e2950f41STomohiro Kusumi  * are met:
15e2950f41STomohiro Kusumi  * 1. Redistributions of source code must retain the above copyright
16e2950f41STomohiro Kusumi  *    notice, this list of conditions and the following disclaimer.
17e2950f41STomohiro Kusumi  * 2. Redistributions in binary form must reproduce the above copyright
18e2950f41STomohiro Kusumi  *    notice, this list of conditions and the following disclaimer in the
19e2950f41STomohiro Kusumi  *    documentation and/or other materials provided with the distribution.
20e2950f41STomohiro Kusumi  *
21e2950f41STomohiro Kusumi  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22e2950f41STomohiro Kusumi  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23e2950f41STomohiro Kusumi  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24e2950f41STomohiro Kusumi  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25e2950f41STomohiro Kusumi  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26e2950f41STomohiro Kusumi  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27e2950f41STomohiro Kusumi  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28e2950f41STomohiro Kusumi  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29e2950f41STomohiro Kusumi  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30e2950f41STomohiro Kusumi  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31e2950f41STomohiro Kusumi  * SUCH DAMAGE.
32e2950f41STomohiro Kusumi  *
33e2950f41STomohiro Kusumi  * $FreeBSD$
34e2950f41STomohiro Kusumi  */
35e2950f41STomohiro Kusumi 
36e2950f41STomohiro Kusumi #include <stdio.h>
37e2950f41STomohiro Kusumi #include <stdint.h>
38e2950f41STomohiro Kusumi #include <string.h>
39e2950f41STomohiro Kusumi 
40e2950f41STomohiro Kusumi #include "common.h"
41e2950f41STomohiro Kusumi 
42e2950f41STomohiro Kusumi int lineno;
43e2950f41STomohiro Kusumi 
44e2950f41STomohiro Kusumi #define	YY_DECL int yylex(void)
45e2950f41STomohiro Kusumi extern int	yylex(void);
46e2950f41STomohiro Kusumi 
47e2950f41STomohiro Kusumi %}
48e2950f41STomohiro Kusumi 
49e2950f41STomohiro Kusumi %option noinput
50e2950f41STomohiro Kusumi %option nounput
51e2950f41STomohiro Kusumi %option noyywrap
52e2950f41STomohiro Kusumi 
53e2950f41STomohiro Kusumi %%
54e2950f41STomohiro Kusumi \"[^"]+\"		{ yytext++; yytext[strlen(yytext) - 1] = '\0'; return STR; };
55e2950f41STomohiro Kusumi [a-zA-Z0-9\.\+-_/\:\[\]$&%{}]+ { return STR; }
56e2950f41STomohiro Kusumi #.*\n			{ lineno++; return NEWLINE; };
57e2950f41STomohiro Kusumi \\\n			{ lineno++; };
58e2950f41STomohiro Kusumi \n			{ lineno++; return NEWLINE; }
59e2950f41STomohiro Kusumi [ \t]+			/* ignore whitespace */;
60e2950f41STomohiro Kusumi .			{ return STR; }
61e2950f41STomohiro Kusumi %%
62