You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2014/02/17 16:45:31 UTC

[22/28] [OLINGO-161] Refactored Java package names

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchTerm.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchTerm.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchTerm.java
new file mode 100644
index 0000000..1a8e823
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchTerm.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.olingo.odata4.server.api.uri.queryoption.search;
+
+public interface SearchTerm extends SearchExpression {
+  
+  String getSearchTerm();
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchUnary.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchUnary.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchUnary.java
new file mode 100644
index 0000000..b2fd9ea
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SearchUnary.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.olingo.odata4.server.api.uri.queryoption.search;
+
+public interface SearchUnary {
+  
+  SearchExpression getOperand();
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchBinaryOperators.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
new file mode 100644
index 0000000..cc5c573
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchBinaryOperators.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.olingo.odata4.server.api.uri.queryoption.search;
+
+public enum SupportedSearchBinaryOperators {
+  // and/or
+  AND("and"), OR("or");
+
+  private String syntax;
+
+  private SupportedSearchBinaryOperators(final String syntax) {
+    this.syntax = syntax;
+  }
+  
+  @Override
+  public String toString() {
+    return syntax;
+  }
+
+  public static SupportedSearchBinaryOperators get(final String operator) {
+    for (SupportedSearchBinaryOperators op : SupportedSearchBinaryOperators.values()) {
+      if (op.toString().equals(operator)) {
+        return op;
+      }
+    }
+    return null;
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchUnaryOperators.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
new file mode 100644
index 0000000..a61e72d
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/search/SupportedSearchUnaryOperators.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.olingo.odata4.server.api.uri.queryoption.search;
+
+public enum SupportedSearchUnaryOperators {
+  NOT("not");
+
+  private String syntax;
+
+  private SupportedSearchUnaryOperators(final String syntax) {
+    this.syntax = syntax;
+  }
+
+  @Override
+  public String toString() {
+    return syntax;
+  }
+
+  public static SupportedSearchUnaryOperators get(final String operator) {
+    for (SupportedSearchUnaryOperators op : SupportedSearchUnaryOperators.values()) {
+      if (op.toString().equals(operator)) {
+        return op;
+      }
+    }
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/pom.xml
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/pom.xml b/odata4-lib/odata4-server-core/pom.xml
index e6ada36..58ca7ce 100644
--- a/odata4-lib/odata4-server-core/pom.xml
+++ b/odata4-lib/odata4-server-core/pom.xml
@@ -79,7 +79,7 @@
           <visitor>true</visitor>
           <!--maven antlr plugin has trouble with grammer import if the grammerfiles are 
           not directly inside  src/main/antlr4, hence we have to set the libDirectory-->
-          <libDirectory>src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr</libDirectory>
+          <libDirectory>src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr</libDirectory>
         </configuration>
       </plugin>
     </plugins>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4 b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
deleted file mode 100644
index 33e7296..0000000
--- a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
+++ /dev/null
@@ -1,405 +0,0 @@
-/*******************************************************************************
- * 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.
- ******************************************************************************/
-lexer grammar UriLexer;
-
-//;==============================================================================
-// Mode "DEFAULT_MODE": Processes everything bevor the first '?' char
-// On '?' the next mode "MODE_QUERY" is used
-// The percent encoding rules a defined in RFC3986 ABNF rule "path-rootless" apply
-//;==============================================================================
-QM              : '?'                 ->        pushMode(MODE_QUERY);               //first query parameter
-AMP             : '&'                 ->        pushMode(MODE_QUERY);               //more query parameters
-STRING          : '\''                -> more,  pushMode(MODE_STRING);              //reads up to next single '
-QUOTATION_MARK  : ('\u0022' | '%22')  -> more,  pushMode(MODE_JSON_STRING);         //reads up to next unescaped "
-SEARCH_INLINE   : '$search'           ->        pushMode(MODE_SYSTEM_QUERY_SEARCH); //
-FRAGMENT        : '#'                 ->        pushMode(MODE_FRAGMENT); //
-
-GEOGRAPHY    : G E O G R A P H Y SQUOTE         -> pushMode(MODE_ODATA_GEO); //TODO make case insensitive
-GEOMETRY     : G E O M E T R Y   SQUOTE         -> pushMode(MODE_ODATA_GEO);
-
-//Letters for case insensitivity
-fragment A    : 'A'|'a';
-fragment B    : 'B'|'b';
-fragment D    : 'D'|'d';
-fragment E    : 'E'|'e';
-fragment F    : 'F'|'f';
-fragment G    : 'G'|'g';
-fragment H    : 'H'|'h';
-fragment I    : 'I'|'i';
-fragment L    : 'L'|'l';
-fragment M    : 'M'|'m';
-fragment N    : 'N'|'n';
-fragment O    : 'O'|'o';
-fragment P    : 'P'|'p';
-fragment R    : 'R'|'r';
-fragment S    : 'S'|'s';
-fragment T    : 'T'|'t';
-fragment U    : 'U'|'u';
-fragment Y    : 'Y'|'y';
-fragment Z    : 'Z'|'z';
-
-//special chars
-OPEN            : '(' | '%28';
-CLOSE           : ')' | '%29';
-COMMA           : ',' | '%2C';
-SLASH           : '/';
-POINT           : '.';
-AT              : '@';
-EQ              : '=' ;
-STAR            : '*';
-SEMI            : ';' | '%3b';
-COLON           : ':';
-
-EQ_sq           : '='           -> type(EQ);
-AMP_sq          : '&'           -> type(AMP), popMode;
-fragment WS     : ( ' ' | '%09' | '%20' | '%09' );
-WSP             : WS+;
-
-//JSON support 
-BEGIN_OBJECT    : WS* ( '{' / '%7B' ) WS*;
-END_OBJECT      : WS* ( '}' / '%7D' ) WS*;
-
-BEGIN_ARRAY     : WS* ( '[' / '%5B' ) WS*;
-END_ARRAY       : WS* ( ']' / '%5D' ) WS*;
-
-
-//alpha stuff
-fragment ALPHA                : 'a'..'z' | 'A'..'Z';
-fragment ALPHA_A_TO_F         : 'a'..'f' | 'A'..'F';
-fragment DIGIT                : '0'..'9';
-fragment DIGITS               : DIGIT+;
-fragment HEXDIG               : DIGIT | ALPHA_A_TO_F;
-fragment ODI_LEADINGCHARACTER : ALPHA | '_';            //TODO; add Unicode characters from the categories L or Nl
-fragment ODI_CHARACTER        : ALPHA | '_' | DIGIT;    //TODO; add Unicode characters from the categories L, Nl, Nd, Mn, Mc, Pc, or Cf
-
-//helper for date/time values
-fragment ONE_TO_NINE        : '1'..'9';
-fragment ZERO_TO_FIFTYNINE  : ('0'..'5') DIGIT;
-fragment FRACTIONALSECONDS  : DIGIT+;
-fragment SECOND             : ZERO_TO_FIFTYNINE;
-fragment MINUTE             : ZERO_TO_FIFTYNINE;
-fragment HOUR               : ('0' | '1') DIGIT | '2' ( '0'..'3');
-fragment DAY                : '0' '1'..'9' | ('1'|'2') DIGIT | '3' ('0'|'1');
-fragment MONTH              : '0' ONE_TO_NINE | '1' ( '0' | '1' | '2' );
-fragment YEAR               : ('-')? ( '0' DIGIT DIGIT DIGIT | ONE_TO_NINE DIGIT DIGIT DIGIT );
-
-//tags start with $ 
-BATCH         : '$batch';
-ENTITY        : '$entity';
-METADATA      : '$metadata';
-
-ALL           : '$all';
-CROSSJOIN     : '$crossjoin';
-
-VALUE         : '$value';
-REF           : '$ref';
-COUNT         : '$count';
-
-//inlined query parameters ( e.g. $skip)
-TOP_I    : '$top' -> type(TOP);
-SKIP_I   : '$skip' -> type(SKIP);
-FILTER_I : '$filter' -> type(FILTER);
-ORDERBY_I: '$orderby' -> type(ORDERBY);
-SELECT_I: '$select' -> type(SELECT);
-EXPAND_I: '$expand' -> type(EXPAND);
-LEVELS_I: '$levels' -> type(LEVELS);
-MAX: 'max';
-
-ROOT            : '$root/';
-
-
-
-//rest
-NULLVALUE     : 'null';
-
-TRUE          : 'true';
-FALSE         : 'false';
-BOOLEAN       :  T R U E |  F A L S E; 
-PLUS          : '+';
-SIGN          : PLUS  | '%2B'   |'-';
-INT           : SIGN? DIGITS;
-DECIMAL       : INT '.' DIGITS ('e' SIGN?  DIGITS)?;
-
-//primary types
-BINARY                      : B I N A R Y SQUOTE (HEXDIG HEXDIG)* SQUOTE; 
-DATE                        : YEAR '-' MONTH '-' DAY;
-DATETIMEOFFSET              : YEAR '-' MONTH '-' DAY T HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )? ( Z | SIGN HOUR ':' MINUTE );
-fragment DUSECONDFRAG       : DIGITS ('.' DIGITS)? 'S';
-fragment DUTIMEFRAG         : 'T' (   
-                              ( DIGITS 'H' (DIGITS 'M')? DUSECONDFRAG?) 
-                              | (DIGITS 'M' DUSECONDFRAG?) 
-                              | DUSECONDFRAG
-                            );
-fragment DUDAYTIMEFRAG      : DIGITS 'D' DUTIMEFRAG? | DUTIMEFRAG;
-DURATION                    : D U R A T I O N SQUOTE '-'? 'P' DUDAYTIMEFRAG SQUOTE;
-TIMEOFDAY                   : HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )?;
-fragment GUIDVALUE          : HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG'-' 
-                              HEXDIG HEXDIG HEXDIG HEXDIG  '-' 
-                              HEXDIG HEXDIG HEXDIG HEXDIG  '-' 
-                              HEXDIG HEXDIG HEXDIG HEXDIG  '-' 
-                              HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG;
-GUID                        : GUIDVALUE;
-
-//expression tokens
-ASC             : 'asc'; 
-DESC            : 'desc';
-MUL             : 'mul';
-DIV             : 'div';
-MOD             : 'mod';
-HAS             : 'has';
-
-ADD             : 'add';
-SUB             : 'sub';
-
-ANY_LAMDA       : 'any';
-ALL_LAMDA       : 'all';
-
-GT              : 'gt';
-GE              : 'ge';
-LT              : 'lt';
-LE              : 'le';
-ISOF            : 'isof';
-
-EQ_ALPHA        : 'eq';
-NE              : 'ne';
-
-AND             : 'and';
-OR              : 'or';
-
-
-NOT             : 'not';
-MINUS           :'-';
-NANINFINITY     : 'NaN' | '-INF' | 'INF';
-
-IT  : '$it';
-ITSLASH  : '$it/';
-LEVELS               : '$levels';
-
-CONTAINS_WORD             : 'contains(';
-STARTSWITH_WORD           : 'startswith(';
-ENDSWITH_WORD             : 'endswith(';
-LENGTH_WORD               : 'length(';
-INDEXOF_WORD              : 'indexof(';
-SUBSTRING_WORD            : 'substring(';
-TOLOWER_WORD              : 'tolower(';
-TOUPPER_WORD              : 'toupper(';
-TRIM_WORD                 : 'trim(';
-CONCAT_WORD               : 'concat(';
-YEAR_WORD                 : 'year(';
-MONTH_WORD                : 'month(';
-DAY_WORD                  : 'day(';
-HOUR_WORD                 : 'hour(';
-MINUTE_WORD               : 'minute(';
-SECOND_WORD               : 'second(';
-FRACTIONALSECONDS_WORD    : 'fractionalseconds(';
-TOTALSECONDS_WORD         : 'totalseconds(';
-DATE_WORD                 : 'date(';
-TIME_WORD                 : 'time(';
-TOTALOFFSETMINUTES_WORD   : 'totaloffsetminutes(';
-
-MINDATETIME_WORD          : 'mindatetime(';
-MAXDATETIME_WORD          : 'maxdatetime(';
-NOW_WORD                  : 'now(';
-
-ROUND_WORD                : 'round(';
-FLOOR_WORD                : 'floor(';
-CEILING_WORD              : 'ceiling(';
-
-GEO_DISTANCE_WORD         : 'geo.distance(';
-GEO_LENGTH_WORD           : 'geo.length(';
-GEO_INTERSECTS_WORD       : 'geo.intersects(';
-ISOF_WORD                 : 'isof(';
-CAST_WORD                 : 'cast(';
-
-COLLECTION_REF            : 'Collection($ref)';
-COLLECTION_ENTITY_TYPE    : 'Collection(Edm.EntityType)';
-COLLECTION_COMPLEX_TYPE   : 'Collection(Edm.ComplexType)';
-COLLECTION                : 'Collection(' -> type(COLLECTION);
-
-//used in fragment only
-DELETED_ENTITY            : '$deletedEntity';
-LINK                      : '$link';
-DELETED_LINK              : '$deletedLink';
-DELTA                     : '$delta';
-
-//ODI
-ODATAIDENTIFIER             : ODI_LEADINGCHARACTER (ODI_CHARACTER)*;
-
-//;==============================================================================
-// Mode "QUERY": Processes everything between the first '?' and the '#' char
-// On '?' the next mode "FRAGMENT" is used
-// The percent encoding rules a defined in RFC3986 ABNF rule "query" apply
-mode MODE_QUERY;
-//;==============================================================================
-
-FRAGMENT_q          : '#'           -> type(FRAGMENT);
-FILTER              : '$filter'     ->                    pushMode(DEFAULT_MODE);
-ORDERBY             : '$orderby'    ->                    pushMode(DEFAULT_MODE);
-EXPAND              : '$expand'     ->                    pushMode(DEFAULT_MODE);
-SELECT              : '$select'     ->                    pushMode(DEFAULT_MODE);
-SKIP                : '$skip'       ->                    pushMode(DEFAULT_MODE);
-SKIPTOKEN           : '$skiptoken'  ->                    pushMode(MODE_SYSTEM_QUERY_REST);
-TOP                 : '$top'        ->                    pushMode(DEFAULT_MODE);
-LEVELS_q            : '$levels'     -> type(LEVELS),      pushMode(DEFAULT_MODE);
-FORMAT              : '$format'     ->                    pushMode(MODE_SYSTEM_QUERY_PCHAR);
-COUNT_q             : '$count'      -> type(COUNT),       pushMode(DEFAULT_MODE);
-REF_q               : '$ref'        -> type(REF);
-VALUE_q             : '$value'      -> type(VALUE);
-ID                  : '$id'         ->                    pushMode(MODE_SYSTEM_QUERY_REST);
-SEARCH              : '$search'     ->                    pushMode(MODE_SYSTEM_QUERY_SEARCH);
-
-EQ_q          : '=' -> type(EQ);
-AMP_q         : '&' -> type(AMP);
-
-AT_Q          : '@' -> pushMode(DEFAULT_MODE);
-
-CUSTOMNAME    : ~[&=@$] ~[&=]* -> pushMode(MODE_SYSTEM_QUERY_REST);
-
-//;==============================================================================
-mode MODE_SYSTEM_QUERY_PCHAR;
-//;==============================================================================
-
-AMP_sqp   : '&' -> type(AMP),       popMode;
-
-fragment ALPHA_sqp          : 'a'..'z'|'A'..'Z';
-fragment A_TO_F_sqp         : 'a'..'f'|'A'..'F';
-fragment DIGIT_sqp          : '0'..'9';
-fragment HEXDIG_sqp         : DIGIT_sqp | A_TO_F_sqp;
-fragment PCT_ENCODED_sqp    : '%' HEXDIG_sqp HEXDIG_sqp;
-fragment SUB_DELIMS_sqp     : '$' | /*'&' |*/ '\'' | EQ_sqp | OTHER_DELIMS_sqp;
-fragment OTHER_DELIMS_sqp   : '!' | '(' | ')' | '*' | '+' | ',' | ';';
-fragment UNRESERVED_sqp     : ALPHA_sqp | DIGIT_sqp | '-' |'.' | '_' | '~'; 
-fragment PCHAR              : UNRESERVED_sqp | PCT_ENCODED_sqp | SUB_DELIMS_sqp | ':' | '@'; 
-fragment PCHARSTART         : UNRESERVED_sqp | PCT_ENCODED_sqp | '$' | /*'&' |*/ '\'' | OTHER_DELIMS_sqp | ':' | '@'; 
-
-
-ATOM : [Aa][Tt][Oo][Mm];
-JSON : [Jj][Ss][Oo][Nn];
-XML  : [Xx][Mm][Ll];
-
-PCHARS : PCHARSTART PCHAR*;
-
-
-SLASH_sqp : '/' -> type(SLASH);
-EQ_sqp    : '=' -> type(EQ);
-FRAGMENT_sqp  : '#'     -> type(FRAGMENT),  pushMode(MODE_FRAGMENT);
-
-//;==============================================================================
-mode MODE_FRAGMENT;
-// Read the remaining characters of a URI queryparameter up to an & or # 
-// character.
-//;==============================================================================
-
-REST_F          : ~('\r'|'\n')* -> type(REST),  popMode;
-
-//;==============================================================================
-mode MODE_SYSTEM_QUERY_REST;
-// Read the remaining characters of a URI queryparameter up to an & or # 
-// character.
-//;==============================================================================
-
-AMP_sqr       : '&'     -> type(AMP),       popMode;
-FRAGMENT_sqr  : '#'     -> type(FRAGMENT),  popMode;
-
-EQ_sqr        : '='     -> type(EQ);
-REST          : ~[&#=] ~[&#]*;
-
-//;==============================================================================
-mode MODE_SYSTEM_QUERY_SEARCH;
-//;==============================================================================
-
-NOT_sqc             : 'NOT'   -> type(NOT);
-AND_sqc             : 'AND'   -> type(AND);
-OR_sqc              : 'OR'    -> type(OR);
-EQ_sqc              : '='     -> type(EQ);
-
-fragment WS_sqc     : ( ' ' | '\u0009' | '%20' | '%09' );
-WSP_sqc             : WS_sqc+ -> type(WSP);
-
-QUOTATION_MARK_sqc  : '\u0022' | '%22';
-
-SEARCHWORD          : ('a'..'z'|'A'..'Z')+;
-SEARCHPHRASE        : QUOTATION_MARK_sqc ~["]* QUOTATION_MARK_sqc -> popMode;
-
-
-//;==============================================================================
-mode MODE_STRING;
-// Read the remaining characters up to an ' character.
-// An "'" character inside a string are expressed as double ''
-//;==============================================================================
-
-STRING_s            : ('\'\'' | ~[\u0027] )* '\'' -> type(STRING), popMode;
-
-//;==============================================================================
-mode MODE_JSON_STRING;
-// Read the remaining characters up to an " character.
-// An "'" character inside a string are expressed excaped \"
-//;==============================================================================
-
-STRING_IN_JSON      : ('\\"' | ~[\u0022] )* ('"' | '%22') -> popMode;
-
-//;==============================================================================
-mode MODE_ODATA_GEO;
-//;==============================================================================
-
-fragment C_  : 'c'|'C';
-fragment D_  : 'd'|'D';
-fragment E_  : 'e'|'E';
-fragment G_  : 'g'|'G';
-fragment H_  : 'h'|'H';
-fragment I_  : 'i'|'I';
-fragment L_  : 'l'|'L';
-fragment M_  : 'm'|'M';
-fragment N_  : 'n'|'N';
-fragment O_  : 'o'|'O';
-fragment P_  : 'p'|'P';
-fragment R_  : 'r'|'R';
-fragment S_  : 's'|'S';
-fragment T_  : 't'|'T';
-fragment U_  : 'u'|'U';
-fragment Y_  : 'y'|'Y';
-
-fragment SP_g   : ' ';//'\u0020'; // a simple space
-fragment WS_g   : ( ' ' | '%20' | '%09' );
-
-OPEN_g          : ('(' | '%28') -> type(OPEN);
-CLOSE_g         : (')' | '%29') -> type(CLOSE);
-COMMA_g         : (',' | '%2C') -> type(COMMA);
-WSP_g           : WS_g+ -> type(WSP);
-POINT_g         : '.' -> type(POINT);
-AT_g            : '@' -> type(AT);
-SEMI_g            : (';' | '%3B') -> type(SEMI);
-EQ_g            : '=' -> type(EQ);
-
-fragment DIGIT_g    : '0'..'9';
-fragment DIGITS_g   : DIGIT_g+;
-SIGN_g              : ('+' | '%2B' |'-') -> type(SIGN);
-INT_g               : SIGN_g? DIGITS_g -> type(INT);
-DECIMAL_g           : INT_g '.' DIGITS_g ('e' SIGN_g?  DIGITS_g)? -> type(DECIMAL);
-COLLECTION_g        : C_ O_ L_ L_ E_ C_ T_ I_ O_ N_ -> type(COLLECTION);
-LINESTRING          : L_ I_ N_ E_ S_ T_ R_ I_ N_ G_ ;
-MULTILINESTRING     : M_ U_ L_ T_ I_ L_ I_ N_ E_ S_ T_ R_ I_ N_ G_;
-MULTIPOINT          : M_ U_ L_ T_ I_ P_ O_ I_ N_ T_ ;
-MULTIPOLYGON        : M_ U_ L_ T_ I_ P_ O_ L_ Y_ G_ O_ N_;
-GEO_POINT           : P_ O_ I_ N_ T_;
-POLYGON             : P_ O_ L_ Y_ G_ O_ N_ ;
-
-SRID                : S_ R_ I_ D_;
-
-SQUOTE              : '\''  -> popMode;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4 b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
deleted file mode 100644
index 82d2d60..0000000
--- a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriParser.g4
+++ /dev/null
@@ -1,518 +0,0 @@
-/*******************************************************************************
- * 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.
- ******************************************************************************/
-
- grammar UriParser;
-
-
-//Antlr4 (as most parsers) has a lexer for token detection and a parser which defines
-//rules based on the tokens. However its hard to define a clear lexer on the
-//ODATA URI syntax due to some reasons:
-// - the syntax is based on the URI specification and there fore contains the definition
-//   of delimiters and percent encoding
-// - the syntax includes JSON
-// - the syntax includes a expression syntax which comes from ODATA itself (e.g. $filter)
-// - the syntax includes searchstring and searchword 
-// - the ABNF describing syntax is not defined in a context free manner
-// so there are several kinds of "String" tokens:
-// -  strings with single quotes, 
-// -  strings with single quotes and a special syntax within the quotes (like geometry data)
-// -  strings with double quotes
-// -  strings without quotes ( usually identifiers, searchstrings, searchwords, custom parameters)
-//    but each with different allowed charactersets
-// Drawing a simple line between lexer and parser is not possible.
-//
-// This grammer is a compromiss we have choosen to satisfy the requirements we have
-// - the grammer is context free
-//   - this makes the parser much simpler and we have a clear saparation between parsing and
-//     EDM validation, but also creates a parse tree which is not semantically correct from the
-//     EDM perspective ( e.g.it will not pass the EDM validation)
-// - the grammer can not be applied on a full URI string
-//   - the URI should be split according the URI specification before used as input for the 
-//     ODATA parser
-// - while creating the grammer the antlr lexer modes where only allowed in pure lexer grammers
-//   not in combined grammers, and is was not possible to include lexer grammer with a mode into
-//   a combined grammar without creating JAVA errors.
-
-//   see https://github.com/antlr/antlr4/issues/160 "Support importing multi-mode lexer grammars"
-
-
-//Naming convention 
-//  ...
-//Decoding encoding
-//- within rule "resourcePath": special chars used in EDM.Strings must still be encoded when 
-//  used as tokenizer input
-//  e.g. .../Employees(id='Hugo%2FMueller')/EmployeeName <-- SLASH must be encoded to '%2F' in "Hugo/Mueller"
-//    but it must not be encoded before the EmployeeName
-
-
-
-options {
-    language = Java;
-    tokenVocab=UriLexer;
-}
-
-
-//;------------------------------------------------------------------------------
-//; 0. URI
-//;------------------------------------------------------------------------------
-
-//ABNF odataUri and serviceRoot are currently not used here
-//odataUri = serviceRoot [ odataRelativeUri ]  
-//
-//serviceRoot = ( "https" / "http" )                    ; Note: case-insensitive 
-//              "://" host [ ":" port ]
-//              "/" *( segment-nz "/" )
-
-
-odataRelativeUriEOF : odataRelativeUri? EOF;
-
-//QM and FRAGMENT enable next lexer mode
-//TODO add the new "ENTITYCAST"
-odataRelativeUri    : BATCH                                                                     # altBatch 
-                    | ENTITY       QM vEO=entityOptions                                          # altEntity
-                    | ENTITY       SLASH vNS=namespace vODI=odataIdentifier QM vEO=entityOptionsCast  # altEntityCast
-                    | METADATA     ( QM vF=format )? ( FRAGMENT vCF=contextFragment )?                 # altMetadata
-                    | vRP=resourcePath ( QM vQO=queryOptions )?                                         # altResourcePath
-                    ;
-
-//;------------------------------------------------------------------------------
-//; 1. Resource Path
-//;------------------------------------------------------------------------------
-                   
-resourcePath        : vAll=ALL          
-                    | vCJ=crossjoin     
-                    | vlPS=pathSegments  
-                    ;
-crossjoin           : CROSSJOIN OPEN WSP? vlODI+=odataIdentifier WSP? ( COMMA WSP? vlODI+=odataIdentifier  WSP?)* CLOSE;
-
-pathSegments        : vlPS+=pathSegment (SLASH vlPS+=pathSegment)* vCS=constSegment?;
-
-pathSegment         : vNS=namespace? vODI=odataIdentifier vlNVO+=nameValueOptList*;
-
-nameValueOptList    : OPEN (vVO=valueOnly | vNVL=nameValueList)? CLOSE;
-valueOnly           : vV=commonExpr ;
-nameValueList       : WSP* vlNVP+=nameValuePair WSP* ( COMMA WSP* vlNVP+=nameValuePair  WSP*)* ;
-nameValuePair       : vODI=odataIdentifier EQ (AT vALI=odataIdentifier | vCOM=commonExpr /*TODO | val2=enumX*/);
-
-constSegment        : SLASH (vV=value | vC=count | vR=ref | vAll=allExpr | vAny=anyExpr);
-
-count               : COUNT;
-ref                 : REF;
-value               : VALUE;
-//;------------------------------------------------------------------------------
-//; 2. Query Options
-//;------------------------------------------------------------------------------
-
-queryOptions    : vlQO+=queryOption ( AMP vlQO+=queryOption )*;
-
-queryOption     : systemQueryOption
-                | AT_Q aliasAndValue
-                | customQueryOption
-                ;
-
-entityOptions   : (vlEOb+=entityOption AMP )* vlEOm=id ( AMP vlEOa+=entityOption )*;
-entityOption    : format
-                | customQueryOption 
-                ;
-
-entityOptionsCast : (vlEOb+=entityOptionCast AMP )* vlEOm=id ( AMP vlEOa+=entityOptionCast )*;
-entityOptionCast  : expand 
-                  | format 
-                  | select 
-                  | filter
-                  | customQueryOption 
-                  ;
-
-systemQueryOption   : expand
-                    | filter 
-                    | format 
-                    | id
-                    | inlinecount 
-                    | orderBy 
-                    | search
-                    | select 
-                    | skip 
-                    | skiptoken
-                    | top
-                    ;
-
-id                  : ID EQ REST;
-skiptoken           : SKIPTOKEN EQ REST;
-expand              : EXPAND EQ vlEI+=expandItem ( COMMA vlEI+=expandItem )*;
-
-expandItem          : vS=STAR ( SLASH vR=ref | OPEN LEVELS EQ ( vL=INT | vM=MAX)  CLOSE )?
-                    | vEP=expandPath vEPE=expandPathExtension?;
-
-
-expandPath          : vlPS+=pathSegment (SLASH vlPS+=pathSegment)*;
-//expandPath          : expandPathSegment ( SLASH expandPathSegment )*;
-//expandPathSegment   : vNS=namespace? vODI=odataIdentifier;
-
-expandPathExtension : OPEN vlEO+=expandOption                        ( SEMI vlEO+=expandOption       )* CLOSE 
-                    | SLASH vR=ref   ( OPEN vlEOR+=expandRefOption   ( SEMI vlEOR+=expandRefOption   )* CLOSE )?
-                    | SLASH vC=count ( OPEN vlEOC+=expandCountOption ( SEMI vlEOC+=expandCountOption )* CLOSE )?
-                    ;  
-expandCountOption   : filter
-                    | search
-                    ;
-expandRefOption     : expandCountOption
-                    | orderBy
-                    | skip
-                    | top 
-                    | inlinecount
-                    ;
-expandOption        : expandRefOption
-                    | select 
-                    | expand
-                    | levels;
-
-levels              : LEVELS EQ ( INT | MAX );
-
-filter              : FILTER EQ commonExpr;
-
-orderBy             : ORDERBY EQ WSP* vlOI+=orderByItem ( WSP* COMMA WSP* vlOI+=orderByItem )*;
-orderByItem         : vC=commonExpr ( WSP ( vA=ASC | vD=DESC ) )?;
-
-//this is completly done in lexer grammer to avoid ambiguities with odataIdentifier and STRING
-skip                : SKIP EQ INT;
-top                 : TOP EQ INT;
-format              : FORMAT EQ ( ATOM | JSON | XML | PCHARS ( SLASH PCHARS)?);
-
-inlinecount         : COUNT EQ booleanNonCase;
-
-search              : SEARCH searchSpecialToken;
-searchInline        : SEARCH_INLINE searchSpecialToken;
-
-searchSpecialToken  : EQ WSP? searchExpr;
-
-searchExpr          : (NOT WSP) searchExpr
-                    | searchExpr searchExpr
-                    | searchExpr  WSP searchExpr
-                    | searchExpr ( WSP AND WSP) searchExpr
-                    | searchExpr ( WSP OR WSP) searchExpr
-                    | searchPhrase
-                    | searchWord
-                    ;
-
-searchPhrase        : SEARCHPHRASE;
-searchWord          : SEARCHWORD;  
-
-select              : SELECT EQ vlSI+=selectItem ( COMMA vlSI+=selectItem )*;
-selectItem          : vlSS+=selectSegment ( SLASH vlSS+=selectSegment ) *;
-selectSegment       : vNS=namespace? ( vODI=odataIdentifier | vS=STAR );
-
-aliasAndValue       : vODI=ODATAIDENTIFIER EQ vV=parameterValue;
-parameterValue      : //TODO json not supported arrayOrObject
-                      commonExpr
-                    ;
-
-
-                    
-customQueryOption   : customName ( EQ customValue)?
-                    ;
-customName          : CUSTOMNAME;
-customValue         : REST;
-
-
-
-//;------------------------------------------------------------------------------
-//; 3. Context URL Fragments
-//;------------------------------------------------------------------------------
-//TODO add ps+=pathSegment (SLASH ps+=pathSegment)*
-contextFragment     : REST;
-
-propertyList         : OPEN propertyListItem ( COMMA propertyListItem )* CLOSE;
-propertyListItem     : STAR           //; all structural properties
-                     | propertyListProperty
-                     ;
-propertyListProperty : namespace? odataIdentifier ( SLASH namespace? odataIdentifier)* ( PLUS )? ( propertyList)?
-                     ;
-                 
-
-//;------------------------------------------------------------------------------
-//; 4. Expressions
-//;------------------------------------------------------------------------------
-
-// this expression part of the grammer is not similar to the ABNF because
-// we had to introduced operator precesence witch is not reflected in the ABNF
-
-test        : test_expr EOF;
-test_expr   : INT
-            //| test_expr /*WSP*/ (  '!' | '*' ) /*WSP*/ test_expr;
-            //| test_expr WSP (  '!' | '*' ) WSP test_expr;
-            | test_expr ( WSP '!' WSP | WSP '*' WSP ) test_expr;
-
-commonExpr          : OPEN commonExpr CLOSE                                                     #altPharenthesis
-                    | vE1=commonExpr (WSP HAS WSP) vE2=commonExpr                               #altHas
-                    | methodCallExpr                                                            #altMethod
-                    | ( unary WSP ) commonExpr                                                  #altUnary
-                    | anyExpr                                                                   #altAny
-                    | allExpr                                                                   #altAll
-                    | memberExpr                                                                #altMember
-                    | vE1=commonExpr (WSP vO=MUL WSP | WSP vO=DIV WSP | WSP vO=MOD WSP ) vE2=commonExpr  #altMult
-                    | vE1=commonExpr (WSP vO=ADD WSP | WSP vO=SUB WSP) vE2=commonExpr           #altAdd
-                    | vE1=commonExpr (WSP vO=GT WSP | WSP vO=GE WSP | WSP vO=LT WSP 
-                                     | WSP vO=LE WSP ) vE2=commonExpr          #altComparism
-                    | vE1=commonExpr (WSP vO=EQ_ALPHA WSP | WSP vO=NE WSP) vE2=commonExpr       #altEquality
-                    | vE1=commonExpr (WSP AND WSP) vE2=commonExpr                               #altAnd
-                    | vE1=commonExpr (WSP OR WSP) vE2=commonExpr                                #altOr
-                    | rootExpr                                                                  #altRoot  //; $...
-                    | AT odataIdentifier                                                        #altAlias  // @...
-                    | primitiveLiteral                                                          #altLiteral  // ...
-                    ;
-
-unary               : (MINUS| NOT) ;
-
-rootExpr            : ROOT vPs=pathSegments;
-
-memberExpr          :  vIt=IT ( SLASH (vANY=anyExpr | vALL=allExpr))?
-                    |  vIts=ITSLASH? vPs=pathSegments ( SLASH (vANY=anyExpr | vALL=allExpr))?;
-
-anyExpr             : ANY_LAMDA OPEN WSP? ( vLV=odataIdentifier WSP? COLON WSP? vLE=commonExpr WSP? )? CLOSE;
-allExpr             : ALL_LAMDA OPEN WSP?   vLV=odataIdentifier WSP? COLON WSP? vLE=commonExpr WSP? CLOSE;
-
-methodCallExpr      : indexOfMethodCallExpr
-                    | toLowerMethodCallExpr
-                    | toUpperMethodCallExpr
-                    | trimMethodCallExpr
-                    | substringMethodCallExpr
-                    | concatMethodCallExpr
-                    | lengthMethodCallExpr
-                    | yearMethodCallExpr
-                    | monthMethodCallExpr
-                    | dayMethodCallExpr
-                    | hourMethodCallExpr
-                    | minuteMethodCallExpr
-                    | secondMethodCallExpr
-                    | fractionalsecondsMethodCallExpr
-                    | totalsecondsMethodCallExpr
-                    | dateMethodCallExpr
-                    | timeMethodCallExpr
-                    | roundMethodCallExpr
-                    | floorMethodCallExpr
-                    | ceilingMethodCallExpr
-                    | geoDistanceMethodCallExpr
-                    | geoLengthMethodCallExpr
-                    | totalOffsetMinutesMethodCallExpr
-                    | minDateTimeMethodCallExpr
-                    | maxDateTimeMethodCallExpr
-                    | nowMethodCallExpr
-                    //from boolean
-                    | isofExpr
-                    | castExpr
-                    | endsWithMethodCallExpr
-                    | startsWithMethodCallExpr
-                    | containsMethodCallExpr
-                    | geoIntersectsMethodCallExpr
-                    ;
-
-
-containsMethodCallExpr    : CONTAINS_WORD    WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-startsWithMethodCallExpr  : STARTSWITH_WORD  WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-endsWithMethodCallExpr    : ENDSWITH_WORD    WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-lengthMethodCallExpr      : LENGTH_WORD      WSP? vE1=commonExpr WSP? CLOSE;
-indexOfMethodCallExpr     : INDEXOF_WORD     WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-substringMethodCallExpr   : SUBSTRING_WORD   WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? ( COMMA WSP? vE3=commonExpr WSP? )? CLOSE;
-toLowerMethodCallExpr     : TOLOWER_WORD     WSP? vE1=commonExpr WSP? CLOSE;
-toUpperMethodCallExpr     : TOUPPER_WORD     WSP? vE1=commonExpr WSP? CLOSE;
-trimMethodCallExpr        : TRIM_WORD        WSP? vE1=commonExpr WSP? CLOSE;
-concatMethodCallExpr      : CONCAT_WORD      WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-
-yearMethodCallExpr                : YEAR_WORD                WSP? vE1=commonExpr WSP? CLOSE;
-monthMethodCallExpr               : MONTH_WORD               WSP? vE1=commonExpr WSP? CLOSE;
-dayMethodCallExpr                 : DAY_WORD                 WSP? vE1=commonExpr WSP? CLOSE;
-hourMethodCallExpr                : HOUR_WORD                WSP? vE1=commonExpr WSP? CLOSE;
-minuteMethodCallExpr              : MINUTE_WORD              WSP? vE1=commonExpr WSP? CLOSE;
-secondMethodCallExpr              : SECOND_WORD              WSP? vE1=commonExpr WSP? CLOSE;
-fractionalsecondsMethodCallExpr   : FRACTIONALSECONDS_WORD   WSP? vE1=commonExpr WSP? CLOSE;
-totalsecondsMethodCallExpr        : TOTALSECONDS_WORD        WSP? vE1=commonExpr WSP? CLOSE;
-dateMethodCallExpr                : DATE_WORD                WSP? vE1=commonExpr WSP? CLOSE;
-timeMethodCallExpr                : TIME_WORD                WSP? vE1=commonExpr WSP? CLOSE;
-totalOffsetMinutesMethodCallExpr  : TOTALOFFSETMINUTES_WORD  WSP? vE1=commonExpr WSP? CLOSE;
-
-minDateTimeMethodCallExpr         : MINDATETIME_WORD WSP? CLOSE;
-maxDateTimeMethodCallExpr         : MAXDATETIME_WORD WSP? CLOSE;
-nowMethodCallExpr                 : NOW_WORD         WSP? CLOSE;
-
-roundMethodCallExpr               : ROUND_WORD   WSP? vE1=commonExpr WSP? CLOSE;
-floorMethodCallExpr               : FLOOR_WORD   WSP? vE1=commonExpr WSP? CLOSE;
-ceilingMethodCallExpr             : CEILING_WORD WSP? vE1=commonExpr WSP? CLOSE;
-
-geoDistanceMethodCallExpr         : GEO_DISTANCE_WORD   WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-geoLengthMethodCallExpr           : GEO_LENGTH_WORD     WSP? vE1=commonExpr WSP? CLOSE;
-geoIntersectsMethodCallExpr       : GEO_INTERSECTS_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-
-isofExpr                          : ISOF_WORD  WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier WSP? CLOSE;
-castExpr                          : CAST_WORD  WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier WSP? CLOSE;
-
-//;------------------------------------------------------------------------------
-//; 5. JSON format for function parameters
-//;------------------------------------------------------------------------------
-//; Note: the query part of a URI needs to be partially percent-decoded before
-//; applying these rules, see comment at the top of this file
-//;------------------------------------------------------------------------------
-
-arrayOrObject       : json_array
-                    | json_object;
-
-json_array          : BEGIN_ARRAY json_value ( WSP? COMMA WSP? json_value)* END_ARRAY;
-
-json_value          : jsonPrimitiv
-                    | rootExpr
-                    | json_object
-                    | json_array;
-
-json_object         : BEGIN_OBJECT 
-                      STRING_IN_JSON
-                      WSP? COLON WSP? 
-                      json_value
-                      END_OBJECT;
-
-                                        
-//; JSON syntax: adapted to URI restrictions from [RFC4627]                 
-jsonPrimitiv        : STRING_IN_JSON
-                    | number_in_json
-                    | TRUE
-                    | FALSE
-                    | 'null'
-                    ;
-
-number_in_json          : INT | DECIMAL;
-
-//;------------------------------------------------------------------------------
-//; 6. Names and identifiers
-//;------------------------------------------------------------------------------
-
-qualifiedtypename       : namespace odataIdentifier
-                        | 'collection' OPEN ( namespace odataIdentifier ) CLOSE
-                        ;
-
-namespace               : (odataIdentifier POINT)+;
-
-odataIdentifier         : ODATAIDENTIFIER;
-
-//;------------------------------------------------------------------------------
-//; 7. Literal Data Values
-//;------------------------------------------------------------------------------
-
-
-/*TODO add missing values*/
-primitiveLiteral    : nullrule
-                    | booleanNonCase
-                    | DECIMAL   //includes double and single literals
-                    | INT       //includes int16/int32 and int64 literals
-                    | BINARY  
-                    | DATE
-                    | DATETIMEOFFSET
-                    | DURATION
-                    | GUID
-                    | string
-                    | TIMEOFDAY
-                    | enumLit
-                    | geographyCollection
-                    | geographyLineString
-                    | geographyMultilineString
-                    | geographyMultipoint
-                    | geographyMultipolygon
-                    | geographyPoint
-                    | geographyPolygon
-                    | geometryCollection
-                    | geometryLineString
-                    | geometryMultilineString
-                    | geometryMultipoint
-                    | geometryMultipolygon
-                    | geometryPoint
-                    | geometryPolygon
-                    ;
-
-
-nullrule            : NULLVALUE;// (SQUOTE qualifiedtypename SQUOTE)?;
-booleanNonCase      : BOOLEAN | TRUE | FALSE;
-string              : STRING;
-
-enumLit             : vNS=namespace vODI=odataIdentifier vValues=STRING;
-//enum             : namespace odataIdentifier STRING;
-enumValues         : vlODI+=odataIdentifier ( COMMA vlODI+=odataIdentifier )*;
-//singleEnumValue  : odataIdentifier / INT;
-
-
-geographyCollection        : GEOGRAPHY  fullCollectionLiteral SQUOTE;
-fullCollectionLiteral      : sridLiteral collectionLiteral;
-
-collectionLiteral          : (COLLECTION ) OPEN geoLiteral ( COMMA geoLiteral )* CLOSE;
-
-geoLiteral                 : collectionLiteral
-                           | lineStringLiteral
-                           | multipointLiteral
-                           | multilineStringLiteral
-                           | multipolygonLiteral
-                           | pointLiteral
-                           | polygonLiteral;
-
-geographyLineString        : GEOGRAPHY  fullLineStringLiteral SQUOTE;
-fullLineStringLiteral      : sridLiteral lineStringLiteral;
-lineStringLiteral          : LINESTRING lineStringData;
-lineStringData             : OPEN positionLiteral ( COMMA positionLiteral )* CLOSE;
-
-geographyMultilineString   : GEOGRAPHY  fullMultilineStringLiteral SQUOTE;
-fullMultilineStringLiteral : sridLiteral multilineStringLiteral;
-multilineStringLiteral     : MULTILINESTRING OPEN ( lineStringData ( COMMA lineStringData )* )? CLOSE;
-
-geographyMultipoint        : GEOGRAPHY  fullMultipointLiteral SQUOTE;
-fullMultipointLiteral      : sridLiteral multipointLiteral;
-multipointLiteral          : MULTIPOINT OPEN ( pointData ( COMMA pointData )* )? CLOSE ;
-
-geographyMultipolygon      : GEOGRAPHY  fullmultipolygonLiteral SQUOTE;
-fullmultipolygonLiteral    : sridLiteral multipolygonLiteral;
-multipolygonLiteral        : MULTIPOLYGON OPEN ( polygonData ( COMMA polygonData )* )? CLOSE;
-
-geographyPoint             : GEOGRAPHY  fullpointLiteral SQUOTE;
-fullpointLiteral           : sridLiteral pointLiteral;
-
-pointLiteral               : GEO_POINT pointData;
-pointData                  : OPEN positionLiteral CLOSE;
-
-positionLiteral            : (DECIMAL | INT ) WSP (DECIMAL | INT );  //; longitude, then latitude
-
-
-geographyPolygon           : GEOGRAPHY fullPolygonLiteral SQUOTE;
-fullPolygonLiteral         : sridLiteral polygonLiteral;
-polygonLiteral             : POLYGON polygonData;
-polygonData                : OPEN ringLiteral ( COMMA ringLiteral )* CLOSE;
-ringLiteral                : OPEN positionLiteral ( COMMA positionLiteral )* CLOSE;
-                 
-
-geometryCollection        : GEOMETRY  fullCollectionLiteral      SQUOTE;
-geometryLineString        : GEOMETRY  fullLineStringLiteral      SQUOTE;
-geometryMultilineString   : GEOMETRY  fullMultilineStringLiteral SQUOTE;
-geometryMultipoint        : GEOMETRY  fullMultipointLiteral      SQUOTE;
-geometryMultipolygon      : GEOMETRY  fullmultipolygonLiteral    SQUOTE;
-geometryPoint             : GEOMETRY  fullpointLiteral           SQUOTE;
-geometryPolygon           : GEOMETRY  fullPolygonLiteral         SQUOTE;
-
-sridLiteral               : SRID EQ INT SEMI;
-
-
-
-
-
-/*
-mode MODEd333gh;
-
-MO12E1 : 'ASD' -> mode(DEFAULT_MODE);*/

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/9593b53c/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriLexer.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriLexer.g4 b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriLexer.g4
new file mode 100644
index 0000000..33e7296
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriLexer.g4
@@ -0,0 +1,405 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+lexer grammar UriLexer;
+
+//;==============================================================================
+// Mode "DEFAULT_MODE": Processes everything bevor the first '?' char
+// On '?' the next mode "MODE_QUERY" is used
+// The percent encoding rules a defined in RFC3986 ABNF rule "path-rootless" apply
+//;==============================================================================
+QM              : '?'                 ->        pushMode(MODE_QUERY);               //first query parameter
+AMP             : '&'                 ->        pushMode(MODE_QUERY);               //more query parameters
+STRING          : '\''                -> more,  pushMode(MODE_STRING);              //reads up to next single '
+QUOTATION_MARK  : ('\u0022' | '%22')  -> more,  pushMode(MODE_JSON_STRING);         //reads up to next unescaped "
+SEARCH_INLINE   : '$search'           ->        pushMode(MODE_SYSTEM_QUERY_SEARCH); //
+FRAGMENT        : '#'                 ->        pushMode(MODE_FRAGMENT); //
+
+GEOGRAPHY    : G E O G R A P H Y SQUOTE         -> pushMode(MODE_ODATA_GEO); //TODO make case insensitive
+GEOMETRY     : G E O M E T R Y   SQUOTE         -> pushMode(MODE_ODATA_GEO);
+
+//Letters for case insensitivity
+fragment A    : 'A'|'a';
+fragment B    : 'B'|'b';
+fragment D    : 'D'|'d';
+fragment E    : 'E'|'e';
+fragment F    : 'F'|'f';
+fragment G    : 'G'|'g';
+fragment H    : 'H'|'h';
+fragment I    : 'I'|'i';
+fragment L    : 'L'|'l';
+fragment M    : 'M'|'m';
+fragment N    : 'N'|'n';
+fragment O    : 'O'|'o';
+fragment P    : 'P'|'p';
+fragment R    : 'R'|'r';
+fragment S    : 'S'|'s';
+fragment T    : 'T'|'t';
+fragment U    : 'U'|'u';
+fragment Y    : 'Y'|'y';
+fragment Z    : 'Z'|'z';
+
+//special chars
+OPEN            : '(' | '%28';
+CLOSE           : ')' | '%29';
+COMMA           : ',' | '%2C';
+SLASH           : '/';
+POINT           : '.';
+AT              : '@';
+EQ              : '=' ;
+STAR            : '*';
+SEMI            : ';' | '%3b';
+COLON           : ':';
+
+EQ_sq           : '='           -> type(EQ);
+AMP_sq          : '&'           -> type(AMP), popMode;
+fragment WS     : ( ' ' | '%09' | '%20' | '%09' );
+WSP             : WS+;
+
+//JSON support 
+BEGIN_OBJECT    : WS* ( '{' / '%7B' ) WS*;
+END_OBJECT      : WS* ( '}' / '%7D' ) WS*;
+
+BEGIN_ARRAY     : WS* ( '[' / '%5B' ) WS*;
+END_ARRAY       : WS* ( ']' / '%5D' ) WS*;
+
+
+//alpha stuff
+fragment ALPHA                : 'a'..'z' | 'A'..'Z';
+fragment ALPHA_A_TO_F         : 'a'..'f' | 'A'..'F';
+fragment DIGIT                : '0'..'9';
+fragment DIGITS               : DIGIT+;
+fragment HEXDIG               : DIGIT | ALPHA_A_TO_F;
+fragment ODI_LEADINGCHARACTER : ALPHA | '_';            //TODO; add Unicode characters from the categories L or Nl
+fragment ODI_CHARACTER        : ALPHA | '_' | DIGIT;    //TODO; add Unicode characters from the categories L, Nl, Nd, Mn, Mc, Pc, or Cf
+
+//helper for date/time values
+fragment ONE_TO_NINE        : '1'..'9';
+fragment ZERO_TO_FIFTYNINE  : ('0'..'5') DIGIT;
+fragment FRACTIONALSECONDS  : DIGIT+;
+fragment SECOND             : ZERO_TO_FIFTYNINE;
+fragment MINUTE             : ZERO_TO_FIFTYNINE;
+fragment HOUR               : ('0' | '1') DIGIT | '2' ( '0'..'3');
+fragment DAY                : '0' '1'..'9' | ('1'|'2') DIGIT | '3' ('0'|'1');
+fragment MONTH              : '0' ONE_TO_NINE | '1' ( '0' | '1' | '2' );
+fragment YEAR               : ('-')? ( '0' DIGIT DIGIT DIGIT | ONE_TO_NINE DIGIT DIGIT DIGIT );
+
+//tags start with $ 
+BATCH         : '$batch';
+ENTITY        : '$entity';
+METADATA      : '$metadata';
+
+ALL           : '$all';
+CROSSJOIN     : '$crossjoin';
+
+VALUE         : '$value';
+REF           : '$ref';
+COUNT         : '$count';
+
+//inlined query parameters ( e.g. $skip)
+TOP_I    : '$top' -> type(TOP);
+SKIP_I   : '$skip' -> type(SKIP);
+FILTER_I : '$filter' -> type(FILTER);
+ORDERBY_I: '$orderby' -> type(ORDERBY);
+SELECT_I: '$select' -> type(SELECT);
+EXPAND_I: '$expand' -> type(EXPAND);
+LEVELS_I: '$levels' -> type(LEVELS);
+MAX: 'max';
+
+ROOT            : '$root/';
+
+
+
+//rest
+NULLVALUE     : 'null';
+
+TRUE          : 'true';
+FALSE         : 'false';
+BOOLEAN       :  T R U E |  F A L S E; 
+PLUS          : '+';
+SIGN          : PLUS  | '%2B'   |'-';
+INT           : SIGN? DIGITS;
+DECIMAL       : INT '.' DIGITS ('e' SIGN?  DIGITS)?;
+
+//primary types
+BINARY                      : B I N A R Y SQUOTE (HEXDIG HEXDIG)* SQUOTE; 
+DATE                        : YEAR '-' MONTH '-' DAY;
+DATETIMEOFFSET              : YEAR '-' MONTH '-' DAY T HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )? ( Z | SIGN HOUR ':' MINUTE );
+fragment DUSECONDFRAG       : DIGITS ('.' DIGITS)? 'S';
+fragment DUTIMEFRAG         : 'T' (   
+                              ( DIGITS 'H' (DIGITS 'M')? DUSECONDFRAG?) 
+                              | (DIGITS 'M' DUSECONDFRAG?) 
+                              | DUSECONDFRAG
+                            );
+fragment DUDAYTIMEFRAG      : DIGITS 'D' DUTIMEFRAG? | DUTIMEFRAG;
+DURATION                    : D U R A T I O N SQUOTE '-'? 'P' DUDAYTIMEFRAG SQUOTE;
+TIMEOFDAY                   : HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )?;
+fragment GUIDVALUE          : HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG'-' 
+                              HEXDIG HEXDIG HEXDIG HEXDIG  '-' 
+                              HEXDIG HEXDIG HEXDIG HEXDIG  '-' 
+                              HEXDIG HEXDIG HEXDIG HEXDIG  '-' 
+                              HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG;
+GUID                        : GUIDVALUE;
+
+//expression tokens
+ASC             : 'asc'; 
+DESC            : 'desc';
+MUL             : 'mul';
+DIV             : 'div';
+MOD             : 'mod';
+HAS             : 'has';
+
+ADD             : 'add';
+SUB             : 'sub';
+
+ANY_LAMDA       : 'any';
+ALL_LAMDA       : 'all';
+
+GT              : 'gt';
+GE              : 'ge';
+LT              : 'lt';
+LE              : 'le';
+ISOF            : 'isof';
+
+EQ_ALPHA        : 'eq';
+NE              : 'ne';
+
+AND             : 'and';
+OR              : 'or';
+
+
+NOT             : 'not';
+MINUS           :'-';
+NANINFINITY     : 'NaN' | '-INF' | 'INF';
+
+IT  : '$it';
+ITSLASH  : '$it/';
+LEVELS               : '$levels';
+
+CONTAINS_WORD             : 'contains(';
+STARTSWITH_WORD           : 'startswith(';
+ENDSWITH_WORD             : 'endswith(';
+LENGTH_WORD               : 'length(';
+INDEXOF_WORD              : 'indexof(';
+SUBSTRING_WORD            : 'substring(';
+TOLOWER_WORD              : 'tolower(';
+TOUPPER_WORD              : 'toupper(';
+TRIM_WORD                 : 'trim(';
+CONCAT_WORD               : 'concat(';
+YEAR_WORD                 : 'year(';
+MONTH_WORD                : 'month(';
+DAY_WORD                  : 'day(';
+HOUR_WORD                 : 'hour(';
+MINUTE_WORD               : 'minute(';
+SECOND_WORD               : 'second(';
+FRACTIONALSECONDS_WORD    : 'fractionalseconds(';
+TOTALSECONDS_WORD         : 'totalseconds(';
+DATE_WORD                 : 'date(';
+TIME_WORD                 : 'time(';
+TOTALOFFSETMINUTES_WORD   : 'totaloffsetminutes(';
+
+MINDATETIME_WORD          : 'mindatetime(';
+MAXDATETIME_WORD          : 'maxdatetime(';
+NOW_WORD                  : 'now(';
+
+ROUND_WORD                : 'round(';
+FLOOR_WORD                : 'floor(';
+CEILING_WORD              : 'ceiling(';
+
+GEO_DISTANCE_WORD         : 'geo.distance(';
+GEO_LENGTH_WORD           : 'geo.length(';
+GEO_INTERSECTS_WORD       : 'geo.intersects(';
+ISOF_WORD                 : 'isof(';
+CAST_WORD                 : 'cast(';
+
+COLLECTION_REF            : 'Collection($ref)';
+COLLECTION_ENTITY_TYPE    : 'Collection(Edm.EntityType)';
+COLLECTION_COMPLEX_TYPE   : 'Collection(Edm.ComplexType)';
+COLLECTION                : 'Collection(' -> type(COLLECTION);
+
+//used in fragment only
+DELETED_ENTITY            : '$deletedEntity';
+LINK                      : '$link';
+DELETED_LINK              : '$deletedLink';
+DELTA                     : '$delta';
+
+//ODI
+ODATAIDENTIFIER             : ODI_LEADINGCHARACTER (ODI_CHARACTER)*;
+
+//;==============================================================================
+// Mode "QUERY": Processes everything between the first '?' and the '#' char
+// On '?' the next mode "FRAGMENT" is used
+// The percent encoding rules a defined in RFC3986 ABNF rule "query" apply
+mode MODE_QUERY;
+//;==============================================================================
+
+FRAGMENT_q          : '#'           -> type(FRAGMENT);
+FILTER              : '$filter'     ->                    pushMode(DEFAULT_MODE);
+ORDERBY             : '$orderby'    ->                    pushMode(DEFAULT_MODE);
+EXPAND              : '$expand'     ->                    pushMode(DEFAULT_MODE);
+SELECT              : '$select'     ->                    pushMode(DEFAULT_MODE);
+SKIP                : '$skip'       ->                    pushMode(DEFAULT_MODE);
+SKIPTOKEN           : '$skiptoken'  ->                    pushMode(MODE_SYSTEM_QUERY_REST);
+TOP                 : '$top'        ->                    pushMode(DEFAULT_MODE);
+LEVELS_q            : '$levels'     -> type(LEVELS),      pushMode(DEFAULT_MODE);
+FORMAT              : '$format'     ->                    pushMode(MODE_SYSTEM_QUERY_PCHAR);
+COUNT_q             : '$count'      -> type(COUNT),       pushMode(DEFAULT_MODE);
+REF_q               : '$ref'        -> type(REF);
+VALUE_q             : '$value'      -> type(VALUE);
+ID                  : '$id'         ->                    pushMode(MODE_SYSTEM_QUERY_REST);
+SEARCH              : '$search'     ->                    pushMode(MODE_SYSTEM_QUERY_SEARCH);
+
+EQ_q          : '=' -> type(EQ);
+AMP_q         : '&' -> type(AMP);
+
+AT_Q          : '@' -> pushMode(DEFAULT_MODE);
+
+CUSTOMNAME    : ~[&=@$] ~[&=]* -> pushMode(MODE_SYSTEM_QUERY_REST);
+
+//;==============================================================================
+mode MODE_SYSTEM_QUERY_PCHAR;
+//;==============================================================================
+
+AMP_sqp   : '&' -> type(AMP),       popMode;
+
+fragment ALPHA_sqp          : 'a'..'z'|'A'..'Z';
+fragment A_TO_F_sqp         : 'a'..'f'|'A'..'F';
+fragment DIGIT_sqp          : '0'..'9';
+fragment HEXDIG_sqp         : DIGIT_sqp | A_TO_F_sqp;
+fragment PCT_ENCODED_sqp    : '%' HEXDIG_sqp HEXDIG_sqp;
+fragment SUB_DELIMS_sqp     : '$' | /*'&' |*/ '\'' | EQ_sqp | OTHER_DELIMS_sqp;
+fragment OTHER_DELIMS_sqp   : '!' | '(' | ')' | '*' | '+' | ',' | ';';
+fragment UNRESERVED_sqp     : ALPHA_sqp | DIGIT_sqp | '-' |'.' | '_' | '~'; 
+fragment PCHAR              : UNRESERVED_sqp | PCT_ENCODED_sqp | SUB_DELIMS_sqp | ':' | '@'; 
+fragment PCHARSTART         : UNRESERVED_sqp | PCT_ENCODED_sqp | '$' | /*'&' |*/ '\'' | OTHER_DELIMS_sqp | ':' | '@'; 
+
+
+ATOM : [Aa][Tt][Oo][Mm];
+JSON : [Jj][Ss][Oo][Nn];
+XML  : [Xx][Mm][Ll];
+
+PCHARS : PCHARSTART PCHAR*;
+
+
+SLASH_sqp : '/' -> type(SLASH);
+EQ_sqp    : '=' -> type(EQ);
+FRAGMENT_sqp  : '#'     -> type(FRAGMENT),  pushMode(MODE_FRAGMENT);
+
+//;==============================================================================
+mode MODE_FRAGMENT;
+// Read the remaining characters of a URI queryparameter up to an & or # 
+// character.
+//;==============================================================================
+
+REST_F          : ~('\r'|'\n')* -> type(REST),  popMode;
+
+//;==============================================================================
+mode MODE_SYSTEM_QUERY_REST;
+// Read the remaining characters of a URI queryparameter up to an & or # 
+// character.
+//;==============================================================================
+
+AMP_sqr       : '&'     -> type(AMP),       popMode;
+FRAGMENT_sqr  : '#'     -> type(FRAGMENT),  popMode;
+
+EQ_sqr        : '='     -> type(EQ);
+REST          : ~[&#=] ~[&#]*;
+
+//;==============================================================================
+mode MODE_SYSTEM_QUERY_SEARCH;
+//;==============================================================================
+
+NOT_sqc             : 'NOT'   -> type(NOT);
+AND_sqc             : 'AND'   -> type(AND);
+OR_sqc              : 'OR'    -> type(OR);
+EQ_sqc              : '='     -> type(EQ);
+
+fragment WS_sqc     : ( ' ' | '\u0009' | '%20' | '%09' );
+WSP_sqc             : WS_sqc+ -> type(WSP);
+
+QUOTATION_MARK_sqc  : '\u0022' | '%22';
+
+SEARCHWORD          : ('a'..'z'|'A'..'Z')+;
+SEARCHPHRASE        : QUOTATION_MARK_sqc ~["]* QUOTATION_MARK_sqc -> popMode;
+
+
+//;==============================================================================
+mode MODE_STRING;
+// Read the remaining characters up to an ' character.
+// An "'" character inside a string are expressed as double ''
+//;==============================================================================
+
+STRING_s            : ('\'\'' | ~[\u0027] )* '\'' -> type(STRING), popMode;
+
+//;==============================================================================
+mode MODE_JSON_STRING;
+// Read the remaining characters up to an " character.
+// An "'" character inside a string are expressed excaped \"
+//;==============================================================================
+
+STRING_IN_JSON      : ('\\"' | ~[\u0022] )* ('"' | '%22') -> popMode;
+
+//;==============================================================================
+mode MODE_ODATA_GEO;
+//;==============================================================================
+
+fragment C_  : 'c'|'C';
+fragment D_  : 'd'|'D';
+fragment E_  : 'e'|'E';
+fragment G_  : 'g'|'G';
+fragment H_  : 'h'|'H';
+fragment I_  : 'i'|'I';
+fragment L_  : 'l'|'L';
+fragment M_  : 'm'|'M';
+fragment N_  : 'n'|'N';
+fragment O_  : 'o'|'O';
+fragment P_  : 'p'|'P';
+fragment R_  : 'r'|'R';
+fragment S_  : 's'|'S';
+fragment T_  : 't'|'T';
+fragment U_  : 'u'|'U';
+fragment Y_  : 'y'|'Y';
+
+fragment SP_g   : ' ';//'\u0020'; // a simple space
+fragment WS_g   : ( ' ' | '%20' | '%09' );
+
+OPEN_g          : ('(' | '%28') -> type(OPEN);
+CLOSE_g         : (')' | '%29') -> type(CLOSE);
+COMMA_g         : (',' | '%2C') -> type(COMMA);
+WSP_g           : WS_g+ -> type(WSP);
+POINT_g         : '.' -> type(POINT);
+AT_g            : '@' -> type(AT);
+SEMI_g            : (';' | '%3B') -> type(SEMI);
+EQ_g            : '=' -> type(EQ);
+
+fragment DIGIT_g    : '0'..'9';
+fragment DIGITS_g   : DIGIT_g+;
+SIGN_g              : ('+' | '%2B' |'-') -> type(SIGN);
+INT_g               : SIGN_g? DIGITS_g -> type(INT);
+DECIMAL_g           : INT_g '.' DIGITS_g ('e' SIGN_g?  DIGITS_g)? -> type(DECIMAL);
+COLLECTION_g        : C_ O_ L_ L_ E_ C_ T_ I_ O_ N_ -> type(COLLECTION);
+LINESTRING          : L_ I_ N_ E_ S_ T_ R_ I_ N_ G_ ;
+MULTILINESTRING     : M_ U_ L_ T_ I_ L_ I_ N_ E_ S_ T_ R_ I_ N_ G_;
+MULTIPOINT          : M_ U_ L_ T_ I_ P_ O_ I_ N_ T_ ;
+MULTIPOLYGON        : M_ U_ L_ T_ I_ P_ O_ L_ Y_ G_ O_ N_;
+GEO_POINT           : P_ O_ I_ N_ T_;
+POLYGON             : P_ O_ L_ Y_ G_ O_ N_ ;
+
+SRID                : S_ R_ I_ D_;
+
+SQUOTE              : '\''  -> popMode;