You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2014/07/04 02:01:37 UTC

[7/8] git commit: [OPTIQ-321] Add support for overriding implementation of CompoundIdentifier in SqlParser.

[OPTIQ-321] Add support for overriding implementation of CompoundIdentifier in SqlParser.


Project: http://git-wip-us.apache.org/repos/asf/incubator-optiq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-optiq/commit/55d67e20
Tree: http://git-wip-us.apache.org/repos/asf/incubator-optiq/tree/55d67e20
Diff: http://git-wip-us.apache.org/repos/asf/incubator-optiq/diff/55d67e20

Branch: refs/heads/master
Commit: 55d67e204c5ac196b1a62e50e5605d8fa97f998c
Parents: 1df2761
Author: Jacques Nadeau <ja...@apache.org>
Authored: Wed Jul 2 10:29:40 2014 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Thu Jul 3 12:21:29 2014 -0700

----------------------------------------------------------------------
 core/src/main/codegen/config.fmpp               |  2 ++
 .../codegen/includes/compoundIdentifier.ftl     | 35 ++++++++++++++++++++
 .../main/codegen/templates/CombinedParser.jj    |  4 +++
 3 files changed, 41 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-optiq/blob/55d67e20/core/src/main/codegen/config.fmpp
----------------------------------------------------------------------
diff --git a/core/src/main/codegen/config.fmpp b/core/src/main/codegen/config.fmpp
index af5e792..862b502 100644
--- a/core/src/main/codegen/config.fmpp
+++ b/core/src/main/codegen/config.fmpp
@@ -73,6 +73,8 @@ data: {
     implementationFiles: [
       "parserImpls.ftl"
     ]
+    
+    includeCompoundIdentifier: true
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-optiq/blob/55d67e20/core/src/main/codegen/includes/compoundIdentifier.ftl
----------------------------------------------------------------------
diff --git a/core/src/main/codegen/includes/compoundIdentifier.ftl b/core/src/main/codegen/includes/compoundIdentifier.ftl
new file mode 100644
index 0000000..3b830d7
--- /dev/null
+++ b/core/src/main/codegen/includes/compoundIdentifier.ftl
@@ -0,0 +1,35 @@
+<#--
+// Licensed to Julian Hyde under one or more contributor license
+// agreements. See the NOTICE file distributed with this work for
+// additional information regarding copyright ownership.
+//
+// Julian Hyde 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.
+-->
+
+<#--
+  Add implementations of additional parser statements, literals or
+  data types.
+ 
+  Example of SqlShowTables() implementation:
+  SqlNode SqlShowTables()
+  {
+    ...local variables...
+  }
+  {
+    <SHOW> <TABLES>
+    ...
+    {
+      return SqlShowTables(...)
+    }
+  }
+-->

http://git-wip-us.apache.org/repos/asf/incubator-optiq/blob/55d67e20/core/src/main/codegen/templates/CombinedParser.jj
----------------------------------------------------------------------
diff --git a/core/src/main/codegen/templates/CombinedParser.jj b/core/src/main/codegen/templates/CombinedParser.jj
index 7a138ab..56b1ff6 100644
--- a/core/src/main/codegen/templates/CombinedParser.jj
+++ b/core/src/main/codegen/templates/CombinedParser.jj
@@ -3354,6 +3354,7 @@ SqlNodeList ParenthesizedSimpleIdentifierList() :
     }
 }
 
+<#if parser.includeCompoundIdentifier >
 /**
  * Parses a compound identifier.
  */
@@ -3384,6 +3385,9 @@ SqlIdentifier CompoundIdentifier() :
         return new SqlIdentifier(list, null, pos, posList);
     }
 }
+<#else>
+  <#include "/@includes/compoundIdentifier.ftl" />
+</#if>
 
 /**
  * Parses a NEW UDT(...) expression.