1 %{
2 
3 /*
4  * fsaparse.l (lex.yy.c)
5  *
6  * Lex definitions for lexical scanner for parsing word-acceptor
7  * automata.  See fsaparse.y for more info.
8  *
9  * mbp Sat Mar 23 21:58:12 1991
10  * mbp@thales.urich.edu
11  */
12 
13 #ifdef HAVE_CONFIG_H
14 # include "config.h"
15 #endif
16 
17 #include <stdio.h>
18 #include <stdlib.h> /* for atof() */
19 #include <math.h>
20 #include <string.h>
21 #include "wa.yystype.h"
22 #include "wa.yacc.h"
23 
24 YYSTYPE yylval;
25 
26 /* disable output of unmatched input */
27 #undef output
28 #define output(c)
29 
30 %}
31 
32 DIGIT	[0-9]
33 WS	[ \t\n,]
34 LETTER	[A-Za-z]
35 SIGN	[+-]
36 
37 %% /* RULES SECTION */
38 
39 {WS}+			;
40 
41 "Format"	{ return(FORMAT);	}
42 "format"	{ return(FORMAT);	}
43 "fsa"		{ return(FSA);		}
44 "states"	{ return(STATES);	}
45 "symbols"	{ return(SYMBOLS);	}
46 "bfs"		{ return(BFS);		}
47 "min"		{ return(MIN);		}
48 "variables"	{ return(VARIABLES);	}
49 "alphabet"	{ return(ALPHABET);	}
50 "start"		{ return(START);	}
51 "atable"	{ return(ATABLE);	}
52 "inverses"	{ return(INVERSES);	}
53 "inv"		{ return(INV);		}
54 
55 "{"		{ return(LEFT_BRACE);	}
56 "}"		{ return(RIGHT_BRACE);	}
57 "("		{ return(LEFT_PAREN);	}
58 ")"		{ return(RIGHT_PAREN);	}
59 ";"		{ return(SEMICOLON);	}
60 "%"		{ return(PERCENT);	}
61 "="		{ return(EQUAL);	}
62 
63 {SIGN}?{DIGIT}+			{ yylval.i = atoi(yytext); return(INT);  }
64 {SIGN}?{DIGIT}*\.{DIGIT}?	{ yylval.d = atof(yytext); return(REAL); }
65 {SIGN}?{DIGIT}+\.{DIGIT}*	{ yylval.d = atof(yytext); return(REAL); }
66 
67 [^ \t\n{};%()=]+		{ strcpy(yylval.s, yytext); return(STRING); }
68 
69 %%  /* SUBPROGRAMS SECTION */
70 
71 int yywrap()
72 {
73   return(1);
74 }
75