mirror of
https://github.com/lightbend/config.git
synced 2025-03-22 15:20:26 +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;
|
boolean sawSeparatorOrNewline = false;
|
||||||
Token t = nextToken();
|
Token t = nextToken();
|
||||||
while (true) {
|
while (true) {
|
||||||
if (Tokens.isIgnoredWhitespace(t) || isUnquotedWhitespace(t)) {
|
if (Tokens.isIgnoredWhitespace(t) || isUnquotedWhitespace(t) || Tokens.isComment(t)) {
|
||||||
//do nothing
|
//do nothing
|
||||||
} else if (Tokens.isNewline(t)) {
|
} else if (Tokens.isNewline(t)) {
|
||||||
sawSeparatorOrNewline = true;
|
sawSeparatorOrNewline = true;
|
||||||
|
@ -165,11 +165,11 @@ class ConfigDocumentParserTest extends TestUtils {
|
|||||||
c: 13
|
c: 13
|
||||||
d: {
|
d: {
|
||||||
a: 22
|
a: 22
|
||||||
b: "abcdefg"
|
b: "abcdefg" # this is a comment
|
||||||
c: [1, 2, 3]
|
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
|
//The above value is a map containing a map containing a map, all in an array
|
||||||
22,
|
22,
|
||||||
// The below value is an array contained in another array
|
// The below value is an array contained in another array
|
||||||
|
Loading…
Reference in New Issue
Block a user