nitcc: show the text of the token in NParserError.message
authorJean Privat <jean@pryen.org>
Fri, 18 Oct 2013 19:37:16 +0000 (15:37 -0400)
committerJean Privat <jean@pryen.org>
Fri, 18 Oct 2013 19:40:33 +0000 (15:40 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

22 files changed:
contrib/nitcc/tests/sav/inf5000-04-lexer-priorite_declaree.res
contrib/nitcc/tests/sav/inf5000-05-grammaire-arithmetique.alt1.res
contrib/nitcc/tests/sav/inf5000-06-grammaire2-calculatrice.res
contrib/nitcc/tests/sav/lexer-c-comment.alt1.res
contrib/nitcc/tests/sav/lexer-c-comment.alt3.res
contrib/nitcc/tests/sav/lexer-c-comment.alt4.res
contrib/nitcc/tests/sav/lexer-errors.alt7.res
contrib/nitcc/tests/sav/lexer-implicit-longest-and-priority.alt1.res
contrib/nitcc/tests/sav/lexer-implicit-longest-and-priority.res
contrib/nitcc/tests/sav/lexer-implicit-longest.alt1.res
contrib/nitcc/tests/sav/lexer-implicit-longest.res
contrib/nitcc/tests/sav/lexer-precedences.alt8.res
contrib/nitcc/tests/sav/lexer-shortest-longest.alt1.res
contrib/nitcc/tests/sav/lexer-shortest-longest.alt2.res
contrib/nitcc/tests/sav/lexer-shortest-longest.alt3.res
contrib/nitcc/tests/sav/lexer-shortest-longest.res
contrib/nitcc/tests/sav/lexer-shortest-longest2.alt1.res
contrib/nitcc/tests/sav/lexer-shortest-longest2.alt2.res
contrib/nitcc/tests/sav/lexer-shortest-longest2.alt3.res
contrib/nitcc/tests/sav/lexer-shortest-longest2.alt4.res
contrib/nitcc/tests/sav/lexer-shortest-longest2.res
lib/nitcc_runtime.nit

index fad10ce..ef17b61 100644 (file)
@@ -1 +1 @@
-6:34-6:34 Syntax Error: Unexpected character 'E'; is acceptable instead: ';', '|'
+6:34-6:40 Syntax Error: Unexpected unknown_keyword 'Except'; is acceptable instead: ';', '|'
index e37a1c9..faf3609 100644 (file)
@@ -1 +1 @@
-16:1-16:2 Syntax Error: Unexpected character 'P'; is acceptable instead: Eof
+16:1-16:11 Syntax Error: Unexpected unknown_keyword 'Precedence'; is acceptable instead: Eof
index c853944..0ede240 100644 (file)
@@ -1 +1 @@
-15:7-15:8 Syntax Error: Unexpected character 'P'; is acceptable instead: Eof
+15:7-15:17 Syntax Error: Unexpected unknown_keyword 'Precedence'; is acceptable instead: Eof
index 6a407ce..2d5b75c 100644 (file)
@@ -1 +1 @@
-9:16-9:16 Syntax Error: Unexpected character 'S'; is acceptable instead: re, re1, re2, re3
+9:16-9:24 Syntax Error: Unexpected unknown_keyword 'Shortest'; is acceptable instead: re, re1, re2, re3
index 35d1cf4..c55cc90 100644 (file)
@@ -1 +1 @@
-11:26-11:27 Syntax Error: Unexpected character 'L'; is acceptable instead: ')', '|'
+11:26-11:35 Syntax Error: Unexpected unknown_keyword 'Lookahead'; is acceptable instead: ')', '|'
index c05eb8a..928cd2c 100644 (file)
@@ -1 +1 @@
-12:27-12:27 Syntax Error: Unexpected character 'E'; is acceptable instead: ')', '|'
+12:27-12:33 Syntax Error: Unexpected unknown_keyword 'Except'; is acceptable instead: ')', '|'
index 67873f9..c45c729 100644 (file)
@@ -1 +1 @@
-10:16-10:17 Syntax Error: Unexpected character 'L'; is acceptable instead: ';', '|'
+10:16-10:25 Syntax Error: Unexpected unknown_keyword 'Lookahead'; is acceptable instead: ';', '|'
index dc78c9a..9f9fd49 100644 (file)
@@ -1 +1 @@
-4:9-4:10 Syntax Error: Unexpected character 'L'; is acceptable instead: ';', '|'
+4:9-4:18 Syntax Error: Unexpected unknown_keyword 'Lookahead'; is acceptable instead: ';', '|'
index dc78c9a..9f9fd49 100644 (file)
@@ -1 +1 @@
-4:9-4:10 Syntax Error: Unexpected character 'L'; is acceptable instead: ';', '|'
+4:9-4:18 Syntax Error: Unexpected unknown_keyword 'Lookahead'; is acceptable instead: ';', '|'
index 665246c..4d18e58 100644 (file)
@@ -1 +1 @@
-3:10-3:11 Syntax Error: Unexpected character 'L'; is acceptable instead: ';', '|'
+3:10-3:19 Syntax Error: Unexpected unknown_keyword 'Lookahead'; is acceptable instead: ';', '|'
index 9c7098c..1d461d0 100644 (file)
@@ -1 +1 @@
-3:9-3:10 Syntax Error: Unexpected character 'L'; is acceptable instead: ';', '|'
+3:9-3:18 Syntax Error: Unexpected unknown_keyword 'Lookahead'; is acceptable instead: ';', '|'
index 838d77c..e445b4e 100644 (file)
@@ -1 +1 @@
-6:18-6:19 Syntax Error: Unexpected character 'L'; is acceptable instead: ')', '|'
+6:18-6:27 Syntax Error: Unexpected unknown_keyword 'Lookahead'; is acceptable instead: ')', '|'
index 0ba1d64..23db6fc 100644 (file)
@@ -1 +1 @@
-6:22-6:23 Syntax Error: Unexpected character 'L'; is acceptable instead: ';', '|'
+6:22-6:31 Syntax Error: Unexpected unknown_keyword 'Lookahead'; is acceptable instead: ';', '|'
index 0ba1d64..23db6fc 100644 (file)
@@ -1 +1 @@
-6:22-6:23 Syntax Error: Unexpected character 'L'; is acceptable instead: ';', '|'
+6:22-6:31 Syntax Error: Unexpected unknown_keyword 'Lookahead'; is acceptable instead: ';', '|'
index 0ba1d64..23db6fc 100644 (file)
@@ -1 +1 @@
-6:22-6:23 Syntax Error: Unexpected character 'L'; is acceptable instead: ';', '|'
+6:22-6:31 Syntax Error: Unexpected unknown_keyword 'Lookahead'; is acceptable instead: ';', '|'
index 0ba1d64..23db6fc 100644 (file)
@@ -1 +1 @@
-6:22-6:23 Syntax Error: Unexpected character 'L'; is acceptable instead: ';', '|'
+6:22-6:31 Syntax Error: Unexpected unknown_keyword 'Lookahead'; is acceptable instead: ';', '|'
index a1fa111..517008f 100644 (file)
@@ -1 +1 @@
-4:6-4:7 Syntax Error: Unexpected character 'L'; is acceptable instead: re, re1, re2, re3
+4:6-4:13 Syntax Error: Unexpected unknown_keyword 'Longest'; is acceptable instead: re, re1, re2, re3
index a1fa111..517008f 100644 (file)
@@ -1 +1 @@
-4:6-4:7 Syntax Error: Unexpected character 'L'; is acceptable instead: re, re1, re2, re3
+4:6-4:13 Syntax Error: Unexpected unknown_keyword 'Longest'; is acceptable instead: re, re1, re2, re3
index a1fa111..517008f 100644 (file)
@@ -1 +1 @@
-4:6-4:7 Syntax Error: Unexpected character 'L'; is acceptable instead: re, re1, re2, re3
+4:6-4:13 Syntax Error: Unexpected unknown_keyword 'Longest'; is acceptable instead: re, re1, re2, re3
index a1fa111..517008f 100644 (file)
@@ -1 +1 @@
-4:6-4:7 Syntax Error: Unexpected character 'L'; is acceptable instead: re, re1, re2, re3
+4:6-4:13 Syntax Error: Unexpected unknown_keyword 'Longest'; is acceptable instead: re, re1, re2, re3
index a1fa111..517008f 100644 (file)
@@ -1 +1 @@
-4:6-4:7 Syntax Error: Unexpected character 'L'; is acceptable instead: re, re1, re2, re3
+4:6-4:13 Syntax Error: Unexpected unknown_keyword 'Longest'; is acceptable instead: re, re1, re2, re3
index 26e5f12..7e9ee57 100644 (file)
@@ -435,7 +435,15 @@ class NParserError
        # The unexpected token
        var token: nullable NToken
 
-       redef fun unexpected do return token.node_name
+       redef fun unexpected
+       do
+               var res = token.node_name
+               var text = token.text
+               if not text.is_empty and res != "'{text}'" then
+                       res += " '{text.escape_to_c}'"
+               end
+               return res
+       end
 end
 
 # A hogeneous sequence of node, used to represent unbounded lists (and + modifier)