1184054Slulf/*- 2186743Slulf * Copyright (c) 2007-2009, Ulf Lilleengen <lulf@FreeBSD.org> 3184054Slulf * All rights reserved. 4184054Slulf * 5184054Slulf * Redistribution and use in source and binary forms, with or without 6184054Slulf * modification, are permitted provided that the following conditions 7184054Slulf * are met: 8184054Slulf * 1. Redistributions of source code must retain the above copyright 9184054Slulf * notice, this list of conditions and the following disclaimer. 10184054Slulf * 2. Redistributions in binary form must reproduce the above copyright 11184054Slulf * notice, this list of conditions and the following disclaimer in the 12184054Slulf * documentation and/or other materials provided with the distribution. 13184054Slulf * 14184054Slulf * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15184054Slulf * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16184054Slulf * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17184054Slulf * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18184054Slulf * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19184054Slulf * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20184054Slulf * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21184054Slulf * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22184054Slulf * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23184054Slulf * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24184054Slulf * SUCH DAMAGE. 25184054Slulf * 26184054Slulf * $FreeBSD$ 27184054Slulf */ 28184054Slulf 29184054Slulf/* 30184054Slulf * This tokenizer must be generated by a lexxer with support for reentrancy. 31184054Slulf */ 32184054Slulf%{ 33184054Slulf#include <string.h> 34185134Slulf 35184054Slulf#include "misc.h" 36184054Slulf#include "rcsparse.h" 37184054Slulf 38184054Slulf%} 39184054Slulf%option reentrant noyywrap 40184054Slulf%option header-file="rcstokenizer.h" 41184054Slulf 42184054Slulfeverything (.|\n)* 43184054Slulfnum [0-9\.]+ 44184054Slulfwhitespace [\t\n ] 45184054Slulfdigit [0-9] 46184054Slulfidchar [^$,.:;\t\n ] 47184054Slulfstring @([^@]|\n|"@@")*@ 48184054Slulfkeyword head|access|symbols|locks|comment|expand|strict|date|author|state|branches|next|desc|log|text 49184054Slulfkeyword2 branch 50184054Slulfnewline \n 51184054Slulf%% 52184054Slulf 53184054Slulf{keyword2} { 54184054Slulf return (KEYWORD_TWO); 55184054Slulf} 56184054Slulf{keyword} { 57184054Slulf return (KEYWORD); 58184054Slulf} 59184054Slulf{string} { 60184054Slulf return (STRING); 61184054Slulf} 62184054Slulf{num} { 63184054Slulf return (NUM); 64184054Slulf} 65184054Slulf{num}?{idchar}({idchar}|{num})* { 66184054Slulf/* This will use ID as both ID and SYM. Do extra checking elsewhere.*/ 67184054Slulf return (ID); 68184054Slulf} 69184054Slulf; { return (SEMIC); } 70184054Slulf: { return (COLON); } 71184054Slulf\n ; 72184054Slulf[ \t]+ ; 73184054Slulf%% 74