>From 7b4fbee90bffd346447efc335f1ebeaa9d62c541 Mon Sep 17 00:00:00 2001
From: Juan Hernandez <juan.hernandez@redhat.com>
Date: Wed, 8 Feb 2012 16:22:56 +0100
Subject: [PATCH 4/4] Fix JavaCC grammars for version 5.

The JBossQL en EJBQL grammars used for CMP use some tokens with
empty regular expressions. This worked with JavaCC 4 but doesn't
with version 5.

This patch creates a DUMMY lexical state that will never be
reached and puts those tokens inside with a non empty regular
expression (that will never be matched).
---
 .../jjtree/org/jboss/as/cmp/ejbql/EJBQLParser.jjt  |   37 ++++++++++---------
 .../org/jboss/as/cmp/ejbql/JBossQLParser.jjt       |   38 ++++++++++----------
 2 files changed, 38 insertions(+), 37 deletions(-)

diff --git a/cmp/src/main/jjtree/org/jboss/as/cmp/ejbql/EJBQLParser.jjt b/cmp/src/main/jjtree/org/jboss/as/cmp/ejbql/EJBQLParser.jjt
index 7f338d4..6f1afd8 100644
--- a/cmp/src/main/jjtree/org/jboss/as/cmp/ejbql/EJBQLParser.jjt
+++ b/cmp/src/main/jjtree/org/jboss/as/cmp/ejbql/EJBQLParser.jjt
@@ -1067,10 +1067,6 @@ TOKEN_MGR_DECLS :
       }
    }
 |
-   < ABSTRACT_SCHEMA: [] >
-|
-   < IDENTIFICATION_VARIABLE: [] >
-|
    < #NAME: <LETTER> (<LETTER>|<DIGIT>)* >
 |
    < #LETTER:
@@ -1149,12 +1145,6 @@ TOKEN_MGR_DECLS :
          }
       }
    }
-|  < NUMERIC_VALUED_PARAMETER: [] >
-|  < STRING_VALUED_PARAMETER: [] >
-|  < DATETIME_VALUED_PARAMETER: [] >
-|  < BOOLEAN_VALUED_PARAMETER: [] >
-|  < ENTITY_VALUED_PARAMETER: [] >
-|  < VALUE_CLASS_VALUED_PARAMETER: [] >
 }
 
 /**
@@ -1222,14 +1212,25 @@ TOKEN_MGR_DECLS :
       idManager.registerPath(matchedToken.image, pathList, fieldList);
       resetPath();
    } : DEFAULT
-|  < NUMERIC_VALUED_PATH: [] >
-|  < STRING_VALUED_PATH: [] >
-|  < DATETIME_VALUED_PATH: [] >
-|  < BOOLEAN_VALUED_PATH: [] >
-|  < ENTITY_VALUED_PATH: [] >
-|  < VALUE_CLASS_VALUED_PATH: [] >
-|  < UNKNOWN_PATH: [] >
-|  < COLLECTION_VALUED_PATH: [] >
 }  
 
+<DUMMY> TOKEN:
+{
+   < ABSTRACT_SCHEMA: "ABSTRACT_SCHEMA" >
+|  < IDENTIFICATION_VARIABLE: "IDENTIFICATION_VARIABLE" >
+|  < NUMERIC_VALUED_PARAMETER: "NUMERIC_VALUED_PARAMETER" >
+|  < STRING_VALUED_PARAMETER: "STRING_VALUED_PARAMETER" >
+|  < DATETIME_VALUED_PARAMETER: "DATETIME_VALUED_PARAMETER" >
+|  < BOOLEAN_VALUED_PARAMETER: "BOOLEAN_VALUED_PARAMETER" >
+|  < ENTITY_VALUED_PARAMETER: "ENTITY_VALUED_PARAMETER" >
+|  < VALUE_CLASS_VALUED_PARAMETER: "VALUE_CLASS_VALUED_PARAMETER" >
+|  < NUMERIC_VALUED_PATH: "NUMERIC_VALUED_PATH" >
+|  < STRING_VALUED_PATH: "STRING_VALUED_PATH" >
+|  < DATETIME_VALUED_PATH: "DATETIME_VALUED_PATH" >
+|  < BOOLEAN_VALUED_PATH: "BOOLEAN_VALUED_PATH" >
+|  < ENTITY_VALUED_PATH: "ENTITY_VALUED_PATH" >
+|  < VALUE_CLASS_VALUED_PATH: "VALUE_CLASS_VALUED_PATH" >
+|  < UNKNOWN_PATH: "UNKNOWN_PATH" >
+|  < COLLECTION_VALUED_PATH: "COLLECTION_VALUED_PATH" >
+}
 
diff --git a/cmp/src/main/jjtree/org/jboss/as/cmp/ejbql/JBossQLParser.jjt b/cmp/src/main/jjtree/org/jboss/as/cmp/ejbql/JBossQLParser.jjt
index 116f86b..51f996f 100644
--- a/cmp/src/main/jjtree/org/jboss/as/cmp/ejbql/JBossQLParser.jjt
+++ b/cmp/src/main/jjtree/org/jboss/as/cmp/ejbql/JBossQLParser.jjt
@@ -1163,10 +1163,6 @@ TOKEN_MGR_DECLS :
       }
    }
 |
-   < ABSTRACT_SCHEMA: [] >
-|
-   < IDENTIFICATION_VARIABLE: [] >
-|
    < #NAME: <LETTER> (<LETTER>|<DIGIT>)* >
 |
    < #LETTER:
@@ -1245,12 +1241,6 @@ TOKEN_MGR_DECLS :
          }
       }
    }
-|  < NUMERIC_VALUED_PARAMETER: [] >
-|  < STRING_VALUED_PARAMETER: [] >
-|  < DATETIME_VALUED_PARAMETER: [] >
-|  < BOOLEAN_VALUED_PARAMETER: [] >
-|  < ENTITY_VALUED_PARAMETER: [] >
-|  < VALUE_CLASS_VALUED_PARAMETER: [] >
 }
 
 /**
@@ -1318,14 +1308,24 @@ TOKEN_MGR_DECLS :
       idManager.registerPath(matchedToken.image, pathList, fieldList);
       resetPath();
    } : DEFAULT
-|  < NUMERIC_VALUED_PATH: [] >
-|  < STRING_VALUED_PATH: [] >
-|  < DATETIME_VALUED_PATH: [] >
-|  < BOOLEAN_VALUED_PATH: [] >
-|  < ENTITY_VALUED_PATH: [] >
-|  < VALUE_CLASS_VALUED_PATH: [] >
-|  < UNKNOWN_PATH: [] >
-|  < COLLECTION_VALUED_PATH: [] >
 }
 
-
+<DUMMY> TOKEN :
+{
+   < ABSTRACT_SCHEMA: "ABSTRACT_SCHEMA:" >
+|  < IDENTIFICATION_VARIABLE: "IDENTIFICATION_VARIABLE" >
+|  < NUMERIC_VALUED_PARAMETER: "NUMERIC_VALUED_PARAMETER" >
+|  < STRING_VALUED_PARAMETER: "STRING_VALUED_PARAMETER" >
+|  < DATETIME_VALUED_PARAMETER: "DATETIME_VALUED_PARAMETER" >
+|  < BOOLEAN_VALUED_PARAMETER: "BOOLEAN_VALUED_PARAMETER" >
+|  < ENTITY_VALUED_PARAMETER: "ENTITY_VALUED_PARAMETER" >
+|  < VALUE_CLASS_VALUED_PARAMETER: "VALUE_CLASS_VALUED_PARAMETER" >
+|  < NUMERIC_VALUED_PATH: "NUMERIC_VALUED_PATH" >
+|  < STRING_VALUED_PATH: "STRING_VALUED_PATH" >
+|  < DATETIME_VALUED_PATH: "DATETIME_VALUED_PATH" >
+|  < BOOLEAN_VALUED_PATH: "BOOLEAN_VALUED_PATH" >
+|  < ENTITY_VALUED_PATH: "ENTITY_VALUED_PATH" >
+|  < VALUE_CLASS_VALUED_PATH: "VALUE_CLASS_VALUED_PATH" >
+|  < UNKNOWN_PATH: "UNKNOWN_PATH" >
+|  < COLLECTION_VALUED_PATH: "COLLECTION_VALUED_PATH" >
+}
-- 
1.7.7.6

