Include file name in parse error message

Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
This commit is contained in:
Donald Hunter 2024-05-22 19:39:21 +01:00
parent 55b85080f0
commit d31a96a3c0

View file

@ -241,7 +241,7 @@ func (d *Document) parseOne(i int, stop stopFn) (consumed int, node Node) {
if consumed != 0 { if consumed != 0 {
return consumed, node return consumed, node
} }
d.Log.Printf("Could not parse token %#v: Falling back to treating it as plain text.", d.tokens[i]) d.Log.Printf("Could not parse token %#v in file %s: Falling back to treating it as plain text.", d.tokens[i], d.Path)
m := plainTextRegexp.FindStringSubmatch(d.tokens[i].matches[0]) m := plainTextRegexp.FindStringSubmatch(d.tokens[i].matches[0])
d.tokens[i] = token{"text", len(m[1]), m[2], m} d.tokens[i] = token{"text", len(m[1]), m[2], m}
return d.parseOne(i, stop) return d.parseOne(i, stop)