blob: a39b2b1b165012a6c8ecad28a701dc6accf3842e (
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
|
%{
#include "booksim.hpp"
#include <stdlib.h>
#include <string>
#include <cstring>
#include "config_tab.hpp"
#include "config_utils.hpp"
void configerror(string msg);
extern "C" int configwrap() { return 1; }
extern int config_input(char *, int);
#undef YY_INPUT
#define YY_INPUT(b, r, ms) (r = config_input(b, ms))
int configlineno = 1;
%}
%option nounput
%%
/* Ignore comments and all spaces */
\/\/[^\n]* ;
[ \t\r]* ;
\n { configlineno++; }
/* Commands */
[A-Za-z_][A-Za-z0-9_]* { configlval.name = strdup( yytext ); return STR; }
[0-9]+ { configlval.num = strtoul( yytext, 0, 10 ); return NUM; }
[0-9]+\.[0-9]+ { configlval.fnum = strtod( yytext, 0 ); return FNUM; }
. { return yytext[0]; }
%%
void configerror( string msg )
{
Configuration::GetTheConfig( )->ParseError( msg, configlineno );
}
|