Skip to content

Commit

Permalink
Fix bug: syntax error with list with no ending semicolon
Browse files Browse the repository at this point in the history
This bug was caused when a list with no ending semicolon was followed
directly by another setting.

We were eating the next token after a list, which if it was a newline,
means when we go to check that the next value is a newline or semicolon,
we get a syntax error.

Resolves #29
  • Loading branch information
brettlangdon committed Feb 26, 2016
1 parent 0b2bf8e commit 12d49ac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions forge_test.go
Expand Up @@ -42,6 +42,13 @@ primary {
key = "primary sub key value";
include "./test_include.cfg";
}
sub_section {
# Testing of a special case that had previous caused failures
# Was caused by an array with no ending semicolon, followed directly by another setting
nested_array_no_semi_colon = ["a", "b"]
another = true
}
}
secondary {
Expand Down
1 change: 1 addition & 0 deletions parser.go
Expand Up @@ -193,6 +193,7 @@ func (parser *Parser) parseSettingValue() (Value, error) {
}
value = NewList()
value.UpdateValue(listVal)
readNext = false
default:
return value, parser.syntaxError(
fmt.Sprintf("expected STRING, INTEGER, FLOAT, BOOLEAN or IDENTIFIER, instead found %s", parser.curTok.ID),
Expand Down
7 changes: 7 additions & 0 deletions test.cfg
Expand Up @@ -31,6 +31,13 @@ primary {
key = "primary sub key value";
include "./test_include.cfg";
}

sub_section {
# Testing of a special case that had previous caused failures
# Was caused by an array with no ending semicolon, followed directly by another setting
nested_array_no_semi_colon = ["a", "b"]
another = true
}
}

secondary {
Expand Down

0 comments on commit 12d49ac

Please sign in to comment.