45 |
static void string_finish(); |
static void string_finish(); |
46 |
static int escape(int c); |
static int escape(int c); |
47 |
char * trimws(char *s); |
char * trimws(char *s); |
48 |
|
char * trimcpy(); |
49 |
|
|
50 |
static struct string_list *str_head, *str_tail; |
static struct string_list *str_head, *str_tail; |
51 |
int cfg_line_num; |
int cfg_line_num; |
120 |
return REGEX; } |
return REGEX; } |
121 |
<RX>[^!\n]*! { string_add(yytext, yyleng); } |
<RX>[^!\n]*! { string_add(yytext, yyleng); } |
122 |
<RXM>[^!\n]*/\n { BEGIN(INITIAL); |
<RXM>[^!\n]*/\n { BEGIN(INITIAL); |
123 |
yylval.string = strdup(yytext); |
yylval.string = trimcpy(); |
|
trimws(yylval.string); |
|
124 |
DBG("RX3", yylval.string); |
DBG("RX3", yylval.string); |
125 |
return REGEX; } |
return REGEX; } |
126 |
<RXM>[^!\n]*! { BEGIN(RX); |
<RXM>[^!\n]*! { int i; |
127 |
|
|
128 |
|
BEGIN(RX); |
129 |
string_begin(); |
string_begin(); |
130 |
string_add(yytext, yyleng); } |
for (i = 0; i < yyleng && isspace(yytext[i]); i++) |
131 |
|
; |
132 |
|
string_add(yytext + i, yyleng - i); } |
133 |
= return EQ; |
= return EQ; |
134 |
!= return NE; |
!= return NE; |
135 |
[iI][fF] return IF; |
[iI][fF] return IF; |
138 |
[rR][uU][lL][eE] return RULE; |
[rR][uU][lL][eE] return RULE; |
139 |
[dD][oO][nN][eE] return DONE; |
[dD][oO][nN][eE] return DONE; |
140 |
/* Literal */ |
/* Literal */ |
141 |
<LIT>[^\n]*/\n { int i, j, len; |
<LIT>[^\n]*/\n { BEGIN(INITIAL); |
142 |
|
yylval.string = trimcpy(); |
|
BEGIN(INITIAL); |
|
|
for (i = 0; i < yyleng && isspace(yytext[i]); i++) |
|
|
; |
|
|
for (j = yyleng - 1; j > i && isspace(yytext[i]); j--) |
|
|
; |
|
|
len = j - i + 1; |
|
|
yylval.string = xmalloc(len + 1); |
|
|
memcpy(yylval.string, yytext + i, len); |
|
|
yylval.string[len] = 0; |
|
143 |
DBG("<LIT>STRING", yylval.string); |
DBG("<LIT>STRING", yylval.string); |
144 |
return STRING; } |
return STRING; } |
145 |
/* Identifiers */ |
/* Identifiers */ |
274 |
return s; |
return s; |
275 |
} |
} |
276 |
|
|
277 |
|
char * |
278 |
|
trimcpy() |
279 |
|
{ |
280 |
|
char *string; |
281 |
|
int i, j, len; |
282 |
|
|
283 |
|
for (i = 0; i < yyleng && isspace(yytext[i]); i++) |
284 |
|
; |
285 |
|
for (j = yyleng - 1; j > i && isspace(yytext[i]); j--) |
286 |
|
; |
287 |
|
len = j - i + 1; |
288 |
|
string = xmalloc(len + 1); |
289 |
|
memcpy(string, yytext + i, len); |
290 |
|
string[len] = 0; |
291 |
|
return string; |
292 |
|
} |
293 |
|
|
294 |
int |
int |
295 |
rc_open(char *name) |
rc_open(char *name) |
296 |
{ |
{ |