mirror of
https://github.com/lightbend/config.git
synced 2025-03-18 13:20:23 +08:00
Fix same-line comments bug in ConfigDocumentParser
Fix bug wherein putting a comment on the same line as a value would cause an exception to be thrown by the ConfigDocumentParser
This commit is contained in:
parent
59981da04d
commit
7aff85dead
@ -104,7 +104,7 @@ final class ConfigDocumentParser {
|
||||
boolean sawSeparatorOrNewline = false;
|
||||
Token t = nextToken();
|
||||
while (true) {
|
||||
if (Tokens.isIgnoredWhitespace(t) || isUnquotedWhitespace(t)) {
|
||||
if (Tokens.isIgnoredWhitespace(t) || isUnquotedWhitespace(t) || Tokens.isComment(t)) {
|
||||
//do nothing
|
||||
} else if (Tokens.isNewline(t)) {
|
||||
sawSeparatorOrNewline = true;
|
||||
|
@ -165,11 +165,11 @@ class ConfigDocumentParserTest extends TestUtils {
|
||||
c: 13
|
||||
d: {
|
||||
a: 22
|
||||
b: "abcdefg"
|
||||
b: "abcdefg" # this is a comment
|
||||
c: [1, 2, 3]
|
||||
}
|
||||
}
|
||||
},
|
||||
}, # this was an object in an array
|
||||
//The above value is a map containing a map containing a map, all in an array
|
||||
22,
|
||||
// The below value is an array contained in another array
|
||||
|
Loading…
Reference in New Issue
Block a user