olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kobl...@apache.org
Subject [4/9] [OLINGO-63] Uri Parser: adoptions in lexer and parser, create UriParserImpl to convert the parsetree into internal structures, moved parser antlr part from .../olingo/producer/... to .../olingo/odata4/producer
Date Fri, 13 Dec 2013 09:04:23 GMT
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/10ac7ee3/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
new file mode 100644
index 0000000..0a6e0df
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/antlr/TestParser.java
@@ -0,0 +1,1450 @@
+/*******************************************************************************
+ * 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.producer.core.uri.antlr;
+
+import org.apache.olingo.odata4.producer.core.testutil.ParserValidator;
+import org.junit.Test;
+
+/**
+ * The class {@link TestParser} contains regression tests which work directly on the
+ * output of the parser (which is generated by ANTLR). These tests should only test the
+ * parser and must NOT require any EDM in order to ensure that the parser can run in a
+ * context free manner.
+ * The single test cases are written according the ABNF (not the parser) since we
+ * want if the parser works as defined in the ABNF.
+ * 
+ * Ideally these test detect any (wrong) change on the grammar files
+ */
+public class TestParser {
+  private ParserValidator test = null;
+
+  public TestParser() {
+    test = new ParserValidator();
+  }
+
+  @Test
+  public void test() {
+    test.log(2).aAM().aFC().aCS().run("ODI?$filter=(1) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr("
+        + "commonExpr(( commonExpr(primitiveLiteral(1)) ))   "
+        + "mul   "
+        + "commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+    // test.log(2).run("ESTwoKeyTwoPrim(PropertyInt16=1,PropertyString='ABC')");
+    /*
+     * test.log(2).run("ODI?$filter=geo.distance("+
+     * "geometry'SRID=0;Point(142.1 64.1)',geometry'SRID=0;Point(142.1 64.1)')")
+     * .isText("odataRelativeUriEOF(odataRelativeUri("
+     * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+     * + "queryOption(systemQueryOption("
+     * + "filter($filter = commonExpr(methodCallExpr("
+     * + "distanceMethodCallExpr("
+     * + "geo.distance( "
+     * + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
+     * + "pointLiteral(Point pointData(( positionLiteral(142.1   64.1) )))) '))) , "
+     * + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
+     * + "pointLiteral(Point pointData(( positionLiteral(142.1   64.1) )))) '))) ))))))))) <EOF>)");
+     */
+  }
+
+  // ;------------------------------------------------------------------------------
+  // ; 0. URI
+  // ;------------------------------------------------------------------------------
+  @Test
+  public void testUri() {
+    // Test parser rule odataRelativeUri
+    test.run("$batch").isText("odataRelativeUriEOF(odataRelativeUri($batch) <EOF>)");
+
+    // TODO do more tests on entity
+    test.run("$entity?$id=ODI").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
+        + "entityOptions($id = ODI)) <EOF>)");
+
+    test.run("$entity?$select=*&$id=ODI").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
+        + "entityOptions(entityOption("
+        + "select($select = selectItem(*))) & "
+        + "$id = ODI)) <EOF>)");
+    test.run("$entity?$id=ODI&$select=*").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
+        + "entityOptions("
+        + "$id = ODI & entityOption("
+        + "select($select = selectItem(*))))) <EOF>)");
+    test.run("$entity?$select=*&$id=ODI&$format=json").isText("odataRelativeUriEOF(odataRelativeUri($entity ? "
+        + "entityOptions(entityOption(select("
+        + "$select = selectItem(*))) & "
+        + "$id = ODI & entityOption(format("
+        + "$format = json)))) <EOF>)");
+
+    // TODO do more tests on entity
+    test.run("$metadata").isText("odataRelativeUriEOF(odataRelativeUri($metadata) <EOF>)");
+
+    test.run("ODI").isText(
+        "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment(odataIdentifier(ODI))))) <EOF>)");
+
+    // Test parser rule resourcePath
+    test.run("$all").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath($all)) <EOF>)");
+
+    test.run("$crossjoin(ODI)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath("
+        + "crossjoin($crossjoin ( odataIdentifier(ODI) )))) <EOF>)");
+
+    // Test parser rule pathSegments
+    test.run("ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+        + "pathSegment(odataIdentifier(ODI)) / "
+        + "pathSegment(odataIdentifier(ODI))))) <EOF>)");
+    test.run("NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+        + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
+        + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
+    test.run("NS.ODI/ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+        + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) / "
+        + "pathSegment(odataIdentifier(ODI)) / "
+        + "pathSegment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
+    // Test parser rule constSegment
+    test.run("ODI/$value").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+        + "pathSegment(odataIdentifier(ODI)) "
+        + "constSegment(/ value($value))))) <EOF>)");
+    test.run("ODI/$count").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+        + "pathSegment(odataIdentifier(ODI)) "
+        + "constSegment(/ count($count))))) <EOF>)");
+    test.run("ODI/$ref").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+        + "pathSegment(odataIdentifier(ODI)) "
+        + "constSegment(/ ref($ref))))) <EOF>)");
+
+    // Test parser rule pathSegment
+    test.run("NS.ODI")
+        .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+            + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))) <EOF>)");
+    test.run("ODI(1)")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )))))) <EOF>)");
+
+    test.run("ODI('ABC')")
+        .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+            + "odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(string('ABC'))) )))))) <EOF>)");
+    
+    test.run("ODI(K1=1)")
+        .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+            + "odataIdentifier(ODI) "
+            + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
+            + "primitiveLiteral(1))) )))))) <EOF>)");
+
+    test.run("ODI(K1='ABC')")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI) "
+                + "nameValueOptList(( nameValueList(nameValuePair(odataIdentifier(K1) = "
+                + "primitiveLiteral(string('ABC')))) )))))) <EOF>)");
+
+    test.run("ODI(K1='ABC',K2=123)")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI) nameValueOptList(( nameValueList("
+                + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(string('ABC'))) , "
+                + "nameValuePair(odataIdentifier(K2) = primitiveLiteral(123))) )))))) <EOF>)");
+
+    test.run("ODI(K1=1)(P1=1)")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI) nameValueOptList(( nameValueList("
+                + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(1))) )) nameValueOptList(( nameValueList("
+                + "nameValuePair(odataIdentifier(P1) = primitiveLiteral(1))) )))))) <EOF>)");
+
+    test.run("ODI(K1='ABC',K2=123)(P1='ABC',P2=123)")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI) nameValueOptList(( nameValueList("
+                + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(string('ABC'))) , "
+                + "nameValuePair(odataIdentifier(K2) = primitiveLiteral(123))) )) nameValueOptList(( nameValueList("
+                + "nameValuePair(odataIdentifier(P1) = primitiveLiteral(string('ABC'))) , "
+                + "nameValuePair(odataIdentifier(P2) = primitiveLiteral(123))) )))))) <EOF>)");
+
+    test.run("NS.ODI(K1='ABC',K2=123)(P1='ABC',P2=123)")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "namespace(odataIdentifier(NS) .) "
+                + "odataIdentifier(ODI) nameValueOptList(( nameValueList("
+                + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(string('ABC'))) , "
+                + "nameValuePair(odataIdentifier(K2) = primitiveLiteral(123))) )) "
+                + "nameValueOptList(( nameValueList("
+                + "nameValuePair(odataIdentifier(P1) = primitiveLiteral(string('ABC'))) , "
+                + "nameValuePair(odataIdentifier(P2) = primitiveLiteral(123))) )))))) <EOF>)");
+
+    test.run("ODI(K1=@ABC)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath("
+        + "pathSegments(pathSegment(odataIdentifier(ODI) nameValueOptList(( nameValueList("
+        + "nameValuePair(odataIdentifier(K1) = @ odataIdentifier(ABC))) )))))) <EOF>)");
+    
+    test.run("ODI(K1=1,K2=@ABC)").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath("
+        + "pathSegments(pathSegment(odataIdentifier(ODI) nameValueOptList(( nameValueList("
+        + "nameValuePair(odataIdentifier(K1) = primitiveLiteral(1)) , "
+        + "nameValuePair(odataIdentifier(K2) = @ odataIdentifier(ABC))) )))))) <EOF>)");
+
+  }
+
+  // TODO error testing
+  @Test
+  public void testUriError() {
+    // test.run("$entity").isExType(InputMismatchException.class);
+    // test.run("$entity").isText("");
+  }
+
+  // ;------------------------------------------------------------------------------
+  // ; 2. Query Options
+  // ;------------------------------------------------------------------------------
+
+  @Test
+  public void testQueryOptions() {
+
+    // Test parser rule expand
+    test.run("ODI?$expand=*").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList(expandItem(*))))))) <EOF>)");
+
+    test.run("ODI?$expand=*,*,*").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList("
+        + "expandItem(*) , "
+        + "expandItem(*) , "
+        + "expandItem(*))))))) <EOF>)");
+
+    test.run("ODI?$expand=*/$ref").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList("
+        + "expandItem(* / ref($ref)))))))) <EOF>)");
+
+    test.run("ODI?$expand=*/$ref,*,*/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList(expandItem(* / ref($ref)) , "
+        + "expandItem(*) , "
+        + "expandItem(* / ref($ref)))))))) <EOF>)");
+
+    // Test parser rules expand -> levels
+    test.run("ODI?$expand=*($levels=12)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList("
+        + "expandItem(* ( $levels = 12 )))))))) <EOF>)");
+    test.run("ODI?$expand=*($levels=max)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList("
+        + "expandItem(* ( $levels=max )))))))) <EOF>)");
+
+    // Test parser rules expand -> expandPath
+    test.run("ODI?$expand=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList(expandItem("
+        + "expandPath(odataIdentifier(ODI))))))))) <EOF>)");
+
+    test.run("ODI?$expand=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList(expandItem("
+        + "expandPath(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))))) <EOF>)");
+
+    test.run("ODI?$expand=ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList(expandItem("
+        + "expandPath("
+        + "odataIdentifier(ODI) / "
+        + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))))) <EOF>)");
+
+    test.run("ODI?$expand=ODI/NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList(expandItem("
+        + "expandPath("
+        + "odataIdentifier(ODI) / "
+        + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI) / "
+        + "odataIdentifier(ODI))))))))) <EOF>)");
+
+    test.run("ODI?$expand=ODI/$ref").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList("
+        + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ ref($ref))))))))) <EOF>)");
+
+    // Test options for expand items
+    test.run("ODI?$expand=ODI/$ref($skip=1)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList("
+        + "expandItem(expandPath(odataIdentifier(ODI)) "
+        + "expandPathExtension(/ ref($ref) ( expandRefOption(skipInline($skip = 1)) ))))))))) <EOF>)");
+
+    test.run("ODI?$expand=ODI/$count").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList("
+        + "expandItem(expandPath(odataIdentifier(ODI)) "
+        + "expandPathExtension(/ count($count))))))))) <EOF>)");
+
+    test.run("ODI?$expand=ODI/$count($filter=1)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList("
+        + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ count($count) ( "
+        + "expandCountOption("
+        + "filterInline($filter = commonExpr(primitiveLiteral(1)))) ))))))))) <EOF>)");
+
+    test.run("ODI?$expand=ODI/$count($search=\"abc\")").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList("
+        + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ count($count) ( "
+        + "expandCountOption("
+        + "searchInline($search searchSpecialToken(= searchExpr(searchPhrase(\"abc\"))))) ))))))))) <EOF>)");
+
+    test.run("ODI?$expand=ODI/$ref($skip=1;$filter=true)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList("
+        + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(/ ref($ref) ( "
+        + "expandRefOption(skipInline($skip = 1)) ; "
+        + "expandRefOption(expandCountOption("
+        + "filterInline($filter = commonExpr(primitiveLiteral(booleanNonCase(true)))))) ))))))))) <EOF>)");
+
+    test.run("ODI?$expand=ODI($skip=1;$filter=true)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment("
+        + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+        + "expand($expand = expandItemList("
+        + "expandItem(expandPath(odataIdentifier(ODI)) expandPathExtension(( "
+        + "expandOption(expandRefOption(skipInline($skip = 1))) ; "
+        + "expandOption(expandRefOption(expandCountOption("
+        + "filterInline($filter = commonExpr(primitiveLiteral(booleanNonCase(true))))))) ))))))))) <EOF>)");
+
+    // Test parser rule filter ( more filter test in method testExpressions)
+    test.run("ODI?$filter=true")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri("
+                + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+                + "queryOption(systemQueryOption(filter($filter = commonExpr("
+                + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
+
+    // Test parser rule format
+    test.run("ODI?$format=atom").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(format($format = atom))))) <EOF>)");
+
+    test.run("ODI?$format=json").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(format($format = json))))) <EOF>)");
+
+    test.run("ODI?$format=xml").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(format($format = xml))))) <EOF>)");
+
+    // Test parser rule id
+    test.run("ODI?$id=abc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(id($id = abc))))) <EOF>)");
+
+    // Test parser rule count
+    /*
+     * TODO add count to new mode based lexer
+     * test.lexerlog(1).run("ODI?$count=true").isText("odataRelativeUriEOF(odataRelativeUri("
+     * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+     * + "systemQueryOption("
+     * + "inlinecount($count = booleanNonCase(true)))))) <EOF>)");
+     */
+    test.run("ODI?$count=false").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption("
+        + "inlinecount($count = booleanNonCase(false)))))) <EOF>)");
+
+    test.run("ODI?$count=TrUe").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption("
+        + "inlinecount($count = booleanNonCase(TrUe)))))) <EOF>)");
+
+    // Test parser rule orderby
+    test.run("ODI?$orderby=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(orderby($orderby = "
+        + "orderbyItem(commonExpr("
+        + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))))))))) <EOF>)");
+
+    test.run("ODI?$orderby=ODI asc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(orderby($orderby = "
+        + "orderbyItem(commonExpr("
+        + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))   asc)))))) <EOF>)");
+
+    test.run("ODI?$orderby=ODI desc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(orderby($orderby = "
+        + "orderbyItem(commonExpr("
+        + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))   desc)))))) <EOF>)");
+
+    test.run("ODI?$orderby=ODI desc,ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(orderby($orderby = "
+        + "orderbyItem(commonExpr("
+        + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))   desc) , "
+        + "orderbyItem(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))))))))) <EOF>)");
+
+    test.run("ODI?$orderby=ODI desc,ODI asc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(orderby($orderby = "
+        + "orderbyItem(commonExpr("
+        + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))   desc) , "
+        + "orderbyItem(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))   asc)))))) <EOF>)");
+
+    test.aFC().aAM().aCS().run("ODI?$orderby=3 add 4,ODI asc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "orderby($orderby = "
+        + "orderbyItem(commonExpr(commonExpr(primitiveLiteral(3))   add   commonExpr(primitiveLiteral(4)))) , "
+        + "orderbyItem(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))   asc)))))) <EOF>)");
+
+    // Test parser rule skiptoken
+    test.run("ODI?$skiptoken=abc").isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments("
+        + "pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(skiptoken($skiptoken = abc))))) <EOF>)");
+
+    // Test parser rule search
+    test.run("ODI?$search=abc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(search("
+        + "$search searchSpecialToken(= searchExpr(searchWord(abc)))))))) <EOF>)");
+
+    test.run("ODI?$search=NOT abc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(search("
+        + "$search searchSpecialToken(= searchExpr(NOT   searchExpr(searchWord(abc))))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$search=abc abc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(search("
+        + "$search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc))   s"
+        + "earchExpr(searchWord(abc))))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$search=abc AND abc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(search("
+        + "$search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc))   AND   "
+        + "searchExpr(searchWord(abc))))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$search=abc OR abc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(search($search searchSpecialToken(= searchExpr(searchExpr(searchWord(abc))   OR   "
+        + "searchExpr(searchWord(abc))))))))) <EOF>)");
+
+    test.run("ODI?$search=\"a%20b%20c\"").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(search("
+        + "$search searchSpecialToken(= searchExpr(searchPhrase(\"a%20b%20c\")))))))) <EOF>)");
+
+    // Test parser rule search
+    test.run("ODI?$select=*").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(select("
+        + "$select = selectItem(*)))))) <EOF>)");
+
+    test.run("ODI?$select=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(select("
+        + "$select = selectItem(odataIdentifier(ODI))))))) <EOF>)");
+
+    test.run("ODI?$select=NS.*").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(select("
+        + "$select = selectItem(namespace(odataIdentifier(NS) .) *)))))) <EOF>)");
+
+    test.run("ODI?$select=NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(select("
+        + "$select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
+
+    test.run("ODI?$select=NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(select("
+        + "$select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+        + "/ odataIdentifier(ODI))))))) <EOF>)");
+
+    test.run("ODI?$select=NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(select("
+        + "$select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+        + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
+
+    test.run("ODI?$select=ODI,ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(select($select = selectItem(odataIdentifier(ODI)) , "
+        + "selectItem(odataIdentifier(ODI))))))) <EOF>)");
+
+    test.run("ODI?$select=NS.ODI,NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(select($select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) , "
+        + "selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
+
+    test.run("ODI?$select=NS.ODI/ODIm,NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(select($select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+        + "/ odataIdentifier(ODIm)) , selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+        + "/ odataIdentifier(ODI))))))) <EOF>)");
+
+    test.run("ODI?$select=NS.ODI/NS.ODI,NS.ODI/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(select($select = selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+        + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI)) , "
+        + "selectItem(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+        + "/ namespace(odataIdentifier(NS) .) odataIdentifier(ODI))))))) <EOF>)");
+
+    test.run("ODI?$skip=123").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(skip($skip = 123))))) <EOF>)");
+
+    test.run("ODI?$skiptoken=abc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(skiptoken($skiptoken = abc))))) <EOF>)");
+
+    test.run("ODI?$top=123").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(top($top = 123))))) <EOF>)");
+
+    // test.run("ODI?customparameter=abc");
+
+    // test.run("ODI").isText("");
+  };
+
+  @Test
+  public void testExpressions() {
+    // Test parser rule commonExpr -> primitiveLiteral
+    test.run("ODI?$filter=null").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? "
+        + "queryOptions(queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(nullrule(null)))))))) <EOF>)");
+
+    test.run("ODI?$filter=true").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
+
+    test.run("ODI?$filter=false").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(booleanNonCase(false)))))))) <EOF>)");
+
+    test.run("ODI?$filter=1").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(1))))))) <EOF>)");
+
+    test.run("ODI?$filter=-1").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(-1))))))) <EOF>)");
+
+    test.run("ODI?$filter=1.1").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(1.1))))))) <EOF>)");
+
+    test.run("ODI?$filter=-1.2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(-1.2))))))) <EOF>)");
+
+    test.run("ODI?$filter=-1.2e3").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(-1.2e3))))))) <EOF>)");
+
+    test.run("ODI?$filter=-1.2e-3").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(-1.2e-3))))))) <EOF>)");
+
+    test.run("ODI?$filter=binary'12AB'").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(binary'12AB'))))))) <EOF>)");
+
+    test.run("ODI?$filter=BiNaRy'12AB'").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(BiNaRy'12AB'))))))) <EOF>)");
+
+    test.run("ODI?$filter=2013-11-15").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(2013-11-15))))))) <EOF>)");
+
+    test.run("ODI?$filter=2013-11-15T13:35Z").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(2013-11-15T13:35Z))))))) <EOF>)");
+
+    test.run("ODI?$filter=duration'PT67S'").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(duration'PT67S'))))))) <EOF>)");
+
+    test.run("ODI?$filter=1234ABCD-12AB-23CD-45EF-123456780ABC").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(1234ABCD-12AB-23CD-45EF-123456780ABC))))))) <EOF>)");
+
+    test.run("ODI?$filter='ABC'").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(string('ABC')))))))) <EOF>)");
+
+    test.run("ODI?$filter=20:00").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(20:00))))))) <EOF>)");
+
+    // Test enum
+    test.run("ODI?$filter=NS.ODI'1'").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(enumX(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) '1')))))))) <EOF>)");
+    test.run("ODI?$filter=NS.ODI'1,3'").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(enumX(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) '1,3')))))))) <EOF>)");
+    test.run("ODI?$filter=NS.ODI'ODI,3'").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(enumX(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) 'ODI,3')))))))) <EOF>)");
+
+    // Test Geometry
+
+    // Rule GeographyCollection
+
+    test.run("ODI?$filter=geography'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'")
+        .isText("odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+            + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+            + "filter($filter = commonExpr(primitiveLiteral(geographyCollection("
+            + "geography' fullCollectionLiteral(sridLiteral(SRID = 0 ;) collectionLiteral("
+            + "Collection ( geoLiteral(lineStringLiteral("
+            + "LineString lineStringData(( "
+            + "positionLiteral(142.1   64.1) , "
+            + "positionLiteral(3.14   2.78) )))) ))) ')))))))) <EOF>)");
+
+    // Rule GeographyLineString
+    test.run("ODI?$filter=geography'SRID=0;LineString(142.1 64.1,3.14 2.78)'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geographyLineString("
+                + "geography' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
+                + "LineString lineStringData(( positionLiteral(142.1   64.1) , positionLiteral(3.14   2.78) )))) '"
+                + ")))))))) <EOF>)");
+
+    // Rule GeographyMultiLineString
+    test.run("ODI?$filter=geography'SRID=0;MultiLineString((142.1 64.1,3.14 2.78),(142.1 64.1,3.14 2.78))'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geographyMultilineString("
+                + "geography' fullMultilineStringLiteral(sridLiteral(SRID = 0 ;) multilineStringLiteral("
+                + "MultiLineString ( "
+                + "lineStringData(( positionLiteral(142.1   64.1) , positionLiteral(3.14   2.78) )) , "
+                + "lineStringData(( positionLiteral(142.1   64.1) , positionLiteral(3.14   2.78) )) ))) '"
+                + ")))))))) <EOF>)");
+
+    // Rule GeographyMultiPoint
+    test.run("ODI?$filter=geography'SRID=0;MultiPoint()'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geographyMultipoint("
+                + "geography' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral("
+                + "MultiPoint ( ))) ')))))))) <EOF>)");
+    // Rule GeographyMultiPoint
+    test.run("ODI?$filter=geography'SRID=0;MultiPoint((142.1 64.1),(1 2))'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geographyMultipoint("
+                + "geography' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral("
+                + "MultiPoint ( "
+                + "pointData(( positionLiteral(142.1   64.1) )) , "
+                + "pointData(( positionLiteral(1   2) )) ))) ')))))))) <EOF>)");
+    // Rule GeographyMultiPolygon
+    test.run("ODI?$filter=geography'SRID=0;MultiPolygon(((1 1,1 1),(1 1,2 2,3 3,1 1)))'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geographyMultipolygon("
+                + "geography' fullmultipolygonLiteral(sridLiteral(SRID = 0 ;) multipolygonLiteral("
+                + "MultiPolygon ( polygonData(( "
+                + "ringLiteral(( positionLiteral(1   1) , positionLiteral(1   1) )) , "
+                + "ringLiteral(( positionLiteral(1   1) , positionLiteral(2   2) , "
+                + "positionLiteral(3   3) , positionLiteral(1   1) )) )) ))) ')))))))) <EOF>)");
+    // Rule GeographyPoint
+    test.run("ODI?$filter=geography'SRID=0;Point(142.1 64.1)'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geographyPoint("
+                + "geography' fullpointLiteral(sridLiteral(SRID = 0 ;) pointLiteral("
+                + "Point pointData(( positionLiteral(142.1   64.1) )))) ')))))))) <EOF>)");
+    // Rule GeographyPolygon
+    test.run("ODI?$filter=geography'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geographyPolygon("
+                + "geography' fullPolygonLiteral(sridLiteral(SRID = 0 ;) polygonLiteral("
+                + "Polygon polygonData(( "
+                + "ringLiteral(( positionLiteral(1   1) , positionLiteral(1   1) )) , "
+                + "ringLiteral(( positionLiteral(1   1) , positionLiteral(2   2) , "
+                + "positionLiteral(3   3) , positionLiteral(1   1) )) )))) ')))))))) <EOF>)");
+    // Rule GeometryCollection
+    test.run("ODI?$filter=geometry'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geometryCollection("
+                + "geometry' fullCollectionLiteral(sridLiteral(SRID = 0 ;) collectionLiteral("
+                + "Collection ( geoLiteral(lineStringLiteral(LineString lineStringData(( "
+                + "positionLiteral(142.1   64.1) , "
+                + "positionLiteral(3.14   2.78) )))) ))) ')))))))) <EOF>)");
+    // Rule GeometryLineString
+    test.run("ODI?$filter=geometry'SRID=0;LineString(142.1 64.1,3.14 2.78)'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geometryLineString("
+                + "geometry' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
+                + "LineString lineStringData(( positionLiteral(142.1   64.1) , positionLiteral(3.14   2.78) )))) '"
+                + ")))))))) <EOF>)");
+    // Rule GeometryMultiLineString
+    test.run("ODI?$filter=geometry'SRID=0;MultiLineString((142.1 64.1,3.14 2.78),(142.1 64.1,3.14 2.78))'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geometryMultilineString("
+                + "geometry' fullMultilineStringLiteral(sridLiteral(SRID = 0 ;) multilineStringLiteral("
+                + "MultiLineString ( "
+                + "lineStringData(( positionLiteral(142.1   64.1) , positionLiteral(3.14   2.78) )) , "
+                + "lineStringData(( positionLiteral(142.1   64.1) , positionLiteral(3.14   2.78) )) ))) '"
+                + ")))))))) <EOF>)");
+    // Rule GeometryMultiPoint
+    test.run("ODI?$filter=geometry'SRID=0;MultiPoint()'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geometryMultipoint("
+                + "geometry' fullMultipointLiteral(sridLiteral(SRID = 0 ;) multipointLiteral(MultiPoint ( ))) '"
+                + ")))))))) <EOF>)");
+    // Rule GeometryMultiPoint
+    test.run("ODI?$filter=geometry'SRID=0;MultiPoint((142.1 64.1),(1 2))'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geometryMultipoint("
+                + "geometry' fullMultipointLiteral(sridLiteral(SRID = 0 ;) "
+                + "multipointLiteral(MultiPoint ( "
+                + "pointData(( positionLiteral(142.1   64.1) )) , "
+                + "pointData(( positionLiteral(1   2) )) ))) ')))))))) <EOF>)");
+    // Rule GeometryMultiPolygon
+    test.run("ODI?$filter=geometry'SRID=0;MultiPolygon(((1 1,1 1),(1 1,2 2,3 3,1 1)))'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geometryMultipolygon("
+                + "geometry' fullmultipolygonLiteral(sridLiteral(SRID = 0 ;) "
+                + "multipolygonLiteral(MultiPolygon ( polygonData(( "
+                + "ringLiteral(( positionLiteral(1   1) , positionLiteral(1   1) )) , "
+                + "ringLiteral(( positionLiteral(1   1) , positionLiteral(2   2) , "
+                + "positionLiteral(3   3) , positionLiteral(1   1) )) )) ))) ')))))))) <EOF>)");
+    // Rule GeometryPoint
+    test.run("ODI?$filter=geometry'SRID=0;Point(142.1 64.1)'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geometryPoint("
+                + "geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) pointLiteral("
+                + "Point pointData(( positionLiteral(142.1   64.1) )))) ')))))))) <EOF>)");
+    // Rule GeometryPolygon
+    test.run("ODI?$filter=geometry'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))'")
+        .isText(
+            "odataRelativeUriEOF(odataRelativeUri(resourcePath(pathSegments(pathSegment("
+                + "odataIdentifier(ODI)))) ? queryOptions(queryOption(systemQueryOption("
+                + "filter($filter = commonExpr(primitiveLiteral(geometryPolygon("
+                + "geometry' fullPolygonLiteral(sridLiteral(SRID = 0 ;) polygonLiteral("
+                + "Polygon polygonData(( "
+                + "ringLiteral(( positionLiteral(1   1) , positionLiteral(1   1) )) , "
+                + "ringLiteral(( positionLiteral(1   1) , positionLiteral(2   2) , "
+                + "positionLiteral(3   3) , positionLiteral(1   1) )) )))) ')))))))) <EOF>)");
+
+    // Parsing expression required in some cases a FullContextParsing and a report of a ContextSensitivity is fine
+
+    // Test commonExpr - parenthesis
+    test.aAM().aFC().aCS().run("ODI?$filter=(1) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr("
+        + "commonExpr(( commonExpr(primitiveLiteral(1)) ))   "
+        + "mul   "
+        + "commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=((((1)))) mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(( commonExpr(( commonExpr(( commonExpr(( commonExpr("
+        + "primitiveLiteral(1)) )) )) )) ))   "
+        + "mul   commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+    test.aAM().aFC().aCS().run("ODI?$filter=(1 add 2)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr(( commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "add   commonExpr(primitiveLiteral(2))) ))))))) <EOF>)");
+    test.aAM().aFC().aCS().run("ODI?$filter=1 mul (2 add 3)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "mul   commonExpr(( commonExpr(commonExpr(primitiveLiteral(2))   "
+        + "add   commonExpr(primitiveLiteral(3))) )))))))) <EOF>)");
+
+    // Test commonExpr - methodCallExpr
+    test.run("ODI?$filter=indexof('ABCXYZ','CXY')").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "indexOfMethodCallExpr(indexof( "
+        + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
+        + "commonExpr(primitiveLiteral(string('CXY'))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=tolower('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "toLowerMethodCallExpr(tolower( "
+        + "commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=toupper('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "toUpperMethodCallExpr(toupper( "
+        + "commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=trim('%20%20%20ABC%20%20%20')").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "trimMethodCallExpr(trim( "
+        + "commonExpr(primitiveLiteral(string('%20%20%20ABC%20%20%20'))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=substring('ABC',1)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "substringMethodCallExpr(substring( "
+        + "commonExpr(primitiveLiteral(string('ABC'))) , "
+        + "commonExpr(primitiveLiteral(1)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=substring('ABC',1,2)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "substringMethodCallExpr(substring( "
+        + "commonExpr(primitiveLiteral(string('ABC'))) , "
+        + "commonExpr(primitiveLiteral(1)) , "
+        + "commonExpr(primitiveLiteral(2)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=concat('ABC','XYZ')").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "concatMethodCallExpr(concat( "
+        + "commonExpr(primitiveLiteral(string('ABC'))) , "
+        + "commonExpr(primitiveLiteral(string('XYZ'))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=length('ABC')").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "lengthMethodCallExpr(length( commonExpr(primitiveLiteral(string('ABC'))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=year(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "yearMethodCallExpr(year( "
+        + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=month(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "monthMethodCallExpr(month( "
+        + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=day(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "dayMethodCallExpr(day( "
+        + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=hour(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "hourMethodCallExpr(hour( "
+        + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=minute(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "minuteMethodCallExpr(minute( "
+        + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=second(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "secondMethodCallExpr(second( "
+        + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=fractionalseconds(BirthDate)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "fractionalsecondsMethodCallExpr(fractionalseconds( "
+        + "commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(BirthDate))))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=totalseconds(duration'PT67S')").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "totalsecondsMethodCallExpr(totalseconds( commonExpr(primitiveLiteral(duration'PT67S')) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=date(2013-11-15T13:35Z)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "dateMethodCallExpr(date( commonExpr(primitiveLiteral(2013-11-15T13:35Z)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=time(2013-11-15T13:35Z)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "timeMethodCallExpr(time( commonExpr(primitiveLiteral(2013-11-15T13:35Z)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=round(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "roundMethodCallExpr(round( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=floor(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "floorMethodCallExpr(floor( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=ceiling(12.34)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "ceilingMethodCallExpr(ceiling( commonExpr(primitiveLiteral(12.34)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=geo.distance(geometry'SRID=0;Point(142.1 64.1)',geometry'SRID=0;Point(142.1 64.1)')")
+        .isText("odataRelativeUriEOF(odataRelativeUri("
+            + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+            + "queryOption(systemQueryOption("
+            + "filter($filter = commonExpr(methodCallExpr("
+            + "distanceMethodCallExpr("
+            + "geo.distance( "
+            + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
+            + "pointLiteral(Point pointData(( positionLiteral(142.1   64.1) )))) '))) , "
+            + "commonExpr(primitiveLiteral(geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
+            + "pointLiteral(Point pointData(( positionLiteral(142.1   64.1) )))) '))) ))))))))) <EOF>)");
+
+    // TODO check this
+    /*
+     * test.run("ODI?$filter=geo.length(geometry'SRID=0;LineString(142.1 64.1,3.14 2.78)')")
+     * .isText("odataRelativeUriEOF(odataRelativeUri("
+     * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+     * + "queryOption(systemQueryOption(filter($filter = commonExpr(methodCallExpr("
+     * + "geoLengthMethodCallExpr(geo.length ( commonExpr(primitiveLiteral("
+     * + "geometryLineString(geometry' fullLineStringLiteral(sridLiteral(SRID = 0 ;) lineStringLiteral("
+     * + "LineString lineStringData(( positionLiteral(142.1   64.1) , "
+     * + "positionLiteral(3.14   2.78) )))) '))) ))))))))) <EOF>)");
+     */
+    test.run("ODI?$filter=totaloffsetminutes(2013-11-15T13:35Z)")
+        .isText("odataRelativeUriEOF(odataRelativeUri("
+            + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+            + "queryOption(systemQueryOption(filter($filter = commonExpr(methodCallExpr("
+            + "totalOffsetMinutesMethodCallExpr(totaloffsetminutes( commonExpr("
+            + "primitiveLiteral(2013-11-15T13:35Z)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=mindatetime()").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr(minDateTimeMethodCallExpr(mindatetime( ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=maxdatetime()").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr(maxDateTimeMethodCallExpr(maxdatetime( ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=now()").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr(nowMethodCallExpr(now( ))))))))) <EOF>)");
+
+    // from boolean
+    test.run("ODI?$filter=isof(Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr(isofExpr("
+        + "isof( qualifiedtypename("
+        + "namespace(odataIdentifier(Model) .) "
+        + "odataIdentifier(Employee)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=isof(ODI,Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "isofExpr(isof( commonExpr("
+        + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI))))) , "
+        + "qualifiedtypename(namespace(odataIdentifier(Model) .) odataIdentifier(Employee)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=cast(Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "castExpr(cast( "
+        + "qualifiedtypename(namespace(odataIdentifier(Model) .) "
+        + "odataIdentifier(Employee)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=cast(ODI,Model.Employee)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "castExpr(cast( commonExpr("
+        + "memberExpr(pathSegments(pathSegment("
+        + "odataIdentifier(ODI))))) , "
+        + "qualifiedtypename(namespace(odataIdentifier(Model) .) "
+        + "odataIdentifier(Employee)) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=endswith('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "endsWithMethodCallExpr(endswith( "
+        + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
+        + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
+
+    test.run("ODI?$filter=startswith('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "startsWithMethodCallExpr(startswith( "
+        + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
+        + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
+    test.run("ODI?$filter=contains('ABCXYZ','YZ')").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(methodCallExpr("
+        + "containsMethodCallExpr(contains( "
+        + "commonExpr(primitiveLiteral(string('ABCXYZ'))) , "
+        + "commonExpr(primitiveLiteral(string('YZ'))) ))))))))) <EOF>)");
+    /*
+     * test.run("ODI?$filter=geo.intersects("
+     * + "geometry'SRID=0;Point(142.1 64.1)',"
+     * + "geometry'SRID=0;Polygon((1 1,1 1),(1 1,2 2,3 3,1 1))')").isText("odataRelativeUriEOF(odataRelativeUri("
+     * + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+     * + "queryOption(systemQueryOption("
+     * + "filter($filter = commonExpr(methodCallExpr("
+     * + "intersectsMethodCallExpr(geo.intersects ( "
+     * + "commonExpr(primitiveLiteral("
+     * + "geometryPoint(geometry' fullpointLiteral(sridLiteral(SRID = 0 ;) "
+     * + "pointLiteral(Point pointData(( positionLiteral(142.1   64.1) )))) '))) , "
+     * + "commonExpr(primitiveLiteral("
+     * + "geometryPolygon(geometry' fullPolygonLiteral(sridLiteral(SRID = 0 ;) "
+     * + "polygonLiteral(Polygon polygonData(( "
+     * + "ringLiteral(( positionLiteral(1   1) , positionLiteral(1   1) )) , "
+     * + "ringLiteral(( positionLiteral(1   1) , positionLiteral(2   2) , "
+     * + "positionLiteral(3   3) , positionLiteral(1   1) )) )))) '))) ))))))))) <EOF>)");
+     */
+    // Test commonExpr - unary
+    test.run("ODI?$filter=true").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = commonExpr("
+        + "primitiveLiteral(booleanNonCase(true)))))))) <EOF>)");
+
+    // Test commonExpr - member
+    test.run("ODI?$filter=ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr("
+        + "memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))))))) <EOF>)");
+
+    // Test commonExpr - mathematical
+    test.aAM().aFC().aCS().run("ODI?$filter=1 mul 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "mul   commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=1 div 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "div   commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=1 mod 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "mod   commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=1 add 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "add   commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=1 sub 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "sub   commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=1 gt 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "gt   commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=1 ge 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "ge   commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=1 lt 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "lt   commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=1 le 2").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "le   commonExpr(primitiveLiteral(2)))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=ODI isof Model.Employee").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(memberExpr(pathSegments(pathSegment(odataIdentifier(ODI)))))   "
+        + "isof   commonExpr(memberExpr("
+        + "pathSegments(pathSegment("
+        + "namespace(odataIdentifier(Model) .) "
+        + "odataIdentifier(Employee))))))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=true and false").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(primitiveLiteral(booleanNonCase(true)))   "
+        + "and   commonExpr(primitiveLiteral(booleanNonCase(false))))))))) <EOF>)");
+
+    test.aAM().aFC().aCS().run("ODI?$filter=true or false").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr(commonExpr(primitiveLiteral(booleanNonCase(true)))   "
+        + "or   commonExpr(primitiveLiteral(booleanNonCase(false))))))))) <EOF>)");
+
+    // Test commonExpr - $root
+    test.run("ODI?$filter=$root/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr("
+        + "rootExpr($root/ pathSegments(pathSegment(odataIdentifier(ODI)))))))))) <EOF>)");
+
+    // Test concatenated parenthesis
+    test.run("ODI?$filter=not true").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = commonExpr("
+        + "unary(not)   commonExpr(primitiveLiteral(booleanNonCase(true))))))))) <EOF>)");
+  }
+
+  @Test
+  public void testFragment() {
+
+    test.run("$metadata#Collection($ref)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(Collection($ref))) <EOF>)");
+
+    test.run("$metadata#Collection(Edm.EntityType)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(Collection(Edm.EntityType))) <EOF>)");
+
+    test.run("$metadata#Collection(Edm.ComplexType)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(Collection(Edm.ComplexType))) <EOF>)");
+
+    test.run("$metadata#singletonEntity").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(singletonEntity))) <EOF>)");
+
+    test.run("$metadata#NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) <EOF>)");
+
+    test.run("$metadata#Edm.Boolean").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(namespace(odataIdentifier(Edm) .) odataIdentifier(Boolean))) <EOF>)");
+
+    test.run("$metadata#ODI/$deletedEntity").isText("odataRelativeUriEOF("
+        + "odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) / $deletedEntity)) <EOF>)");
+
+    test.run("$metadata#ODI/$link").isText("odataRelativeUriEOF("
+        + "odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) / $link)) <EOF>)");
+
+    test.run("$metadata#ODI/$deletedLink").isText("odataRelativeUriEOF("
+        + "odataRelativeUri($metadata # contextFragment(odataIdentifier(ODI) / $deletedLink)) <EOF>)");
+
+    test.run("$metadata#ODI(1)/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+        + "odataIdentifier(ODI))) <EOF>)");
+
+    test.run("$metadata#ODI(1)/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+        + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) <EOF>)");
+
+    test.run("$metadata#ODI(1)/NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+        + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI) / odataIdentifier(ODI))) <EOF>)");
+
+    test.run("$metadata#NS.ODI(*)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(namespace(odataIdentifier(NS) .) odataIdentifier(ODI) "
+        + "propertyList(( propertyListItem(*) )))) <EOF>)");
+
+    test.run("$metadata#ODI(1)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )))) "
+        + "<EOF>)");
+
+    test.run("$metadata#ODI(1)/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+        + "odataIdentifier(ODI))) <EOF>)");
+
+    test.run("$metadata#ODI(1)/NS.ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+        + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI))) <EOF>)");
+
+    test.run("$metadata#ODI(1)/NS.ODI/ODI").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) / "
+        + "namespace(odataIdentifier(NS) .) odataIdentifier(ODI) / odataIdentifier(ODI))) <EOF>)");
+
+    test.run("$metadata#ODI(1)(*)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+        + "propertyList(( propertyListItem(*) )))) <EOF>)");
+
+    test.run("$metadata#ODI(1)(PROP)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+        + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(PROP))) )))) <EOF>)");
+    test.run("$metadata#ODI(1)(NAVPROP+)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) "
+        + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+        + "propertyList(( propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) +)) )))) <EOF>)");
+    test.run("$metadata#ODI(1)(NAVPROP+(*))").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) "
+        + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+        + "propertyList(( "
+        + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
+        + "propertyList(( "
+        + "propertyListItem(*) )))) )))) <EOF>)");
+    test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) "
+        + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+        + "propertyList(( "
+        + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
+        + "propertyList(( "
+        + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
+        + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
+        + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )))) <EOF>)");
+
+    test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$delta").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) "
+        + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+        + "propertyList(( "
+        + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
+        + "propertyList(( "
+        + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
+        + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
+        + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )) "
+        + "/ $delta)) <EOF>)");
+
+    test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$entity").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) "
+        + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+        + "propertyList(( "
+        + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
+        + "propertyList(( "
+        + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
+        + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
+        + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )) "
+        + "/ $entity)) <EOF>)");
+    test.run("$metadata#ODI(1)(NAVPROP+(A,B,C))/$delta/$entity").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "$metadata # contextFragment(odataIdentifier(ODI) "
+        + "nameValueOptList(( valueOnly(primitiveLiteral(1)) )) "
+        + "propertyList(( "
+        + "propertyListItem(propertyListProperty(odataIdentifier(NAVPROP) + "
+        + "propertyList(( "
+        + "propertyListItem(propertyListProperty(odataIdentifier(A))) , "
+        + "propertyListItem(propertyListProperty(odataIdentifier(B))) , "
+        + "propertyListItem(propertyListProperty(odataIdentifier(C))) )))) )) "
+        + "/ $delta / $entity)) <EOF>)");
+
+  }
+
+  @Test
+  public void testPrecedence() {
+    // Test operator precedence
+
+    test.aFC().aCS().aAM().run("ODI?$filter=(1 add 2) mul 3").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = "
+        + "commonExpr(commonExpr(( commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "add   commonExpr(primitiveLiteral(2))) ))   "
+        + "mul   commonExpr(primitiveLiteral(3)))))))) <EOF>)");
+
+    test.aFC().aCS().aAM().run("ODI?$filter=1 add (2 mul 3)").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = "
+        + "commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "add   commonExpr(( commonExpr(commonExpr(primitiveLiteral(2))   "
+        + "mul   commonExpr(primitiveLiteral(3))) )))))))) <EOF>)");
+
+    test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 add 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = "
+        + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "add   commonExpr(primitiveLiteral(2)))   "
+        + "add   commonExpr(primitiveLiteral(3)))   "
+        + "add   commonExpr(primitiveLiteral(4)))))))) <EOF>)");
+
+    test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = "
+        + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "add   commonExpr(primitiveLiteral(2)))   "
+        + "add   commonExpr(commonExpr(primitiveLiteral(3))   "
+        + "mul   commonExpr(primitiveLiteral(4))))))))) <EOF>)");
+
+    test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 mul 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = "
+        + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "add   commonExpr(commonExpr(primitiveLiteral(2))   "
+        + "mul   commonExpr(primitiveLiteral(3))))   "
+        + "add   commonExpr(primitiveLiteral(4)))))))) <EOF>)");
+
+    test.aFC().aCS().aAM().run("ODI?$filter=1 add 2 mul 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = "
+        + "commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "add   commonExpr(commonExpr(commonExpr(primitiveLiteral(2))   "
+        + "mul   commonExpr(primitiveLiteral(3)))   "
+        + "mul   commonExpr(primitiveLiteral(4))))))))) <EOF>)");
+    test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = "
+        + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "mul   commonExpr(primitiveLiteral(2)))   "
+        + "add   commonExpr(primitiveLiteral(3)))   "
+        + "add   commonExpr(primitiveLiteral(4)))))))) <EOF>)");
+
+    test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = "
+        + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "mul   commonExpr(primitiveLiteral(2)))   "
+        + "add   commonExpr(commonExpr(primitiveLiteral(3))   "
+        + "mul   commonExpr(primitiveLiteral(4))))))))) <EOF>)");
+
+    test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 mul 3 add 4").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = "
+        + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "mul   commonExpr(primitiveLiteral(2)))   "
+        + "mul   commonExpr(primitiveLiteral(3)))   "
+        + "add   commonExpr(primitiveLiteral(4)))))))) <EOF>)");
+
+    test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 mul 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption(filter($filter = "
+        + "commonExpr(commonExpr(commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "mul   commonExpr(primitiveLiteral(2)))   "
+        + "mul   commonExpr(primitiveLiteral(3)))   "
+        + "mul   commonExpr(primitiveLiteral(4)))))))) <EOF>)");
+
+    test.aFC().aCS().aAM().run("ODI?$filter=1 mul 2 add 3 mul 4").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions("
+        + "queryOption(systemQueryOption("
+        + "filter($filter = "
+        + "commonExpr(commonExpr(commonExpr(primitiveLiteral(1))   "
+        + "mul   commonExpr(primitiveLiteral(2)))   "
+        + "add   commonExpr(commonExpr(primitiveLiteral(3))   "
+        + "mul   commonExpr(primitiveLiteral(4))))))))) <EOF>)");
+
+    // Test parser rule search
+    test.aFC().aCS().aAM().run("ODI?$search=abc OR abc AND abc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(search("
+        + "$search searchSpecialToken(= "
+        + "searchExpr(searchExpr(searchWord(abc))   OR   "
+        + "searchExpr("
+        + "searchExpr(searchWord(abc))   AND   "
+        + "searchExpr(searchWord(abc)))))))))) <EOF>)");
+
+    test.aFC().aCS().aAM().run("ODI?$search=abc OR abc abc").isText("odataRelativeUriEOF(odataRelativeUri("
+        + "resourcePath(pathSegments(pathSegment(odataIdentifier(ODI)))) ? queryOptions(queryOption("
+        + "systemQueryOption(search("
+        + "$search searchSpecialToken(= "
+        + "searchExpr(searchExpr(searchWord(abc))   OR   "
+        + "searchExpr("
+        + "searchExpr(searchWord(abc))   "
+        + "searchExpr(searchWord(abc)))))))))) <EOF>)");
+  }
+
+  // ;------------------------------------------------------------------------------
+  // ; 2. Query Options
+  // ;------------------------------------------------------------------------------
+
+  // ;------------------------------------------------------------------------------
+  // ; 4. Expressions
+  // ;------------------------------------------------------------------------------
+
+  // ;------------------------------------------------------------------------------
+  // ; 5. JSON format for function parameters
+  // ;------------------------------------------------------------------------------
+
+  // ;------------------------------------------------------------------------------
+  // ; 6. Names and identifiers
+  // ;------------------------------------------------------------------------------
+
+  // ;------------------------------------------------------------------------------
+  // ; 7. Literal Data Values
+  // ;------------------------------------------------------------------------------
+
+  // ;------------------------------------------------------------------------------
+  // ; 0. misc
+  // 

<TRUNCATED>

Mime
View raw message