aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ndiscvt/inf-token.l
diff options
context:
space:
mode:
authorMatthew N. Dodd <mdodd@FreeBSD.org>2004-01-11 21:10:35 +0000
committerMatthew N. Dodd <mdodd@FreeBSD.org>2004-01-11 21:10:35 +0000
commitca3aed2f13c511af73d7ad34a065e5fcc37db56d (patch)
tree5a06b640ab61ddaf53ecb3dacadde82ef51ee91c /usr.sbin/ndiscvt/inf-token.l
parent2eb3a038d73387f43741ff2bee858fe700894e33 (diff)
downloadsrc-ca3aed2f13c511af73d7ad34a065e5fcc37db56d.tar.gz
src-ca3aed2f13c511af73d7ad34a065e5fcc37db56d.zip
- Handle doubled double quotes:
`"""foo"" bar"' -> `"foo" bar' - Handle C++ style comments. Requested by: wpaul
Notes
Notes: svn path=/head/; revision=124401
Diffstat (limited to 'usr.sbin/ndiscvt/inf-token.l')
-rw-r--r--usr.sbin/ndiscvt/inf-token.l12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/ndiscvt/inf-token.l b/usr.sbin/ndiscvt/inf-token.l
index c6c08b9a4800..cc1508bba4a2 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':