Skip to content

Commit

Permalink
configparser: allow multiple quotes in one line
Browse files Browse the repository at this point in the history
  • Loading branch information
franku committed Aug 27, 2020
1 parent f75dc5b commit 5c1e664
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions core/src/lib/lex.cc
Expand Up @@ -585,6 +585,17 @@ static bool NextLineContinuesWithQuotes(LEX* lf)
return false;
}

static bool CurrentLineContinuesWithQuotes(LEX* lf)
{
int i = lf->col_no;
while (lf->line[i] != '\0') {
if (lf->line[i] == '"') { return true; }
if (lf->line[i] != ' ' && lf->line[i] != '\t') { return false; }
++i;
};
return false;
}

/*
*
* Get the next token from the input
Expand Down Expand Up @@ -647,10 +658,7 @@ int LexGetToken(LEX* lf, int expect)
BeginStr(lf, ch);
break;
case ' ':
if (continue_string) {
//
continue;
}
if (continue_string) { continue; }
break;
case '"':
lf->state = lex_quoted_string;
Expand Down Expand Up @@ -810,7 +818,8 @@ int LexGetToken(LEX* lf, int expect)
break;
}
if (ch == '"') {
if (NextLineContinuesWithQuotes(lf)) {
if (NextLineContinuesWithQuotes(lf) ||
CurrentLineContinuesWithQuotes(lf)) {
continue_string = true;
lf->state = lex_none;
continue;
Expand Down

0 comments on commit 5c1e664

Please sign in to comment.