From f805d7f5527061ba7af4c825e0657a43fb69f380 Mon Sep 17 00:00:00 2001 From: mdodd Date: Sun, 11 Jan 2004 21:10:35 +0000 Subject: - Handle doubled double quotes: `"""foo"" bar"' -> `"foo" bar' - Handle C++ style comments. Requested by: wpaul --- usr.sbin/ndiscvt/inf-token.l | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'usr.sbin/ndiscvt/inf-token.l') diff --git a/usr.sbin/ndiscvt/inf-token.l b/usr.sbin/ndiscvt/inf-token.l index c6c08b9..cc1508b 100644 --- a/usr.sbin/ndiscvt/inf-token.l +++ b/usr.sbin/ndiscvt/inf-token.l @@ -64,9 +64,10 @@ update_lineno(const char *cp) \n { lineno++; return EOL; } \r ; ;.*$ ; +\/\/.*$ ; = { return EQUALS; } , { return COMMA; } -\"(\\\"|[^"])*\" { +\"(\\\"|[^"]|\"\")*\" { int len = strlen(yytext) - 2; int blen = len + 1; char *walker; @@ -77,6 +78,15 @@ update_lineno(const char *cp) goto out; walker = yylval.str; for (i = 1; i <= len; i++) { + if (yytext[i] == '\"') { + switch (yytext[i + 1]) { + case '\"': + i++; + break; + default: + break; + } + } if (yytext[i] == '\\') { switch (yytext[i + 1]) { case '\n': -- cgit v1.1