Merge: parser_util: drop injected tokens in `parse_someting`
authorJean Privat <jean@pryen.org>
Tue, 13 May 2014 02:02:14 +0000 (22:02 -0400)
committerJean Privat <jean@pryen.org>
Tue, 13 May 2014 02:02:14 +0000 (22:02 -0400)
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>

1  2 
src/parser_util.nit

@@@ -156,7 -156,8 +156,8 @@@ redef class ToolContex
                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