diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-03 01:27:27 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-03 01:27:27 +0200 |
commit | bd8dcb97354bc29050e5aefe957c651bf2fedd07 (patch) | |
tree | a2136790e88df12a0a7607811c02fc05f3413e2c /src/config.l | |
parent | a25640e3b49e7abdf8930d9439a85d066b5235f2 (diff) | |
download | fastd-bd8dcb97354bc29050e5aefe957c651bf2fedd07.tar fastd-bd8dcb97354bc29050e5aefe957c651bf2fedd07.zip |
Keep list of strings allocated by the lexer
Diffstat (limited to 'src/config.l')
-rw-r--r-- | src/config.l | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/config.l b/src/config.l index f2a9002..546bd8d 100644 --- a/src/config.l +++ b/src/config.l @@ -88,7 +88,7 @@ no { UPDATE_LOCATION; return TOK_NO; } UPDATE_LOCATION; if (!inet_pton(AF_INET, yytext, &yylval->addr)) { - yylval->str = "invalid address"; + yylval->error = "invalid address"; return -1; } @@ -116,7 +116,7 @@ no { UPDATE_LOCATION; return TOK_NO; } yytext[i-esc] = yytext[i]; } yytext[yyleng-esc-1] = 0; - yylval->str = strdup(yytext); + yylval->str = fastd_config_str_dup(yytext); BEGIN(INITIAL); yylloc->last_column++; return TOK_STRING; @@ -127,7 +127,7 @@ no { UPDATE_LOCATION; return TOK_NO; } <ADDR6>[0-9a-fA-F:]+ { yylloc->last_column += yyleng; if (!inet_pton(AF_INET6, yytext, &yylval->addr6)) { - yylval->str = "invalid address"; + yylval->error = "invalid address"; return -1; } } @@ -144,12 +144,12 @@ no { UPDATE_LOCATION; return TOK_NO; } . { yylloc->first_line = yylloc->last_line; yylloc->first_column = yylloc->last_column+1; - yylval->str = "invalid character"; + yylval->error = "invalid character"; return -1; } <INITIAL><<EOF>> { return 0; } -<COMMENT><<EOF>> { yylval->str = "unterminated block comment"; return -1; } -<STRING><<EOF>> { yylval->str = "unterminated string"; return -1; } -<ADDR6><<EOF>> { yylval->str = "unterminated address"; return -1; } +<COMMENT><<EOF>> { yylval->error = "unterminated block comment"; return -1; } +<STRING><<EOF>> { yylval->error = "unterminated string"; return -1; } +<ADDR6><<EOF>> { yylval->error = "unterminated address"; return -1; } %% |