You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2006/08/20 19:55:04 UTC

svn commit: r432995 - in /incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core: pom.xml src/main/java/org/apache/cayenne/ejbql/ src/main/java/org/apache/cayenne/ejbql/QLStatement.java src/main/jjtree/ src/main/jjtree/JavaCCEJBQLParser.jjt

Author: aadamchik
Date: Sun Aug 20 10:55:02 2006
New Revision: 432995

URL: http://svn.apache.org/viewvc?rev=432995&view=rev
Log:
first cut of the EJBQL parser
there are still lots of warnings, so it is commented out in the POM

Added:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/java/org/apache/cayenne/ejbql/
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/java/org/apache/cayenne/ejbql/QLStatement.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/jjtree/
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/jjtree/JavaCCEJBQLParser.jjt
Modified:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/pom.xml

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/pom.xml?rev=432995&r1=432994&r2=432995&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/pom.xml (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/pom.xml Sun Aug 20 10:55:02 2006
@@ -160,7 +160,41 @@
 					<target>1.4</target>
 				</configuration>
 			</plugin>
-
+<!--  
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>javacc-maven-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>jjtree</id>
+						<phase>generate-sources</phase>
+						<goals>
+							<goal>jjtree</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>
+								${basedir}/target/generated-sources/javacc/org/apache/cayenne/ejbql
+							</outputDirectory>
+						</configuration>
+					</execution>
+					<execution>
+						<id>javacc</id>
+						<phase>generate-sources</phase>
+						<goals>
+							<goal>javacc</goal>
+						</goals>
+						<configuration>
+							<sourceDirectory>
+								${basedir}/target/generated-sources/javacc/org/apache/cayenne/ejbql
+							</sourceDirectory>
+							<outputDirectory>
+								${basedir}/target/generated-sources/javacc/org/apache/cayenne/ejbql
+							</outputDirectory>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+-->
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-surefire-plugin</artifactId>

Added: incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/java/org/apache/cayenne/ejbql/QLStatement.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/java/org/apache/cayenne/ejbql/QLStatement.java?rev=432995&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/java/org/apache/cayenne/ejbql/QLStatement.java (added)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/java/org/apache/cayenne/ejbql/QLStatement.java Sun Aug 20 10:55:02 2006
@@ -0,0 +1,29 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.ejbql;
+
+/**
+ * An abstract EJBQL statement.
+ * 
+ * @author Andrus Adamchik
+ * @since 3.0
+ */
+public abstract class QLStatement {
+
+}

Added: incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/jjtree/JavaCCEJBQLParser.jjt
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/jjtree/JavaCCEJBQLParser.jjt?rev=432995&view=auto
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/jjtree/JavaCCEJBQLParser.jjt (added)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4-core/src/main/jjtree/JavaCCEJBQLParser.jjt Sun Aug 20 10:55:02 2006
@@ -0,0 +1,884 @@
+options {
+	MULTI = true;
+	NODE_DEFAULT_VOID = true;
+	STATIC = false;
+	DEBUG_PARSER = false;
+	DEBUG_LOOKAHEAD = false;
+	DEBUG_TOKEN_MANAGER = false;
+	JAVA_UNICODE_ESCAPE = true;
+	UNICODE_INPUT = true;
+	NODE_PREFIX = "EJBQL";
+	NODE_FACTORY = false;
+	VISITOR = true;
+}
+
+PARSER_BEGIN(JavaCCEJBQLParser)
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+
+package org.apache.cayenne.ejbql;
+
+import java.io.*;
+import java.util.*;
+import java.math.*;
+
+/**
+ * Parser of EJBQL syntax.  
+ *
+ * @since 3.0
+ */ 
+public class JavaCCEJBQLParser {
+    
+}
+PARSER_END(JavaCCEJBQLParser)
+
+
+QLStatement qlStatement() : {}
+{
+    ( selectStatement() #SelectStatement
+    | updateStatement()
+    | deleteStatement()
+    ) <EOF>
+
+    { return (QLStatement) jjtree.rootNode(); }
+}
+
+void selectStatement() : {} 
+{
+   selectClause()
+   fromClause()
+   [ whereClause() ]
+   [ groupByClause() ]
+   [ havingClause() ]
+   [ orderByClause() ]
+}
+
+void updateStatement() : {} 
+{
+   updateClause()
+   [ whereClause() ]
+}
+
+void deleteStatement() : {} 
+{
+   deleteClause()
+   [ whereClause() ]
+}
+
+void fromClause() : {} 
+{
+   "FROM" 
+   identificationVariableDeclaration()
+   ( "," 
+     ( identificationVariableDeclaration()
+     | collectionMemberDeclaration()
+     ) 
+   )*
+}
+
+void identificationVariableDeclaration() : {}
+{
+   rangeVariableDeclaration()
+   ( LOOKAHEAD(3) 
+     join()
+   | fetchJoin()
+   )*
+}
+
+void rangeVariableDeclaration() : {}
+{
+   abstractSchemaName()
+   ["AS"]
+   identificationVariable()
+}
+
+void join() : {}
+{
+   joinSpec()
+   joinAssociationPathExpression()
+   ["AS"]
+   identificationVariable()
+}
+
+void fetchJoin() : {}
+{
+   joinSpec()
+   "FETCH"
+   joinAssociationPathExpression()
+}
+
+void associationPathExpression() : {}
+{
+  // **** SPEC NOTE: defined as 
+  //    collection_valued_path_expression | single_valued_association_path_expression 
+  
+  <PROPERTY_PATH>
+}
+
+void joinSpec() : {}
+{
+   [ 
+      ( "LEFT" [ "OUTER" ] )
+      | "INNER"
+   ]
+   "JOIN"
+}
+
+void joinAssociationPathExpression() : {}
+{
+   identificationVariable()
+   "."
+   <IDENTIFIER> 
+   // **** SPEC NOTE: defined as "join_collection_valued_path_expression | join_single_valued_association_path_expression"
+}
+
+void collectionMemberDeclaration() : {}
+{
+   "IN ("
+   <PROPERTY_PATH> // **** SPEC NOTE: defined as "colection_valued_path_expression"
+   ")"
+   [ "AS" ] 
+   identificationVariable()
+}
+
+void updateClause() : {}
+{
+  "UPDATE" 
+  abstractSchemaName()
+  [ [ "AS" ]
+     identificationVariable()
+  ]
+  "SET"
+  updateItem()
+  ( ","
+     updateItem()
+  )* 
+}
+
+void updateItem() : {}
+{
+   
+   [ LOOKAHEAD(2) identificationVariable()
+     "."
+   ]
+   <IDENTIFIER> // **** SPEC NOTE: defined as "{state_field | single_valued_association_field}"
+   "="
+   newValue()
+}
+
+void newValue() : {}
+{
+     simpleArithmeticExpression()
+  // | stringPrimary()
+ //  | datetimePrimary()
+  // | booleanPrimary()
+ //  | enumPrimary()
+ //  | simpleEntityExpression()
+   | "NULL"
+}
+
+void deleteClause() : {}
+{
+  "DELETE" "FROM" 
+  abstractSchemaName()
+  [ [ "AS" ]
+     identificationVariable()
+  ]
+}
+
+void selectClause() : {} 
+{
+   "SELECT"
+   [ "DISTINCT" ]
+   selectExpression()
+   ( ","
+     selectExpression()
+   )* 
+}
+
+void selectExpression() : {}
+{
+     <PROPERTY_PATH> // **** SPEC NOTE: defined as "single_valued_path_expression | identification_variable"	
+   | aggregateExpression()
+   | ( "OBJECT(" 
+     identificationVariable()
+     ")" 
+     )
+   | constructorExpression() 
+}
+
+void constructorExpression() : {}
+{
+  "NEW" 
+  constructorName()
+  "("
+  constructorItem()
+  ( ","
+    constructorItem()
+  )*
+  ")"
+}
+
+void constructorItem() : {}
+{
+     <PROPERTY_PATH> // **** SPEC NOTE: defined as "single_valued_path_expression"
+   | aggregateExpression()
+}
+
+void aggregateExpression() : {}
+{
+   (
+     ( "AVG"
+     | "MAX"
+     | "MIN"
+     | "SUM"
+     )
+     "("
+      [ "DISTINCT" ] 
+      <PROPERTY_PATH> // **** SPEC NOTE: defined as "state_field_path_expression"
+      ")"
+   )
+   | ( 
+     "COUNT"
+     "("
+        [ "DISTINCT" ] 
+        <PROPERTY_PATH> // **** SPEC NOTE: defined as "identificationVariable() | stateFieldPathExpression() | singleValuedAssociationPathExpression()"
+      ")"
+   ) 
+  <PROPERTY_PATH> // **** SPEC NOTE: defined as "single_valued_path_expression"	
+}
+
+void whereClause() : {} 
+{
+   "WHERE"
+   conditionalExpression() 
+}
+
+void groupByClause() : {} 
+{
+   "GROUP" "BY"
+   groupByItem()
+   ( ","
+     groupByItem()
+   )*
+}
+
+void groupByItem() : {}
+{
+   <PROPERTY_PATH> // **** SPEC NOTE: defined as "single_valued_path_expression | identification_variable"	
+}
+
+void havingClause() : {} 
+{
+   "HAVING" conditionalExpression()
+}
+
+void orderByClause() : {} 
+{
+   "ORDER BY"
+   orderByItem()
+   ( ","
+     orderByItem()
+   )*
+}
+
+void orderByItem() : {}
+{
+   <PROPERTY_PATH> // **** SPEC NOTE: defined as "state_field_path_expression"	
+   ( "ASC" | "DESC" )
+}
+
+void subquery() : {}
+{
+   simpleSelectClause()
+   subqueryFromClause()
+   [ whereClause() ]
+   [ groupByClause() ]
+   [ havingClause() ]
+}
+
+void subqueryFromClause() : {}
+{
+   "FROM" 
+   subselectIdentificationVariableDeclaration()
+   ( "," subselectIdentificationVariableDeclaration() 
+   )*
+}
+
+void subselectIdentificationVariableDeclaration() : {}
+{
+     identificationVariableDeclaration()
+   | ( associationPathExpression() 
+       [ "AS" ]
+       identificationVariable()
+     )
+   | collectionMemberDeclaration()
+}
+
+void simpleSelectClause() : {}
+{
+   "SELECT" 
+   [ "DISTINCT" ]
+   simpleSelectExpression()
+}
+
+void simpleSelectExpression() : {}
+{
+     <PROPERTY_PATH> // **** SPEC NOTE: defined as "single_valued_path_expression | identification_variable"	
+   | aggregateExpression()
+}
+
+void conditionalExpression() : {}
+{
+     conditionalTerm()
+     ( "OR" 
+       conditionalTerm()
+     )*
+}
+
+void conditionalTerm() : {}
+{
+     conditionalFactor()
+    ( "AND" 
+       conditionalFactor()
+     )*
+}
+
+void conditionalFactor() : {}
+{
+   [ "NOT" ]
+   conditionalPrimary()
+}
+
+void conditionalPrimary() : {}
+{
+     simpleCondExpression() 
+   | ( "(" 
+       conditionalExpression() 
+       ")" 
+     )
+}
+
+void simpleCondExpression() : {}
+{
+     comparisonExpression()
+   | betweenExpression()
+   | likeExpression()
+   | inExpression()
+   | nullComparisonExpression() 
+   | emptyCollectionComparisonExpression()
+   | collectionMemberExpression()
+   | existsExpression()
+}
+
+void betweenExpression() : {}
+{
+     ( arithmeticExpression()
+       ( [ "NOT" ]
+         "BETWEEN"
+       )
+       arithmeticExpression()
+       "AND" 
+       arithmeticExpression()
+     )
+     | ( stringExpression()
+       ( [ "NOT" ]
+         "BETWEEN"
+       )
+       stringExpression()
+       "AND" 
+       stringExpression()
+     ) 
+     | ( datetimeExpression()
+       ( [ "NOT" ]
+         "BETWEEN"
+       )
+       datetimeExpression()
+       "AND" 
+       datetimeExpression()
+     )
+}
+
+void inExpression() : {}
+{
+   <PROPERTY_PATH> // **** SPEC NOTE: defined as "state_field_path_expression"	
+   [ "NOT" ]
+   "IN"
+   "("
+   ( inItem() 
+     ( "," 
+       inItem()
+     )*
+   )
+   | subquery()
+   ")"
+}
+
+void inItem() : {}
+{
+     literal()
+   | inputParameter()
+}
+
+void likeExpression() : {}
+{
+   stringExpression()
+   [ "NOT" ]
+   "LIKE"
+   patternValue()
+   [ "ESCAPE"
+     escapeCharacter()
+   ]
+}
+
+void nullComparisonExpression() : {}
+{
+     <PROPERTY_PATH> // **** SPEC NOTE: defined as "single_valued_path_expression"	
+   | inputParameter()
+   "IS"
+   [ "NOT" ]
+   "NULL"
+}
+
+void emptyCollectionComparisonExpression() : {}
+{
+  <PROPERTY_PATH> // **** SPEC NOTE: defined as "collection_valued_path_expression"	
+  "IS"
+  [ "NOT" ]
+  "EMPTY"
+}
+
+void collectionMemberExpression() : {}
+{
+   entityExpression()
+   [ "NOT" ]
+   "MEMBER"
+   [ "OF" ]
+   <PROPERTY_PATH> // **** SPEC NOTE: defined as "collection_valued_path_expression"	
+}
+
+void existsExpression() : {}
+{
+   [ "NOT" ] 
+   "EXISTS"
+   subquery()
+}
+
+void allOrAnyExpression() : {}
+{
+   ( "ALL"
+   | "ANY"
+   | "SOME"
+   )
+   "("
+   subquery()
+   ")"
+}
+
+void comparisonExpression() : {}
+{
+   ( stringExpression() 
+     comparisonOperator()
+     ( stringExpression()
+     | allOrAnyExpression()
+     )
+   )
+   | ( booleanExpression() 
+     ( "="
+     | "<>"
+     )
+     ( booleanExpression()
+     | allOrAnyExpression()
+     )
+   )
+   | ( enumExpression() 
+     ( "="
+     | "<>"
+     )
+     ( enumExpression()
+     | allOrAnyExpression()
+     )
+   )
+   | ( datetimeExpression() 
+     comparisonOperator()
+     ( datetimeExpression()
+     | allOrAnyExpression()
+     )
+   )
+   | ( entityExpression() 
+     ( "="
+     | "<>"
+     )
+     ( entityExpression()
+     | allOrAnyExpression()
+     )
+   )
+   | ( arithmeticExpression() 
+     comparisonOperator()
+     ( arithmeticExpression()
+     | allOrAnyExpression()
+     )
+   )
+}
+
+void comparisonOperator() : {}
+{
+     "="
+   | ">"
+   | ">="
+   | "<"
+   | "<="
+   | "<>"
+}
+
+void arithmeticExpression() : {}
+{
+     simpleArithmeticExpression()
+   | ( "(" 
+       subquery()
+       ")"
+     )
+}
+
+void simpleArithmeticExpression() : {}
+{
+      arithmeticTerm()
+      (
+        ( "+"
+        | "-"
+        )
+        arithmeticTerm()
+      )*
+}
+
+void arithmeticTerm() : {}
+{
+     arithmeticFactor() 
+   | ( 
+        ( "*"
+        | "/"
+        )
+        arithmeticFactor()
+     )*
+}
+
+void arithmeticFactor() : {}
+{
+   [ ( "+"
+     | "-"
+     )
+   ]  
+   arithmeticPrimary()
+}
+
+void arithmeticPrimary() : {}
+{
+     <PROPERTY_PATH> // **** SPEC NOTE: defined as "state_field_path_expression"	
+   | numericLiteral()
+   | (
+       "("
+       simpleArithmeticExpression()
+       ")"
+     )
+   | inputParameter()
+   | functionsReturningNumerics()
+   | aggregateExpression()
+}
+
+void stringExpression() : {} 
+{
+   stringPrimary()
+   | ( "(" 
+       subquery()
+       ")"
+     )
+}
+
+void stringPrimary() : {}
+{
+     <PROPERTY_PATH> // **** SPEC NOTE: defined as "state_field_path_expression"	
+   | stringLiteral()
+   | inputParameter()
+   | functionsReturningStrings()
+   | aggregateExpression()
+}
+
+void datetimeExpression() : {} 
+{
+      datetimePrimary()
+   | ( "(" 
+       subquery()
+       ")"
+     )
+}
+
+void datetimePrimary() : {}
+{
+     <PROPERTY_PATH> // **** SPEC NOTE: defined as "state_field_path_expression"	
+   | inputParameter()
+   | functionsReturningDatetime()
+   | aggregateExpression()
+}
+
+void booleanExpression() : {} 
+{
+     booleanPrimary()
+   | ( "(" 
+       subquery()
+       ")"
+     )
+}
+
+void booleanPrimary() : {}
+{
+     <PROPERTY_PATH> // **** SPEC NOTE: defined as "state_field_path_expression"	
+   | booleanLiteral()
+   | inputParameter()
+}
+
+void enumExpression() : {} 
+{
+     enumPrimary()
+   | ( "(" 
+       subquery()
+       ")"
+     )
+}
+
+void enumPrimary() : {}
+{
+     <PROPERTY_PATH> // **** SPEC NOTE: defined as "state_field_path_expression"	
+   | enumLiteral()
+   | inputParameter()
+}
+
+void entityExpression() : {}
+{
+	<PROPERTY_PATH> // **** SPEC NOTE: defined as "single_valued_association_path_expression | simple_entity_expression"
+}
+
+void simpleEntityExpression() : {}
+{
+     identificationVariable()
+   | inputParameter()
+}
+
+void functionsReturningNumerics() : {}
+{
+     ( "LENGTH(" 
+       stringPrimary()
+       ")"
+     )
+   | ( "LOCATE("
+       stringPrimary()
+       ","
+       stringPrimary()
+       [ "," 
+         simpleArithmeticExpression()
+       ]
+       ")"
+     )
+   | ( "ABS("
+       simpleArithmeticExpression()
+       ")"
+     )
+   | ( "SQRT("
+       simpleArithmeticExpression()
+       ")"
+     )
+   | ( "MOD("
+       simpleArithmeticExpression()
+       ","
+       simpleArithmeticExpression()
+       ")"
+     )
+   | ( "SIZE("
+       <PROPERTY_PATH> // **** SPEC NOTE: defined as "collection_valued_path_expression"
+       ")"
+     )
+}
+
+void functionsReturningDatetime() : {}
+{
+     "CURRENT_DATE"
+   | "CURRENT_TIME"
+   | "CURRENT_TIMESTAMP"
+}
+
+void functionsReturningStrings() : {}
+{
+     ( "CONCAT("
+       stringPrimary()
+       ","
+       stringPrimary()
+       ")"
+     )
+   | ( "SUBSTRING("
+       stringPrimary()
+       ","
+       simpleArithmeticExpression()
+       ","
+       simpleArithmeticExpression()
+       ")"
+     )
+   | ( "TRIM("
+       [
+         [ trimSpecification() ]
+         [ trimCharacter() ]
+         "FROM"
+       ] 
+       stringPrimary()
+       ")"
+     )
+   | ( "LOWER("
+       stringPrimary()
+       ")"
+     )
+   | ( "UPPER("
+       stringPrimary()
+       ")"
+     )
+}
+
+void trimSpecification() : {}
+{
+     "LEADING" 
+   | "TRAILING"
+   | "BOTH"
+}
+
+void abstractSchemaName() : {}
+{
+   <IDENTIFIER>
+}
+
+void identificationVariable() : {}
+{
+   <IDENTIFIER>
+}
+
+void inputParameter() : {}
+{
+     ( ":" 
+       <IDENTIFIER>
+     )
+  |  ( "?" 
+       <DECIMAL_DIGITS>
+     )
+}
+
+void literal() : {}
+{
+     stringLiteral()
+   | enumLiteral()
+   | numericLiteral()
+   | booleanLiteral()
+}
+
+void stringLiteral() : {}
+{
+   <SINGLE_QUOTED_STRING>
+}
+
+void numericLiteral() : {}
+{
+   // TODO
+   <DECIMAL_DIGITS>
+}
+
+void enumLiteral() : {}
+{
+   <PROPERTY_PATH>
+}
+
+void booleanLiteral() : {}
+{
+     "TRUE" 
+   | "FALSE"
+}
+
+void constructorName() : {}
+{
+   <IDENTIFIER>
+}
+
+void trimCharacter() : {}
+{
+   <ANY_CHAR>
+}
+
+void escapeCharacter() : {}
+{
+   <ANY_CHAR>
+}
+
+void patternValue() : {}
+{
+   stringLiteral()
+}
+
+// **** TOKENS ****
+
+SKIP :
+{
+  " "
+| "\t"
+| "\n"
+| "\r"
+}
+
+TOKEN :
+{
+  < PROPERTY_PATH: <IDENTIFIER> ( "." <IDENTIFIER>) *>
+|
+  < IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)* >
+|
+  < #LETTER: ["_","$","a"-"z","A"-"Z"] >
+|
+  < #DIGIT: ["0"-"9"] >
+| 
+  < DECIMAL_DIGITS: (["0"-"9"])+ >
+| 
+  < ANY_CHAR: ~["\n","\r"]>
+}
+
+
+MORE:
+{
+    "'"  { stringBuffer = new StringBuffer(); }: WithinSingleQuoteLiteral
+}
+
+<WithinSingleQuoteLiteral> MORE:
+{
+	< ESC: "\\" ( ["n","r","t","b","f","\\","'","`","\""]
+                | (["0"-"3"])? ["0"-"7"] (["0"-"7"])?
+                )
+    >
+        { stringBuffer.append( escapeChar() ); }
+ |
+    < (~["'","\\"]) >
+        { stringBuffer.append( image.charAt(image.length()-1) ); }
+}
+
+<WithinSingleQuoteLiteral> TOKEN :
+{
+    <SINGLE_QUOTED_STRING: "'">
+        : DEFAULT
+}
\ No newline at end of file