Open fstirlitz opened 5 years ago
I think I am going to solve this and #9 in one go. In other words, I will create a callback that shall receive diagnostics from the parser as a structured object; if the callback is absent, the parser will fall back to throwing a SyntaxError
as before.
As of 6f8a7ea28c04f4e31d6ab88b9ce56f39359589d9, the error type thrown by the parser is exported as a SyntaxError
export. Users are encouraged to use that export instead of directly referring to the engine’s SyntaxError
to detect errors thrown by luaparse, to minimise future breakage.
The
SyntaxError
type is reserved for errors raised by the host runtime (i.e. JavaScript), not errors raised by user code. UsingSyntaxError
to signal errors in inputs to the Lua parser causes problems in some engines, like the one worked around in 8536fdfafc7b1823d16e3012ad0ba26dbc795d5b.Fixing this will be a breaking change, given that some downstream users already rely on the error to be an instance of
SyntaxError
, e.g. the ACE editor.Related PR: #33.