Matthias Brantner has proposed merging 
lp:~zorba-coders/zorba/feature-empty_selectors into lp:zorba.

Commit message:
- $array() => jn:members($array)
- $object() => jn:keys($object)
- fixed implicit iteration of object/array selectors if type is not statically 
known

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/feature-empty_selectors/+merge/153615
-- 
https://code.launchpad.net/~zorba-coders/zorba/feature-empty_selectors/+merge/153615
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h	2013-03-06 10:37:33 +0000
+++ include/zorba/pregenerated/diagnostic_list.h	2013-03-15 19:32:31 +0000
@@ -909,6 +909,8 @@
 
 extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNTY0020;
 
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNTY0021;
+
 extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNDY0021;
 #endif
 

=== modified file 'modules/org/jsoniq/www/pregenerated/errors.xq'
--- modules/org/jsoniq/www/pregenerated/errors.xq	2013-03-06 00:18:36 +0000
+++ modules/org/jsoniq/www/pregenerated/errors.xq	2013-03-15 19:32:31 +0000
@@ -157,6 +157,11 @@
 declare variable $jerr:JNTY0020 as xs:QName := fn:QName($jerr:NS, "jerr:JNTY0020");
 
 (:~
+ :array or object selector on heterogeneous sequence
+:)
+declare variable $jerr:JNTY0021 as xs:QName := fn:QName($jerr:NS, "jerr:JNTY0021");
+
+(:~
  :parser error raised by jn:parse-json
 :)
 declare variable $jerr:JNDY0021 as xs:QName := fn:QName($jerr:NS, "jerr:JNDY0021");
\ No newline at end of file

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2013-03-08 00:09:46 +0000
+++ src/compiler/translator/translator.cpp	2013-03-15 19:32:31 +0000
@@ -11432,7 +11432,7 @@
   if (!theSctx->is_feature_set(feature::hof) ||
       (TypeOps::is_subtype(tm, *srcType, *theRTM.JSON_ITEM_TYPE_STAR)))
   {
-    if (numArgs != 1)
+    if (numArgs > 1)
     {
       RAISE_ERROR_NO_PARAMS(jerr::JNTY0018, loc);
     }
@@ -11448,22 +11448,27 @@
 
     if (TypeOps::is_subtype(tm, *srcType, *theRTM.JSON_ARRAY_TYPE_STAR))
     {
-      func = BUILTIN_FUNC(FN_JSONIQ_MEMBER_2);
+      func = numArgs==1 ?
+        BUILTIN_FUNC(FN_JSONIQ_MEMBER_2) :
+        BUILTIN_FUNC(FN_JSONIQ_MEMBERS_1);
     }
     else if (TypeOps::is_subtype(tm, *srcType, *theRTM.JSON_OBJECT_TYPE_STAR))
     {
-      func = BUILTIN_FUNC(FN_JSONIQ_VALUE_2);
+      func = numArgs==1 ?
+        BUILTIN_FUNC(FN_JSONIQ_VALUE_2) :
+        BUILTIN_FUNC(FN_JSONIQ_KEYS_1);
     }
     else
     {
-      func = BUILTIN_FUNC(OP_ZORBA_JSON_ITEM_ACCESSOR_2);
+      func = numArgs==1 ?
+        BUILTIN_FUNC(OP_ZORBA_JSON_ITEM_ACCESSOR_2) :
+        BUILTIN_FUNC(OP_ZORBA_JSON_ITEM_ACCESSOR_1);
     }
-
-    accessorExpr = theExprManager->create_fo_expr(theRootSctx, theUDF,
-                                                  loc,
-                                                  func,
-                                                  flworVarExpr,
-                                                  arguments[0]);
+    accessorExpr = numArgs==1 ?
+      theExprManager->create_fo_expr(
+          theRootSctx, theUDF, loc, func, flworVarExpr, arguments[0]) :
+      theExprManager->create_fo_expr(
+          theRootSctx, theUDF, loc, func, flworVarExpr);
 
     normalize_fo(accessorExpr);
 

=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2013-03-07 10:10:10 +0000
+++ src/diagnostics/diagnostic_en.xml	2013-03-15 19:32:31 +0000
@@ -3095,7 +3095,7 @@
     <diagnostic code="JNTY0018" if="defined(ZORBA_WITH_JSON)">
       <comment>It is a dynamic error if there is not exactly one supplied parameter for an object or array selector.</comment>
 
-      <value>object or array selection needs exactly one parameter</value>
+      <value>object or array selection needs zero or one parameter</value>
     </diagnostic>
 
     <diagnostic code="JNUP0019" if="defined(ZORBA_WITH_JSON)">
@@ -3120,6 +3120,11 @@
       <value>$1: invalid option type for option $2 (expected $3)</value>
     </diagnostic>
 
+    <diagnostic code="JNTY0021" if="defined(ZORBA_WITH_JSON)">
+      <comment>array or object selector on heterogeneous sequence</comment>
+      <value>$1: invalid json-item() type (expected $2)</value>
+    </diagnostic>
+
     <diagnostic code="JNDY0021" if="defined(ZORBA_WITH_JSON)">
       <comment>parser error raised by jn:parse-json</comment>
       <value>$1</value>

=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp	2013-03-06 10:37:33 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp	2013-03-15 19:32:31 +0000
@@ -1339,6 +1339,9 @@
 JSONiqErrorCode JNTY0020( "JNTY0020" );
 
 
+JSONiqErrorCode JNTY0021( "JNTY0021" );
+
+
 JSONiqErrorCode JNDY0021( "JNDY0021" );
 #endif
 

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2013-03-07 10:10:10 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2013-03-15 19:32:31 +0000
@@ -126,12 +126,15 @@
   { "JNTY0011", "JSON item cannot appear in content sequence of node constructor or updating expression" },
 #endif
 #if defined(ZORBA_WITH_JSON)
-  { "JNTY0018", "object or array selection needs exactly one parameter" },
+  { "JNTY0018", "object or array selection needs zero or one parameter" },
 #endif
 #if defined(ZORBA_WITH_JSON)
   { "JNTY0020", "$1: invalid option type for option $2 (expected $3)" },
 #endif
 #if defined(ZORBA_WITH_JSON)
+  { "JNTY0021", "$1: invalid json-item() type (expected $2)" },
+#endif
+#if defined(ZORBA_WITH_JSON)
   { "JNTY0023", "$1: value of \"$2\" is not a $3" },
 #endif
 #if defined(ZORBA_WITH_JSON)

=== modified file 'src/functions/pregenerated/func_jsoniq_functions.cpp'
--- src/functions/pregenerated/func_jsoniq_functions.cpp	2013-03-05 23:11:50 +0000
+++ src/functions/pregenerated/func_jsoniq_functions.cpp	2013-03-15 19:32:31 +0000
@@ -505,6 +505,22 @@
     DECL_WITH_KIND(sctx, op_zorba_json_item_accessor,
         (createQName("http://www.zorba-xquery.com/internal/zorba-ops","","json-item-accessor";), 
         GENV_TYPESYSTEM.JSON_ITEM_TYPE_ONE, 
+        GENV_TYPESYSTEM.ITEM_TYPE_STAR),
+        FunctionConsts::OP_ZORBA_JSON_ITEM_ACCESSOR_1);
+
+  }
+
+
+#endif
+
+
+#ifdef ZORBA_WITH_JSON
+
+
+      {
+    DECL_WITH_KIND(sctx, op_zorba_json_item_accessor,
+        (createQName("http://www.zorba-xquery.com/internal/zorba-ops","","json-item-accessor";), 
+        GENV_TYPESYSTEM.JSON_ITEM_TYPE_ONE, 
         GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_ONE, 
         GENV_TYPESYSTEM.ITEM_TYPE_QUESTION),
         FunctionConsts::OP_ZORBA_JSON_ITEM_ACCESSOR_2);

=== modified file 'src/functions/pregenerated/function_enum.h'
--- src/functions/pregenerated/function_enum.h	2013-03-06 07:39:18 +0000
+++ src/functions/pregenerated/function_enum.h	2013-03-15 19:32:31 +0000
@@ -256,6 +256,7 @@
   FN_JSONIQ_MEMBERS_1,
   FN_JSONIQ_FLATTEN_1,
   FN_JSONIQ_JSON_DOC_1,
+  OP_ZORBA_JSON_ITEM_ACCESSOR_1,
   OP_ZORBA_JSON_ITEM_ACCESSOR_2,
   FN_JSONIQ_NULL_0,
   FN_JSONIQ_IS_NULL_1,

=== modified file 'src/runtime/function_item/dynamic_fncall_iterator.cpp'
--- src/runtime/function_item/dynamic_fncall_iterator.cpp	2013-02-07 17:24:36 +0000
+++ src/runtime/function_item/dynamic_fncall_iterator.cpp	2013-03-15 19:32:31 +0000
@@ -71,6 +71,9 @@
   thePlanState = &planState;
   thePlan = NULL;
   theIsOpen = false;
+#ifdef ZORBA_WITH_JSON
+  theIterator = NULL;
+#endif
 }
 
 
@@ -84,6 +87,9 @@
   {
     thePlan->reset(planState);
   }
+#ifdef ZORBA_WITH_JSON
+  theIterator = NULL;
+#endif
 }
 
 
@@ -146,8 +152,6 @@
 #ifdef ZORBA_WITH_JSON
   store::Item_t selectorItem1;
   store::Item_t selectorItem2;
-  store::Item_t selectorItem3;
-  bool isObjectNav;
   bool selectorError;
 #endif
   FunctionItem* fnItem;
@@ -224,83 +228,115 @@
 #ifdef ZORBA_WITH_JSON
   else if (targetItem->isJSONObject() || targetItem->isJSONArray())
   {
-    if (theChildren.size() != 2)
+    if (theChildren.size() > 2)
     {
       RAISE_ERROR_NO_PARAMS(jerr::JNTY0018, loc);
     }
-
-    isObjectNav = targetItem->isJSONObject();
-    selectorError = false;
-
-    if (!consumeNext(selectorItem1, theChildren[1], planState))
-    {
-      selectorError = true;
-    }
-    else
-    {
-      try
-      {
-        if (selectorItem1->isNode())
+    else if (theChildren.size() == 2)
+    {
+      state->theIsObjectNav = targetItem->isJSONObject();
+      selectorError = false;
+
+      if (!consumeNext(selectorItem1, theChildren[1], planState))
+      {
+        selectorError = true;
+      }
+      else
+      {
+        try
         {
-          store::Iterator_t iter;
-          
-          selectorItem1->getTypedValue(selectorItem2, iter);
-
-          if (iter != NULL)
-          {
-            if (!iter->next(selectorItem2) || iter->next(item))
+          if (selectorItem1->isNode())
+          {
+            store::Iterator_t iter;
+            
+            selectorItem1->getTypedValue(selectorItem2, iter);
+
+            if (iter != NULL)
+            {
+              if (!iter->next(selectorItem2) || iter->next(item))
+              {
+                selectorError = true;
+              }
+            }
+          }
+          else
+          {
+            selectorItem2.transfer(selectorItem1);
+          }
+
+          if (!selectorError)
+          {
+            if (!selectorItem2->isAtomic())
             {
               selectorError = true;
             }
+            else
+            {
+              store::SchemaTypeCode selectorType = 
+              (state->theIsObjectNav ? store::XS_STRING : store::XS_INTEGER);
+
+              GenericCast::castToBuiltinAtomic(state->theSelector,
+                                               selectorItem2,
+                                               selectorType,
+                                               NULL,
+                                               loc);
+              selectorError = false;
+            }
           }
         }
+        catch (...)
+        {
+          selectorError = true;
+        }
+      }
+        
+      if (selectorError)
+      {
+        item = (selectorItem1 == NULL ? selectorItem2 : selectorItem1);
+
+        zstring selectorType = tm->create_value_type(item)->toSchemaString();
+
+        RAISE_ERROR(err::XPTY0004, loc,
+        ERROR_PARAMS(ZED(XPTY0004_JSONIQ_SELECTOR), selectorType));
+      }
+
+      do {
+        if ((state->theIsObjectNav && !targetItem->isJSONObject()) ||
+            (!state->theIsObjectNav && !targetItem->isJSONArray()))
+        {
+          zstring itemType = tm->create_value_type(targetItem)->toSchemaString();
+          RAISE_ERROR(jerr::JNTY0021, loc,
+            ERROR_PARAMS(itemType,
+              state->theIsObjectNav?
+              GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE->toSchemaString() :
+              GENV_TYPESYSTEM.JSON_ARRAY_TYPE_ONE->toSchemaString()));
+        }
+        if (state->theIsObjectNav)
+          result = targetItem->getObjectValue(state->theSelector);
         else
-        {
-          selectorItem2.transfer(selectorItem1);
-        }
-
-        if (!selectorError)
-        {
-          if (!selectorItem2->isAtomic())
-          {
-            selectorError = true;
-          }
-          else
-          {
-            store::SchemaTypeCode selectorType = 
-            (isObjectNav ? store::XS_STRING : store::XS_INTEGER);
-
-            GenericCast::castToBuiltinAtomic(selectorItem3,
-                                             selectorItem2,
-                                             selectorType,
-                                             NULL,
-                                             loc);
-            selectorError = false;
-          }
-        }
-      }
-      catch (...)
-      {
-        selectorError = true;
-      }
+          result = targetItem->getArrayValue(state->theSelector->getIntegerValue());
+        STACK_PUSH(true, state);
+      } while (consumeNext(targetItem, theChildren[0], planState));
     }
-      
-    if (selectorError)
+    else
     {
-      item = (selectorItem1 == NULL ? selectorItem2 : selectorItem1);
-
-      zstring selectorType = tm->create_value_type(item)->toSchemaString();
-
-      RAISE_ERROR(err::XPTY0004, loc,
-      ERROR_PARAMS(ZED(XPTY0004_JSONIQ_SELECTOR), selectorType));
+      do {
+        if (targetItem->isJSONArray())
+        {
+          state->theIterator = targetItem->getArrayValues();
+        }
+        else if (targetItem->isJSONObject())
+        {
+          state->theIterator = targetItem->getObjectKeys();
+        }
+        state->theIterator->open();
+        while (state->theIterator->next(result))
+        {
+          STACK_PUSH(true, state);
+        }
+        state->theIterator->close();
+      } while (consumeNext(targetItem, theChildren[0], planState));
     }
-
-    if (isObjectNav)
-      result = targetItem->getObjectValue(selectorItem3);
-    else
-      result = targetItem->getArrayValue(selectorItem3->getIntegerValue());
-
-    STACK_PUSH(true, state);
   }
 #endif
   else

=== modified file 'src/runtime/function_item/dynamic_fncall_iterator.h'
--- src/runtime/function_item/dynamic_fncall_iterator.h	2013-02-07 17:24:36 +0000
+++ src/runtime/function_item/dynamic_fncall_iterator.h	2013-03-15 19:32:31 +0000
@@ -37,6 +37,12 @@
 
   uint32_t     theUDFStateOffset;
 
+#ifdef ZORBA_WITH_JSON
+  bool              theIsObjectNav;
+  store::Item_t     theSelector;
+  store::Iterator_t theIterator;
+#endif
+
   DynamicFnCallIteratorState();
 
   ~DynamicFnCallIteratorState();

=== modified file 'src/runtime/json/jsoniq_functions_impl.cpp'
--- src/runtime/json/jsoniq_functions_impl.cpp	2013-03-05 12:34:19 +0000
+++ src/runtime/json/jsoniq_functions_impl.cpp	2013-03-15 19:32:31 +0000
@@ -1149,53 +1149,67 @@
 
   const TypeManager* tm = theSctx->get_typemanager();
 
-  PlanIteratorState* state;
-  DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
+  JSONItemAccessorIteratorState* state;
+  DEFAULT_STACK_INIT(JSONItemAccessorIteratorState, state, planState);
 
   consumeNext(input, theChild0.getp(), planState);
-  consumeNext(selector, theChild1.getp(), planState);
-
-  if (input->isJSONArray())
-  {
-    store::SchemaTypeCode type = selector->getTypeCode();
-
-    if (!TypeOps::is_subtype(type, store::XS_INTEGER))
-    {
-      xqtref_t type = tm->create_value_type(selector, loc);
-
-      RAISE_ERROR(err::XPTY0004, loc, 
-      ERROR_PARAMS(ZED(XPTY0004_NoTypePromote_23),
-                   type->toSchemaString(),
-                   GENV_TYPESYSTEM.INTEGER_TYPE_ONE->toSchemaString()));
-    }
-
-    result = input->getArrayValue(selector->getIntegerValue());
-  }
-  else if (input->isJSONObject())
-  {
-    store::SchemaTypeCode type = selector->getTypeCode();
-
-    if (!TypeOps::is_subtype(type, store::XS_STRING) &&
-        !TypeOps::is_subtype(type, store::XS_UNTYPED_ATOMIC) &&
-        !TypeOps::is_subtype(type, store::XS_ANY_URI))
-    {
-      xqtref_t type = tm->create_value_type(selector, loc);
-
-      RAISE_ERROR(err::XPTY0004, loc, 
-      ERROR_PARAMS(ZED(XPTY0004_NoTypePromote_23),
-                   type->toSchemaString(),
-                   GENV_TYPESYSTEM.STRING_TYPE_ONE->toSchemaString()));
-    }
-
-    result = input->getObjectValue(selector);
+  ZORBA_ASSERT(input->isJSONArray() || input->isJSONObject());
+  if (consumeNext(selector, theChild1.getp(), planState))
+  {
+    if (input->isJSONArray())
+    {
+      store::SchemaTypeCode type = selector->getTypeCode();
+
+      if (!TypeOps::is_subtype(type, store::XS_INTEGER))
+      {
+        xqtref_t type = tm->create_value_type(selector, loc);
+
+        RAISE_ERROR(err::XPTY0004, loc, 
+        ERROR_PARAMS(ZED(XPTY0004_NoTypePromote_23),
+                     type->toSchemaString(),
+                     GENV_TYPESYSTEM.INTEGER_TYPE_ONE->toSchemaString()));
+      }
+
+      result = input->getArrayValue(selector->getIntegerValue());
+    }
+    else if (input->isJSONObject())
+    {
+      store::SchemaTypeCode type = selector->getTypeCode();
+
+      if (!TypeOps::is_subtype(type, store::XS_STRING) &&
+          !TypeOps::is_subtype(type, store::XS_UNTYPED_ATOMIC) &&
+          !TypeOps::is_subtype(type, store::XS_ANY_URI))
+      {
+        xqtref_t type = tm->create_value_type(selector, loc);
+
+        RAISE_ERROR(err::XPTY0004, loc, 
+        ERROR_PARAMS(ZED(XPTY0004_NoTypePromote_23),
+                     type->toSchemaString(),
+                     GENV_TYPESYSTEM.STRING_TYPE_ONE->toSchemaString()));
+      }
+
+      result = input->getObjectValue(selector);
+    }
+    STACK_PUSH(result != 0, state);
   }
   else
   {
-    ZORBA_ASSERT(false);
+    if (input->isJSONArray())
+    {
+      state->theIterator = input->getArrayValues();
+    }
+    else if (input->isJSONObject())
+    {
+      state->theIterator = input->getObjectKeys();
+    }
+    state->theIterator->open();
+    while (state->theIterator->next(result))
+    {
+      STACK_PUSH(true, state);
+    }
+    state->theIterator->close();
   }
 
-  STACK_PUSH(result != 0, state);
-
   STACK_END(state);
 }
 

=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.cpp'
--- src/runtime/json/pregenerated/jsoniq_functions.cpp	2013-03-05 23:11:50 +0000
+++ src/runtime/json/pregenerated/jsoniq_functions.cpp	2013-03-15 19:32:31 +0000
@@ -395,7 +395,7 @@
 void JSONItemAccessorIterator::serialize(::zorba::serialization::Archiver& ar)
 {
   serialize_baseclass(ar,
-  (BinaryBaseIterator<JSONItemAccessorIterator, PlanIteratorState>*)this);
+  (BinaryBaseIterator<JSONItemAccessorIterator, JSONItemAccessorIteratorState>*)this);
 }
 
 
@@ -411,6 +411,18 @@
 
 JSONItemAccessorIterator::~JSONItemAccessorIterator() {}
 
+JSONItemAccessorIteratorState::JSONItemAccessorIteratorState() {}
+
+JSONItemAccessorIteratorState::~JSONItemAccessorIteratorState() {}
+
+
+void JSONItemAccessorIteratorState::init(PlanState& planState) {
+  PlanIteratorState::init(planState);
+}
+
+void JSONItemAccessorIteratorState::reset(PlanState& planState) {
+  PlanIteratorState::reset(planState);
+}
 // </JSONItemAccessorIterator>
 
 #endif

=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.h'
--- src/runtime/json/pregenerated/jsoniq_functions.h	2013-03-05 23:11:50 +0000
+++ src/runtime/json/pregenerated/jsoniq_functions.h	2013-03-15 19:32:31 +0000
@@ -513,13 +513,26 @@
  * 
  * Author: 
  */
-class JSONItemAccessorIterator : public BinaryBaseIterator<JSONItemAccessorIterator, PlanIteratorState>
+class JSONItemAccessorIteratorState : public PlanIteratorState
+{
+public:
+  store::Iterator_t theIterator; //
+
+  JSONItemAccessorIteratorState();
+
+  ~JSONItemAccessorIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class JSONItemAccessorIterator : public BinaryBaseIterator<JSONItemAccessorIterator, JSONItemAccessorIteratorState>
 { 
 public:
   SERIALIZABLE_CLASS(JSONItemAccessorIterator);
 
   SERIALIZABLE_CLASS_CONSTRUCTOR2T(JSONItemAccessorIterator,
-    BinaryBaseIterator<JSONItemAccessorIterator, PlanIteratorState>);
+    BinaryBaseIterator<JSONItemAccessorIterator, JSONItemAccessorIteratorState>);
 
   void serialize( ::zorba::serialization::Archiver& ar);
 
@@ -528,7 +541,7 @@
     const QueryLoc& loc,
     PlanIter_t& child1, PlanIter_t& child2)
     : 
-    BinaryBaseIterator<JSONItemAccessorIterator, PlanIteratorState>(sctx, loc, child1, child2)
+    BinaryBaseIterator<JSONItemAccessorIterator, JSONItemAccessorIteratorState>(sctx, loc, child1, child2)
   {}
 
   virtual ~JSONItemAccessorIterator();

=== modified file 'src/runtime/spec/json/jsoniq_functions.xml'
--- src/runtime/spec/json/jsoniq_functions.xml	2013-02-07 17:24:36 +0000
+++ src/runtime/spec/json/jsoniq_functions.xml	2013-03-15 19:32:31 +0000
@@ -427,6 +427,11 @@
 
     <zorba:signature localname="json-item-accessor" prefix="op-zorba">
       <zorba:param>json-item()</zorba:param>
+      <zorba:output>item()*</zorba:output>
+    </zorba:signature>
+
+    <zorba:signature localname="json-item-accessor" prefix="op-zorba">
+      <zorba:param>json-item()</zorba:param>
       <zorba:param>xs:anyAtomicType</zorba:param>
       <zorba:output>item()?</zorba:output>
     </zorba:signature>
@@ -438,6 +443,10 @@
 
   </zorba:function>
 
+  <zorba:state>
+    <zorba:member type="store::Iterator_t" name="theIterator" brief=""/>
+  </zorba:state>
+
 </zorba:iterator>
 
 

=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/keys_01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/keys_01.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/keys_01.xml.res	2013-03-15 19:32:31 +0000
@@ -0,0 +1,1 @@
+foo1 foo2 foo3 foo4 foo5 foo6 foo7 foo8 foo9 foo10

=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/keys_02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/keys_02.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/keys_02.xml.res	2013-03-15 19:32:31 +0000
@@ -0,0 +1,1 @@
+true

=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/keys_03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/keys_03.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/keys_03.xml.res	2013-03-15 19:32:31 +0000
@@ -0,0 +1,1 @@
+foo1 foo2 foo3 foo4 foo5 foo6 foo7 foo8 foo9 foo10

=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/member_02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/member_02.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/member_02.xml.res	2013-03-15 19:32:31 +0000
@@ -0,0 +1,1 @@
+foo1 foo2 foo3 foo4 foo5 foo6 foo7 foo8 foo9 foo10

=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/members_01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/members_01.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/members_01.xml.res	2013-03-15 19:32:31 +0000
@@ -0,0 +1,1 @@
+foo1 bar1 foo2 bar2 foo3 bar3 foo4 bar4 foo5 bar5 foo6 bar6 foo7 bar7 foo8 bar8 foo9 bar9 foo10 bar10

=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/members_02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/members_02.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/members_02.xml.res	2013-03-15 19:32:31 +0000
@@ -0,0 +1,1 @@
+true

=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/members_03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/members_03.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/members_03.xml.res	2013-03-15 19:32:31 +0000
@@ -0,0 +1,1 @@
+foo1 bar1 foo2 bar2 foo3 bar3 foo4 bar4 foo5 bar5 foo6 bar6 foo7 bar7 foo8 bar8 foo9 bar9 foo10 bar10

=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/value_02.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/value_02.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/value_02.xml.res	2013-03-15 19:32:31 +0000
@@ -0,0 +1,1 @@
+bar1 bar2 bar3 bar4 bar5 bar6 bar7 bar8 bar9 bar10

=== added file 'test/rbkt/Queries/zorba/jsoniq/keys_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/keys_01.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/keys_01.xq	2013-03-15 19:32:31 +0000
@@ -0,0 +1,3 @@
+let $a := for $i in 1 to 10 return { "foo" || $i : "bar" || $i }
+return $a()
+

=== added file 'test/rbkt/Queries/zorba/jsoniq/keys_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/keys_02.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/keys_02.xq	2013-03-15 19:32:31 +0000
@@ -0,0 +1,1 @@
+empty({| |}())

=== added file 'test/rbkt/Queries/zorba/jsoniq/keys_03.xq'
--- test/rbkt/Queries/zorba/jsoniq/keys_03.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/keys_03.xq	2013-03-15 19:32:31 +0000
@@ -0,0 +1,10 @@
+import module namespace refl = "http://www.zorba-xquery.com/modules/reflection";;
+
+declare namespace op = "http://www.zorba-xquery.com/options/features";;
+declare namespace f = "http://www.zorba-xquery.com/features";;
+
+declare option op:enable "f:hof";
+
+let $x := refl:eval("for $i in 1 to 10 return { 'foo' || $i : 'bar' || $i }")
+return $x()
+

=== added file 'test/rbkt/Queries/zorba/jsoniq/member_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/member_02.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/member_02.xq	2013-03-15 19:32:31 +0000
@@ -0,0 +1,10 @@
+import module namespace refl = "http://www.zorba-xquery.com/modules/reflection";;
+
+declare namespace op = "http://www.zorba-xquery.com/options/features";;
+declare namespace f = "http://www.zorba-xquery.com/features";;
+
+declare option op:enable "f:hof";
+
+let $x := refl:eval("for $i in 1 to 10 return [ 'foo' || $i, 'bar' || $i ]")
+return $x(1)
+

=== added file 'test/rbkt/Queries/zorba/jsoniq/members_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/members_01.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/members_01.xq	2013-03-15 19:32:31 +0000
@@ -0,0 +1,2 @@
+let $a := for $i in 1 to 10 return [ "foo" || $i, "bar" || $i]
+return $a()

=== added file 'test/rbkt/Queries/zorba/jsoniq/members_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/members_02.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/members_02.xq	2013-03-15 19:32:31 +0000
@@ -0,0 +1,1 @@
+empty([]())

=== added file 'test/rbkt/Queries/zorba/jsoniq/members_03.xq'
--- test/rbkt/Queries/zorba/jsoniq/members_03.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/members_03.xq	2013-03-15 19:32:31 +0000
@@ -0,0 +1,9 @@
+import module namespace refl = "http://www.zorba-xquery.com/modules/reflection";;
+
+declare namespace op = "http://www.zorba-xquery.com/options/features";;
+declare namespace f = "http://www.zorba-xquery.com/features";;
+
+declare option op:enable "f:hof";
+
+let $x := refl:eval("for $i in 1 to 10 return [ 'foo' || $i, 'bar' || $i ]")
+return $x()

=== added file 'test/rbkt/Queries/zorba/jsoniq/value_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/value_02.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/value_02.xq	2013-03-15 19:32:31 +0000
@@ -0,0 +1,9 @@
+import module namespace refl = "http://www.zorba-xquery.com/modules/reflection";;
+
+declare namespace op = "http://www.zorba-xquery.com/options/features";;
+declare namespace f = "http://www.zorba-xquery.com/features";;
+
+declare option op:enable "f:hof";
+
+let $x := refl:eval("for $i in 1 to 10 return { 'foo' : 'bar' || $i }")
+return $x("foo")

=== added file 'test/rbkt/Queries/zorba/jsoniq/value_03.spec'
--- test/rbkt/Queries/zorba/jsoniq/value_03.spec	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/value_03.spec	2013-03-15 19:32:31 +0000
@@ -0,0 +1,2 @@
+Error: http://jsoniq.org/errors:JNTY0021
+

=== added file 'test/rbkt/Queries/zorba/jsoniq/value_03.xq'
--- test/rbkt/Queries/zorba/jsoniq/value_03.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/value_03.xq	2013-03-15 19:32:31 +0000
@@ -0,0 +1,10 @@
+import module namespace refl = "http://www.zorba-xquery.com/modules/reflection";;
+
+declare namespace op = "http://www.zorba-xquery.com/options/features";;
+declare namespace f = "http://www.zorba-xquery.com/features";;
+
+declare option op:enable "f:hof";
+
+let $x := refl:eval("({ 'foo' : 'bar' }, [ 1 ])")
+return $x("foo")
+

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to