chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1133142 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src: main/antlr3/org/apache/chemistry/opencmis/server/support/query/ test/java/org/apache/chemistry/opencmis/server/support/query/
Date Tue, 07 Jun 2011 20:16:56 GMT
Author: jens
Date: Tue Jun  7 20:16:56 2011
New Revision: 1133142

URL: http://svn.apache.org/viewvc?rev=1133142&view=rev
Log:
Support backslash escaping and SQL escaping with doubling a single quote [CMIS-385]

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserStrict.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g?rev=1133142&r1=1133141&r2=1133142&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/antlr3/org/apache/chemistry/opencmis/server/support/query/CmisQlStrictLexer.g
Tue Jun  7 20:16:56 2011
@@ -126,7 +126,20 @@ fragment ExactNumLit : Digits DOT Digits
 fragment ApproxNumLit : ExactNumLit ('e'|'E') Sign Digits;
 NUM_LIT : Sign (ExactNumLit | ApproxNumLit);
 
-STRING_LIT : '\'' (~'\''|'\'\'')* '\'';
+fragment QUOTE: '\'';
+fragment BACKSL: '\\';
+
+// An escape sequence is two backslashes for backslash, backslash single quote for single
quote
+// or single quote single quote for single quote
+fragment
+ESC 
+	: BACKSL (QUOTE | BACKSL)
+	| QUOTE QUOTE
+	;
+	
+STRING_LIT
+    :  QUOTE ( ESC | ~(BACKSL|QUOTE) )* QUOTE
+	;
 
 WS : ( ' ' | '\t' | '\r'? '\n' )+ { $channel=HIDDEN; };
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserStrict.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserStrict.java?rev=1133142&r1=1133141&r2=1133142&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserStrict.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/TestParserStrict.java
Tue Jun  7 20:16:56 2011
@@ -266,6 +266,23 @@ public class TestParserStrict extends Ab
     public void testSTRING_LIT5() throws Exception {
         testLexerFail("STRING_LIT", "'ab'c'");
     }
+    
+    @Test
+    public void testSTRING_LIT6() throws Exception {
+        testLexerOk("STRING_LIT", "'That''s'");
+        testLexerOk("STRING_LIT", "'Gus'''");
+    }
+    
+    @Test
+    public void testSTRING_LIT7() throws Exception {
+        testLexerOk("STRING_LIT", "'That\\\'s'");
+        testLexerOk("STRING_LIT", "'Gus\\\'\'");
+    }
+
+    @Test
+    public void testSTRING_LIT8() throws Exception {
+        testLexerOk("STRING_LIT", "'c:\\\\temp'");
+    }
 
 
 //    BOOL_LIT:



Mime
View raw message