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:
parent
e9d713c007
commit
d615ebefe2
3 changed files with 4 additions and 3 deletions
3
std/encoding/testdata/boolean.toml
vendored
3
std/encoding/testdata/boolean.toml
vendored
|
@ -1,3 +1,4 @@
|
|||
[boolean] # i hate comments
|
||||
bool1 = true
|
||||
bool2 = false
|
||||
bool2 = false
|
||||
bool3 = true # I love comments
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue