groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Refine error messages
Date Fri, 08 Sep 2017 14:05:00 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 4771c4d98 -> cddd25141


Refine error messages

(cherry picked from commit 881219c)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: cddd25141b7f44a286e7a0b038db7e812a194c08
Parents: 4771c4d
Author: sunlan <sunlan@apache.org>
Authored: Fri Sep 8 21:59:59 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Fri Sep 8 22:04:50 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/cddd2514/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.


Mime
View raw message