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:
Preben Ingvaldsen 2015-03-25 11:25:48 -07:00
parent 59981da04d
commit 7aff85dead
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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