summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 56322d3)
raw | patch | inline | side by side (parent: 56322d3)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 12 Jul 2008 09:34:30 +0000 (11:34 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 15 Jul 2008 06:48:58 +0000 (08:48 +0200) |
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/liboconfig/scanner.l | patch | blob | history |
index 0f146ca488dd23faece3cf7968e4a7ba5bca8a61..b559e863179ebfebaf1acc4219baa24522897e5d 100644 (file)
--- a/src/liboconfig/scanner.l
+++ b/src/liboconfig/scanner.l
%x ML
WHITE_SPACE [\ \t\b]
NON_WHITE_SPACE [^\ \t\b]
+EOL (\r\n|\n)
QUOTED_STRING ([^\\"]+|\\.)*
UNQUOTED_STRING [0-9A-Za-z_]+
HEX_NUMBER 0[xX][0-9a-fA-F]+
{WHITE_SPACE} |
{COMMENT} {/* ignore */}
-\\\n {/* continue line */}
+\\{EOL} {/* continue line */}
-\n {return (EOL);}
+{EOL} {return (EOL);}
"/" {return (SLASH);}
"<" {return (OPENBRAC);}
">" {return (CLOSEBRAC);}
\"{QUOTED_STRING}\" {yylval.string = yytext; return (QUOTED_STRING);}
{UNQUOTED_STRING} {yylval.string = yytext; return (UNQUOTED_STRING);}
-\"{QUOTED_STRING}\\\n {
+\"{QUOTED_STRING}\\{EOL} {
+ int len = strlen (yytext);
+
ml_pos = 0;
- /* remove "\\\n" */
- yytext[strlen (yytext) - 2] = '\0';
+ /* remove "\\<EOL>" */
+ if ('\r' == yytext[len - 2])
+ len -= 3;
+ else
+ len -= 2;
+ yytext[len] = '\0';
ml_append (yytext);
BEGIN (ML);
}
<ML>^{WHITE_SPACE}+ {/* remove leading white-space */}
-<ML>{NON_WHITE_SPACE}{QUOTED_STRING}\\\n {
- /* remove "\\\n" */
- yytext[strlen (yytext) - 2] = '\0';
+<ML>{NON_WHITE_SPACE}{QUOTED_STRING}\\{EOL} {
+ int len = strlen (yytext);
+
+ /* remove "\\<EOL>" */
+ if ('\r' == yytext[len - 2])
+ len -= 3;
+ else
+ len -= 2;
+ yytext[len] = '\0';
ml_append(yytext);
}