djot.lua icon indicating copy to clipboard operation
djot.lua copied to clipboard

Improve source position in parsing warnings

Open Omikhleia opened this issue 1 year ago • 1 comments

A mere space error:

...
... some text {.class}

Yields a warning:

{
  message = "Ignoring unattached attribute",
  pos = 30
}

Where pos is the byte position. When the sourcepos map is enabled, it would be handy to have the usual line:col:charpos in warnings, as we can have on nodes, for easier investigation by the typist.

Omikhleia avatar Jan 28 '24 13:01 Omikhleia

~~Conversely having the bytepos kept in nodes could be useful to extract the offending substring.~~ Oh wait is has the UTF charpos, so it's sufficient.

Omikhleia avatar Jan 28 '24 18:01 Omikhleia