1204076Spjd%{ 2204076Spjd/*- 3330449Seadler * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 4330449Seadler * 5204076Spjd * Copyright (c) 2009-2010 The FreeBSD Foundation 6219351Spjd * Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net> 7204076Spjd * All rights reserved. 8204076Spjd * 9204076Spjd * This software was developed by Pawel Jakub Dawidek under sponsorship from 10204076Spjd * the FreeBSD Foundation. 11204076Spjd * 12204076Spjd * Redistribution and use in source and binary forms, with or without 13204076Spjd * modification, are permitted provided that the following conditions 14204076Spjd * are met: 15204076Spjd * 1. Redistributions of source code must retain the above copyright 16204076Spjd * notice, this list of conditions and the following disclaimer. 17204076Spjd * 2. Redistributions in binary form must reproduce the above copyright 18204076Spjd * notice, this list of conditions and the following disclaimer in the 19204076Spjd * documentation and/or other materials provided with the distribution. 20204076Spjd * 21204076Spjd * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 22204076Spjd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23204076Spjd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24204076Spjd * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 25204076Spjd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26204076Spjd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27204076Spjd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28204076Spjd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29204076Spjd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30204076Spjd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31204076Spjd * SUCH DAMAGE. 32204076Spjd * 33204076Spjd * $FreeBSD: stable/11/sbin/hastd/token.l 330449 2018-03-05 07:26:05Z eadler $ 34204076Spjd */ 35204076Spjd 36204076Spjd#include <stdio.h> 37204076Spjd#include <string.h> 38204076Spjd 39204076Spjd#include "hast.h" 40204076Spjd 41204076Spjd#include "y.tab.h" 42204076Spjd 43204076Spjdint depth; 44204076Spjdint lineno; 45204076Spjd 46204076Spjd#define DP do { } while (0) 47250914Sjkim#define YY_DECL int yylex(void) 48250914Sjkim 49250914Sjkimextern int yylex(void); 50204076Spjd%} 51204076Spjd 52228696Spjd%option noinput 53228696Spjd%option nounput 54250503Strociny%option noyywrap 55228696Spjd 56204076Spjd%% 57204076Spjdcontrol { DP; return CONTROL; } 58226463Spjdpidfile { DP; return PIDFILE; } 59204076Spjdlisten { DP; return LISTEN; } 60204076Spjdreplication { DP; return REPLICATION; } 61219351Spjdchecksum { DP; return CHECKSUM; } 62219354Spjdcompression { DP; return COMPRESSION; } 63207371Spjdtimeout { DP; return TIMEOUT; } 64211886Spjdexec { DP; return EXEC; } 65225830Spjdmetaflush { DP; return METAFLUSH; } 66204076Spjdresource { DP; return RESOURCE; } 67204076Spjdname { DP; return NAME; } 68204076Spjdlocal { DP; return LOCAL; } 69204076Spjdremote { DP; return REMOTE; } 70219818Spjdsource { DP; return SOURCE; } 71204076Spjdon { DP; return ON; } 72225830Spjdoff { DP; return OFF; } 73204076Spjdfullsync { DP; return FULLSYNC; } 74204076Spjdmemsync { DP; return MEMSYNC; } 75204076Spjdasync { DP; return ASYNC; } 76219351Spjdnone { DP; return NONE; } 77219351Spjdcrc32 { DP; return CRC32; } 78219351Spjdsha256 { DP; return SHA256; } 79219354Spjdhole { DP; return HOLE; } 80219354Spjdlzf { DP; return LZF; } 81204076Spjd[0-9]+ { DP; yylval.num = atoi(yytext); return NUM; } 82222117Spjd[a-zA-Z0-9\.\-_/\:\[\]]+ { DP; yylval.str = strdup(yytext); return STR; } 83204076Spjd\{ { DP; depth++; return OB; } 84204076Spjd\} { DP; depth--; return CB; } 85204076Spjd#.*$ /* ignore comments */; 86204076Spjd\n { lineno++; } 87204076Spjd[ \t]+ /* ignore whitespace */; 88204076Spjd%% 89