| 1 |
%{ |
| 2 |
/** |
| 3 |
* This file is part of the Detox package. |
| 4 |
* |
| 5 |
* Copyright (c) Doug Harple <[email protected]> |
| 6 |
* |
| 7 |
* For the full copyright and license information, please view the LICENSE |
| 8 |
* file that was distributed with this source code. |
| 9 |
*/ |
| 10 |
|
| 11 |
#include "config_file_yacc.h" |
| 12 |
#include "config_file.h" |
| 13 |
|
| 14 |
int config_file_lineno = 1; |
| 15 |
|
| 16 |
%} |
| 17 |
|
| 18 |
%option noyywrap |
| 19 |
|
| 20 |
%% |
| 21 |
|
| 22 |
[\t ]+ { /* ignore whitespace */ } |
| 23 |
|
| 24 |
#.* { /* ignore comments */ } |
| 25 |
|
| 26 |
\n { config_file_lineno++; } |
| 27 |
|
| 28 |
builtin { return BUILTIN; } |
| 29 |
filename { return FILENAME; } |
| 30 |
ignore { return IGNORE; } |
| 31 |
iso8859_1 { return ISO8859_1; } |
| 32 |
length { return LENGTH; } |
| 33 |
lower { return LOWER; } |
| 34 |
max_length { return MAX_LENGTH; } |
| 35 |
remove_trailing { return REMOVE_TRAILING; } |
| 36 |
safe { return SAFE; } |
| 37 |
sequence { return SEQUENCE; } |
| 38 |
uncgi { return UNCGI; } |
| 39 |
utf_8 { return UTF_8; } |
| 40 |
wipeup { return WIPEUP; } |
| 41 |
|
| 42 |
[{] { return OPEN; } |
| 43 |
[}] { return CLOSE; } |
| 44 |
|
| 45 |
\"[^\"\n]*[\"\n] { |
| 46 |
yylval.string = strdup(yytext+1); |
| 47 |
if (yylval.string[yyleng-2] != '"') { |
| 48 |
printf("Unterminated character string\n"); |
| 49 |
} |
| 50 |
else { |
| 51 |
yylval.string[yyleng-2] = '\0'; |
| 52 |
} |
| 53 |
return QSTRING; |
| 54 |
} |
| 55 |
|
| 56 |
[a-zA-Z][a-zA-Z0-9_]* { |
| 57 |
yylval.string = strdup(yytext); |
| 58 |
return ID; |
| 59 |
} |
| 60 |
|
| 61 |
[0-9]+ { |
| 62 |
yylval.nvalue = atoi(yytext); |
| 63 |
return NVALUE; |
| 64 |
} |
| 65 |
|
| 66 |
[;] { return EOL; } |
| 67 |
|
| 68 |
%% |