tools: add 'Location' class to use in AST and errors
authorJean-Sebastien Gelinas <calestar@gmail.com>
Fri, 10 Jul 2009 20:54:13 +0000 (16:54 -0400)
committerJean Privat <jean@pryen.org>
Fri, 10 Jul 2009 21:37:27 +0000 (17:37 -0400)
Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

55 files changed:
src/mmloader.nit
src/parser/lexer.nit
src/parser/parser.nit
src/parser/parser_abs.nit
src/parser/parser_nodes.nit
src/parser/parser_prod.nit
src/parser/xss/lexer.xss
src/parser/xss/main.xss
src/parser/xss/nodes.xss
src/parser/xss/parser.xss
tests/sav/base_closure6.sav
tests/sav/base_closure6_alt1.sav
tests/sav/base_closure_default2_alt6.sav
tests/sav/base_gen2_alt2.sav
tests/sav/base_gen2_alt4.sav
tests/sav/base_gen_alt1.sav
tests/sav/base_gen_int_alt1.sav
tests/sav/base_if_expr_alt1.sav
tests/sav/base_nullable_alt2.sav
tests/sav/base_nullable_alt4.sav
tests/sav/base_var_assignment_flow_alt1.sav
tests/sav/base_var_assignment_flow_alt4.sav
tests/sav/base_var_assignment_flow_alt5.sav
tests/sav/base_var_assignment_flow_alt6.sav
tests/sav/base_virtual_type5_alt1.sav
tests/sav/base_virtual_type7.sav
tests/sav/base_virtual_type_alt2.sav
tests/sav/base_virtual_type_alt3.sav
tests/sav/base_virtual_type_self.fail
tests/sav/base_virtual_type_self_alt1.fail
tests/sav/base_virtual_type_self_alt2.fail
tests/sav/base_virtual_type_self_alt3.fail
tests/sav/base_virtual_type_self_alt4.fail
tests/sav/base_virtual_type_self_alt5.fail
tests/sav/error_array_ambig.sav
tests/sav/error_expr_not_ok.sav
tests/sav/error_expr_not_ok_alt1.sav
tests/sav/error_expr_not_ok_alt2.sav
tests/sav/error_expr_not_ok_alt3.sav
tests/sav/error_expr_not_ok_alt4.sav
tests/sav/error_expr_not_ok_alt5.sav
tests/sav/error_for_coll.sav
tests/sav/error_if_bool.sav
tests/sav/error_left_bool.sav
tests/sav/error_loop_bool_while.sav
tests/sav/error_right_bool.sav
tests/sav/error_type_not_ok.sav
tests/sav/error_type_not_ok2.sav
tests/sav/error_type_not_ok3.sav
tests/sav/error_type_not_ok4.sav
tests/sav/error_type_not_ok5.sav
tests/sav/error_unk_class.sav
tests/sav/test_array_comb_alt1.sav
tests/sav/test_array_comb_alt2.sav
tests/sav/test_combined_assignment_alt1.sav

index 0288e49..17066c4 100644 (file)
@@ -2,6 +2,7 @@
 #
 # Copyright 2006-2008 Floréal Morandat <morandat@lirmm.fr>
 # Copyright 2008 Jean Privat <jean@pryen.org>
+# Copyright 2009 Jean-Sebastien Gelinas <calestar@gmail.com>
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -21,6 +22,26 @@ package mmloader
 import metamodel
 import opts
 
+class Location
+       readable var _file: String
+       readable var _line_start: Int
+       readable var _line_end: Int
+       readable var _column_start: Int
+       readable var _column_end: Int
+
+       redef meth to_s: String do
+               if line_start == line_end then
+                       if column_start == column_end then
+                               return "{file}:{line_start},{column_start}"
+                       else
+                               return "{file}:{line_start},{column_start}--{column_end}"
+                       end
+               else
+                       return "{file}:{line_start},{column_start}--{line_end}:{column_end}"
+               end
+       end
+end
+
 # Global context for tools
 class ToolContext
 special MMContext
index 2949034..352c1e1 100644 (file)
@@ -2,7 +2,7 @@
 # This file was generated by SableCC (http://www.sablecc.org/).
 package lexer
 
-import parser_nodes
+intrude import parser_nodes
 
 redef class Token
     readable writable var _text: String 
@@ -1496,6 +1496,7 @@ class Lexer
                                        if accept_token == 1 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TEol.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1504,6 +1505,7 @@ class Lexer
                                        if accept_token == 2 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TComment.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1511,6 +1513,7 @@ class Lexer
                                        end
                                        if accept_token == 3 then
                                                var token = new TKwpackage.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1518,6 +1521,7 @@ class Lexer
                                        end
                                        if accept_token == 4 then
                                                var token = new TKwimport.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1525,6 +1529,7 @@ class Lexer
                                        end
                                        if accept_token == 5 then
                                                var token = new TKwclass.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1532,6 +1537,7 @@ class Lexer
                                        end
                                        if accept_token == 6 then
                                                var token = new TKwabstract.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1539,6 +1545,7 @@ class Lexer
                                        end
                                        if accept_token == 7 then
                                                var token = new TKwinterface.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1546,6 +1553,7 @@ class Lexer
                                        end
                                        if accept_token == 8 then
                                                var token = new TKwuniversal.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1553,6 +1561,7 @@ class Lexer
                                        end
                                        if accept_token == 9 then
                                                var token = new TKwspecial.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1560,6 +1569,7 @@ class Lexer
                                        end
                                        if accept_token == 10 then
                                                var token = new TKwend.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1568,6 +1578,7 @@ class Lexer
                                        if accept_token == 11 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TKwmeth.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1575,6 +1586,7 @@ class Lexer
                                        end
                                        if accept_token == 12 then
                                                var token = new TKwtype.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1582,6 +1594,7 @@ class Lexer
                                        end
                                        if accept_token == 13 then
                                                var token = new TKwattr.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1589,6 +1602,7 @@ class Lexer
                                        end
                                        if accept_token == 14 then
                                                var token = new TKwinit.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1596,6 +1610,7 @@ class Lexer
                                        end
                                        if accept_token == 15 then
                                                var token = new TKwredef.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1603,6 +1618,7 @@ class Lexer
                                        end
                                        if accept_token == 16 then
                                                var token = new TKwis.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1610,6 +1626,7 @@ class Lexer
                                        end
                                        if accept_token == 17 then
                                                var token = new TKwdo.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1617,6 +1634,7 @@ class Lexer
                                        end
                                        if accept_token == 18 then
                                                var token = new TKwreadable.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1624,6 +1642,7 @@ class Lexer
                                        end
                                        if accept_token == 19 then
                                                var token = new TKwwritable.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1631,6 +1650,7 @@ class Lexer
                                        end
                                        if accept_token == 20 then
                                                var token = new TKwvar.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1638,6 +1658,7 @@ class Lexer
                                        end
                                        if accept_token == 21 then
                                                var token = new TKwintern.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1645,6 +1666,7 @@ class Lexer
                                        end
                                        if accept_token == 22 then
                                                var token = new TKwextern.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1652,6 +1674,7 @@ class Lexer
                                        end
                                        if accept_token == 23 then
                                                var token = new TKwprotected.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1659,6 +1682,7 @@ class Lexer
                                        end
                                        if accept_token == 24 then
                                                var token = new TKwprivate.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1666,6 +1690,7 @@ class Lexer
                                        end
                                        if accept_token == 25 then
                                                var token = new TKwintrude.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1673,6 +1698,7 @@ class Lexer
                                        end
                                        if accept_token == 26 then
                                                var token = new TKwif.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1680,6 +1706,7 @@ class Lexer
                                        end
                                        if accept_token == 27 then
                                                var token = new TKwthen.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1687,6 +1714,7 @@ class Lexer
                                        end
                                        if accept_token == 28 then
                                                var token = new TKwelse.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1694,6 +1722,7 @@ class Lexer
                                        end
                                        if accept_token == 29 then
                                                var token = new TKwwhile.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1701,6 +1730,7 @@ class Lexer
                                        end
                                        if accept_token == 30 then
                                                var token = new TKwfor.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1708,6 +1738,7 @@ class Lexer
                                        end
                                        if accept_token == 31 then
                                                var token = new TKwin.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1715,6 +1746,7 @@ class Lexer
                                        end
                                        if accept_token == 32 then
                                                var token = new TKwand.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1722,6 +1754,7 @@ class Lexer
                                        end
                                        if accept_token == 33 then
                                                var token = new TKwor.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1729,6 +1762,7 @@ class Lexer
                                        end
                                        if accept_token == 34 then
                                                var token = new TKwnot.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1736,6 +1770,7 @@ class Lexer
                                        end
                                        if accept_token == 35 then
                                                var token = new TKwreturn.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1743,6 +1778,7 @@ class Lexer
                                        end
                                        if accept_token == 36 then
                                                var token = new TKwcontinue.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1750,6 +1786,7 @@ class Lexer
                                        end
                                        if accept_token == 37 then
                                                var token = new TKwbreak.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1757,6 +1794,7 @@ class Lexer
                                        end
                                        if accept_token == 38 then
                                                var token = new TKwabort.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1764,6 +1802,7 @@ class Lexer
                                        end
                                        if accept_token == 39 then
                                                var token = new TKwassert.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1771,6 +1810,7 @@ class Lexer
                                        end
                                        if accept_token == 40 then
                                                var token = new TKwnew.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1778,6 +1818,7 @@ class Lexer
                                        end
                                        if accept_token == 41 then
                                                var token = new TKwisa.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1785,6 +1826,7 @@ class Lexer
                                        end
                                        if accept_token == 42 then
                                                var token = new TKwonce.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1792,6 +1834,7 @@ class Lexer
                                        end
                                        if accept_token == 43 then
                                                var token = new TKwsuper.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1799,6 +1842,7 @@ class Lexer
                                        end
                                        if accept_token == 44 then
                                                var token = new TKwself.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1806,6 +1850,7 @@ class Lexer
                                        end
                                        if accept_token == 45 then
                                                var token = new TKwtrue.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1813,6 +1858,7 @@ class Lexer
                                        end
                                        if accept_token == 46 then
                                                var token = new TKwfalse.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1820,6 +1866,7 @@ class Lexer
                                        end
                                        if accept_token == 47 then
                                                var token = new TKwnull.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1827,6 +1874,7 @@ class Lexer
                                        end
                                        if accept_token == 48 then
                                                var token = new TKwas.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1834,6 +1882,7 @@ class Lexer
                                        end
                                        if accept_token == 49 then
                                                var token = new TKwwith.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1841,6 +1890,7 @@ class Lexer
                                        end
                                        if accept_token == 50 then
                                                var token = new TKwnullable.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1848,6 +1898,7 @@ class Lexer
                                        end
                                        if accept_token == 51 then
                                                var token = new TKwisset.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1855,6 +1906,7 @@ class Lexer
                                        end
                                        if accept_token == 52 then
                                                var token = new TOpar.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1862,6 +1914,7 @@ class Lexer
                                        end
                                        if accept_token == 53 then
                                                var token = new TCpar.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1869,6 +1922,7 @@ class Lexer
                                        end
                                        if accept_token == 54 then
                                                var token = new TObra.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1876,6 +1930,7 @@ class Lexer
                                        end
                                        if accept_token == 55 then
                                                var token = new TCbra.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1883,6 +1938,7 @@ class Lexer
                                        end
                                        if accept_token == 56 then
                                                var token = new TComma.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1890,6 +1946,7 @@ class Lexer
                                        end
                                        if accept_token == 57 then
                                                var token = new TColumn.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1897,6 +1954,7 @@ class Lexer
                                        end
                                        if accept_token == 58 then
                                                var token = new TQuad.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1904,6 +1962,7 @@ class Lexer
                                        end
                                        if accept_token == 59 then
                                                var token = new TAssign.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1911,6 +1970,7 @@ class Lexer
                                        end
                                        if accept_token == 60 then
                                                var token = new TPluseq.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1918,6 +1978,7 @@ class Lexer
                                        end
                                        if accept_token == 61 then
                                                var token = new TMinuseq.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1925,6 +1986,7 @@ class Lexer
                                        end
                                        if accept_token == 62 then
                                                var token = new TDotdotdot.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1932,6 +1994,7 @@ class Lexer
                                        end
                                        if accept_token == 63 then
                                                var token = new TDotdot.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1939,6 +2002,7 @@ class Lexer
                                        end
                                        if accept_token == 64 then
                                                var token = new TDot.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1946,6 +2010,7 @@ class Lexer
                                        end
                                        if accept_token == 65 then
                                                var token = new TPlus.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1953,6 +2018,7 @@ class Lexer
                                        end
                                        if accept_token == 66 then
                                                var token = new TMinus.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1960,6 +2026,7 @@ class Lexer
                                        end
                                        if accept_token == 67 then
                                                var token = new TStar.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1967,6 +2034,7 @@ class Lexer
                                        end
                                        if accept_token == 68 then
                                                var token = new TSlash.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1974,6 +2042,7 @@ class Lexer
                                        end
                                        if accept_token == 69 then
                                                var token = new TPercent.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1981,6 +2050,7 @@ class Lexer
                                        end
                                        if accept_token == 70 then
                                                var token = new TEq.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1988,6 +2058,7 @@ class Lexer
                                        end
                                        if accept_token == 71 then
                                                var token = new TNe.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -1995,6 +2066,7 @@ class Lexer
                                        end
                                        if accept_token == 72 then
                                                var token = new TLt.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2002,6 +2074,7 @@ class Lexer
                                        end
                                        if accept_token == 73 then
                                                var token = new TLe.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2009,6 +2082,7 @@ class Lexer
                                        end
                                        if accept_token == 74 then
                                                var token = new TGt.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2016,6 +2090,7 @@ class Lexer
                                        end
                                        if accept_token == 75 then
                                                var token = new TGe.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2023,6 +2098,7 @@ class Lexer
                                        end
                                        if accept_token == 76 then
                                                var token = new TStarship.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2031,6 +2107,7 @@ class Lexer
                                        if accept_token == 77 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TClassid.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2039,6 +2116,7 @@ class Lexer
                                        if accept_token == 78 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TId.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2047,6 +2125,7 @@ class Lexer
                                        if accept_token == 79 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TAttrid.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2055,6 +2134,7 @@ class Lexer
                                        if accept_token == 80 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TNumber.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2063,6 +2143,7 @@ class Lexer
                                        if accept_token == 81 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TFloat.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2071,6 +2152,7 @@ class Lexer
                                        if accept_token == 82 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TChar.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2079,6 +2161,7 @@ class Lexer
                                        if accept_token == 83 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TString.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2087,6 +2170,7 @@ class Lexer
                                        if accept_token == 84 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TStartString.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2095,6 +2179,7 @@ class Lexer
                                        if accept_token == 85 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TMidString.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2103,6 +2188,7 @@ class Lexer
                                        if accept_token == 86 then
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new TEndString.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                push_back(accept_length)
                                                _pos = accept_pos
                                                _line = accept_line
@@ -2111,9 +2197,11 @@ class Lexer
                                else
                                        if _text.length > 0 then
                                                var token = new PError.init_error(_filename, start_line + 1, start_pos + 1, "Unknown token: {_text}")
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                return token
                                        else
                                                var token = new EOF(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                return token
                                        end
                                end
index 3f668cf..51181be 100644 (file)
@@ -2,7 +2,7 @@
 # This file was generated by SableCC (http://www.sablecc.org/). 
 package parser
 
-import parser_prod
+intrude import parser_prod
 intrude import parser_tables
 
 # State of the parser automata as stored in the parser stack.
@@ -146,6 +146,7 @@ special ParserTable
                                return node
                        else if action_type == 3 then # ERROR
                                var node2 = new PError.init_error(lexer.filename, last_line, last_pos, error_messages[errors[action_value]])
+                               node2._location = new Location(lexer.filename, last_line, last_line, last_pos, last_pos)
                                var node = new Start(null, node2)
                                return node
                        end
@@ -919,6 +920,20 @@ special Visitor
                        _untokenned_nodes.add(n)
                        n.visit_all(self)
                        n.last_token = _last_token
+
+                       if n.first_token != null then
+                               var start_location = n.first_token.location
+                               var end_location = _last_token.location
+
+                               if start_location != null and end_location != null then
+                                       var file = end_location.file
+                                       var line_start = start_location.line_start
+                                       var line_end = end_location.line_end
+                                       var column_start = start_location.column_start
+                                       var column_end = end_location.column_end
+                                       n._location = new Location(file, line_start, line_end, column_start, column_end)
+                               end
+                       end
                end
        end
        init
index 95e93fa..21e3055 100644 (file)
@@ -2,8 +2,11 @@
 # This file was generated by SableCC (http://www.sablecc.org/). 
 package parser_abs
 
+import mmloader
+
 # Root of the AST hierarchy
 abstract class PNode
+       readable var _location: nullable Location
 end
 
 # Ancestor of all tokens
index 5ddd64c..ddecf3e 100644 (file)
@@ -2,8 +2,11 @@
 # This file was generated by SableCC (http://www.sablecc.org/). 
 package parser_nodes
 
+import mmloader
+
 # Root of the AST hierarchy
 abstract class PNode
+       readable var _location: nullable Location
 end
 
 # Ancestor of all tokens
index 46c828b..576dd4f 100644 (file)
@@ -35,7 +35,14 @@ redef class PNode
        fun visit_all_reverse(v: Visitor) is abstract
 
        # Give a human readable location of the node.
-       fun locate: String is abstract
+       fun locate: String
+       do
+               if location == null then
+                       return "????"
+               end
+               return location.to_s
+       end
+
 
        # Return only the line number of the node
        fun line_number: Int is abstract
@@ -52,11 +59,6 @@ redef class Token
        redef fun visit_all_reverse(v: Visitor) do end
        redef fun replace_child(old_child: PNode, new_child: nullable PNode) do end
 
-       redef fun locate: String
-       do
-               return "{filename}:{line},{pos}"
-       end
-
        redef fun line_number do return line
 end
 
@@ -67,28 +69,13 @@ redef class Prod
        # The last token of the production node
        readable writable var _last_token: nullable Token
 
-       redef fun locate: String
-       do
-               if first_token == null then
-                       return "????"
-               end
-               if last_token == null then
-                       return "{first_token.locate}--????"
-               end
-               var lastpos = last_token.pos + last_token.text.length - 1
-               if first_token.line == last_token.line then
-                       return "{first_token.locate}--{lastpos}"
-               else
-                       return "{first_token.locate}--{last_token.line}:{lastpos}"
-               end
-       end
-
        redef fun replace_with(n: PNode)
         do
                 super
                 assert n isa Prod
                 n.first_token = first_token
                 n.last_token = last_token
+                n._location = location
         end
 
        redef fun line_number
index 02ab651..fcec9c6 100644 (file)
@@ -179,9 +179,11 @@ $    if {not(@text)}
 $        if {@parser_index}
                                                var token_text = _text.substring(0, accept_length)
                                                var token = new @ename.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
 $        end
 $    else
                                                var token = new @ename.init_tk(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
 $    end
                                                push_back(accept_length)
                                                _pos = accept_pos
@@ -204,9 +206,11 @@ $ end foreach
                                else
                                        if _text.length > 0 then
                                                var token = new PError.init_error(_filename, start_line + 1, start_pos + 1, "Unknown token: {_text}")
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                return token
                                        else
                                                var token = new EOF(_filename, start_line + 1, start_pos + 1)
+                                               token._location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos)
                                                return token
                                        end
                                end
index dc32b23..a867481 100644 (file)
@@ -27,6 +27,8 @@ $ output 'parser_abs.nit'
 # This file was generated by SableCC (http://www.sablecc.org/). 
 package parser_abs
 
+import mmloader
+
 $ call make_abs_nodes()
 $ call make_abs_tokens()
 $ call make_abs_prods()
@@ -38,9 +40,9 @@ $ output 'lexer.nit'
 package lexer
 
 $ if $usermodule
-import $usermodule
+intrude import $usermodule
 $ else
-import parser_abs
+intrude import parser_abs
 $ end
 $ call make_tokens()
 $ call make_lexer()
@@ -75,7 +77,7 @@ $ output 'parser.nit'
 # This file was generated by SableCC (http://www.sablecc.org/). 
 package parser
 
-import parser_prod
+intrude import parser_prod
 intrude import parser_tables
 $ call make_parser()
 $ end output
index 58b12d7..1382f31 100644 (file)
@@ -19,6 +19,7 @@
 $ template make_abs_nodes()
 # Root of the AST hierarchy
 abstract class PNode
+       readable var _location: nullable Location
 end
 
 # Ancestor of all tokens
@@ -63,7 +64,14 @@ redef class PNode
        fun visit_all_reverse(v: Visitor) is abstract
 
        # Give a human readable location of the node.
-       fun locate: String is abstract
+       fun locate: String
+       do
+               if location == null then
+                       return "????"
+               end
+               return location.to_s
+       end
+
 
        # Return only the line number of the node
        fun line_number: Int is abstract
@@ -80,11 +88,6 @@ redef class Token
        redef fun visit_all_reverse(v: Visitor) do end
        redef fun replace_child(old_child: PNode, new_child: nullable PNode) do end
 
-       redef fun locate: String
-       do
-               return "{filename}:{line},{pos}"
-       end
-
        redef fun line_number do return line
 end
 
@@ -95,28 +98,13 @@ redef class Prod
        # The last token of the production node
        readable writable var _last_token: nullable Token
 
-       redef fun locate: String
-       do
-               if first_token == null then
-                       return "????"
-               end
-               if last_token == null then
-                       return "{first_token.locate}--????"
-               end
-               var lastpos = last_token.pos + last_token.text.length - 1
-               if first_token.line == last_token.line then
-                       return "{first_token.locate}--{lastpos}"
-               else
-                       return "{first_token.locate}--{last_token.line}:{lastpos}"
-               end
-       end
-
        redef fun replace_with(n: PNode)
         do
                 super
                 assert n isa Prod
                 n.first_token = first_token
                 n.last_token = last_token
+                n._location = location
         end
 
        redef fun line_number
index 3ca1bcd..96b88ab 100644 (file)
@@ -159,6 +159,7 @@ special ParserTable
                                return node
                        else if action_type == 3 then # ERROR
                                var node2 = new PError.init_error(lexer.filename, last_line, last_pos, error_messages[errors[action_value]])
+                               node2._location = new Location(lexer.filename, last_line, last_line, last_pos, last_pos)
                                var node = new Start(null, node2)
                                return node
                        end
@@ -197,6 +198,20 @@ special Visitor
                        _untokenned_nodes.add(n)
                        n.visit_all(self)
                        n.last_token = _last_token
+
+                       if n.first_token != null then
+                               var start_location = n.first_token.location
+                               var end_location = _last_token.location
+
+                               if start_location != null and end_location != null then
+                                       var file = end_location.file
+                                       var line_start = start_location.line_start
+                                       var line_end = end_location.line_end
+                                       var column_start = start_location.column_start
+                                       var column_end = end_location.column_end
+                                       n._location = new Location(file, line_start, line_end, column_start, column_end)
+                               end
+                       end
                end
        end
        init
index 2bb3eee..ebd57db 100644 (file)
@@ -1,2 +1,2 @@
-./base_closure6.nit:55,25--25: Type error: no most general type. Got V and U.
-./base_closure6.nit:65,8--8: Type error: no most general type. Got V and U at ./base_closure6.nit:64,8--8.
+./base_closure6.nit:55,25: Type error: no most general type. Got V and U.
+./base_closure6.nit:65,8: Type error: no most general type. Got V and U at ./base_closure6.nit:64,8.
index 12ab6ff..41fc33a 100644 (file)
@@ -1,4 +1,4 @@
 alt/base_closure6_alt1.nit:53,5--25: Type error: expected U, got T
-alt/base_closure6_alt1.nit:55,25--25: Type error: no most general type. Got V and U.
+alt/base_closure6_alt1.nit:55,25: Type error: no most general type. Got V and U.
 alt/base_closure6_alt1.nit:57,5--61:8: Type error: expected U, got T
-alt/base_closure6_alt1.nit:65,8--8: Type error: no most general type. Got V and U at alt/base_closure6_alt1.nit:64,8--8.
+alt/base_closure6_alt1.nit:65,8: Type error: no most general type. Got V and U at alt/base_closure6_alt1.nit:64,8.
index 1cb19a8..c1ca6e5 100644 (file)
@@ -1 +1 @@
-alt/base_closure_default2_alt6.nit:32,3--3: Error: Method or variable 'i' unknown in A.
+alt/base_closure_default2_alt6.nit:32,3: Error: Method or variable 'i' unknown in A.
index 2841441..aa7e26f 100644 (file)
@@ -1 +1 @@
-alt/base_gen2_alt2.nit:62,13--13: Type error: 'B' is a generic class.
+alt/base_gen2_alt2.nit:62,13: Type error: 'B' is a generic class.
index 57b3bc0..926cb78 100644 (file)
@@ -1 +1 @@
-alt/base_gen2_alt4.nit:64,13--13: Type error: 'C' is a generic class.
+alt/base_gen2_alt4.nit:64,13: Type error: 'C' is a generic class.
index 06f16e0..47709e3 100644 (file)
@@ -1 +1 @@
-alt/base_gen_alt1.nit:62,11--11: Type error: expected B, got A
+alt/base_gen_alt1.nit:62,11: Type error: expected B, got A
index e465b69..93cf8fd 100644 (file)
@@ -1 +1 @@
-alt/base_gen_int_alt1.nit:56,11--11: Type error: expected Int, got A
+alt/base_gen_int_alt1.nit:56,11: Type error: expected Int, got A
index a2aa7e9..136c35c 100644 (file)
@@ -1 +1 @@
-alt/base_if_expr_alt1.nit:39,35--35: Type error: no most general type. Got Int and A at alt/base_if_expr_alt1.nit:39,24--28.
+alt/base_if_expr_alt1.nit:39,35: Type error: no most general type. Got Int and A at alt/base_if_expr_alt1.nit:39,24--28.
index ecb4861..65c0daa 100644 (file)
@@ -1 +1 @@
-alt/base_nullable_alt2.nit:37,13--13: Type error: expected A, got Object
+alt/base_nullable_alt2.nit:37,13: Type error: expected A, got Object
index e65bb22..d6ebe3e 100644 (file)
@@ -1 +1 @@
-alt/base_nullable_alt4.nit:41,23--23: Type error: expected nullable A, got Object
+alt/base_nullable_alt4.nit:41,23: Type error: expected nullable A, got Object
index 8f78919..e8b202f 100644 (file)
@@ -1 +1 @@
-alt/base_var_assignment_flow_alt1.nit:34,1--1: Error: variable 'a' is possibly unset.
+alt/base_var_assignment_flow_alt1.nit:34,1: Error: variable 'a' is possibly unset.
index be5fb12..93efbdb 100644 (file)
@@ -1 +1 @@
-alt/base_var_assignment_flow_alt4.nit:45,1--1: Error: variable 'c' is possibly unset.
+alt/base_var_assignment_flow_alt4.nit:45,1: Error: variable 'c' is possibly unset.
index f8078f9..5193452 100644 (file)
@@ -1 +1 @@
-alt/base_var_assignment_flow_alt5.nit:54,1--1: Error: variable 'd' is possibly unset.
+alt/base_var_assignment_flow_alt5.nit:54,1: Error: variable 'd' is possibly unset.
index 23bad0d..903db2a 100644 (file)
@@ -1 +1 @@
-alt/base_var_assignment_flow_alt6.nit:68,1--1: Error: variable 'f' is possibly unset.
+alt/base_var_assignment_flow_alt6.nit:68,1: Error: variable 'f' is possibly unset.
index e409041..99beb9a 100644 (file)
@@ -1 +1 @@
-alt/base_virtual_type5_alt1.nit:26,7--7: Type error: expected nullable U, got Int
+alt/base_virtual_type5_alt1.nit:26,7: Type error: expected nullable U, got Int
index 7d0142c..ad12cff 100644 (file)
@@ -1 +1 @@
-./base_virtual_type7.nit:20,10--10: Type error: circular definition in formal type F.
+./base_virtual_type7.nit:20,10: Type error: circular definition in formal type F.
index b86b1b0..12534ca 100644 (file)
@@ -1 +1 @@
-alt/base_virtual_type_alt2.nit:40,7--7: Type error: expected nullable T, got Int
+alt/base_virtual_type_alt2.nit:40,7: Type error: expected nullable T, got Int
index 991e9ac..e2f44c8 100644 (file)
@@ -1 +1 @@
-alt/base_virtual_type_alt3.nit:43,7--7: Type error: expected nullable T, got B
+alt/base_virtual_type_alt3.nit:43,7: Type error: expected nullable T, got B
index e35355b..da58e30 100644 (file)
@@ -1,4 +1,4 @@
-./base_virtual_type_self.nit:44,3--3: Error: Method or variable 'a' unknown in B.
-./base_virtual_type_self.nit:45,7--7: Error: Method or variable 'a' unknown in B.
-./base_virtual_type_self.nit:46,3--3: Error: Method or variable 'a' unknown in B.
-./base_virtual_type_self.nit:47,7--7: Error: Method or variable 'a' unknown in B.
+./base_virtual_type_self.nit:44,3: Error: Method or variable 'a' unknown in B.
+./base_virtual_type_self.nit:45,7: Error: Method or variable 'a' unknown in B.
+./base_virtual_type_self.nit:46,3: Error: Method or variable 'a' unknown in B.
+./base_virtual_type_self.nit:47,7: Error: Method or variable 'a' unknown in B.
index 1996d7d..443e73a 100644 (file)
@@ -1,4 +1,4 @@
-alt/base_virtual_type_self_alt1.nit:44,9--9: Type error: expected Int, got Float
+alt/base_virtual_type_self_alt1.nit:44,9: Type error: expected Int, got Float
 alt/base_virtual_type_self_alt1.nit:45,7--12: Type error: expected Float, got Int
-alt/base_virtual_type_self_alt1.nit:46,9--9: Type error: expected A[T], got Float
+alt/base_virtual_type_self_alt1.nit:46,9: Type error: expected A[T], got Float
 alt/base_virtual_type_self_alt1.nit:47,7--12: Type error: expected Float, got A[T]
index c55efd8..61faf40 100644 (file)
@@ -1,4 +1,4 @@
-alt/base_virtual_type_self_alt2.nit:44,9--9: Type error: expected Int, got Float
+alt/base_virtual_type_self_alt2.nit:44,9: Type error: expected Int, got Float
 alt/base_virtual_type_self_alt2.nit:45,7--12: Type error: expected Float, got Int
-alt/base_virtual_type_self_alt2.nit:46,9--9: Type error: expected A[T], got Float
+alt/base_virtual_type_self_alt2.nit:46,9: Type error: expected A[T], got Float
 alt/base_virtual_type_self_alt2.nit:47,7--12: Type error: expected Float, got A[T]
index 71d3ee3..2b9d3cd 100644 (file)
@@ -1,4 +1,4 @@
-alt/base_virtual_type_self_alt3.nit:44,9--9: Type error: expected Int, got Float
+alt/base_virtual_type_self_alt3.nit:44,9: Type error: expected Int, got Float
 alt/base_virtual_type_self_alt3.nit:45,7--12: Type error: expected Float, got Int
-alt/base_virtual_type_self_alt3.nit:46,9--9: Type error: expected A[T], got Float
+alt/base_virtual_type_self_alt3.nit:46,9: Type error: expected A[T], got Float
 alt/base_virtual_type_self_alt3.nit:47,7--12: Type error: expected Float, got A[T]
index ab7b629..7e3e5d4 100644 (file)
@@ -1,4 +1,4 @@
-alt/base_virtual_type_self_alt4.nit:44,9--9: Type error: expected A[Int], got Float
+alt/base_virtual_type_self_alt4.nit:44,9: Type error: expected A[Int], got Float
 alt/base_virtual_type_self_alt4.nit:45,7--12: Type error: expected Float, got A[Int]
-alt/base_virtual_type_self_alt4.nit:46,9--9: Type error: expected A[T], got Float
+alt/base_virtual_type_self_alt4.nit:46,9: Type error: expected A[T], got Float
 alt/base_virtual_type_self_alt4.nit:47,7--12: Type error: expected Float, got A[T]
index 71fe8ef..240d628 100644 (file)
@@ -1,4 +1,4 @@
-alt/base_virtual_type_self_alt5.nit:44,9--9: Type error: expected A[U], got Float
+alt/base_virtual_type_self_alt5.nit:44,9: Type error: expected A[U], got Float
 alt/base_virtual_type_self_alt5.nit:45,7--12: Type error: expected Float, got A[U]
-alt/base_virtual_type_self_alt5.nit:46,9--9: Type error: expected A[T], got Float
+alt/base_virtual_type_self_alt5.nit:46,9: Type error: expected A[T], got Float
 alt/base_virtual_type_self_alt5.nit:47,7--12: Type error: expected Float, got A[T]
index e06ed05..f05fdee 100644 (file)
@@ -1 +1 @@
-./error_array_ambig.nit:17,13--15: Type error: no most general type. Got Char and Int at ./error_array_ambig.nit:17,10--10.
+./error_array_ambig.nit:17,13--15: Type error: no most general type. Got Char and Int at ./error_array_ambig.nit:17,10.
index 4cc8ccb..8124b4b 100644 (file)
@@ -19,7 +19,7 @@
 ./error_expr_not_ok.nit:55,1--12: Error: Method or variable 'fail' unknown in Sys.
 ./error_expr_not_ok.nit:58,2--5: Error: Method or variable 'fail' unknown in Sys.
 ./error_expr_not_ok.nit:60,4--7: Error: Method or variable 'fail' unknown in Sys.
-./error_expr_not_ok.nit:60,20--20: Type error: expected A, got Int
+./error_expr_not_ok.nit:60,20: Type error: expected A, got Int
 ./error_expr_not_ok.nit:61,14--17: Error: Method or variable 'fail' unknown in Sys.
 ./error_expr_not_ok.nit:61,24--27: Error: Method or variable 'fail' unknown in Sys.
 ./error_expr_not_ok.nit:62,10--13: Error: Method or variable 'fail' unknown in Sys.
@@ -28,7 +28,7 @@
 ./error_expr_not_ok.nit:64,20--23: Error: Method or variable 'fail' unknown in Sys.
 ./error_expr_not_ok.nit:64,30--33: Error: Method or variable 'fail' unknown in Sys.
 ./error_expr_not_ok.nit:66,7--10: Error: Method or variable 'fail' unknown in Sys.
-./error_expr_not_ok.nit:66,21--21: Type error: expected A, got Int
+./error_expr_not_ok.nit:66,21: Type error: expected A, got Int
 ./error_expr_not_ok.nit:67,15--18: Error: Method or variable 'fail' unknown in Sys.
 ./error_expr_not_ok.nit:69,10--13: Error: Method or variable 'fail' unknown in Sys.
 ./error_expr_not_ok.nit:70,20--23: Error: Method or variable 'fail' unknown in Sys.
index 4db74a4..2c04b73 100644 (file)
@@ -1 +1 @@
-alt/error_expr_not_ok_alt1.nit:32,11: Type error: class Fail not found in module error_expr_not_ok_alt1.
+alt/error_expr_not_ok_alt1.nit:32,11--14: Type error: class Fail not found in module error_expr_not_ok_alt1.
index bd116d2..29648ab 100644 (file)
@@ -3,14 +3,14 @@ alt/error_expr_not_ok_alt2.nit:21,11--14: Error: Method or variable 'fail' unkno
 alt/error_expr_not_ok_alt2.nit:22,26--29: Error: Method or variable 'fail' unknown in A.
 alt/error_expr_not_ok_alt2.nit:24,8--11: Error: Method or variable 'fail' unknown in A.
 alt/error_expr_not_ok_alt2.nit:25,9--12: Error: Method or variable 'fail' unknown in A.
-alt/error_expr_not_ok_alt2.nit:33,11: Type error: class Fail not found in module error_expr_not_ok_alt2.
-alt/error_expr_not_ok_alt2.nit:33,22: Type error: class Fail not found in module error_expr_not_ok_alt2.
+alt/error_expr_not_ok_alt2.nit:33,11--14: Type error: class Fail not found in module error_expr_not_ok_alt2.
+alt/error_expr_not_ok_alt2.nit:33,22--25: Type error: class Fail not found in module error_expr_not_ok_alt2.
 alt/error_expr_not_ok_alt2.nit:40,1--7: Error: Method 'fail' doesn't exists in Int.
 alt/error_expr_not_ok_alt2.nit:42,7--9: Type error: expected A, got Int
 alt/error_expr_not_ok_alt2.nit:43,1--8: Error: Method 'fail' doesn't exists in Int.
-alt/error_expr_not_ok_alt2.nit:60,20--20: Type error: expected A, got Int
+alt/error_expr_not_ok_alt2.nit:60,20: Type error: expected A, got Int
 alt/error_expr_not_ok_alt2.nit:62,7--27: Type error: expected A, got Int
-alt/error_expr_not_ok_alt2.nit:66,21--21: Type error: expected A, got Int
+alt/error_expr_not_ok_alt2.nit:66,21: Type error: expected A, got Int
 alt/error_expr_not_ok_alt2.nit:73,7--18: Type error: expected A, got Bool
 alt/error_expr_not_ok_alt2.nit:74,7--18: Type error: expected A, got Bool
 alt/error_expr_not_ok_alt2.nit:75,7--18: Type error: expected A, got Bool
index 7139349..6c229c3 100644 (file)
@@ -7,9 +7,9 @@ alt/error_expr_not_ok_alt3.nit:34,12--17: Error: Method or variable 'fail' unkno
 alt/error_expr_not_ok_alt3.nit:40,1--7: Error: Method 'fail' doesn't exists in Int.
 alt/error_expr_not_ok_alt3.nit:42,7--9: Type error: expected A, got Int
 alt/error_expr_not_ok_alt3.nit:43,1--8: Error: Method 'fail' doesn't exists in Int.
-alt/error_expr_not_ok_alt3.nit:60,20--20: Type error: expected A, got Int
+alt/error_expr_not_ok_alt3.nit:60,20: Type error: expected A, got Int
 alt/error_expr_not_ok_alt3.nit:62,7--27: Type error: expected A, got Int
-alt/error_expr_not_ok_alt3.nit:66,21--21: Type error: expected A, got Int
+alt/error_expr_not_ok_alt3.nit:66,21: Type error: expected A, got Int
 alt/error_expr_not_ok_alt3.nit:73,7--18: Type error: expected A, got Bool
 alt/error_expr_not_ok_alt3.nit:74,7--18: Type error: expected A, got Bool
 alt/error_expr_not_ok_alt3.nit:75,7--18: Type error: expected A, got Bool
index 9a3e75e..043b28f 100644 (file)
@@ -12,13 +12,13 @@ alt/error_expr_not_ok_alt4.nit:46,1--9: Error: Method 'fail' doesn't exists in O
 alt/error_expr_not_ok_alt4.nit:49,7--10: Type error: expected A, got Object
 alt/error_expr_not_ok_alt4.nit:50,1--10: Error: 'trash' arity missmatch.
 alt/error_expr_not_ok_alt4.nit:60,4--7: Type error: expected Bool, got Int
-alt/error_expr_not_ok_alt4.nit:60,20--20: Type error: expected A, got Int
+alt/error_expr_not_ok_alt4.nit:60,20: Type error: expected A, got Int
 alt/error_expr_not_ok_alt4.nit:62,10--13: Type error: expected Bool, got Int
 alt/error_expr_not_ok_alt4.nit:62,7--27: Type error: expected A, got Int
 alt/error_expr_not_ok_alt4.nit:63,7--30: Type error: expected A, got Int
 alt/error_expr_not_ok_alt4.nit:64,7--33: Type error: expected A, got Int
 alt/error_expr_not_ok_alt4.nit:66,7--10: Type error: expected Bool, got Int
-alt/error_expr_not_ok_alt4.nit:66,21--21: Type error: expected A, got Int
+alt/error_expr_not_ok_alt4.nit:66,21: Type error: expected A, got Int
 alt/error_expr_not_ok_alt4.nit:69,10--13: Type error: expected Collection[nullable Object], got Int
 alt/error_expr_not_ok_alt4.nit:71,8--11: Type error: expected Bool, got Int
 alt/error_expr_not_ok_alt4.nit:72,7--15: Type error: expected A, got Int
index a45185c..0dee678 100644 (file)
@@ -13,13 +13,13 @@ alt/error_expr_not_ok_alt5.nit:46,1--9: Error: Method 'fail' doesn't exists in O
 alt/error_expr_not_ok_alt5.nit:49,7--10: Type error: expected A, got Object
 alt/error_expr_not_ok_alt5.nit:50,1--10: Error: 'trash' arity missmatch.
 alt/error_expr_not_ok_alt5.nit:60,4--7: Type error: expected Bool, got Int
-alt/error_expr_not_ok_alt5.nit:60,20--20: Type error: expected A, got Int
+alt/error_expr_not_ok_alt5.nit:60,20: Type error: expected A, got Int
 alt/error_expr_not_ok_alt5.nit:62,10--13: Type error: expected Bool, got Int
 alt/error_expr_not_ok_alt5.nit:62,7--27: Type error: expected A, got Int
 alt/error_expr_not_ok_alt5.nit:63,7--30: Type error: expected A, got Int
 alt/error_expr_not_ok_alt5.nit:64,7--33: Type error: expected A, got Int
 alt/error_expr_not_ok_alt5.nit:66,7--10: Type error: expected Bool, got Int
-alt/error_expr_not_ok_alt5.nit:66,21--21: Type error: expected A, got Int
+alt/error_expr_not_ok_alt5.nit:66,21: Type error: expected A, got Int
 alt/error_expr_not_ok_alt5.nit:69,10--13: Type error: expected Collection[nullable Object], got Int
 alt/error_expr_not_ok_alt5.nit:71,8--11: Type error: expected Bool, got Int
 alt/error_expr_not_ok_alt5.nit:72,7--15: Type error: expected A, got Int
index c105270..19225fb 100644 (file)
@@ -1 +1 @@
-./error_for_coll.nit:17,10--10: Type error: expected Collection[nullable Object], got Int
+./error_for_coll.nit:17,10: Type error: expected Collection[nullable Object], got Int
index 1abea62..4ff6af5 100644 (file)
@@ -1 +1 @@
-./error_if_bool.nit:17,4--4: Type error: expected Bool, got Int
+./error_if_bool.nit:17,4: Type error: expected Bool, got Int
index a01938b..5171b21 100644 (file)
@@ -1 +1 @@
-./error_left_bool.nit:17,4--4: Type error: expected Bool, got Int
+./error_left_bool.nit:17,4: Type error: expected Bool, got Int
index 29c7837..a4f76ec 100644 (file)
@@ -1 +1 @@
-./error_loop_bool_while.nit:17,7--7: Type error: expected Bool, got Int
+./error_loop_bool_while.nit:17,7: Type error: expected Bool, got Int
index 3414c35..aa45c2b 100644 (file)
@@ -1 +1 @@
-./error_right_bool.nit:17,12--12: Type error: expected Bool, got Int
+./error_right_bool.nit:17,12: Type error: expected Bool, got Int
index 8a1c5fd..13f88f2 100644 (file)
@@ -1 +1 @@
-./error_type_not_ok.nit:21,9: Type error: class Fail not found in module error_type_not_ok.
+./error_type_not_ok.nit:21,9--12: Type error: class Fail not found in module error_type_not_ok.
index 29b84c0..234cc18 100644 (file)
@@ -1 +1 @@
-./error_type_not_ok2.nit:21,15: Type error: class Fail not found in module error_type_not_ok2.
+./error_type_not_ok2.nit:21,15--18: Type error: class Fail not found in module error_type_not_ok2.
index 701307a..2584182 100644 (file)
@@ -1,2 +1,2 @@
-./error_type_not_ok3.nit:23,18: Type error: class Fail not found in module error_type_not_ok3.
-./error_type_not_ok3.nit:20,12: Type error: class Fail not found in module error_type_not_ok3.
+./error_type_not_ok3.nit:23,18--21: Type error: class Fail not found in module error_type_not_ok3.
+./error_type_not_ok3.nit:20,12--15: Type error: class Fail not found in module error_type_not_ok3.
index 6e788b7..db72bf0 100644 (file)
@@ -1,7 +1,7 @@
-./error_type_not_ok4.nit:25,16: Type error: class Fail not found in module error_type_not_ok4.
-./error_type_not_ok4.nit:29,28: Type error: class Fail not found in module error_type_not_ok4.
-./error_type_not_ok4.nit:30,12: Type error: class Fail not found in module error_type_not_ok4.
-./error_type_not_ok4.nit:31,18: Type error: class Fail not found in module error_type_not_ok4.
-./error_type_not_ok4.nit:32,10: Type error: class Fail not found in module error_type_not_ok4.
-./error_type_not_ok4.nit:33,16: Type error: class Fail not found in module error_type_not_ok4.
-./error_type_not_ok4.nit:21,10: Type error: class Fail not found in module error_type_not_ok4.
+./error_type_not_ok4.nit:25,16--19: Type error: class Fail not found in module error_type_not_ok4.
+./error_type_not_ok4.nit:29,28--31: Type error: class Fail not found in module error_type_not_ok4.
+./error_type_not_ok4.nit:30,12--15: Type error: class Fail not found in module error_type_not_ok4.
+./error_type_not_ok4.nit:31,18--21: Type error: class Fail not found in module error_type_not_ok4.
+./error_type_not_ok4.nit:32,10--13: Type error: class Fail not found in module error_type_not_ok4.
+./error_type_not_ok4.nit:33,16--19: Type error: class Fail not found in module error_type_not_ok4.
+./error_type_not_ok4.nit:21,10--13: Type error: class Fail not found in module error_type_not_ok4.
index fc35a2e..4469fee 100644 (file)
@@ -1,6 +1,6 @@
-./error_type_not_ok5.nit:23,8: Type error: class Fail not found in module error_type_not_ok5.
-./error_type_not_ok5.nit:25,18: Type error: class Fail not found in module error_type_not_ok5.
-./error_type_not_ok5.nit:28,14: Type error: class Fail not found in module error_type_not_ok5.
-./error_type_not_ok5.nit:29,11: Type error: class Fail not found in module error_type_not_ok5.
-./error_type_not_ok5.nit:30,11: Type error: class Fail not found in module error_type_not_ok5.
-./error_type_not_ok5.nit:31,13: Type error: class Fail not found in module error_type_not_ok5.
+./error_type_not_ok5.nit:23,8--11: Type error: class Fail not found in module error_type_not_ok5.
+./error_type_not_ok5.nit:25,18--21: Type error: class Fail not found in module error_type_not_ok5.
+./error_type_not_ok5.nit:28,14--17: Type error: class Fail not found in module error_type_not_ok5.
+./error_type_not_ok5.nit:29,11--14: Type error: class Fail not found in module error_type_not_ok5.
+./error_type_not_ok5.nit:30,11--14: Type error: class Fail not found in module error_type_not_ok5.
+./error_type_not_ok5.nit:31,13--16: Type error: class Fail not found in module error_type_not_ok5.
index 90bd026..051b07a 100644 (file)
@@ -1 +1 @@
-./error_unk_class.nit:17,13: Type error: class Canard not found in module error_unk_class.
+./error_unk_class.nit:17,13--18: Type error: class Canard not found in module error_unk_class.
index 7e94e0f..2dc2b75 100644 (file)
@@ -1 +1 @@
-alt/test_array_comb_alt1.nit:23,19--21: Type error: no most general type. Got String and nullable Int at alt/test_array_comb_alt1.nit:23,16--16.
+alt/test_array_comb_alt1.nit:23,19--21: Type error: no most general type. Got String and nullable Int at alt/test_array_comb_alt1.nit:23,16.
index d7042b5..531d390 100644 (file)
@@ -1 +1 @@
-alt/test_array_comb_alt2.nit:24,19--21: Type error: no most general type. Got String and nullable Int at alt/test_array_comb_alt2.nit:24,16--16.
+alt/test_array_comb_alt2.nit:24,19--21: Type error: no most general type. Got String and nullable Int at alt/test_array_comb_alt2.nit:24,16.
index c7e9c6a..ef90cbe 100644 (file)
@@ -1,4 +1,4 @@
 alt/test_combined_assignment_alt1.nit:22,3--9: Error: Method '+' doesn't exists in Object.
 alt/test_combined_assignment_alt1.nit:27,3--9: Error: Method '+' doesn't exists in Object.
-alt/test_combined_assignment_alt1.nit:28,10--10: Type error: expected Int, got Object
+alt/test_combined_assignment_alt1.nit:28,10: Type error: expected Int, got Object
 alt/test_combined_assignment_alt1.nit:48,1--8: Error: Method '+' doesn't exists in Object.