1 | %{ |
1 | %{ |
2 | #include <stdio.h> |
2 | #include <stdio.h> |
3 | |
3 | |
4 | #include "y.tab.h" |
4 | #include "doom3map_parser.tab.h++" |
5 | |
5 | |
6 | %} |
6 | %} |
|
|
7 | %x IN_COMMENT |
7 | |
8 | |
8 | |
9 | |
9 | DIGIT [0-9] |
10 | DIGIT [0-9] |
10 | |
11 | |
11 | |
12 | |
12 | %% |
13 | %% |
13 | |
14 | |
|
|
15 | <INITIAL>{ |
|
|
16 | "/*" BEGIN(IN_COMMENT); |
|
|
17 | } |
|
|
18 | <IN_COMMENT>{ |
|
|
19 | "*/" BEGIN(INITIAL); |
|
|
20 | [^*\n]+ |
|
|
21 | "*" |
|
|
22 | \n yylineno++; |
|
|
23 | } |
|
|
24 | |
14 | \[.*\] ; |
25 | \[.*\] ; |
15 | \"[^\"]*\" { yylval.string = strndup (yytext + 1, yyleng - 2); return STRING; } |
26 | \"[^\"]*\" { yylval.string = strndup (yytext + 1, yyleng - 2); return STRING; } |
|
|
27 | {DIGIT}+ { yylval.num = atof (yytext); return NUMBER; } |
16 | [-+]?{DIGIT}+"."{DIGIT}* { yylval.num = atof ( yytext ); return NUMBER; } |
28 | [-+]?{DIGIT}+"."{DIGIT}* { yylval.num = atof (yytext); return NUMBER; } |
17 | |
29 | |
18 | |
30 | |
19 | \/\/.* ; |
31 | \/\/.* ; |
20 | |
32 | |
21 | [\040\t\r,] ; |
33 | [\040\t\r,] ; |
22 | \n yylineno++; |
34 | \n yylineno++; |
23 | |
35 | |
24 | [\;\{\}()] return yytext[0]; |
36 | [\;\{\}()] return yytext[0]; |
25 | |
37 | |
26 | . printf ("unexpected character '%c' in config file line %d, skipping", yytext[0], yylineno); |
38 | model return MODEL; |
|
|
39 | |
|
|
40 | interAreaPortals return IAPO; |
|
|
41 | nodes return NODES; |
|
|
42 | shadowModel return SHADOWMODEL; |
|
|
43 | |
|
|
44 | [A-Za-z0-9_]+ { yylval.string = strndup (yytext, yyleng); return ID; } |
27 | |
45 | |
28 | %% |
46 | %% |
29 | |
47 | |
30 | int yywrap () |
48 | int yywrap () |
31 | { |
49 | { |