1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix(std/toml): parser error with inline comments (#6942)

This commit is contained in:
Jarrett Helton 2020-08-03 13:26:02 -04:00 committed by GitHub
parent e9d713c007
commit d615ebefe2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View file

@ -1,3 +1,4 @@
[boolean] # i hate comments
bool1 = true
bool2 = false
bool3 = true # I love comments

View file

@ -280,7 +280,7 @@ class Parser {
return dataString.slice(0, endOfString);
}
const m = /(?:|\[|{|).*(?:|\]||})\s*[^#]/g.exec(dataString);
const m = /(?:|\[|{).*(?:|\]|})\s*^((?!#).)*/g.exec(dataString);
if (m) {
return m[0].trim();
} else {

View file

@ -48,7 +48,7 @@ Deno.test({
Deno.test({
name: "[TOML] Boolean",
fn(): void {
const expected = { boolean: { bool1: true, bool2: false } };
const expected = { boolean: { bool1: true, bool2: false, bool3: true } };
const actual = parseFile(path.join(testFilesDir, "boolean.toml"));
assertEquals(actual, expected);
},