token.l revision 211886
1204076Spjd%{
2204076Spjd/*-
3204076Spjd * Copyright (c) 2009-2010 The FreeBSD Foundation
4204076Spjd * All rights reserved.
5204076Spjd *
6204076Spjd * This software was developed by Pawel Jakub Dawidek under sponsorship from
7204076Spjd * the FreeBSD Foundation.
8204076Spjd *
9204076Spjd * Redistribution and use in source and binary forms, with or without
10204076Spjd * modification, are permitted provided that the following conditions
11204076Spjd * are met:
12204076Spjd * 1. Redistributions of source code must retain the above copyright
13204076Spjd *    notice, this list of conditions and the following disclaimer.
14204076Spjd * 2. Redistributions in binary form must reproduce the above copyright
15204076Spjd *    notice, this list of conditions and the following disclaimer in the
16204076Spjd *    documentation and/or other materials provided with the distribution.
17204076Spjd *
18204076Spjd * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
19204076Spjd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20204076Spjd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21204076Spjd * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
22204076Spjd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23204076Spjd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24204076Spjd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25204076Spjd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26204076Spjd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27204076Spjd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28204076Spjd * SUCH DAMAGE.
29204076Spjd *
30204076Spjd * $FreeBSD: head/sbin/hastd/token.l 211886 2010-08-27 15:16:52Z pjd $
31204076Spjd */
32204076Spjd
33204076Spjd#include <stdio.h>
34204076Spjd#include <string.h>
35204076Spjd
36204076Spjd#include "hast.h"
37204076Spjd
38204076Spjd#include "y.tab.h"
39204076Spjd
40204076Spjdint depth;
41204076Spjdint lineno;
42204076Spjd
43204076Spjd#define	DP	do { } while (0)
44204076Spjd%}
45204076Spjd
46204076Spjd%%
47204076Spjdcontrol			{ DP; return CONTROL; }
48204076Spjdlisten			{ DP; return LISTEN; }
49204076Spjdport			{ DP; return PORT; }
50204076Spjdreplication		{ DP; return REPLICATION; }
51207371Spjdtimeout			{ DP; return TIMEOUT; }
52211886Spjdexec			{ DP; return EXEC; }
53204076Spjdresource		{ DP; return RESOURCE; }
54204076Spjdname			{ DP; return NAME; }
55204076Spjdlocal			{ DP; return LOCAL; }
56204076Spjdremote			{ DP; return REMOTE; }
57204076Spjdon			{ DP; return ON; }
58204076Spjdfullsync		{ DP; return FULLSYNC; }
59204076Spjdmemsync			{ DP; return MEMSYNC; }
60204076Spjdasync			{ DP; return ASYNC; }
61204076Spjd[0-9]+			{ DP; yylval.num = atoi(yytext); return NUM; }
62204076Spjd[a-zA-Z0-9\.\-_/\:]+	{ DP; yylval.str = strdup(yytext); return STR; }
63204076Spjd\{			{ DP; depth++; return OB; }
64204076Spjd\}			{ DP; depth--; return CB; }
65204076Spjd#.*$			/* ignore comments */;
66204076Spjd\n			{ lineno++; }
67204076Spjd[ \t]+			/* ignore whitespace */;
68204076Spjd%%
69