Since injected tokens have a false location, highlight.nit had a bad
behavior when trying to color them.
Thez should not survive `parse_something`.
Fixes #451
Pull-Request: #453
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
tree = (new Parser(lexer)).parse
eof = tree.n_eof
if not eof isa AError then
- var nblock = tree.n_base.n_classdefs.first.n_propdefs.first.as(AMethPropdef).n_block.as(ABlockExpr).n_expr.first.as(ADoExpr).n_block.as(not null)
- var nblock = tree.n_base.n_classdefs.first.n_propdefs.first.as(AMainMethPropdef).n_block.as(ABlockExpr).n_expr.first.as(ADoExpr).n_block.as(ABlockExpr)
++ var nblock = tree.n_base.n_classdefs.first.n_propdefs.first.as(AMethPropdef).n_block.as(ABlockExpr).n_expr.first.as(ADoExpr).n_block.as(ABlockExpr)
+ nblock.n_kwend = null # drop injected token
return nblock
end
if eof.location > error.location then error = eof