/*
 * mtd_file.lex:
 *
 * Copyright (c) 2000 James McKenzie <james@fishsoup.dhs.org>,
 * All rights reserved.
 *
 */
%{
static char rcsid[]="$Id: mtd_file.lex,v 1.4 2000/10/07 18:30:03 root Exp $";

/*
 *
 * $Log: mtd_file.lex,v $
 * Revision 1.4  2000/10/07 18:30:03  root
 * #
 *
 * Revision 1.3  2000/09/24 01:12:43  root
 * #
 *
 * Revision 1.2  2000/09/19 03:53:27  root
 * #
 *
 * Revision 1.1  2000/09/13 15:13:40  root
 * #
 *
 *
 */


#define YY_INPUT(buf,result,size) result=mtd_read(buf,size);

#include "project.h"
#include "mtd_file.tab.h"

// line number
int line = 1;


%}

%x		COMMENT

endofline	\n
quotes		[\"]
space		[ \t]+
eweid		[0123456789abcdefABCDEF]{16}

%%

MTD_FILE		;
{space}			;
{endofline}		{ line++; }

\/\/.*			;
"/*"			BEGIN COMMENT;
<COMMENT>.	|
<COMMENT>\n		;
<COMMENT>"*/"		BEGIN INITIAL;


GROUP			{ return GROUP; }
TEXT			{ return TEXT; }
URI			{ return URI; }
EWEID			{ return EWEID; }
WORK			{ return WORK; }
NOWORK			{ return NOWORK; }

[{]			{ return BRACE_IN; }

[}]			{ return BRACE_OUT; }

{quotes}[^\"]*{quotes} { 
	strcpy(yylval.string , yytext + 1); 
	yylval.string[strlen(yylval.string) - 1] = 0; 
	return STRING;
}

{eweid} {
	satoeweid(&yylval.eweid,yytext);
	return EWEID_VAL;
}


.			{ return yytext[0]; }

%%


int yywrap()
{
	return 1;
}

