diff --git a/conf/lex.go b/conf/lex.go index 6290826f..2308ea22 100644 --- a/conf/lex.go +++ b/conf/lex.go @@ -236,12 +236,9 @@ func lexTopValueEnd(lx *lexer) stateFn { } lx.backup() fallthrough - case isWhitespace(r) || r == optValTerm: + case isWhitespace(r): return lexTopValueEnd - case isNL(r): - lx.ignore() - return lexTop - case r == eof: + case isNL(r) || r == eof || r == optValTerm: lx.ignore() return lexTop } diff --git a/conf/lex_test.go b/conf/lex_test.go index ad1b4701..2ae21bb0 100644 --- a/conf/lex_test.go +++ b/conf/lex_test.go @@ -332,6 +332,21 @@ func TestOptionalSemicolons(t *testing.T) { expect(t, lx, expectedItems) } +func TestSemicolonChaining(t *testing.T) { + expectedItems := []item{ + {itemKey, "foo", 1}, + {itemString, "1", 1}, + {itemKey, "bar", 1}, + {itemFloat, "2.2", 1}, + {itemKey, "baz", 1}, + {itemBool, "true", 1}, + {itemEOF, "", 1}, + } + + lx := lex("foo='1'; bar=2.2; baz=true;") + expect(t, lx, expectedItems) +} +