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