Chunk name is chunked on reporting a lexer error #64
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When you introduce some lexer error in a module source, for example accidentally input a non-english character inside the code, like a Chinese or a Cyrillic one, the lexer fails and reports the error via the https://github.com/luaj/luaj/blob/master/src/core/org/luaj/vm2/compiler/LexState.java#L261 method. This method tries to print the module name or path where the error occured.
However, if the path to the module is too long, it gets chopped at 80 characters because the method https://github.com/luaj/luaj/blob/master/src/core/org/luaj/vm2/Lua.java#L346 that is used to create the error string cuts the module name for the length specified by https://github.com/luaj/luaj/blob/master/src/core/org/luaj/vm2/Lua.java#L344 which is 80 characters.
This artificial limitation is not needed at all and effectively prevents seeing in what file exactly did the error occur.
My proposal is to increase the length of the string like that: