Skip to content

Commit

Permalink
Do not accept closing comma for configuration files
Browse files Browse the repository at this point in the history
  • Loading branch information
yanex committed Feb 5, 2019
1 parent e114ebf commit f03c5f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion marco/parser/MarcoParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ internal class MarcoParser {

guard try !parseCommaSeparatorIfPresent(&children) else { continue }

guard try parseStructuralIfPresent(.rightCurlyBracket, &children) else { break }
if (withBrackets) {
guard try parseStructuralIfPresent(.rightCurlyBracket, &children) else { break }
}

if (whitespaceBeforeKey == nil && !keyMappings.isEmpty) {
try throwOrRecord(state.error("Whitespace required between object entries"))
Expand Down
11 changes: 11 additions & 0 deletions marcoTests/testData/error/object15.marcoConfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--before
foo {
a 1
}}

--after
15: Whitespace required between object entries

foo {
a 1
}💥

0 comments on commit f03c5f8

Please sign in to comment.