You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2016/06/10 03:33:00 UTC

[04/19] vxquery git commit: Adding ArrayConstructorNode

Adding ArrayConstructorNode


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/609930ef
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/609930ef
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/609930ef

Branch: refs/heads/master
Commit: 609930efbde8acec20f4baf8f5bb4cd929285d3e
Parents: beff6de
Author: Christina Pavlopoulou <cp...@ucr.edu>
Authored: Thu Jun 2 16:47:33 2016 -0700
Committer: Christina Pavlopoulou <cp...@ucr.edu>
Committed: Thu Jun 2 16:47:33 2016 -0700

----------------------------------------------------------------------
 .../xmlquery/ast/ArrayConstructorNode.java      | 40 +++++++++++++++++
 vxquery-core/src/main/javacc/xquery-grammar.jj  | 45 +++++++++++---------
 2 files changed, 64 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/609930ef/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
new file mode 100644
index 0000000..cf034a3
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/ast/ArrayConstructorNode.java
@@ -0,0 +1,40 @@
+/*
+* 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.vxquery.xmlquery.ast;
+
+import org.apache.vxquery.util.SourceLocation;
+
+public class ArrayConstructorNode extends ASTNode {
+    private ASTNode expression;
+
+    public ArrayConstructorNode(SourceLocation loc) {
+        super(loc);
+    }
+
+    @Override
+    public ASTTag getTag() {
+        return ASTTag.ARRAY_CONSTRUCTOR;
+    }
+
+    public ASTNode getExpression() {
+        return expression;
+    }
+
+    public void setExpression(ASTNode expression) {
+        this.expression = expression;
+    }
+}

http://git-wip-us.apache.org/repos/asf/vxquery/blob/609930ef/vxquery-core/src/main/javacc/xquery-grammar.jj
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/javacc/xquery-grammar.jj b/vxquery-core/src/main/javacc/xquery-grammar.jj
index 4db964a..a1d9de9 100644
--- a/vxquery-core/src/main/javacc/xquery-grammar.jj
+++ b/vxquery-core/src/main/javacc/xquery-grammar.jj
@@ -1937,27 +1937,6 @@ ASTNode FunctionCall()  :
     }
 }
 
-ASTNode JsonConstructor()  :
-{
-    ASTNode result;
-}
-{
-    result = ArrayConstructor()
-    {
-		return result;
-	}
-}
-
-ASTNode ArrayConstructor()  :
-{
-	ASTNode expr;
-}
-{
-	"[" expr=Expr() "]" {
-		return expr;
-	}
-}
-
 ASTNode Constructor()  :
 {
     ASTNode result;
@@ -2464,6 +2443,30 @@ ASTNode CompPIConstructor()  :
     }
 }
 
+ASTNode JsonConstructor()  :
+{
+    ASTNode result;
+}
+{
+    result = ArrayConstructor()
+    {
+	    return result;
+	}
+}
+
+ASTNode ArrayConstructor()  :
+{
+    ASTNode expr;
+    Token start;
+}
+{
+    (start="[") expr=Expr() "]" {
+        ArrayConstructorNode an = new ArrayConstructorNode(createSourceLocation(start));
+        an.setExpression(expr);
+	    return an;
+    }
+}
+
 SingleTypeNode SingleType()  :
 {
     AtomicTypeNode type;