You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2019/08/19 15:36:54 UTC

[freemarker] 02/02: (Some cleanup in parser literal type error checks)

This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch 2.3-gae
in repository https://gitbox.apache.org/repos/asf/freemarker.git

commit c7dc43f0316daec97dff796effd37d4fbd7da59d
Author: ddekany <dd...@apache.org>
AuthorDate: Mon Aug 19 17:36:44 2019 +0200

    (Some cleanup in parser literal type error checks)
---
 src/main/javacc/FTL.jj | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index a12f4f1..806d16e 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -419,7 +419,7 @@ public class FMParser {
      */
     private void notBooleanLiteral(Expression exp, String expected) throws ParseException {
         if (exp instanceof BooleanLiteral) {
-            throw new ParseException("Found: " + exp.getCanonicalForm() + ". Expecting " + expected, exp);
+            throw new ParseException("Found: " + exp.getCanonicalForm() + " literal. Expecting " + expected , exp);
         }
     }
 
@@ -1893,10 +1893,10 @@ Expression EqualityExpression() :
         )
         rhs = RelationalExpression()
         {
-	        notHashLiteral(lhs, "string");
-	        notHashLiteral(rhs, "string");
-	        notListLiteral(lhs, "string");
-	        notListLiteral(rhs, "string");
+	        notHashLiteral(lhs, "different type for equality check");
+	        notHashLiteral(rhs, "different type for equality check");
+	        notListLiteral(lhs, "different type for equality check");
+	        notListLiteral(rhs, "different type for equality check");
 	        result = new ComparisonExpression(lhs, rhs, t.image);
 	        result.setLocation(template, lhs, rhs);
         }
@@ -1930,12 +1930,8 @@ Expression RelationalExpression() :
         )
         rhs = RangeExpression()
         {
-            notHashLiteral(lhs, "number");
-            notHashLiteral(rhs, "number");
-            notListLiteral(lhs, "number");
-            notListLiteral(rhs, "number");
-            notStringLiteral(lhs, "number");
-            notStringLiteral(rhs, "number");
+            numberLiteralOnly(lhs);
+            numberLiteralOnly(rhs);
             result = new ComparisonExpression(lhs, rhs, t.image);
             result.setLocation(template, lhs, rhs);
         }