1204076Spjd%{
2204076Spjd/*-
3204076Spjd * Copyright (c) 2009-2010 The FreeBSD Foundation
4219351Spjd * Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>
5204076Spjd * All rights reserved.
6204076Spjd *
7204076Spjd * This software was developed by Pawel Jakub Dawidek under sponsorship from
8204076Spjd * the FreeBSD Foundation.
9204076Spjd *
10204076Spjd * Redistribution and use in source and binary forms, with or without
11204076Spjd * modification, are permitted provided that the following conditions
12204076Spjd * are met:
13204076Spjd * 1. Redistributions of source code must retain the above copyright
14204076Spjd *    notice, this list of conditions and the following disclaimer.
15204076Spjd * 2. Redistributions in binary form must reproduce the above copyright
16204076Spjd *    notice, this list of conditions and the following disclaimer in the
17204076Spjd *    documentation and/or other materials provided with the distribution.
18204076Spjd *
19204076Spjd * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
20204076Spjd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21204076Spjd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22204076Spjd * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
23204076Spjd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24204076Spjd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25204076Spjd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26204076Spjd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27204076Spjd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28204076Spjd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29204076Spjd * SUCH DAMAGE.
30204076Spjd *
31204076Spjd * $FreeBSD$
32204076Spjd */
33204076Spjd
34204076Spjd#include <stdio.h>
35204076Spjd#include <string.h>
36204076Spjd
37204076Spjd#include "hast.h"
38204076Spjd
39204076Spjd#include "y.tab.h"
40204076Spjd
41204076Spjdint depth;
42204076Spjdint lineno;
43204076Spjd
44204076Spjd#define	DP	do { } while (0)
45252181Smarius#define	YY_DECL	int yylex(void)
46252181Smarius
47252181Smariusextern int yylex(void);
48204076Spjd%}
49204076Spjd
50229509Strociny%option noinput
51229509Strociny%option nounput
52251004Strociny%option noyywrap
53229509Strociny
54204076Spjd%%
55204076Spjdcontrol			{ DP; return CONTROL; }
56229509Strocinypidfile			{ DP; return PIDFILE; }
57204076Spjdlisten			{ DP; return LISTEN; }
58204076Spjdreplication		{ DP; return REPLICATION; }
59219351Spjdchecksum		{ DP; return CHECKSUM; }
60219354Spjdcompression		{ DP; return COMPRESSION; }
61207371Spjdtimeout			{ DP; return TIMEOUT; }
62211886Spjdexec			{ DP; return EXEC; }
63229509Strocinymetaflush		{ DP; return METAFLUSH; }
64204076Spjdresource		{ DP; return RESOURCE; }
65204076Spjdname			{ DP; return NAME; }
66204076Spjdlocal			{ DP; return LOCAL; }
67204076Spjdremote			{ DP; return REMOTE; }
68219818Spjdsource			{ DP; return SOURCE; }
69204076Spjdon			{ DP; return ON; }
70229509Strocinyoff			{ DP; return OFF; }
71204076Spjdfullsync		{ DP; return FULLSYNC; }
72204076Spjdmemsync			{ DP; return MEMSYNC; }
73204076Spjdasync			{ DP; return ASYNC; }
74219351Spjdnone			{ DP; return NONE; }
75219351Spjdcrc32			{ DP; return CRC32; }
76219351Spjdsha256			{ DP; return SHA256; }
77219354Spjdhole			{ DP; return HOLE; }
78219354Spjdlzf			{ DP; return LZF; }
79204076Spjd[0-9]+			{ DP; yylval.num = atoi(yytext); return NUM; }
80222117Spjd[a-zA-Z0-9\.\-_/\:\[\]]+ { DP; yylval.str = strdup(yytext); return STR; }
81204076Spjd\{			{ DP; depth++; return OB; }
82204076Spjd\}			{ DP; depth--; return CB; }
83204076Spjd#.*$			/* ignore comments */;
84204076Spjd\n			{ lineno++; }
85204076Spjd[ \t]+			/* ignore whitespace */;
86204076Spjd%%
87