chiark / gitweb /
hostside: hidrawconv: break out dispatch()
[trains.git] / hostside / record-l.l
1 /* -*- fundamental -*- */
2
3 %{
4 #include "record-i.h"
5 %}
6
7 %option warn
8 %option batch
9 %option noyywrap
10 %option yylineno
11 %option prefix="record_yy"
12 %option header-file="record-l.h"
13
14 %{
15 #define STRT  record_yylval.name= record_tempzone_strdup(yytext);  return
16 %}
17
18 %%
19
20 train           { STRT TRAIN; }
21 seg             { STRT SEG; }
22 adjunct         { STRT ADJUNCT; }
23 is              { STRT IS; }
24 at              { STRT AT; }
25 has             { STRT HAS; }
26 inverted        { STRT INVERTED; }
27 step            { STRT STEP; }
28 stops           { STRT STOPS; }
29 home            { STRT HOME; }
30 end             { STRT END; }
31  /* new keywords must be added to %token<name> and ident: in record-y.y */
32
33 [A-Za-z][-A-Za-z0-9]+   { STRT IDENT; }
34
35 [0-9]{0,8}      { record_yylval.num= strtoul(yytext,0,10); return NUM; }
36 [0-9]{9}        { record_yyerror("number too long"); }
37 [0-9][0-9]*\.[0-9]* { record_yylval.dbl= strtod(yytext,0); return DBL; }
38
39 [-+:=~/]        { record_yylval.name= 0; return yytext[0]; }
40
41 \#.*\n|\n       { record_yylval.name= 0; return NL; }
42
43 [ \t]           { }
44
45 .               { record_yyerror("lexically invalid input"); }