Skip to content

Commit

Permalink
Fixed|libcore|Info: Correct handling of value-terminating semicolons
Browse files Browse the repository at this point in the history
An optional semicolon may follow a key-value assignment when using
the single-token `=` syntax.
  • Loading branch information
skyjake committed Dec 20, 2015
1 parent 32e1e2a commit f11dae9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions doomsday/sdk/libcore/src/data/info.cpp
Expand Up @@ -30,7 +30,7 @@ namespace de {

static QString const WHITESPACE = " \t\r\n";
static QString const WHITESPACE_OR_COMMENT = " \t\r\n#";
static QString const TOKEN_BREAKING_CHARS = "#:=$(){}<>,\"" + WHITESPACE;
static QString const TOKEN_BREAKING_CHARS = "#:=$(){}<>,;\"" + WHITESPACE;
static QString const INCLUDE_TOKEN = "@include";
static QString const SCRIPT_TOKEN = "script";

Expand Down Expand Up @@ -323,6 +323,8 @@ DENG2_PIMPL(Info)
* first token of the value. Values come in different flavours:
* - single token
* - string literal (can be split)
*
* An optional semicolon may follow a value.
*/
InfoValue parseValue()
{
Expand All @@ -347,8 +349,12 @@ DENG2_PIMPL(Info)
else
{
// Then it must be a single token.
value = peekToken();
nextToken();
if(peekToken() != ";")
{
value = peekToken();
nextToken();
if(peekToken() == ";") nextToken(); // Ignore the semicolon.
}
}
return value;
}
Expand Down

0 comments on commit f11dae9

Please sign in to comment.