blob: 4df14c7e44c4cf17d76ba67be3230fb397b7b66e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
%{
#include "y.tab.h"
static unsigned int lineno = 1;
void config_error(char * msg, int lineno);
void yyerror(char * msg);
extern int config_input(char *, int);
#undef YY_INPUT
#define YY_INPUT(b, r, ms) (r = config_input(b, ms))
%}
Digit [0-9]
Exponent [eE][+-]?{Digit}+
DblConst ({Digit}*\.)?{Digit}+{Exponent}?
StrConst [A-Za-z_\-/\.][A-Za-z0-9_\-/\.\+(\{\,)\}]*
%%
/* Ignore comments and all spaces */
\/\/[^\n]* ;
[ \t\r]* ;
\n { lineno++; }
/* Commands */
\{[A-Za-z0-9_\-\.(\{\,)\}]+(\,[A-Za-z0-9_\-\.(\{\,)\}]+)*\} { yylval.name = strdup( yytext ); return STR; }
-?[0-9]+ { yylval.num = atoi( yytext ); return NUM; }
-?[0-9]*\.[0-9]+ { yylval.fnum = atof( yytext ); return FNUM; }
-?{DblConst} { yylval.fnum = atof( yytext ); return FNUM;}
{StrConst} { yylval.name = strdup( yytext ); return STR; }
. { return yytext[0]; }
%%
void yyerror( char * msg )
{
config_error( msg, lineno );
}
int yywrap()
{
return 1;
}
|