You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2017/09/08 14:00:34 UTC

groovy git commit: Refine error messages

Repository: groovy
Updated Branches:
  refs/heads/master 8a1b3789a -> 881219cc6


Refine error messages


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/881219cc
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/881219cc
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/881219cc

Branch: refs/heads/master
Commit: 881219cc6ee9e8ee6d6a3c865141750c865ba224
Parents: 8a1b378
Author: sunlan <su...@apache.org>
Authored: Fri Sep 8 21:59:59 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Fri Sep 8 21:59:59 2017 +0800

----------------------------------------------------------------------
 src/main/antlr/GroovyLexer.g4 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/881219cc/src/main/antlr/GroovyLexer.g4
----------------------------------------------------------------------
diff --git a/src/main/antlr/GroovyLexer.g4 b/src/main/antlr/GroovyLexer.g4
index 6c8fd33..9e44ae3 100644
--- a/src/main/antlr/GroovyLexer.g4
+++ b/src/main/antlr/GroovyLexer.g4
@@ -445,7 +445,7 @@ IntegerLiteral
         |   HexIntegerLiteral
         |   OctalIntegerLiteral
         |   BinaryIntegerLiteral
-        ) (Underscore { require(false, "Invalid number", -1, true); })?
+        ) (Underscore { require(false, "Number ending with underscores is invalid", -1, true); })?
 
     // !!! Error Alternative !!!
     |   Zero ([0-9] { invalidDigitCount++; })+ { require(false, "Invalid octal number", -(invalidDigitCount + 1), true); } IntegerTypeSuffix?
@@ -587,7 +587,7 @@ BinaryDigitOrUnderscore
 FloatingPointLiteral
     :   (   DecimalFloatingPointLiteral
         |   HexadecimalFloatingPointLiteral
-        ) (Underscore { require(false, "Invalid number", -1, true); })?
+        ) (Underscore { require(false, "Number ending with underscores is invalid", -1, true); })?
     ;
 
 fragment
@@ -935,7 +935,7 @@ SL_COMMENT
 // Script-header comments.
 // The very first characters of the file may be "#!".  If so, ignore the first line.
 SH_COMMENT
-    :   '#!' { 0 == this.tokenIndex }?<fail={"Shebang comment should appear at the first line"}> ~[\r\n\uFFFF]* -> skip
+    :   '#!' { require(0 == this.tokenIndex, "Shebang comment should appear at the first line", -2, true); } ~[\r\n\uFFFF]* -> skip
     ;
 
 // Unexpected characters will be handled by groovy parser later.