summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2018-09-26 00:40:31 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2019-02-22 23:12:41 +0100
commite7a3efd842dc8626e93c34af99f61a3880bf87f2 (patch)
treec06ceebbdb4ee5271dc13acae6a6d178f2a8a138 /conf
parentd9dd3cff349a09af9dd97cd6595f9815ff7eb815 (diff)
Support multi-line strings
Diffstat (limited to 'conf')
-rw-r--r--conf/cf-lex.l14
1 files changed, 13 insertions, 1 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l
index 9bbb3660..920d258e 100644
--- a/conf/cf-lex.l
+++ b/conf/cf-lex.l
@@ -112,7 +112,7 @@ static int check_eof(void);
%option nounput
%option noreject
-%x COMMENT CCOMM CLI
+%x COMMENT CCOMM CLI MULTISTRING
ALPHA [a-zA-Z_]
DIGIT [0-9]
@@ -308,6 +308,18 @@ else: {
return TEXT;
}
+\"\"\" BEGIN(MULTISTRING);
+<MULTISTRING>\"\"\" {
+ yytext[yyleng-3] = 0;
+ cf_lval.t = cfg_strdup(yytext);
+ yytext[yyleng-3] = '\"';
+ BEGIN(INITIAL);
+ return TEXT;
+}
+<MULTISTRING><<EOF>> cf_error("Unterminated multi-line string");
+<MULTISTRING>\n ifs->lino++; ifs->chno = 0; yymore();
+<MULTISTRING>. yymore();
+
["][^"\n]*\n cf_error("Unterminated string");
<INITIAL,COMMENT><<EOF>> { if (check_eof()) return END; }