titan-lang / titan

The Titan programming language

Home Page:http://titan-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Large decimal string escapes crash the compiler

hugomg opened this issue · comments

If a three-digit decimal string escape is too large (greater than 255) it will crash the compiler with an uncaught exception (bad argument to string.char). For example, the following program crashes titanc when we try to compile it

function f(): string
    return "\555"
end

Ideally we should detect this and raise an MalformedEscape_decimal parsing error. This would be super easy to do if lpeglabel implemented this feature request of mine but I think it should also be possible to implement without that.