← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/jsoniq-deactivated into lp:zorba

 

Ghislain Fourny has proposed merging lp:~zorba-coders/zorba/jsoniq-deactivated into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/jsoniq-deactivated/+merge/105825

This merges the JSONiq branch into the zorba trunk, with JSONiq deactivated.
-- 
The attached diff has been truncated due to its size.
https://code.launchpad.net/~zorba-coders/zorba/jsoniq-deactivated/+merge/105825
Your team Zorba Coders is subscribed to branch lp:zorba.
=== added file '.bzrignore'
--- .bzrignore	1970-01-01 00:00:00 +0000
+++ .bzrignore	2012-05-15 14:37:23 +0000
@@ -0,0 +1,2 @@
+CMakeLists.txt.user
+build

=== modified file 'CMakeConfiguration.txt'
--- CMakeConfiguration.txt	2012-05-03 12:31:51 +0000
+++ CMakeConfiguration.txt	2012-05-15 14:37:23 +0000
@@ -152,6 +152,9 @@
 SET(ZORBA_WITH_BIG_INTEGER OFF CACHE BOOL "enable arbitrary precision integers")
 MESSAGE(STATUS "ZORBA_WITH_BIG_INTEGER:               " ${ZORBA_WITH_BIG_INTEGER})
 
+SET(ZORBA_WITH_JSON ON CACHE BOOL "enable integrated JSON support")
+MESSAGE(STATUS "ZORBA_WITH_JSON:                      " ${ZORBA_WITH_JSON})
+
 IF (ZORBA_SUPPRESS_SWIG)
   SET (no_swig ON)
 ELSE (ZORBA_SUPPRESS_SWIG)

=== modified file 'ChangeLog'
--- ChangeLog	2012-05-09 01:25:37 +0000
+++ ChangeLog	2012-05-15 14:37:23 +0000
@@ -141,6 +141,7 @@
   * Fixed bug #951772 (Comment node crashes serialization)
   * Fixed bug #945241 (StaticCollectionManager::declaredIndexes() and temporary indexes)
 
+	
 version 2.1
 
 New Features:

=== added file 'NOTICE.txt'
--- NOTICE.txt	1970-01-01 00:00:00 +0000
+++ NOTICE.txt	2012-05-15 14:37:23 +0000
@@ -0,0 +1,740 @@
+-----------
+Zorba 2.2.0
+-----------
+
+(Note: This file is generated automatically from NOTICE.xml.
+Please do not modify this file directly.)
+
+
+
+
+Apache 2
+
+      Copyright 2006-2011 The FLWOR Foundation
+
+      See LICENSE.txt for license information.
+
+      ------------------------
+      This product includes software developed at
+      The FLWOR Foundation (http://www.flworfound.org/).
+
+      ------------------------
+      Portions of this software were developed at the Systems
+      Group of the ETH Zurich, Switzerland.
+    
+
+Other files used by this project:
+----------------------------------------------------
+
+src/zorbatypes/m_apm.h
+src/zorbatypes/mapm/
+
+Copyright: 1999-2007 Michael C. Ring
+Website: http://www.tc.umn.edu/~ringx004/mapm-main.html
+
+      This software is Freeware.
+
+      Permission to use, copy, and distribute this software and its
+      documentation for any purpose with or without fee is hereby granted,
+      provided that the above copyright notice appear in all copies and
+      that both that copyright notice and this permission notice appear
+      in supporting documentation.
+
+      Permission to modify the software is granted. Permission to distribute
+      the modified code is granted. Modifications are to be distributed by
+      using the file 'license.txt' as a template to modify the file header.
+      'license.txt' is available in the official MAPM distribution.
+
+      To distribute modified source code, insert the file 'license.txt'
+      at the top of all modified source code files and edit accordingly.
+
+      This software is provided "as is" without express or implied warranty.
+    
+----------------------------------------------------
+
+src/zorbamisc/config/stdint.h
+
+Copyright: 2006 Alexander Chemeris
+
+
+      Redistribution and use in source and binary forms, with or without
+      modification, are permitted provided that the following conditions are met:
+
+      1. Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+      2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+      3. The name of the author may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+      THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+      WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+      MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+      EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+      PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+      OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+      WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+      OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+      ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+    
+----------------------------------------------------
+
+src/zorbautils/stemmer/
+
+Copyright: 2001 Dr. Martin Porter
+
+
+      All the software given out on this Snowball site is covered by the BSD
+      License (see http://www.opensource.org/licenses/bsd-license.html), with
+      Copyright (c) 2001, Dr Martin Porter, and (for the Java developments)
+      Copyright (c) 2002, Richard Boulton.
+
+      Essentially, all this means is that you can do what you like with the code,
+      except claim another Copyright for it, or claim that it is issued under a
+      different license. The software is also issued without warranties, which
+      means that if anyone suffers through its use, they cannot come back and sue
+      you. You also have to alert anyone to whom you give the Snowball software to
+      the fact that it is covered by the BSD license.
+
+      We have not bothered to insert the licensing arrangement into the text of
+      the Snowball software.
+    
+----------------------------------------------------
+
+src/util/less.h
+
+Copyright: 1998 Paul J. Lucas
+
+
+      Redistribution and use in source and binary forms, with or without
+      modification, are permitted provided that the following conditions are met:
+
+      o  Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+      o  Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+      o  The name of the author may not be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+      ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+      POSSIBILITY OF SUCH DAMAGE.
+    
+----------------------------------------------------
+
+src/util/auto_vector.h (has been modified)
+
+Copyright: 2003 Reliable Software
+
+
+      Redistribution and use in source and binary forms, with or without
+      modification, are permitted provided that the following conditions are met:
+
+      o  Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+      o  Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+      o  The name of the author may not be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+      ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+      POSSIBILITY OF SUCH DAMAGE.
+    
+----------------------------------------------------
+
+cmake_modules/FindBoost.cmake
+
+Copyright: 
+      2006-2008 Andreas Schneider <mail@xxxxxxxxxxxx>
+      2007      Wengo
+      2007      Mike Jackson
+      2008      Andreas Pakulat <apaku@xxxxxx>
+    
+
+
+      Redistribution AND use is allowed according to the terms of the New BSD license.
+      For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+    
+----------------------------------------------------
+
+cmake_modules/FindJNI.cmake
+cmake_modules/FindPythonLibs.cmake
+cmake_modules/FindSWIG.cmake
+
+Copyright: 2001-2009 Kitware, Inc.
+
+
+      Distributed under the OSI-approved BSD License (the "License");
+      see accompanying file Copyright.txt for details.
+
+      This software is distributed WITHOUT ANY WARRANTY; without even the
+      implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+      See the License for more information.
+
+      CMake - Cross Platform Makefile Generator
+      Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+      All rights reserved.
+
+      Redistribution and use in source and binary forms, with or without
+      modification, are permitted provided that the following conditions
+      are met:
+
+      * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+      * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+      * Neither the names of Kitware, Inc., the Insight Software Consortium,
+      nor the names of their contributors may be used to endorse or promote
+      products derived from this software without specific prior written
+      permission.
+
+      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+      LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+      A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+      HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+      THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+      (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+      OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+      ------------------------------------------------------------------------------
+
+      The above copyright and license notice applies to distributions of
+      CMake in source and binary form.  Some source files contain additional
+      notices of original copyright by their contributors; see each source
+      for details.  Third-party software packages supplied with CMake under
+      compatible licenses provide their own copyright notices documented in
+      corresponding subdirectories.
+
+      ------------------------------------------------------------------------------
+
+      CMake was initially developed by Kitware with the following sponsorship:
+
+      * National Library of Medicine at the National Institutes of Health
+      as part of the Insight Segmentation and Registration Toolkit (ITK).
+
+      * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
+      Visualization Initiative.
+
+      * National Alliance for Medical Image Computing (NAMIC) is funded by the
+      National Institutes of Health through the NIH Roadmap for Medical Research,
+      Grant U54 EB005149.
+
+      * Kitware, Inc.
+    
+----------------------------------------------------
+
+/xml.xsd
+
+Copyright: 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
+
+
+      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+      W3C Software Notice and License
+
+      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
+
+      License
+
+      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
+
+      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
+      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
+      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
+      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
+
+      Disclaimers
+
+      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
+    
+----------------------------------------------------
+
+schemas/xslt-xquery-serialization.xsd
+
+Copyright: 2010 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
+
+
+      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+      W3C Software Notice and License
+
+      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
+
+      License
+
+      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
+
+      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
+      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
+      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
+      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
+
+      Disclaimers
+
+      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
+    
+----------------------------------------------------
+
+modules/w3c/xpath-functions.xsd
+
+Copyright: 2005 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
+
+
+      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+      W3C Software Notice and License
+
+      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
+
+      License
+
+      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
+
+      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
+      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
+      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
+      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
+
+      Disclaimers
+
+      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
+    
+----------------------------------------------------
+
+include/xqc.h
+
+Copyright: 2008, Matthias Brantner, John Snelson
+
+
+      * All rights reserved.
+      *
+      * Redistribution and use in source and binary forms, with or without
+      * modification, are permitted provided that the following conditions are met:
+      *
+      *     * Redistributions of source code must retain the above copyright notice,
+      *       this list of conditions and the following disclaimer.
+      *     * Redistributions in binary form must reproduce the above copyright
+      *       notice, this list of conditions and the following disclaimer in the
+      *       documentation and/or other materials provided with the distribution.
+      *     * Neither the name of the developers nor the names of contributors may be
+      *       used to endorse or promote products derived from this software without
+      *       specific prior written permission.
+      *
+      * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+      * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+      * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+      * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+      * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+      * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+      * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+      * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+      * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+      * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+      * POSSIBILITY OF SUCH DAMAGE.
+    
+----------------------------------------------------
+
+modules/functx/functx.xq
+
+Copyright: 2007 Datypic
+
+
+      : This library is free software; you can redistribute it and/or
+      : modify it under the terms of the GNU Lesser General Public
+      : License as published by the Free Software Foundation; either
+      : version 2.1 of the License.
+
+      : This library is distributed in the hope that it will be useful,
+      : but WITHOUT ANY WARRANTY; without even the implied warranty of
+      : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+      : Lesser General Public License for more details.
+
+      : You should have received a copy of the GNU Lesser General Public
+      : License along with this library; if not, write to the Free Software
+      : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+    
+----------------------------------------------------
+
+src/compiler/parser/FlexLexer.h
+
+Copyright: 1993 The Regents of the University of California
+
+
+      // All rights reserved.
+      //
+      // This code is derived from software contributed to Berkeley by
+      // Kent Williams and Tom Epperly.
+      //
+      //  Redistribution and use in source and binary forms, with or without
+      //  modification, are permitted provided that the following conditions
+      //  are met:
+
+      //  1. Redistributions of source code must retain the above copyright
+      //  notice, this list of conditions and the following disclaimer.
+      //  2. Redistributions in binary form must reproduce the above copyright
+      //  notice, this list of conditions and the following disclaimer in the
+      //  documentation and/or other materials provided with the distribution.
+
+      //  Neither the name of the University nor the names of its contributors
+      //  may be used to endorse or promote products derived from this software
+      //  without specific prior written permission.
+
+      //  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+      //  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+      //  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+      //  PURPOSE.
+    
+----------------------------------------------------
+
+src/diagnostics/StackWalker.cpp
+src/diagnostics/StackWalker.h
+
+Copyright: 2005 Jochen Kalmbach 
+
+
+      Under BSD License: http://www.opensource.org/licenses/bsd-license.php
+    
+----------------------------------------------------
+
+src/util/singleton.h
+src/util/threads.h
+
+Copyright: 2001 Andrei Alexandrescu
+
+
+      This code accompanies the book:
+      Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
+          Patterns Applied". Copyright (c) 2001. Addison-Wesley.
+      Permission to use, copy, modify, distribute and sell this software for any
+          purpose is hereby granted without fee, provided that the above copyright
+          notice appear in all copies and that both that copyright notice and this
+          permission notice appear in supporting documentation.
+      The author or Addison-Wesley Longman make no representations about the
+          suitability of this software for any purpose. It is provided "as is"
+          without express or implied warranty.
+    
+
+External libraries used by this project:
+----------------------------------------------------
+
+Name: LIBXML2
+Preferred version: 2.2.16 or higher
+Is mandatory: true
+Website: http://xmlsoft.org/
+License: MIT
+Copyright: 1998-2002 Daniel Veillard.  All Rights Reserved.
+External notice: 
+
+      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+      The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+      Except as contained in this notice, the name of Daniel Veillard shall not
+      be used in advertising or otherwise to promote the sale, use or other deal-
+      ings in this Software without prior written authorization from him.
+    
+----------------------------------------------------
+
+Name: LIBXSLT
+Preferred version: 1.1.26
+Is mandatory: false
+Website: http://xmlsoft.org/XSLT/
+License: MIT
+Copyright: 2001-2002 Daniel Veillard.  All Rights Reserved.
+External notice: 
+
+      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+      The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+      Except as contained in this notice, the name of Daniel Veillard shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from him.
+
+    
+----------------------------------------------------
+
+Name: ICU4C
+Preferred version: 3.6 or higher
+Is mandatory: true
+Website: http://www.icu-project.org/
+License: ICU License
+Copyright: 1995-2011 International Business Machines Corporation and others 
+External notice: 
+
+      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.
+
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+      Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.
+    
+----------------------------------------------------
+
+Name: CURL
+Preferred version: above 7.12
+Is mandatory: false
+Website: http://curl.haxx.se/
+License: MIT/X derivate license
+Copyright: 1996 - 2011, Daniel Stenberg, <daniel@xxxxxxx>.
+External notice: 
+
+      All rights reserved.
+
+      Permission to use, copy, modify, and distribute this software for any purpose
+      with or without fee is hereby granted, provided that the above copyright
+      notice and this permission notice appear in all copies.
+
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
+      NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+      DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+      OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+      OR OTHER DEALINGS IN THE SOFTWARE.
+
+      Except as contained in this notice, the name of a copyright holder shall not
+      be used in advertising or otherwise to promote the sale, use or other dealings
+      in this Software without prior written authorization of the copyright holder.
+    
+----------------------------------------------------
+
+Name: ICONV
+Preferred version: above 1.12
+Is mandatory: true
+Website: http://www.gnu.org/software/libiconv/
+License: LGPL
+Copyright: 1998, 2010 Free Software Foundation, Inc.
+External notice: 
+
+----------------------------------------------------
+
+Name: ZLIB
+Preferred version: 1.2.5
+Is mandatory: true
+Website: http://www.zlib.net/
+Copyright: 1995-2004 Jean-loup Gailly and Mark Adler
+External notice: 
+
+      This software is provided 'as-is', without any express or implied
+      warranty.  In no event will the authors be held liable for any damages
+      arising from the use of this software.
+
+      Permission is granted to anyone to use this software for any purpose,
+      including commercial applications, and to alter it and redistribute it
+      freely, subject to the following restrictions:
+
+      1. The origin of this software must not be misrepresented; you must not
+      claim that you wrote the original software. If you use this software
+      in a product, an acknowledgment in the product documentation would be
+      appreciated but is not required.
+      2. Altered source versions must be plainly marked as such, and must not be
+      misrepresented as being the original software.
+      3. This notice may not be removed or altered from any source distribution.
+
+      Jean-loup Gailly jloup@xxxxxxxx
+      Mark Adler madler@xxxxxxxxxxxxxxxxxx
+    
+----------------------------------------------------
+
+Name: XERCES
+Preferred version: 2.8.0 or higher
+Is mandatory: true
+Website: http://xerces.apache.org/xerces-c/
+License: Apache 2
+Copyright: Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.
+External notice: 
+
+      http://www.apache.org/licenses/LICENSE-2.0
+    
+----------------------------------------------------
+
+Name: BOOST (boost_filesystem)
+Preferred version: 1.32 or higher
+Is mandatory: false
+Website: http://www.boost.org/
+License: Boost Software License v1.0
+Copyright: 
+      Beman Dawes, David Abrahams, 1998-2005.
+      Rene Rivera 2004-2007
+    
+External notice: 
+
+      Permission is hereby granted, free of charge, to any person or organization
+      obtaining a copy of the software and accompanying documentation covered by
+      this license (the "Software") to use, reproduce, display, distribute,
+      execute, and transmit the Software, and to prepare derivative works of the
+      Software, and to permit third-parties to whom the Software is furnished to
+      do so, all subject to the following:
+
+      The copyright notices in the Software and this entire statement, including
+      the above license grant, this restriction and the following disclaimer,
+      must be included in all copies of the Software, in whole or in part, and
+      all derivative works of the Software, unless such copies or derivative
+      works are solely in the form of machine-executable object code generated by
+      a source language processor.
+
+      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+      FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+      SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+      FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+      ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+      DEALINGS IN THE SOFTWARE.
+    
+
+External applications used by this project:
+----------------------------------------------------
+
+Name: FLEX
+Preferred version: 2.5.33
+Is mandatory: false
+Website: http://flex.sourceforge.net/
+Copyright: 
+      2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The Flex Project.
+      1990, 1997 The Regents of the University of California. All rights reserved.
+    
+External notice: 
+
+      Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+      1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+      2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+      
+      Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+      THIS SOFTWARE IS PROVIDED “AS IS” AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+    
+----------------------------------------------------
+
+Name: BISON
+Preferred version: 2.4 or higher
+Is mandatory: false
+Website: http://www.gnu.org/software/bison/
+License: GPL
+Copyright: 1998, 2001, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+External notice: 
+
+----------------------------------------------------
+
+Name: DOXYGEN
+Preferred version: v1.7.4 
+Is mandatory: false
+Website: www.doxygen.org
+License: GPL
+Copyright: 1997-2011 by Dimitri van Heesch
+External notice: 
+
+      Permission to use, copy, modify, and distribute this software and its documentation under the terms of the GNU General Public License is hereby granted.
+      No representations are made about the suitability of this software for any purpose. 
+      It is provided "as is" without express or implied warranty. 
+      See the GNU General Public License for more details.
+
+      Documents produced by doxygen are derivative works derived from the input used in their production; they are not affected by this license.
+    
+----------------------------------------------------
+
+Name: CMAKE
+Preferred version: 2.8.4
+Is mandatory: true
+Website: http://www.cmake.org/
+License: Creative Commons Attribution-NoDerivs 3.0 Unported License
+Copyright: 2000-2009 Kitware, Inc., Insight Software Consortium. All rights reserved.
+External notice: 
+
+      Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+      Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+      Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+      Neither the names of Kitware, Inc., the Insight Software Consortium, nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+    
+----------------------------------------------------
+
+Name: SWIG
+Preferred version: 2.0.4 or above
+Is mandatory: false
+Website: http://www.swig.org/
+License: GPL
+Copyright: 
+      1995-2011 The SWIG Developers
+      2005-2006 Arizona Board of Regents (University of Arizona).
+      1998-2005 University of Chicago.
+      1995-1998 The University of Utah and the Regents of the University of California
+    
+External notice: 
+
+      SWIG is free software: you can redistribute it and/or modify it
+      under the terms of the GNU General Public License as published by
+      the Free Software Foundation, either version 3 of the License, or
+      (at your option) any later version. See the LICENSE-GPL file for
+      the full terms of the GNU General Public license version 3.
+
+      Portions of SWIG are also licensed under the terms of the licenses
+      in the file LICENSE-UNIVERSITIES. You must observe the terms of
+      these licenses, as well as the terms of the GNU General Public License,
+      when you distribute SWIG.
+
+      The SWIG library and examples, under the Lib and Examples top level
+      directories, are distributed under the following terms:
+
+      You may copy, modify, distribute, and make derivative works based on
+      this software, in source code or object code form, without
+      restriction. If you distribute the software to others, you may do
+      so according to the terms of your choice. This software is offered as
+      is, without warranty of any kind.
+
+      See the COPYRIGHT file for a list of contributors to SWIG and their
+      copyright notices.
+    
\ No newline at end of file

=== removed file 'NOTICE.txt'
--- NOTICE.txt	2012-05-03 12:31:51 +0000
+++ NOTICE.txt	1970-01-01 00:00:00 +0000
@@ -1,740 +0,0 @@
------------
-Zorba 2.2.0
------------
-
-(Note: This file is generated automatically from NOTICE.xml.
-Please do not modify this file directly.)
-
-
-
-
-Apache 2
-
-      Copyright 2006-2011 The FLWOR Foundation
-
-      See LICENSE.txt for license information.
-
-      ------------------------
-      This product includes software developed at
-      The FLWOR Foundation (http://www.flworfound.org/).
-
-      ------------------------
-      Portions of this software were developed at the Systems
-      Group of the ETH Zurich, Switzerland.
-    
-
-Other files used by this project:
-----------------------------------------------------
-
-src/zorbatypes/m_apm.h
-src/zorbatypes/mapm/
-
-Copyright: 1999-2007 Michael C. Ring
-Website: http://www.tc.umn.edu/~ringx004/mapm-main.html
-
-      This software is Freeware.
-
-      Permission to use, copy, and distribute this software and its
-      documentation for any purpose with or without fee is hereby granted,
-      provided that the above copyright notice appear in all copies and
-      that both that copyright notice and this permission notice appear
-      in supporting documentation.
-
-      Permission to modify the software is granted. Permission to distribute
-      the modified code is granted. Modifications are to be distributed by
-      using the file 'license.txt' as a template to modify the file header.
-      'license.txt' is available in the official MAPM distribution.
-
-      To distribute modified source code, insert the file 'license.txt'
-      at the top of all modified source code files and edit accordingly.
-
-      This software is provided "as is" without express or implied warranty.
-    
-----------------------------------------------------
-
-src/zorbamisc/config/stdint.h
-
-Copyright: 2006 Alexander Chemeris
-
-
-      Redistribution and use in source and binary forms, with or without
-      modification, are permitted provided that the following conditions are met:
-
-      1. Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-      2. Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-      3. The name of the author may be used to endorse or promote products
-      derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-      WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-      MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-      EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-      PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-      OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-      WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-      OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-      ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-    
-----------------------------------------------------
-
-src/zorbautils/stemmer/
-
-Copyright: 2001 Dr. Martin Porter
-
-
-      All the software given out on this Snowball site is covered by the BSD
-      License (see http://www.opensource.org/licenses/bsd-license.html), with
-      Copyright (c) 2001, Dr Martin Porter, and (for the Java developments)
-      Copyright (c) 2002, Richard Boulton.
-
-      Essentially, all this means is that you can do what you like with the code,
-      except claim another Copyright for it, or claim that it is issued under a
-      different license. The software is also issued without warranties, which
-      means that if anyone suffers through its use, they cannot come back and sue
-      you. You also have to alert anyone to whom you give the Snowball software to
-      the fact that it is covered by the BSD license.
-
-      We have not bothered to insert the licensing arrangement into the text of
-      the Snowball software.
-    
-----------------------------------------------------
-
-src/util/less.h
-
-Copyright: 1998 Paul J. Lucas
-
-
-      Redistribution and use in source and binary forms, with or without
-      modification, are permitted provided that the following conditions are met:
-
-      o  Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-      o  Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-      o  The name of the author may not be used to endorse or promote products
-      derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-      ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-      POSSIBILITY OF SUCH DAMAGE.
-    
-----------------------------------------------------
-
-src/util/auto_vector.h (has been modified)
-
-Copyright: 2003 Reliable Software
-
-
-      Redistribution and use in source and binary forms, with or without
-      modification, are permitted provided that the following conditions are met:
-
-      o  Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-      o  Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-      o  The name of the author may not be used to endorse or promote products
-      derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-      ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-      POSSIBILITY OF SUCH DAMAGE.
-    
-----------------------------------------------------
-
-cmake_modules/FindBoost.cmake
-
-Copyright: 
-      2006-2008 Andreas Schneider <mail@xxxxxxxxxxxx>
-      2007      Wengo
-      2007      Mike Jackson
-      2008      Andreas Pakulat <apaku@xxxxxx>
-    
-
-
-      Redistribution AND use is allowed according to the terms of the New BSD license.
-      For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-    
-----------------------------------------------------
-
-cmake_modules/FindJNI.cmake
-cmake_modules/FindPythonLibs.cmake
-cmake_modules/FindSWIG.cmake
-
-Copyright: 2001-2009 Kitware, Inc.
-
-
-      Distributed under the OSI-approved BSD License (the "License");
-      see accompanying file Copyright.txt for details.
-
-      This software is distributed WITHOUT ANY WARRANTY; without even the
-      implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-      See the License for more information.
-
-      CMake - Cross Platform Makefile Generator
-      Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-      All rights reserved.
-
-      Redistribution and use in source and binary forms, with or without
-      modification, are permitted provided that the following conditions
-      are met:
-
-      * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-
-      * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-      * Neither the names of Kitware, Inc., the Insight Software Consortium,
-      nor the names of their contributors may be used to endorse or promote
-      products derived from this software without specific prior written
-      permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-      LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-      A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-      HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-      THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-      (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-      OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-      ------------------------------------------------------------------------------
-
-      The above copyright and license notice applies to distributions of
-      CMake in source and binary form.  Some source files contain additional
-      notices of original copyright by their contributors; see each source
-      for details.  Third-party software packages supplied with CMake under
-      compatible licenses provide their own copyright notices documented in
-      corresponding subdirectories.
-
-      ------------------------------------------------------------------------------
-
-      CMake was initially developed by Kitware with the following sponsorship:
-
-      * National Library of Medicine at the National Institutes of Health
-      as part of the Insight Segmentation and Registration Toolkit (ITK).
-
-      * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
-      Visualization Initiative.
-
-      * National Alliance for Medical Image Computing (NAMIC) is funded by the
-      National Institutes of Health through the NIH Roadmap for Medical Research,
-      Grant U54 EB005149.
-
-      * Kitware, Inc.
-    
-----------------------------------------------------
-
-/xml.xsd
-
-Copyright: 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
-
-
-      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-      W3C Software Notice and License
-
-      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
-
-      License
-
-      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
-
-      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
-      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
-      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
-      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
-
-      Disclaimers
-
-      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-
-      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
-
-      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
-    
-----------------------------------------------------
-
-schemas/xslt-xquery-serialization.xsd
-
-Copyright: 2010 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
-
-
-      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-      W3C Software Notice and License
-
-      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
-
-      License
-
-      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
-
-      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
-      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
-      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
-      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
-
-      Disclaimers
-
-      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-
-      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
-
-      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
-    
-----------------------------------------------------
-
-modules/w3c/xpath-functions.xsd
-
-Copyright: 2005 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University)
-
-
-      All Rights Reserved. This work is distributed under the W3C Software License [1] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-      W3C Software Notice and License
-
-      This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license.
-
-      License
-
-      By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
-
-      Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications:
-      •The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
-      •Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code.
-      •Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)
-
-      Disclaimers
-
-      THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
-
-      COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
-
-      The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
-    
-----------------------------------------------------
-
-include/xqc.h
-
-Copyright: 2008, Matthias Brantner, John Snelson
-
-
-      * All rights reserved.
-      *
-      * Redistribution and use in source and binary forms, with or without
-      * modification, are permitted provided that the following conditions are met:
-      *
-      *     * Redistributions of source code must retain the above copyright notice,
-      *       this list of conditions and the following disclaimer.
-      *     * Redistributions in binary form must reproduce the above copyright
-      *       notice, this list of conditions and the following disclaimer in the
-      *       documentation and/or other materials provided with the distribution.
-      *     * Neither the name of the developers nor the names of contributors may be
-      *       used to endorse or promote products derived from this software without
-      *       specific prior written permission.
-      *
-      * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-      * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-      * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-      * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-      * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-      * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-      * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-      * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-      * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-      * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-      * POSSIBILITY OF SUCH DAMAGE.
-    
-----------------------------------------------------
-
-modules/functx/functx.xq
-
-Copyright: 2007 Datypic
-
-
-      : This library is free software; you can redistribute it and/or
-      : modify it under the terms of the GNU Lesser General Public
-      : License as published by the Free Software Foundation; either
-      : version 2.1 of the License.
-
-      : This library is distributed in the hope that it will be useful,
-      : but WITHOUT ANY WARRANTY; without even the implied warranty of
-      : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-      : Lesser General Public License for more details.
-
-      : You should have received a copy of the GNU Lesser General Public
-      : License along with this library; if not, write to the Free Software
-      : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-    
-----------------------------------------------------
-
-src/compiler/parser/FlexLexer.h
-
-Copyright: 1993 The Regents of the University of California
-
-
-      // All rights reserved.
-      //
-      // This code is derived from software contributed to Berkeley by
-      // Kent Williams and Tom Epperly.
-      //
-      //  Redistribution and use in source and binary forms, with or without
-      //  modification, are permitted provided that the following conditions
-      //  are met:
-
-      //  1. Redistributions of source code must retain the above copyright
-      //  notice, this list of conditions and the following disclaimer.
-      //  2. Redistributions in binary form must reproduce the above copyright
-      //  notice, this list of conditions and the following disclaimer in the
-      //  documentation and/or other materials provided with the distribution.
-
-      //  Neither the name of the University nor the names of its contributors
-      //  may be used to endorse or promote products derived from this software
-      //  without specific prior written permission.
-
-      //  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-      //  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-      //  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-      //  PURPOSE.
-    
-----------------------------------------------------
-
-src/diagnostics/StackWalker.cpp
-src/diagnostics/StackWalker.h
-
-Copyright: 2005 Jochen Kalmbach 
-
-
-      Under BSD License: http://www.opensource.org/licenses/bsd-license.php
-    
-----------------------------------------------------
-
-src/util/singleton.h
-src/util/threads.h
-
-Copyright: 2001 Andrei Alexandrescu
-
-
-      This code accompanies the book:
-      Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
-          Patterns Applied". Copyright (c) 2001. Addison-Wesley.
-      Permission to use, copy, modify, distribute and sell this software for any
-          purpose is hereby granted without fee, provided that the above copyright
-          notice appear in all copies and that both that copyright notice and this
-          permission notice appear in supporting documentation.
-      The author or Addison-Wesley Longman make no representations about the
-          suitability of this software for any purpose. It is provided "as is"
-          without express or implied warranty.
-    
-
-External libraries used by this project:
-----------------------------------------------------
-
-Name: LIBXML2
-Preferred version: 2.2.16 or higher
-Is mandatory: true
-Website: http://xmlsoft.org/
-License: MIT
-Copyright: 1998-2002 Daniel Veillard.  All Rights Reserved.
-External notice: 
-
-      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-      The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-      Except as contained in this notice, the name of Daniel Veillard shall not
-      be used in advertising or otherwise to promote the sale, use or other deal-
-      ings in this Software without prior written authorization from him.
-    
-----------------------------------------------------
-
-Name: LIBXSLT
-Preferred version: 1.1.26
-Is mandatory: false
-Website: http://xmlsoft.org/XSLT/
-License: MIT
-Copyright: 2001-2002 Daniel Veillard.  All Rights Reserved.
-External notice: 
-
-      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-      The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-      Except as contained in this notice, the name of Daniel Veillard shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from him.
-
-    
-----------------------------------------------------
-
-Name: ICU4C
-Preferred version: 3.6 or higher
-Is mandatory: true
-Website: http://www.icu-project.org/
-License: ICU License
-Copyright: 1995-2011 International Business Machines Corporation and others 
-External notice: 
-
-      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-      Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.
-    
-----------------------------------------------------
-
-Name: CURL
-Preferred version: above 7.12
-Is mandatory: false
-Website: http://curl.haxx.se/
-License: MIT/X derivate license
-Copyright: 1996 - 2011, Daniel Stenberg, <daniel@xxxxxxx>.
-External notice: 
-
-      All rights reserved.
-
-      Permission to use, copy, modify, and distribute this software for any purpose
-      with or without fee is hereby granted, provided that the above copyright
-      notice and this permission notice appear in all copies.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
-      NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-      DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-      OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
-      OR OTHER DEALINGS IN THE SOFTWARE.
-
-      Except as contained in this notice, the name of a copyright holder shall not
-      be used in advertising or otherwise to promote the sale, use or other dealings
-      in this Software without prior written authorization of the copyright holder.
-    
-----------------------------------------------------
-
-Name: ICONV
-Preferred version: above 1.12
-Is mandatory: true
-Website: http://www.gnu.org/software/libiconv/
-License: LGPL
-Copyright: 1998, 2010 Free Software Foundation, Inc.
-External notice: 
-
-----------------------------------------------------
-
-Name: ZLIB
-Preferred version: 1.2.5
-Is mandatory: true
-Website: http://www.zlib.net/
-Copyright: 1995-2004 Jean-loup Gailly and Mark Adler
-External notice: 
-
-      This software is provided 'as-is', without any express or implied
-      warranty.  In no event will the authors be held liable for any damages
-      arising from the use of this software.
-
-      Permission is granted to anyone to use this software for any purpose,
-      including commercial applications, and to alter it and redistribute it
-      freely, subject to the following restrictions:
-
-      1. The origin of this software must not be misrepresented; you must not
-      claim that you wrote the original software. If you use this software
-      in a product, an acknowledgment in the product documentation would be
-      appreciated but is not required.
-      2. Altered source versions must be plainly marked as such, and must not be
-      misrepresented as being the original software.
-      3. This notice may not be removed or altered from any source distribution.
-
-      Jean-loup Gailly jloup@xxxxxxxx
-      Mark Adler madler@xxxxxxxxxxxxxxxxxx
-    
-----------------------------------------------------
-
-Name: XERCES
-Preferred version: 2.8.0 or higher
-Is mandatory: true
-Website: http://xerces.apache.org/xerces-c/
-License: Apache 2
-Copyright: Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.
-External notice: 
-
-      http://www.apache.org/licenses/LICENSE-2.0
-    
-----------------------------------------------------
-
-Name: BOOST (boost_filesystem)
-Preferred version: 1.32 or higher
-Is mandatory: false
-Website: http://www.boost.org/
-License: Boost Software License v1.0
-Copyright: 
-      Beman Dawes, David Abrahams, 1998-2005.
-      Rene Rivera 2004-2007
-    
-External notice: 
-
-      Permission is hereby granted, free of charge, to any person or organization
-      obtaining a copy of the software and accompanying documentation covered by
-      this license (the "Software") to use, reproduce, display, distribute,
-      execute, and transmit the Software, and to prepare derivative works of the
-      Software, and to permit third-parties to whom the Software is furnished to
-      do so, all subject to the following:
-
-      The copyright notices in the Software and this entire statement, including
-      the above license grant, this restriction and the following disclaimer,
-      must be included in all copies of the Software, in whole or in part, and
-      all derivative works of the Software, unless such copies or derivative
-      works are solely in the form of machine-executable object code generated by
-      a source language processor.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-      FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-      SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-      FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-      ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-      DEALINGS IN THE SOFTWARE.
-    
-
-External applications used by this project:
-----------------------------------------------------
-
-Name: FLEX
-Preferred version: 2.5.33
-Is mandatory: false
-Website: http://flex.sourceforge.net/
-Copyright: 
-      2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The Flex Project.
-      1990, 1997 The Regents of the University of California. All rights reserved.
-    
-External notice: 
-
-      Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-      1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-      2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-      
-      Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED “AS IS” AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-    
-----------------------------------------------------
-
-Name: BISON
-Preferred version: 2.4 or higher
-Is mandatory: false
-Website: http://www.gnu.org/software/bison/
-License: GPL
-Copyright: 1998, 2001, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-External notice: 
-
-----------------------------------------------------
-
-Name: DOXYGEN
-Preferred version: v1.7.4 
-Is mandatory: false
-Website: www.doxygen.org
-License: GPL
-Copyright: 1997-2011 by Dimitri van Heesch
-External notice: 
-
-      Permission to use, copy, modify, and distribute this software and its documentation under the terms of the GNU General Public License is hereby granted.
-      No representations are made about the suitability of this software for any purpose. 
-      It is provided "as is" without express or implied warranty. 
-      See the GNU General Public License for more details.
-
-      Documents produced by doxygen are derivative works derived from the input used in their production; they are not affected by this license.
-    
-----------------------------------------------------
-
-Name: CMAKE
-Preferred version: 2.8.4
-Is mandatory: true
-Website: http://www.cmake.org/
-License: Creative Commons Attribution-NoDerivs 3.0 Unported License
-Copyright: 2000-2009 Kitware, Inc., Insight Software Consortium. All rights reserved.
-External notice: 
-
-      Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-      Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-      Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-      Neither the names of Kitware, Inc., the Insight Software Consortium, nor the names of their contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-    
-----------------------------------------------------
-
-Name: SWIG
-Preferred version: 2.0.4 or above
-Is mandatory: false
-Website: http://www.swig.org/
-License: GPL
-Copyright: 
-      1995-2011 The SWIG Developers
-      2005-2006 Arizona Board of Regents (University of Arizona).
-      1998-2005 University of Chicago.
-      1995-1998 The University of Utah and the Regents of the University of California
-    
-External notice: 
-
-      SWIG is free software: you can redistribute it and/or modify it
-      under the terms of the GNU General Public License as published by
-      the Free Software Foundation, either version 3 of the License, or
-      (at your option) any later version. See the LICENSE-GPL file for
-      the full terms of the GNU General Public license version 3.
-
-      Portions of SWIG are also licensed under the terms of the licenses
-      in the file LICENSE-UNIVERSITIES. You must observe the terms of
-      these licenses, as well as the terms of the GNU General Public License,
-      when you distribute SWIG.
-
-      The SWIG library and examples, under the Lib and Examples top level
-      directories, are distributed under the following terms:
-
-      You may copy, modify, distribute, and make derivative works based on
-      this software, in source code or object code form, without
-      restriction. If you distribute the software to others, you may do
-      so according to the terms of your choice. This software is offered as
-      is, without warranty of any kind.
-
-      See the COPYRIGHT file for a list of contributors to SWIG and their
-      copyright notices.
-    
\ No newline at end of file

=== modified file 'doc/cxx/examples/CMakeLists.txt'
--- doc/cxx/examples/CMakeLists.txt	2012-05-03 12:31:51 +0000
+++ doc/cxx/examples/CMakeLists.txt	2012-05-15 14:37:23 +0000
@@ -36,6 +36,10 @@
 #  LIST(APPEND API_EXAMPLES debugger.cpp)
 ENDIF(ZORBA_WITH_DEBUGGER)
 
+IF (ZORBA_WITH_JSON)
+  LIST (APPEND API_EXAMPLES jsoniq.cpp)
+ENDIF (ZORBA_WITH_JSON)
+
 CREATE_TEST_SOURCELIST(
   examples
   examples.cpp

=== added file 'doc/cxx/examples/jsoniq.cpp'
--- doc/cxx/examples/jsoniq.cpp	1970-01-01 00:00:00 +0000
+++ doc/cxx/examples/jsoniq.cpp	2012-05-15 14:37:23 +0000
@@ -0,0 +1,330 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ * 
+ * Licensed 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.
+ */
+
+#include <iostream>
+#include <sstream>
+
+#include <zorba/zorba.h>
+#include <zorba/store_manager.h>
+#include <zorba/serializer.h>
+#include <zorba/singleton_item_sequence.h>
+#include <zorba/zorba_exception.h>
+
+using namespace zorba;
+
+namespace jsoniq_test {
+
+/**
+ * Test accessing a JSONArray's members
+ */
+bool
+example_1(Zorba* aZorba)
+{
+  Iterator_t lIterator, lMembers;
+  XQuery_t lQuery = aZorba->compileQuery("[ 1, 2, 3 ]");
+  lIterator = lQuery->iterator();
+  lIterator->open();
+  Item lItem;
+  lIterator->next(lItem);
+
+  // Ensure we got a JSON array
+  if (!lItem.isJSONItem() ||
+      lItem.getJSONItemKind() != store::StoreConsts::jsonArray) {
+    std::cerr << "Item is not JSON Array!" << std::endl;
+    return false;
+  }
+
+  // Ensure array has 3 integer members
+  lMembers = lItem.getArrayMembers();
+  lMembers->open();
+  Item lMember;
+  int count = 0;
+  while (lMembers->next(lMember)) {
+    // This will throw an exception if the item isn't an integer
+    std::cout << lMember.getLongValue() << std::endl;
+    count++;
+  }
+  if (count != 3) {
+    std::cerr << count << " array members returned, expecting 3" << std::endl;
+    return false;
+  }
+  lMembers->close();
+  lIterator->close();
+
+  return true;
+}
+
+
+/**
+ * Test accessing a JSONArray's members directly by index
+ */
+bool
+example_2(Zorba* aZorba)
+{
+  Iterator_t lIterator;
+  XQuery_t lQuery = aZorba->compileQuery("[ 1, 2, 3 ]");
+  lIterator = lQuery->iterator();
+  lIterator->open();
+  Item lItem;
+  lIterator->next(lItem);
+
+  Item lMember;
+  for (int i = 1; i <= 3; i++) {
+    lMember = lItem.getArrayMember(i);
+    std::cout << lMember.getLongValue() << std::endl;
+  }
+
+  lIterator->close();
+
+  return true;
+}
+
+
+/**
+ * Test accessing a JSONObject's values directly by name
+ */
+bool
+example_3(Zorba* aZorba)
+{
+  Iterator_t lIterator;
+  XQuery_t lQuery = aZorba->compileQuery("{ \"one\" : 1, \"two\" : 2 }");
+  lIterator = lQuery->iterator();
+  lIterator->open();
+  Item lItem;
+  lIterator->next(lItem);
+
+  Item lValue;
+  lValue = lItem.getObjectValue("one");
+  std::cout << lValue.getLongValue() << std::endl;
+  lValue = lItem.getObjectValue("two");
+  std::cout << lValue.getLongValue() << std::endl;
+
+  lIterator->close();
+
+  return true;
+}
+
+/**
+ * Test accessing a non-existent JSONArray member
+ */
+bool
+example_4(Zorba* aZorba)
+{
+  Iterator_t lIterator, lMembers;
+  XQuery_t lQuery = aZorba->compileQuery("[ 1, 2, 3 ]");
+  lIterator = lQuery->iterator();
+  lIterator->open();
+  Item lItem;
+  lIterator->next(lItem);
+
+  Item lNonMember = lItem.getArrayMember(4);
+  lIterator->close();
+
+  if (!lNonMember.isNull()) {
+    return false;
+  }
+
+  return true;
+}
+
+/**
+ * Test accessing a non-existent JSONObject pair value
+ */
+bool
+example_5(Zorba* aZorba)
+{
+  Iterator_t lIterator;
+  XQuery_t lQuery = aZorba->compileQuery("{ \"one\" : 1, \"two\" : 2 }");
+  lIterator = lQuery->iterator();
+  lIterator->open();
+  Item lItem;
+  lIterator->next(lItem);
+
+  Item lNonValue = lItem.getObjectValue("three");
+  lIterator->close();
+
+  if (!lNonValue.isNull()) {
+    return false;
+  }
+  return true;
+}
+
+/**
+ * Utility function: Given an item, bind that item to a simple query and
+ * serialize the result, then ensure the result matches the expected string.
+ */
+bool
+serialize(Zorba* aZorba, Item aItem, std::string aExpected)
+{
+  Zorba_SerializerOptions lSerialOpt;
+  lSerialOpt.omit_xml_declaration = ZORBA_OMIT_XML_DECLARATION_YES;
+
+  XQuery_t lQuery = aZorba->compileQuery("declare variable $i external; $i");
+
+  lQuery->getDynamicContext()->setVariable("i", aItem);
+
+  std::stringstream lStream;
+  lQuery->execute(lStream, &lSerialOpt);
+
+  std::string lResult = lStream.str();
+  std::cout << lResult << std::endl;
+  if (lResult.compare(aExpected) != 0) {
+    std::cout << "Wrong value! Expected " << aExpected << std::endl;
+    return false;
+  }
+  return true;
+}
+
+/**
+ * Test creating a JSON null value.
+ */
+bool
+example_6(Zorba* aZorba)
+{
+  Item lNull = aZorba->getItemFactory()->createJSONNull();
+  return serialize(aZorba, lNull, "null");
+}
+
+/**
+ * Test creating some JSON numbers.
+ */
+bool
+example_7(Zorba* aZorba)
+{
+  Item lNum = aZorba->getItemFactory()->createJSONNumber(String("12345"));
+  if (lNum.getType().getLocalName().compare("integer") != 0) {
+    std::cout << "Didn't create an xs:integer!";
+    return false;
+  }
+  if (!serialize(aZorba, lNum, "12345")) {
+    return false;
+  }
+
+  lNum = aZorba->getItemFactory()->createJSONNumber(String("123.345"));
+  if (lNum.getType().getLocalName().compare("decimal") != 0) {
+    std::cout << "Didn't create an xs:decimal!";
+    return false;
+  }
+  if (!serialize(aZorba, lNum, "123.345")) {
+    return false;
+  }
+
+  lNum = aZorba->getItemFactory()->createJSONNumber(String("12.34e5"));
+  if (lNum.getType().getLocalName().compare("double") != 0) {
+    std::cout << "Didn't create an xs:double!";
+    return false;
+  }
+  if (!serialize(aZorba, lNum, "1.234E6")) {
+    return false;
+  }
+
+  return true;
+}
+
+/**
+ * Test creating a JSON object.
+ */
+bool example_8(Zorba* aZorba)
+{
+  Item lValue = aZorba->getItemFactory()->createJSONNumber("1234");
+  Item lName = aZorba->getItemFactory()->createString("name");
+  std::vector<std::pair<Item, Item> > pairs;
+  pairs.push_back(std::pair<Item, Item>(lName, lValue));
+  Item lObj = aZorba->getItemFactory()->createJSONObject(pairs);
+
+  return serialize(aZorba, lObj, "{ \"name\" : 1234 }");
+}
+
+/**
+ * Test creating a JSON array.
+ */
+bool example_9(Zorba* aZorba)
+{
+  std::vector<Item> lMembers;
+  for (int i = 1; i <= 4; i++) {
+    // xs:int is fine for JSON arrays
+    lMembers.push_back(aZorba->getItemFactory()->createInt(i));
+  }
+  Item lArray = aZorba->getItemFactory()->createJSONArray(lMembers);
+  return serialize(aZorba, lArray, "[ 1, 2, 3, 4 ]");
+}
+
+
+} /* namespace jsoniq-test */
+
+int 
+jsoniq(int argc, char* argv[])
+{
+  void* lStore = StoreManager::getStore();
+  Zorba *lZorba = Zorba::getInstance(lStore);
+
+  bool res = false;
+
+  try {
+    std::cout << "executing jsoniq example 1" << std::endl;
+    res = jsoniq_test::example_1(lZorba);
+    if (!res) return 1;
+    std::cout << std::endl;
+
+    std::cout << "executing jsoniq example 2" << std::endl;
+    res = jsoniq_test::example_2(lZorba);
+    if (!res) return 1;
+    std::cout << std::endl;
+
+    std::cout << "executing jsoniq example 3" << std::endl;
+    res = jsoniq_test::example_3(lZorba);
+    if (!res) return 1;
+    std::cout << std::endl;
+
+    std::cout << "executing jsoniq example 4" << std::endl;
+    res = jsoniq_test::example_4(lZorba);
+    if (!res) return 1;
+    std::cout << std::endl;
+
+    std::cout << "executing jsoniq example 5" << std::endl;
+    res = jsoniq_test::example_5(lZorba);
+    if (!res) return 1;
+    std::cout << std::endl;
+
+    std::cout << "executing jsoniq example 6" << std::endl;
+    res = jsoniq_test::example_6(lZorba);
+    if (!res) return 1;
+    std::cout << std::endl;
+
+    std::cout << "executing jsoniq example 7" << std::endl;
+    res = jsoniq_test::example_7(lZorba);
+    if (!res) return 1;
+    std::cout << std::endl;
+
+    std::cout << "executing jsoniq example 8" << std::endl;
+    res = jsoniq_test::example_8(lZorba);
+    if (!res) return 1;
+    std::cout << std::endl;
+
+    std::cout << "executing jsoniq example 9" << std::endl;
+    res = jsoniq_test::example_9(lZorba);
+    if (!res) return 1;
+    std::cout << std::endl;
+  }
+  catch (ZorbaException& e) {
+    std::cout << "ZorbaException raised: " << e.what() << std::endl;
+    return 2;
+  }
+
+  lZorba->shutdown();
+  StoreManager::shutdownStore(lStore);
+  return 0;
+}

=== modified file 'doc/zorba/CMakeLists.txt'
--- doc/zorba/CMakeLists.txt	2012-05-03 12:31:51 +0000
+++ doc/zorba/CMakeLists.txt	2012-05-15 14:37:23 +0000
@@ -46,6 +46,10 @@
                   ${CMAKE_CURRENT_BINARY_DIR}/html/noisepattern.png COPYONLY)
   CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/scripting_spec.html
                   ${CMAKE_CURRENT_BINARY_DIR}/html/scripting_spec.html COPYONLY)
+  CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/XQueryforJSON.html
+                  ${CMAKE_CURRENT_BINARY_DIR}/html/XQueryforJSON.html COPYONLY)
+  CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/JSONforXQuery.html
+                  ${CMAKE_CURRENT_BINARY_DIR}/html/JSONforXQuery.html COPYONLY)
   CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/W3C-WD.css
                   ${CMAKE_CURRENT_BINARY_DIR}/html/W3C-WD.css COPYONLY)
 

=== added file 'doc/zorba/JSONforXQuery.html'
--- doc/zorba/JSONforXQuery.html	1970-01-01 00:00:00 +0000
+++ doc/zorba/JSONforXQuery.html	2012-05-15 14:37:23 +0000
@@ -0,0 +1,1 @@
+<html><head><title>JSON for XQuery</title><style type="text/css">@import url('https://themes.googleusercontent.com/fonts/css?kit=lhDjYqiy3mZ0x6ROQEUoUw');ol{margin:0;padding:0}p{margin:0}.c22{max-width:468pt;background-color:#ffffff;padding:72pt 72pt 72pt 72pt}.c19{list-style-type:disc;margin:0;padding:0}.c6{padding-left:0pt;text-align:justify;margin-left:36pt}.c0{height:11pt;direction:ltr}.c3{color:#38761d;font-family:Consolas}.c2{color:inherit;text-decoration:inherit}.c4{color:#1155cc;text-decoration:underline}.c1{direction:ltr}.c20{height:18pt}.c9{margin-left:58.5pt}.c13{text-indent:139.5pt}.c17{text-indent:144pt}.c7{margin-left:144pt}.c8{text-align:right}.c11{font-weight:bold}.c16{text-align:justify}.c10{margin-left:36pt}.c5{font-family:Consolas}.c18{color:#38761d}.c15{margin-left:49.5pt}.c21{text-align:center}.c23{color:#4a86e8}.c12{font-style:italic}.c14{margin-left:18pt}.title{padding-top:24pt;line-height:1.15;text-align:center;color:#4a86e8;font-size:36pt;font-family:Arial;font-weight:bold;padding-bottom:6pt}.subtitle{padding-top:18pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:24pt;font-family:Georgia;padding-bottom:4pt}body{color:#000000;font-size:11pt;font-family:Arial}h1{padding-top:24pt;line-height:1.15;text-align:left;color:#4a86e8;font-size:24pt;font-family:Arial;font-weight:bold;padding-bottom:6pt}h2{padding-top:18pt;line-height:1.15;text-align:left;color:#ff9900;font-size:18pt;font-family:Arial;font-weight:bold;padding-bottom:4pt}h3{padding-top:14pt;line-height:1.15;text-align:left;color:#000000;font-size:14pt;font-family:Arial;font-weight:bold;padding-bottom:4pt}h4{padding-top:12pt;line-height:1.15;text-align:left;color:#000000;font-size:12pt;font-family:Arial;font-weight:bold;padding-bottom:2pt}h5{padding-top:11pt;line-height:1.15;text-align:left;color:#000000;font-size:11pt;font-family:Arial;font-weight:bold;padding-bottom:2pt}h6{padding-top:10pt;line-height:1.15;text-align:left;color:#000000;font-size:10pt;font-family:Arial;font-weight:bold;padding-bottom:2pt}</style></head><body class="c22"><p class="c1 title"><a name="h.li2wdq8unbq"></a><span>JSONiq for XQuery users</span></p><p class="c1 title"><a name="h.5ipqqclfxk4n"></a><span class="c18">JSON for XQuery</span></p><hr><p class="c1 c21"><span>This tutorial introduces the JSONiq language, which declaratively manipulates JSON data.</span></p><p class="c1 c21"><span>Why don&#39;t you go ahead can try the queries of this document on our online demo interface?</span></p><p class="c1 c21"><span>&nbsp;</span><span class="c4 c11"><a class="c2" href="http://jsoniq.zorba-xquery.com/";>http://jsoniq.zorba-xquery.com/</a></span></p><hr><p class="c0"><span></span></p><h2 class="c1 c20"><a name="h.8gra0ylxutrv"></a></h2><p class="c1 c14"><span class="c4"><a class="c2" href="#h.f453h84m2u1a">JSON</a></span></p><p class="c1 c14"><span class="c4"><a class="c2" href="#h.qtfakecy3fr7">Elevator Pitch</a></span></p><p class="c1 c14"><span class="c4"><a class="c2" href="#h.yugk1mszt0re">And here you go</a></span></p><p class="c1 c10"><span class="c4"><a class="c2" href="#h.39rm37noeh9g">JSONiq types</a></span></p><p class="c1 c10"><span class="c4"><a class="c2" href="#h.j0wg8654ivtw">JSON Constructors</a></span></p><p class="c1 c10"><span class="c4"><a class="c2" href="#h.qe57mgdf5ql">JSON as a subset of JSONiq</a></span></p><p class="c1 c14"><span class="c4"><a class="c2" href="#h.mjv7kyjurri2">JSON Navigation</a></span></p><p class="c1 c10"><span class="c4"><a class="c2" href="#h.xosiyb17dh24">Objects</a></span></p><p class="c1 c10"><span class="c4"><a class="c2" href="#h.mrf42gizl3y6">Arrays</a></span></p><p class="c1 c10"><span class="c4"><a class="c2" href="#h.hdc3dgohtdut">Pairs</a></span></p><p class="c1 c14"><span class="c4"><a class="c2" href="#h.eb0bxle2oykl">Relational Algebra</a></span></p><p class="c1 c14"><span class="c4"><a class="c2" href="#h.oii6pvliilhi">Access external data</a></span></p><p class="c1 c14"><span class="c4"><a class="c2" href="#h.bm3buqmzhtko">I want more</a></span></p><p><span></span></p><p class="c0"><span></span></p><h1 class="c1"><a name="h.f453h84m2u1a"></a><span>JSON</span></h1><p class="c1 c16"><span>As explained on </span><span class="c4"><a class="c2" href="http://www.json.org/";>http://www.json.org/</a></span><span>, JSON is a lightweight data-interchange format designed for humans as well as for computers. It supports as values:</span></p><ol class="c19" start="1"><li class="c6 c1"><span>objects (string-to-value map)</span></li><li class="c6 c1"><span>arrays (ordered sequence of values)</span></li><li class="c6 c1"><span>strings</span></li><li class="c6 c1"><span>numbers</span></li><li class="c6 c1"><span>booleans (true, false)</span></li><li class="c6 c1"><span>null</span></li></ol><p class="c0"><span></span></p><p class="c1"><span>JSONiq extends XQuery to query and update JSON data, like XML data.</span></p><h1 class="c1"><a name="h.qtfakecy3fr7"></a><span>Elevator Pitch</span></h1><p class="c1 c16"><span>Here is an appetizer before we start the tutorial from scratch.</span></p><p class="c0"><span></span></p><p class="c1"><span class="c5">let $stores :=</span></p><p class="c1"><span class="c5">[</span></p><p class="c1"><span class="c5">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c5">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c5">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c1"><span class="c5">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c1"><span class="c5">]</span></p><p class="c1"><span class="c5">let $sales := [</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c1"><span class="c5">]</span></p><p class="c1"><span class="c5">let $join :=</span></p><p class="c1"><span class="c5">&nbsp; for $store in jn:values($stores), $sale in jn:values($sales)</span></p><p class="c1"><span class="c5">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c1"><span class="c5">&nbsp; return {</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c1"><span class="c5">&nbsp; }</span></p><p class="c1"><span class="c5">return [$join]</span></p><p class="c1 c7"><span class="c3">[ </span></p><p class="c1 c7"><span class="c3">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c1 c7"><span class="c3">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c1 c7"><span class="c3">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c1 c7"><span class="c3">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c1 c7"><span class="c3">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c1 c7"><span class="c3">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c1 c7"><span class="c3">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c1 c7"><span class="c3">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c1 c7"><span class="c3">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c1 c7"><span class="c3">&nbsp;]</span></p><p class="c0"><span></span></p><h1 class="c1"><a name="h.yugk1mszt0re"></a><span>And here you go</span></h1><h2 class="c1"><a name="h.39rm37noeh9g"></a><span>JSONiq types</span></h2><p class="c1"><span>JSONiq maps JSON types to XQuery. Numbers are xs:integer or xs:decimal, strings are xs:string, true and false are xs:boolean and null is a new atomic type jn:null.</span></p><p class="c0"><span></span></p><p class="c1"><span>JSONiq introduces new items: objects, arrays and pairs. Objects have pairs. Pairs have a string name and a value. Array have members which are values. Values are objects, arrays, XML nodes or atomic items.</span></p><p class="c0"><span></span></p><p class="c1"><span>The new item types for objects and arrays are object() and array(). json-item() is a supertype of both, and json-pair() is the item type for pairs.</span></p><h2 class="c1"><a name="h.j0wg8654ivtw"></a><span>JSON Constructors</span></h2><p class="c1"><span>JSONiq introduces JSON constructors, in a similar way to XML constructors.</span></p><p class="c0"><span></span></p><p class="c1"><span>You can put any expression in a array. The items in the sequence produced by the expression will become members of the array:</span></p><p class="c0"><span></span></p><p class="c1"><span class="c5">[ 1 to 10 ]</span></p><p class="c1 c8"><span class="c3">[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]</span></p><p class="c0 c8"><span class="c3"></span></p><p class="c1"><span>Or you can dynamically compute an object:</span></p><p class="c0"><span></span></p><p class="c1"><span class="c5">{</span></p><p class="c1"><span class="c5">&nbsp; &quot;Greeting&quot; : (let $d := &quot;Mister Spock&quot;</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return concat(&quot;Hello, &quot;, $d)),</span></p><p class="c1"><span class="c5">&nbsp; &quot;Farewell&quot; : string-join((&quot;Live&quot;, &quot;long&quot;, &quot;and&quot;, &quot;prosper&quot;),</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot; &quot;)</span></p><p class="c1"><span class="c5">}</span></p><p class="c0"><span class="c3"></span></p><p class="c1 c8"><span class="c3">{ &quot;Greeting&quot; : &quot;Hello, Mister Spock&quot;, &quot;Farewell&quot; : &quot;Live long and prosper&quot; }</span></p><p class="c0"><span class="c18"></span></p><p class="c1"><span>You can also dynamically generate pairs:</span></p><p class="c0"><span class="c5"></span></p><p class="c1"><span class="c5">concat(&quot;Integer &quot;, 2) : 2 * 2</span></p><p class="c1 c8"><span class="c3">&quot;Integer 2&quot; : 4</span></p><p class="c0 c8"><span class="c3"></span></p><p class="c1"><span>and then wrap lots of them in an object:</span></p><p class="c0"><span class="c5"></span></p><p class="c1"><span class="c5">{</span></p><p class="c1"><span class="c5">&nbsp; for $i in 1 to 10</span></p><p class="c1"><span class="c5">&nbsp; return concat(&quot;Square of &quot;, $i) : $i * $i</span></p><p class="c1"><span class="c5">}</span></p><p class="c1 c7"><span class="c3">{</span></p><p class="c1 c7"><span class="c3">&quot;Square of 1&quot; : 1,</span></p><p class="c1 c7"><span class="c3">&quot;Square of 2&quot; : 4,</span></p><p class="c1 c7"><span class="c3">&quot;Square of 3&quot; : 9,</span></p><p class="c1 c7"><span class="c3">&quot;Square of 4&quot; : 16,</span></p><p class="c1 c7"><span class="c3">&quot;Square of 5&quot; : 25,</span></p><p class="c1 c7"><span class="c3">&quot;Square of 6&quot; : 36,</span></p><p class="c1 c7"><span class="c3">&quot;Square of 7&quot; : 49,</span></p><p class="c1 c7"><span class="c3">&quot;Square of 8&quot; : 64,</span></p><p class="c1 c7"><span class="c3">&quot;Square of 9&quot; : 81,</span></p><p class="c1 c7"><span class="c3">&quot;Square of 10&quot; : 100</span></p><p class="c1 c7"><span class="c3">}</span></p><p class="c0"><span></span></p><h2 class="c1"><a name="h.qe57mgdf5ql"></a><span>JSON as a subset of JSONiq</span></h2><p class="c1 c16"><span>Every well-formed JSON document is a JSONiq query as well. This means that you can copy-and-paste a JSON document into a query. The following are JSONiq queries that are &quot;idempotent&quot; (they just output themselves):</span></p><p class="c0"><span></span></p><p class="c1"><span class="c5">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c1 c8"><span class="c3">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c0"><span class="c3"></span></p><p class="c1"><span class="c5">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c1 c8"><span class="c3">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c0"><span class="c5"></span></p><p class="c1"><span class="c5">{</span></p><p class="c1"><span class="c5">&nbsp; &quot;operations&quot; : [</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot;] },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; { &quot;unary&quot; : [&quot;not&quot;] }</span></p><p class="c1"><span class="c5">&nbsp; ],</span></p><p class="c1"><span class="c5">&nbsp; &quot;bits&quot; : [</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; 0, 1</span></p><p class="c1"><span class="c5">&nbsp; ]</span></p><p class="c1"><span class="c5">}</span></p><p class="c1 c17"><span class="c3">{</span></p><p class="c1 c17"><span class="c3">&nbsp; &quot;operations&quot; : [</span></p><p class="c1 c17"><span class="c3">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot; ] },</span></p><p class="c1 c17"><span class="c3">&nbsp; &nbsp; { &quot;unary&quot; : [ &quot;not&quot; ] }</span></p><p class="c1 c17"><span class="c3">&nbsp; ],</span></p><p class="c1 c17"><span class="c3">&nbsp; &quot;bits&quot; : [</span></p><p class="c1 c17"><span class="c3">&nbsp; &nbsp; 0, 1</span></p><p class="c1 c17"><span class="c3">&nbsp; ]</span></p><p class="c1 c17"><span class="c3">}</span></p><p class="c0 c8"><span class="c3"></span></p><p class="c1 c16"><span>This works with objects, arrays (even nested), strings, numbers, booleans, null. </span><span class="c12">The exceptions to this rule (but we are working on it!) are that:</span></p><p class="c1 c16"><span class="c12">(i) if a pair has a true, false or null value, there must be a space on at least one side of the colon (this will be fixed).</span></p><p class="c1 c16"><span class="c12">(ii) empty objects are not recognized</span></p><p class="c1 c16"><span class="c12">(iii) characters escaped with the \ in JSON strings are not recognized</span></p><p class="c0"><span class="c5 c12"></span></p><p class="c1 c16"><span>It also works the other way round: if your query outputs an object or an array, you can readily use it as a JSON document.</span></p><p class="c0 c8"><span class="c3"></span></p><h1 class="c1"><a name="h.mjv7kyjurri2"></a><span>JSON Navigation</span></h1><p class="c1 c16"><span>I</span><span>f you have some JSON data, you can access it and navigate.</span></p><p class="c0 c16"><span></span></p><p class="c1 c16"><span>All you need to know is, again: JSONiq views</span></p><ol class="c19" start="1"><li class="c1 c6"><span>an array as a sequence of values,</span></li><li class="c6 c1"><span>an object as a set of pairs,</span></li><li class="c6 c1"><span>a pair as a (name, value) tuple.</span></li></ol><h2 class="c1 c16"><a name="h.xosiyb17dh24"></a><span>Objects</span></h2><p class="c1 c16"><span>If you use an object as a functor and provide it with a string, it will return the pair named after its parameter:</span></p><p class="c0"><span class="c5"></span></p><p class="c1"><span class="c5">let $person := {</span></p><p class="c1"><span class="c5">&nbsp; &quot;first name&quot; : &quot;Sarah&quot;,</span></p><p class="c1"><span class="c5">&nbsp; &quot;age&quot; : 13,</span></p><p class="c1"><span class="c5">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c1"><span class="c5">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c5">}</span></p><p class="c1"><span class="c5">return $person(&quot;first name&quot;)</span></p><p class="c1 c8"><span class="c3">&quot;first name&quot; : &quot;Sarah&quot;</span></p><p class="c0 c8"><span class="c3"></span></p><h2 class="c1"><a name="h.mrf42gizl3y6"></a><span>Arrays</span></h2><p class="c1 c16"><span>If you use an array as a functor and provide it with an integer, it will return the corresponding entry:</span></p><p class="c0"><span class="c5"></span></p><p class="c1"><span class="c5">let $friends := [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c5">return $friends(2)</span></p><p class="c1 c8"><span class="c3">Mary</span></p><h2 class="c1"><a name="h.hdc3dgohtdut"></a><span>Pairs</span></h2><p class="c1"><span>Given a pair, you can get its name and value using the functions jn:name and jn:value:</span></p><p class="c0"><span></span></p><p class="c1"><span class="c5">let $pair := &quot;name of the pair&quot; : &quot;value of the pair&quot;</span></p><p class="c1"><span class="c5">return { &nbsp;&quot;name&quot; : jn:name($pair), &quot;value&quot; : jn:value($pair) }</span></p><p class="c0"><span class="c5"></span></p><p class="c1 c8"><span class="c3">{ &quot;name&quot; : &quot;name of the pair&quot;, &quot;value&quot; : &quot;value of the pair&quot; }</span></p><p class="c0"><span class="c18"></span></p><p class="c1"><span>This functions also exist in plural form for objects:</span></p><p class="c0"><span></span></p><p class="c1"><span class="c5">let $person := {</span></p><p class="c1"><span class="c5">&nbsp; &quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c1"><span class="c5">&nbsp; &quot;age&quot; : 13,</span></p><p class="c1"><span class="c5">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c1"><span class="c5">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c5">}</span></p><p class="c1"><span class="c5">return { &quot;names&quot; : [ jn:names($person)],</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;values&quot; : [ jn:values($person)]</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &nbsp; &nbsp;}</span></p><p class="c1 c9"><span class="c3">{</span></p><p class="c1 c9"><span class="c3">&quot;names&quot; : [ &quot;name&quot;, &quot;age&quot;, &quot;gender&quot;, &quot;friends&quot; ],</span></p><p class="c1 c9"><span class="c3">&quot;values&quot; : [ &quot;Sarah&quot;, 13, &quot;female&quot;, [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot; ] ]</span></p><p class="c1 c9"><span class="c3">}</span></p><p class="c1"><span>jn:values can also be used for an array:</span></p><p class="c0"><span></span></p><p class="c1"><span class="c5">let $person := {</span></p><p class="c1"><span class="c5">&nbsp; &quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c1"><span class="c5">&nbsp; &quot;age&quot; : 13,</span></p><p class="c1"><span class="c5">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c1"><span class="c5">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c5">}</span></p><p class="c1"><span class="c5">return jn:values($person(&quot;friends&quot;))</span></p><p class="c1 c8"><span class="c18">[ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot; ]</span></p><p class="c0 c8"><span class="c18"></span></p><h1 class="c1"><a name="h.eb0bxle2oykl"></a><span>Relational Algebra</span></h1><p class="c1 c16"><span>Remember last century&#39;s SELECT FROM WHERE statements? Well, JSONiq didn&#39;t throw out the baby with the bathwater. It has selection, projection and join capability.</span></p><p class="c0"><span></span></p><p class="c1"><span class="c5">let $stores :=</span></p><p class="c1"><span class="c5">[</span></p><p class="c1"><span class="c5">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c5">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c5">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c1"><span class="c5">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c1"><span class="c5">]</span></p><p class="c1"><span class="c5">let $sales := [</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c1"><span class="c5">]</span></p><p class="c1"><span class="c5">let $join :=</span></p><p class="c1"><span class="c5">&nbsp; for $store in jn:values($stores), $sale in jn:values($sales)</span></p><p class="c1"><span class="c5">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c1"><span class="c5">&nbsp; return {</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c1"><span class="c5">&nbsp; }</span></p><p class="c1"><span class="c5">return [$join]</span></p><p class="c1 c13"><span class="c3">[ </span></p><p class="c1 c13"><span class="c3">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c1 c13"><span class="c3">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c1 c13"><span class="c3">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c1 c13"><span class="c3">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c1 c13"><span class="c3">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c1 c13"><span class="c3">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c1 c13"><span class="c3">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c1 c13"><span class="c3">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c1 c13"><span class="c3">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c1 c13"><span class="c3">&nbsp;]</span></p><h1 class="c1"><a name="h.oii6pvliilhi"></a><span>Access external data</span></h1><p class="c1"><span>Our implementation supports collections of JSON objects or arrays:</span></p><p class="c0"><span></span></p><p class="c1"><span class="c5">dml:collection(&quot;my:data&quot;)</span></p><p class="c1 c8"><span class="c3">{ &quot;foo&quot; : &quot;Your&quot; }</span></p><p class="c1 c8"><span class="c3">{ &quot;foo&quot; : &quot;Collection&quot; }</span></p><p class="c1 c8"><span class="c3">{ &quot;foo&quot; : &quot;of&quot; }</span></p><p class="c1 c8"><span class="c3">{ &quot;foo&quot; : &quot;JSON&quot; }</span></p><p class="c1 c8"><span class="c3">{ &quot;foo&quot; : &quot;objects&quot; }</span></p><p class="c0 c8"><span class="c3"></span></p><p class="c1"><span>It is also possible to get JSON content with an HTTP request, or by parsing it from a string. Functions that handle this are available.</span></p><p class="c0"><span class="c3"></span></p><h1 class="c1"><a name="h.fopcxnkoydgt"></a><span>JSON and XML</span></h1><p class="c1 c16"><span>You can readily use XML and JSON in the same program. If you put a JSON array in an XML constructor, it will be flattened (its member values are recursively taken, even in arrays of arrays). If you put a JSON pair in an XML constructor, it will be unboxed (its value is taken).</span></p><p class="c0"><span></span></p><p class="c1"><span class="c5">let $data := {</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;&quot;color&quot; : &quot;blue&quot;,</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;&quot;closed&quot; : true,</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;&quot;points&quot; : [[10,10], [20,10], [20,20], [10,20]]</span></p><p class="c1"><span class="c5">&nbsp; &nbsp;}</span></p><p class="c0"><span class="c5"></span></p><p class="c1"><span class="c5">let $stroke := attribute stroke { $data(&quot;color&quot;) }</span></p><p class="c1"><span class="c5">let $points := attribute points { $data(&quot;points&quot;) }</span></p><p class="c1"><span class="c5">return</span></p><p class="c1"><span class="c5">&nbsp; if ($data(&quot;closed&quot;)) then</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &lt;svg&gt;&lt;polygon&gt;{ $stroke, $points }&lt;/polygon&gt;&lt;/svg&gt;</span></p><p class="c1"><span class="c5">&nbsp; else</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &lt;svg&gt;&lt;polyline&gt;{ $stroke, $points }&lt;/polyline&gt;&lt;/svg&gt;</span></p><p class="c0"><span class="c5"></span></p><p class="c1 c15"><span class="c3">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span></p><p class="c1 c15"><span class="c3">&lt;svg&gt;&lt;polygon stroke=&quot;blue&quot; points=&quot;10 10 20 10 20 20 10 20&quot;/&gt;&lt;/svg&gt;</span></p><p class="c0"><span></span></p><h1 class="c1"><a name="h.bm3buqmzhtko"></a><span>I want more</span></h1><p class="c1 c16"><span>JSONiq supports JSON updates. You can declaratively update your JSON data. JSONiq provides functions that produce a list of updates. The list of updates that is eventually output by your program is then applied to your JSON data.</span></p><p class="c0"><span></span></p><p class="c1"><span class="c5">let $my-data := jn:json(&quot;persons.json&quot;)</span></p><p class="c1"><span class="c5">let $john := jn:value($my-data(&quot;John&quot;))</span></p><p class="c1"><span class="c5">let $mary := jn:value($my-data(&quot;Mary&quot;))</span></p><p class="c1"><span class="c5">return (jn:replace-value($john, &quot;status&quot;, &quot;married&quot;),</span></p><p class="c1"><span class="c5">&nbsp; &nbsp; &nbsp; &nbsp; j:replace-value($mary, &quot;status&quot;, &quot;married&quot;))</span></p><p class="c0"><span></span></p><p class="c1"><span>JSONiq works with the XQuery 3.0 standard (switch, typeswitch and try-catch expressions, universal/existential quantifiers, path expressions, filtering expressions, functors, mappings, grouping, windowing will work). The Zorba implementation is also compatible with the proprietary Zorba scripting.</span></p></body></html>
\ No newline at end of file

=== added file 'doc/zorba/XQueryforJSON.html'
--- doc/zorba/XQueryforJSON.html	1970-01-01 00:00:00 +0000
+++ doc/zorba/XQueryforJSON.html	2012-05-15 14:37:23 +0000
@@ -0,0 +1,1 @@
+<html><head><title>XQuery for JSON</title><style type="text/css">@import url('https://themes.googleusercontent.com/fonts/css?kit=lhDjYqiy3mZ0x6ROQEUoUw');ol{margin:0;padding:0}p{margin:0}.c21{max-width:468pt;background-color:#ffffff;padding:72pt 72pt 72pt 72pt}.c13{list-style-type:disc;margin:0;padding:0}.c11{color:#1155cc;text-decoration:underline}.c16{text-indent:-13.5pt;margin-left:76.5pt}.c8{color:inherit;text-decoration:inherit}.c19{color:#4a86e8}.c1{font-family:Consolas}.c7{height:18pt}.c20{color:#ff9900}.c10{text-align:justify}.c2{text-align:right}.c6{margin-left:36pt}.c0{direction:ltr}.c3{height:11pt}.c17{color:#ff0000}.c12{font-style:italic}.c18{font-weight:bold}.c5{color:#38761d}.c9{margin-left:18pt}.c15{text-align:center}.c14{padding-left:0pt}.c4{margin-left:144pt}.title{padding-top:24pt;line-height:1.15;text-align:center;color:#4a86e8;font-size:36pt;font-family:Arial;font-weight:bold;padding-bottom:6pt}.subtitle{padding-top:18pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:24pt;font-family:Georgia;padding-bottom:4pt}body{color:#000000;font-size:11pt;font-family:Arial}h1{padding-top:24pt;line-height:1.15;text-align:left;color:#4a86e8;font-size:24pt;font-family:Arial;font-weight:bold;padding-bottom:6pt}h2{padding-top:18pt;line-height:1.15;text-align:left;color:#ff9900;font-size:18pt;font-family:Arial;font-weight:bold;padding-bottom:4pt}h3{padding-top:14pt;line-height:1.15;text-align:left;color:#000000;font-size:14pt;font-family:Arial;font-weight:bold;padding-bottom:4pt}h4{padding-top:12pt;line-height:1.15;text-align:left;color:#000000;font-size:12pt;font-family:Arial;font-weight:bold;padding-bottom:2pt}h5{padding-top:11pt;line-height:1.15;text-align:left;color:#000000;font-size:11pt;font-family:Arial;font-weight:bold;padding-bottom:2pt}h6{padding-top:10pt;line-height:1.15;text-align:left;color:#000000;font-size:10pt;font-family:Arial;font-weight:bold;padding-bottom:2pt}</style></head><body class="c21"><p class="c0 title"><a name="h.li2wdq8unbq"></a><span>JSONiq for JSON users</span></p><p class="c0 title"><a name="h.5ipqqclfxk4n"></a><span class="c5">XQuery for JSON</span></p><hr><p class="c0 c15"><span>This tutorial introduces the JSONiq language, which declaratively manipulates JSON data.</span></p><p class="c0 c15"><span>Why don&#39;t you go ahead can try the queries of this document on our online demo interface?</span></p><p class="c0 c15"><span>&nbsp;</span><span class="c11 c18"><a class="c8" href="http://jsoniq.zorba-xquery.com/";>http://jsoniq.zorba-xquery.com/</a></span></p><hr><p class="c0 c3"><span></span></p><h2 class="c0 c7"><a name="h.8gra0ylxutrv"></a></h2><p class="c0 c9"><span class="c11"><a class="c8" href="#h.f453h84m2u1a">JSON</a></span></p><p class="c0 c9"><span class="c11"><a class="c8" href="#h.qtfakecy3fr7">Elevator Pitch</a></span></p><p class="c0 c9"><span class="c11"><a class="c8" href="#h.yugk1mszt0re">And here you go</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.4uvhbej4btrt">Like Monsieur Jourdain, you already knew some JSONiq</a></span></p><p class="c0 c9"><span class="c11"><a class="c8" href="#h.1gal1zhyffu4">JSONiq basics</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.ncbxtez2z3rn">The real JSONiq Hello, World!</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.ifcjheuaxoqc">Numbers and arithmetic operations</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.jmbc6c1fqqwx">Logical operations</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.iq1ixg5ywx0r">Strings</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.rv6w8p4wenfa">Sequences</a></span></p><p class="c0 c9"><span class="c11"><a class="c8" href="#h.7x2r8sj1zjwe">A bit more in depth</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.b6c9zq9um8cu">Variables</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.92ak2udyfghp">Iteration</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.zdhx60a5duyu">Conditions</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.ccs6lkxiixw4">Composability of Expressions</a></span></p><p class="c0 c9"><span class="c11"><a class="c8" href="#h.mjv7kyjurri2">JSON Navigation</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.xosiyb17dh24">Objects</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.mrf42gizl3y6">Arrays</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.hdc3dgohtdut">Pairs</a></span></p><p class="c0 c9"><span class="c11"><a class="c8" href="#h.eb0bxle2oykl">Relational Algebra</a></span></p><p class="c0 c9"><span class="c11"><a class="c8" href="#h.oii6pvliilhi">Access external data</a></span></p><p class="c0 c9"><span class="c11"><a class="c8" href="#h.bm3buqmzhtko">I want more</a></span></p><p class="c6 c0"><span class="c11"><a class="c8" href="#h.5itcphr8262b">Even more</a></span></p><p class="c0 c6"><span class="c11"><a class="c8" href="#h.j7oh3cyhem38">More is not enough</a></span></p><p><span></span></p><p class="c0 c3"><span></span></p><h1 class="c0"><a name="h.f453h84m2u1a"></a><span>JSON</span></h1><p class="c10 c0"><span>As explained on </span><span class="c11"><a class="c8" href="http://www.json.org/";>http://www.json.org/</a></span><span>, JSON is a lightweight data-interchange format designed for humans as well as for computers. It supports as values:</span></p><ol class="c13" start="1"><li class="c10 c6 c0 c14"><span>objects (string-to-value map)</span></li><li class="c10 c6 c0 c14"><span>arrays (ordered sequence of values)</span></li><li class="c10 c6 c0 c14"><span>strings</span></li><li class="c10 c6 c0 c14"><span>numbers</span></li><li class="c10 c6 c0 c14"><span>booleans (true, false)</span></li><li class="c10 c6 c0 c14"><span>null</span></li></ol><p class="c0 c3"><span></span></p><p class="c0"><span>JSONiq provides declarative querying and updating capabilities on JSON data.</span></p><h1 class="c0"><a name="h.qtfakecy3fr7"></a><span>Elevator Pitch</span></h1><p class="c10 c0"><span>JSONiq is based on XQuery, which is a W3C standard (like XML and HTML). XQuery is a very powerful declarative language that manipulates XML data, but that is also a very good fit for JSON. Here is an appetizer before we start the tutorial from scratch.</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">let $stores :=</span></p><p class="c0"><span class="c1">[</span></p><p class="c0"><span class="c1">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c0"><span class="c1">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c0"><span class="c1">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c0"><span class="c1">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c0"><span class="c1">]</span></p><p class="c0"><span class="c1">let $sales := [</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c0"><span class="c1">]</span></p><p class="c0"><span class="c1">let $join :=</span></p><p class="c0"><span class="c1">&nbsp; for $store in jn:values($stores), $sale in jn:values($sales)</span></p><p class="c0"><span class="c1">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c0"><span class="c1">&nbsp; return {</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c0"><span class="c1">&nbsp; }</span></p><p class="c0"><span class="c1">return [$join]</span></p><p class="c0 c4"><span class="c1 c5">[ </span></p><p class="c0 c4"><span class="c1 c5">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c0 c4"><span class="c1 c5">&nbsp;]</span></p><p class="c0 c3"><span></span></p><h1 class="c0"><a name="h.yugk1mszt0re"></a><span>And here you go</span></h1><h2 class="c0"><a name="h.4uvhbej4btrt"></a><span>Like Monsieur Jourdain, you already knew some JSONiq</span></h2><p class="c10 c0"><span>The first thing you need to know is that every well-formed JSON document is a JSONiq query as well.</span></p><p class="c0 c3"><span></span></p><p class="c10 c0"><span>This means that you can copy-and-paste a JSON document into a query. The following are JSONiq queries that are &quot;idempotent&quot; (they just output themselves):</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c2 c0"><span class="c1 c5">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c0 c3"><span class="c1 c5"></span></p><p class="c0"><span class="c1">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c2 c0"><span class="c1 c5">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">{</span></p><p class="c0"><span class="c1">&nbsp; &quot;operations&quot; : [</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot;] },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; { &quot;unary&quot; : [&quot;not&quot;] }</span></p><p class="c0"><span class="c1">&nbsp; ],</span></p><p class="c0"><span class="c1">&nbsp; &quot;bits&quot; : [</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; 0, 1</span></p><p class="c0"><span class="c1">&nbsp; ]</span></p><p class="c0"><span class="c1">}</span></p><p class="c0 c4"><span class="c1 c5">{</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; &quot;operations&quot; : [</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot; ] },</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; &nbsp; { &quot;unary&quot; : [ &quot;not&quot; ] }</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; ],</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; &quot;bits&quot; : [</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; &nbsp; 0, 1</span></p><p class="c0 c4"><span class="c1 c5">&nbsp; ]</span></p><p class="c0 c4"><span class="c1 c5">}</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span>This works with objects, arrays (even nested), strings, numbers, booleans, null. </span><span class="c12">The exceptions to this rule (but we are working on it!) are that:</span></p><p class="c10 c0"><span class="c12">(i) if a pair has a true, false or null value, there must be a space on at least one side of the colon (this will be fixed).</span></p><p class="c10 c0"><span class="c12">(ii) empty objects are not recognized</span></p><p class="c10 c0"><span class="c12">(iii) characters escaped with the \ in JSON strings are not recognized</span></p><p class="c0 c3"><span class="c1 c17 c12"></span></p><p class="c10 c0"><span>It also works the other way round: if your query outputs an object or an array, you can readily use it as a JSON document.</span></p><p class="c0 c3"><span></span></p><p class="c10 c0"><span>JSONiq is a declarative language. This means that you only need to say </span><span class="c12">what</span><span>&nbsp;you want - the compiler will take care of the </span><span class="c12">how</span><span>. In the above queries, you are basically saying: I want to output this JSON content, and here it is.</span></p><h1 class="c0"><a name="h.1gal1zhyffu4"></a><span>JSONiq basics</span></h1><h2 class="c0"><a name="h.ncbxtez2z3rn"></a><span>The real JSONiq Hello, World!</span></h2><p class="c0"><span>Wondering what a hello world program looks like in JSONiq? Here it is:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">&quot;Hello, World!&quot;</span></p><p class="c2 c0"><span class="c1 c5">Hello, World!</span></p><p class="c0 c3"><span class="c1 c5"></span></p><p class="c0"><span>Not surprisingly, it outputs the string &quot;Hello, World!&quot;. Again, just say what you want and you will get it.</span></p><h2 class="c0"><a name="h.ifcjheuaxoqc"></a><span>Numbers and arithmetic operations</span></h2><p class="c10 c0"><span>Okay, so, now, you might be thinking: &quot;What is the use of this language if it just outputs what I put in?&quot; Of course, JSONiq can more than that. And still in a declarative way. Here is how it works with numbers:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">2 + 2</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span>will surprisingly output:</span></p><p class="c2 c0"><span class="c1 c5">4</span></p><p class="c0 c3"><span></span></p><p class="c0"><span>whereas</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">(38 + 2) div 2 + 11 * 2</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span>will output</span></p><p class="c2 c0"><span class="c1 c5">42</span></p><p class="c0 c3"><span class="c1 c5"></span></p><p class="c10 c0"><span>(mind the division operator which is the &quot;div&quot; keyword. The slash has other semantics).</span></p><p class="c0 c3"><span></span></p><p class="c0"><span>Like JSON, JSONiq works with decimals, too:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">6.022e23 * 42</span></p><p class="c2 c0"><span class="c1 c5">2.52924E25</span></p><h2 class="c0"><a name="h.jmbc6c1fqqwx"></a><span>Logical operations</span></h2><p class="c10 c0"><span>JSONiq supports boolean operations.</span></p><p class="c10 c0 c3"><span></span></p><p class="c0"><span class="c1">true and false</span></p><p class="c2 c0"><span class="c1 c5">false</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span class="c1">(true or false) and (false or true)</span></p><p class="c2 c0"><span class="c1 c5">true</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span>The unary not is a function (yes, JSONiq has functions, and they are in the same way as in many languages):</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">not(true)</span></p><p class="c0 c2"><span class="c1 c5">false</span></p><h2 class="c0"><a name="h.iq1ixg5ywx0r"></a><span>Strings</span></h2><p class="c0"><span>JSONiq is capable of manipulating strings as well, using functions:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">concat(&quot;Hello &quot;, &quot;Captain Kirk&quot;)</span></p><p class="c2 c0"><span class="c1 c5">Hello Captain Kirk</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span class="c1">substring(&quot;Mister Spock&quot;, 8, 5)</span></p><p class="c2 c0"><span class="c1 c5">Spock</span></p><p class="c2 c0 c3"><span class="c5"></span></p><p class="c10 c0"><span>JSONiq comes up with a rich string function library out of the box inherited from its base language. These functions are listed </span><span class="c11"><a class="c8" href="http://www.w3.org/TR/xpath-functions-30/#string-functions";>here</a></span><span>&nbsp;(actually, you will find even many more for numbers, etc.)</span></p><h2 class="c0"><a name="h.rv6w8p4wenfa"></a><span>Sequences</span></h2><p class="c0"><span>Until now, we only handled single values (an object, an array, a number, a string, a boolean). JSONiq supports sequences of values. You can build a sequence using commas:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span>1, 2, 3, 4, 5, 6, 7, 8, 9, 10</span></p><p class="c2 c0"><span class="c5">1 2 3 4 5 6 7 8 9 10</span></p><p class="c0 c3"><span class="c5"></span></p><p class="c0"><span class="c1">1, </span><span class="c1">true</span><span class="c1">, 4.2e1, &quot;Life&quot;</span></p><p class="c2 c0"><span class="c1 c5">1 true 42 Life</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">{ &quot;Question&quot; : &quot;Ultimate&quot; }, [&quot;Life&quot;, &quot;The universe&quot;, &quot;and everything&quot;]</span></p><p class="c2 c0 c3"><span class="c1"></span></p><p class="c2 c0"><span class="c1 c5">{ &quot;Question&quot; : &quot;Ultimate&quot; }[ &quot;Life&quot;, &quot;The universe&quot;, &quot;and everything&quot; ]</span></p><p class="c2 c0 c3"><span class="c1"></span></p><p class="c0"><span>The &quot;to&quot; operator is very convenient, too:</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">1 to 100</span></p><p class="c2 c0"><span class="c5">1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20</span></p><p class="c2 c0"><span class="c5">21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40</span></p><p class="c2 c0"><span class="c5">41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60</span></p><p class="c2 c0"><span class="c5">61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80</span></p><p class="c2 c0"><span class="c5">81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100</span></p><p class="c0 c3"><span></span></p><p class="c0"><span>Some functions even work on sequences:</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">sum(1 to 100)</span></p><p class="c2 c0"><span class="c1 c5">5050</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span class="c1">string-join((&quot;These&quot;, &quot;are&quot;, &quot;some&quot;, &quot;words&quot;), &quot;-&quot;)</span></p><p class="c2 c0"><span class="c1 c5">These-are-some-words</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span class="c1">count(10 to 20)</span></p><p class="c2 c0"><span class="c1 c5">11</span></p><p class="c0 c3"><span class="c1 c5"></span></p><p class="c0"><span class="c1">avg(1 to 100)</span></p><p class="c2 c0"><span class="c1 c5">50.5</span></p><h1 class="c0"><a name="h.7x2r8sj1zjwe"></a><span>A bit more in depth</span></h1><h2 class="c0"><a name="h.b6c9zq9um8cu"></a><span>Variables</span></h2><p class="c0"><span>You can bind a sequence of values to a (dollar-prefixed) variable, like so:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">let $x := &quot;Bearing 3 1 4 Mark 5. &quot;</span></p><p class="c0"><span class="c1">return concat($x, &quot;Engage!&quot;)</span></p><p class="c2 c0"><span class="c1 c5">Bearing 3 1 4 Mark 5. Engage!</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c2 c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">let $x := (&quot;Kirk&quot;, &quot;Picard&quot;, &quot;Sisko&quot;)</span></p><p class="c0"><span class="c1">return string-join($x, &quot; and &quot;)</span></p><p class="c2 c0"><span class="c1 c5">Kirk and Picard and Sisko</span></p><p class="c0 c3"><span class="c1 c5"></span></p><p class="c0"><span>You can bind as many variables as you want:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">let $x := 1</span></p><p class="c0"><span class="c1">let $y := $x * 2</span></p><p class="c0"><span class="c1">let $z := $y + $x</span></p><p class="c0"><span class="c1">return [$x, $y, $z]</span></p><p class="c2 c0"><span class="c1 c5">[ 1, 2, 3 ]</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span>and even reuse the same name:</span></p><p class="c0"><span class="c1">let $x := 1</span></p><p class="c0"><span class="c1">let $x := $x + 2</span></p><p class="c0"><span class="c1">let $x := $x + 3</span></p><p class="c0"><span class="c1">return $x</span></p><p class="c2 c0"><span class="c1 c5">6</span></p><h2 class="c0"><a name="h.92ak2udyfghp"></a><span>Iteration</span></h2><p class="c10 c0"><span>In a way very similar to let, you can iterate over a sequence of values with the &quot;for&quot; keyword. Instead of binding the entire sequence of the variable, it will bind each value of the sequence in turn to this variable.</span></p><p class="c10 c0 c3"><span></span></p><p class="c10 c0"><span class="c1">for $i in 1 to 10</span></p><p class="c10 c0"><span class="c1">return $i * 2</span></p><p class="c2 c0"><span class="c1 c5">2 4 6 8 10 12 14 16 18 20</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span>More interestingly, you can combine fors and lets like so:</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">let $sequence := 1 to 10</span></p><p class="c0"><span class="c1">for $value in $sequence</span></p><p class="c0"><span class="c1">let $square := $value * 2</span></p><p class="c0"><span class="c1">return $square</span></p><p class="c2 c0"><span class="c1 c5">2 4 6 8 10 12 14 16 18 20</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span>and even filter out some values:</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">let $sequence := 1 to 10</span></p><p class="c0"><span class="c1">for $value in $sequence</span></p><p class="c0"><span class="c1">let $square := $value * 2</span></p><p class="c0"><span class="c1">where $square &lt; 10</span></p><p class="c0"><span class="c1">return $square</span></p><p class="c2 c0"><span class="c1 c5">2 4 6 8</span></p><h2 class="c0"><a name="h.zdhx60a5duyu"></a><span>Conditions</span></h2><p class="c0"><span>You can make the output depend on a condition with an if-then-else construct:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">for $x in 1 to 10</span></p><p class="c0"><span class="c1">return if ($x &lt; 5) then $x</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else -$x</span></p><p class="c2 c0"><span class="c1 c5">1 2 3 4 -5 -6 -7 -8 -9 -10</span></p><h2 class="c0"><a name="h.ccs6lkxiixw4"></a><span>Composability of Expressions</span></h2><p class="c0"><span>Now that you know of a couple of elementary JSONiq expressions, you can combine then in more elaborate expressions. For example, you can put any sequence of values in an array:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">[ 1 to 10 ]</span></p><p class="c2 c0"><span class="c1 c5">[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span>Or you can dynamically compute the value of object pairs:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">{</span></p><p class="c0"><span class="c1">&nbsp; &quot;Greeting&quot; : (let $d := &quot;Mister Spock&quot;</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return concat(&quot;Hello, &quot;, $d)),</span></p><p class="c0"><span class="c1">&nbsp; &quot;Farewell&quot; : string-join((&quot;Live&quot;, &quot;long&quot;, &quot;and&quot;, &quot;prosper&quot;),</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot; &quot;)</span></p><p class="c0"><span class="c1">}</span></p><p class="c0 c3"><span class="c1 c5"></span></p><p class="c2 c0"><span class="c1 c5">{ &quot;Greeting&quot; : &quot;Hello, Mister Spock&quot;, &quot;Farewell&quot; : &quot;Live long and prosper&quot; }</span></p><p class="c0 c3"><span class="c5"></span></p><p class="c0"><span>You can also dynamically generate pairs:</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">concat(&quot;Integer &quot;, 2) : 2 * 2</span></p><p class="c2 c0"><span class="c1 c5">&quot;Integer 2&quot; : 4</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span>and then wrap lots of them in an object:</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">{</span></p><p class="c0"><span class="c1">&nbsp; for $i in 1 to 10</span></p><p class="c0"><span class="c1">&nbsp; return concat(&quot;Square of &quot;, $i) : $i * $i</span></p><p class="c0"><span class="c1">}</span></p><p class="c0 c4"><span class="c1 c5">{</span></p><p class="c0 c4"><span class="c1 c5">&quot;Square of 1&quot; : 1,</span></p><p class="c0 c4"><span class="c1 c5">&quot;Square of 2&quot; : 4,</span></p><p class="c0 c4"><span class="c1 c5">&quot;Square of 3&quot; : 9,</span></p><p class="c0 c4"><span class="c1 c5">&quot;Square of 4&quot; : 16,</span></p><p class="c0 c4"><span class="c1 c5">&quot;Square of 5&quot; : 25,</span></p><p class="c0 c4"><span class="c1 c5">&quot;Square of 6&quot; : 36,</span></p><p class="c0 c4"><span class="c1 c5">&quot;Square of 7&quot; : 49,</span></p><p class="c0 c4"><span class="c1 c5">&quot;Square of 8&quot; : 64,</span></p><p class="c0 c4"><span class="c1 c5">&quot;Square of 9&quot; : 81,</span></p><p class="c0 c4"><span class="c1 c5">&quot;Square of 10&quot; : 100</span></p><p class="c0 c4"><span class="c1 c5">}</span></p><h1 class="c0"><a name="h.mjv7kyjurri2"></a><span>JSON Navigation</span></h1><p class="c10 c0"><span>Up to now, you learnt how to compose expressions so as to do some computations and to build pairs, objects and arrays. It also works the other way round: if you have some JSON data, you can access it and navigate.</span></p><p class="c10 c0 c3"><span></span></p><p class="c0 c10"><span>All you need to know is: JSONiq views</span></p><ol class="c13" start="1"><li class="c10 c6 c0 c14"><span>an array as a sequence of values,</span></li><li class="c10 c6 c0 c14"><span>an object as a set of name/value pairs (we call them just: pairs)</span></li><li class="c10 c6 c0 c14"><span>a pair as a (name, value) tuple.</span></li></ol><h2 class="c10 c0"><a name="h.xosiyb17dh24"></a><span>Objects</span></h2><p class="c10 c0"><span>If you use an object as a functor and provide it with a string, it will return the pair named after its parameter:</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">let $person := {</span></p><p class="c0"><span class="c1">&nbsp; &quot;first name&quot; : &quot;Sarah&quot;,</span></p><p class="c0"><span class="c1">&nbsp; &quot;age&quot; : 13,</span></p><p class="c0"><span class="c1">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c0"><span class="c1">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c0"><span class="c1">}</span></p><p class="c0"><span class="c1">return $person(&quot;first name&quot;)</span></p><p class="c2 c0"><span class="c1 c5">&quot;first name&quot; : &quot;Sarah&quot;</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><h2 class="c0"><a name="h.mrf42gizl3y6"></a><span>Arrays</span></h2><p class="c10 c0"><span>If you use an array as a functor and provide it with an integer, it will return the corresponding entry:</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c0"><span class="c1">let $friends := [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c0"><span class="c1">return $friends(2)</span></p><p class="c2 c0"><span class="c1 c5">Mary</span></p><h2 class="c0"><a name="h.hdc3dgohtdut"></a><span>Pairs</span></h2><p class="c0"><span>Given a pair, you can get its name and value using the functions jn:name and jn:value:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">let $pair := &quot;name of the pair&quot; : &quot;value of the pair&quot;</span></p><p class="c0"><span class="c1">return { &nbsp;&quot;name&quot; : jn:name($pair), &quot;value&quot; : jn:value($pair) }</span></p><p class="c0 c3"><span class="c1"></span></p><p class="c2 c0"><span class="c1 c5">{ &quot;name&quot; : &quot;name of the pair&quot;, &quot;value&quot; : &quot;value of the pair&quot; }</span></p><p class="c0 c3"><span class="c5"></span></p><p class="c0"><span>This functions also exist in plural form for objects:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">let $person := {</span></p><p class="c0"><span class="c1">&nbsp; &quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c0"><span class="c1">&nbsp; &quot;age&quot; : 13,</span></p><p class="c0"><span class="c1">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c0"><span class="c1">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c0"><span class="c1">}</span></p><p class="c0"><span class="c1">return { &quot;names&quot; : [ jn:names($person)],</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;values&quot; : [ jn:values($person)]</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &nbsp; &nbsp;}</span></p><p class="c0 c16"><span class="c1 c5">{</span></p><p class="c16 c0"><span class="c1 c5">&quot;names&quot; : [ &quot;name&quot;, &quot;age&quot;, &quot;gender&quot;, &quot;friends&quot; ],</span></p><p class="c16 c0"><span class="c1 c5">&quot;values&quot; : [ &quot;Sarah&quot;, 13, &quot;female&quot;, [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot; ] ]</span></p><p class="c16 c0"><span class="c1 c5">}</span></p><p class="c0"><span>jn:values can also be used for an array:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">let $person := {</span></p><p class="c0"><span class="c1">&nbsp; &quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c0"><span class="c1">&nbsp; &quot;age&quot; : 13,</span></p><p class="c0"><span class="c1">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c0"><span class="c1">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c0"><span class="c1">}</span></p><p class="c0"><span class="c1">return jn:values($person(&quot;friends&quot;))</span></p><p class="c2 c0"><span class="c5">[ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot; ]</span></p><p class="c2 c0 c3"><span class="c5"></span></p><h1 class="c0"><a name="h.eb0bxle2oykl"></a><span>Relational Algebra</span></h1><p class="c10 c0"><span>Remember last century&#39;s SELECT FROM WHERE statements? Well, JSONiq didn&#39;t throw out the baby with the bathwater. It has selection, projection and join capability.</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">let $stores :=</span></p><p class="c0"><span class="c1">[</span></p><p class="c0"><span class="c1">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c0"><span class="c1">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c0"><span class="c1">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c0"><span class="c1">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c0"><span class="c1">]</span></p><p class="c0"><span class="c1">let $sales := [</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c0"><span class="c1">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c0"><span class="c1">]</span></p><p class="c0"><span class="c1">let $join :=</span></p><p class="c0"><span class="c1">&nbsp; for $store in jn:values($stores), $sale in jn:values($sales)</span></p><p class="c0"><span class="c1">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c0"><span class="c1">&nbsp; return {</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c0"><span class="c1">&nbsp; }</span></p><p class="c0"><span class="c1">return [$join]</span></p><p class="c0 c4"><span class="c1 c5">[ </span></p><p class="c0 c4"><span class="c1 c5">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c0 c4"><span class="c1 c5">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c0 c4"><span class="c1 c5">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c0 c4"><span class="c1 c5">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c0 c4"><span class="c1 c5">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c0 c4"><span class="c1 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c0 c4"><span class="c1 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c0 c4"><span class="c1 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c0 c4"><span class="c1 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c0 c4"><span class="c1 c5">&nbsp;]</span></p><h1 class="c0"><a name="h.oii6pvliilhi"></a><span>Access external data</span></h1><p class="c0"><span>Our implementation even supports collections of JSON objects or arrays:</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">dml:collection(&quot;my:data&quot;)</span></p><p class="c2 c0"><span class="c1 c5">{ &quot;foo&quot; : &quot;Your&quot; }</span></p><p class="c2 c0"><span class="c1 c5">{ &quot;foo&quot; : &quot;Collection&quot; }</span></p><p class="c2 c0"><span class="c1 c5">{ &quot;foo&quot; : &quot;of&quot; }</span></p><p class="c2 c0"><span class="c1 c5">{ &quot;foo&quot; : &quot;JSON&quot; }</span></p><p class="c2 c0"><span class="c1 c5">{ &quot;foo&quot; : &quot;objects&quot; }</span></p><p class="c2 c0 c3"><span class="c1 c5"></span></p><p class="c0"><span>It is also possible to get JSON content with an HTTP request, or by parsing it from a string. Functions that handle this are available.</span></p><h1 class="c0"><a name="h.bm3buqmzhtko"></a><span>I want more</span></h1><p class="c10 c0"><span>JSONiq supports JSON updates. You can declaratively update your JSON data. JSONiq provides functions that produce a list of updates. The list of updates that is eventually output by your program is then applied to your JSON data.</span></p><p class="c0 c3"><span></span></p><p class="c0"><span class="c1">let $my-data := jn:json(&quot;persons.json&quot;)</span></p><p class="c0"><span class="c1">let $john := jn:value($my-data(&quot;John&quot;))</span></p><p class="c0"><span class="c1">let $mary := jn:value($my-data(&quot;Mary&quot;))</span></p><p class="c0"><span class="c1">return (jn:replace-value($john, &quot;status&quot;, &quot;married&quot;),</span></p><p class="c0"><span class="c1">&nbsp; &nbsp; &nbsp; &nbsp; jn:replace-value($mary, &quot;status&quot;, &quot;married&quot;))</span></p><h2 class="c0"><a name="h.5itcphr8262b"></a><span>Even more</span></h2><p class="c0"><span>JSONiq can do way more that what is presented here. Here are a couple of highlights:</span></p><p class="c10 c0"><span>- JSONiq is a strongly typed language, but is smart enough to not bother you with types when unnecessary. It potentially supports static typing as well to detect errors before you even execute your program.</span></p><p class="c0"><span>- You can define your own functions and modules.</span></p><p class="c0"><span>- JSONiq provides you with loads of available modules.</span></p><p class="c10 c0"><span>- JSONiq has tons of further features such as switch, typeswitch and try-catch expressions, universal/existential quantifiers, path expressions, filtering expressions, functors, mappings, grouping, windowing.</span></p><h2 class="c0"><a name="h.j7oh3cyhem38"></a><span>More is not enough</span></h2><p class="c10 c0"><span>- JSONiq supports XML. Yes: you can manipulate JSON and XML with the same language! JSONiq is actually a superset of XQuery, a W3C standard, and extends its data model to support JSON.</span></p><p class="c10 c0"><span>- JSONiq supports scripting. If you need to write a full-fledged, side-effecting Web application, scripting is for you.</span></p></body></html>
\ No newline at end of file

=== modified file 'doc/zorba/indexpage.dox.in'
--- doc/zorba/indexpage.dox.in	2012-05-03 12:31:51 +0000
+++ doc/zorba/indexpage.dox.in	2012-05-15 14:37:23 +0000
@@ -55,6 +55,8 @@
   - \ref xqddf
   - <a href="scripting_spec.html">XQuery Scripting Extension</a> (also see our \ref scripting_tutorial "Tutorial")
   - \ref options_and_annotations
+  - <a href="XQueryforJSON.html">JSONiq for JSON users</a>
+  - <a href="JSONforXQuery.html">JSONiq for XQuery users</a>
 
 \section tutorials Tutorials
   - \ref web_crawler_tutorial

=== modified file 'include/zorba/config.h.cmake'
--- include/zorba/config.h.cmake	2012-05-03 12:31:51 +0000
+++ include/zorba/config.h.cmake	2012-05-15 14:37:23 +0000
@@ -157,6 +157,7 @@
 #cmakedefine ZORBA_WITH_BIG_INTEGER
 #cmakedefine ZORBA_WITH_DEBUGGER
 #cmakedefine ZORBA_WITH_FILE_ACCESS
+// #cmakedefine ZORBA_WITH_JSON
 #cmakedefine ZORBA_WITH_LIBXML2_SAX
 
 // Zorba parser configuration

=== modified file 'include/zorba/diagnostic.h'
--- include/zorba/diagnostic.h	2012-05-03 12:31:51 +0000
+++ include/zorba/diagnostic.h	2012-05-15 14:37:23 +0000
@@ -242,7 +242,12 @@
   ZORBA_STORE,
 
   JSON_PARSER,
-  JSON_SERIALIZATION
+  JSON_SERIALIZATION,
+
+# ifdef ZORBA_WITH_JSON
+  JSONIQ_CORE,
+  JSONIQ_UPDATE
+# endif
 };
 
 /**

=== modified file 'include/zorba/error.h'
--- include/zorba/error.h	2012-05-03 12:31:51 +0000
+++ include/zorba/error.h	2012-05-15 14:37:23 +0000
@@ -42,6 +42,13 @@
  */
 typedef internal::SystemDiagnostic<internal::ZorbaErrQName> ZorbaErrorCode;
 
+#ifdef ZORBA_WITH_JSON
+/**
+ * An %JSONiqErrorCode is a diagnostic for all JSONiq-specific errors.
+ */
+typedef internal::SystemDiagnostic<internal::JSONiqErrQName> JSONiqErrorCode;
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 
 /**

=== modified file 'include/zorba/identtypes.h'
--- include/zorba/identtypes.h	2012-05-03 12:31:51 +0000
+++ include/zorba/identtypes.h	2012-05-15 14:37:23 +0000
@@ -19,10 +19,14 @@
 #include <zorba/config.h>
 #include <iostream>
 
-namespace zorba {
-class ZORBA_DLL_PUBLIC IdentTypes {
+namespace zorba 
+{
+
+class ZORBA_DLL_PUBLIC IdentTypes 
+{
 public:
-  typedef enum {
+  typedef enum 
+  {
     NAMED_TYPE,     // builtin atomic type
     ELEMENT_TYPE,
     ATTRIBUTE_TYPE,
@@ -31,6 +35,13 @@
     TEXT_TYPE,
     COMMENT_TYPE,
     ANY_NODE_TYPE, // node()
+#ifdef ZORBA_WITH_JSON
+    STRUCTURED_ITEM_TYPE,
+    JSON_ITEM_TYPE,
+    JSON_OBJECT_TYPE,
+    JSON_ARRAY_TYPE,
+    JSON_PAIR_TYPE,
+#endif
     ITEM_TYPE,     // item()
     EMPTY_TYPE,    // empty-sequence()
     SCHEMA_ELEMENT_TYPE,
@@ -40,7 +51,8 @@
   
   static char const *const kind_string_of[];
 
-  typedef enum {
+  typedef enum 
+  {
     QUANT_ONE,
     QUANT_QUESTION,
     QUANT_PLUS,

=== modified file 'include/zorba/internal/qname.h'
--- include/zorba/internal/qname.h	2012-05-03 12:31:51 +0000
+++ include/zorba/internal/qname.h	2012-05-15 14:37:23 +0000
@@ -182,6 +182,46 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
+#ifdef ZORBA_WITH_JSON
+
+/**
+ * An %JSONiqErrQName is-a FixedQName for standard JSONiq errors.
+ */
+class ZORBA_DLL_PUBLIC JSONiqErrQName :
+  public FixedQName<JSONiqErrQName,char const*>
+{
+  typedef FixedQName<JSONiqErrQName,char const*> base_type;
+public:
+  static char const NAMESPACE[];
+  static char const PREFIX[];
+
+  /**
+   * Constructs an %JSONiqErrQName.
+   *
+   * @param localname The local-name of the error.
+   */
+  JSONiqErrQName( char const *localname ) : base_type( localname ) { }
+
+  /**
+   * Gets the category of error this QName represents.
+   *
+   * @return Returns UNKNOWN_CATEGORY as there currently
+   *         are no categories for JSONiq errors
+   */
+  zorba::diagnostic::category category() const;
+
+  /**
+   * Gets the kind of error this QName represents.
+   *
+   * @return Returns said kind.
+   */
+  zorba::diagnostic::kind kind() const;
+};
+
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+
 /**
  * An %ZorbaWarningQName is-a FixedQName for Zorba warnings.
  */

=== modified file 'include/zorba/item.h'
--- include/zorba/item.h	2012-05-03 12:31:51 +0000
+++ include/zorba/item.h	2012-05-15 14:37:23 +0000
@@ -147,6 +147,21 @@
   Item
   getType() const;
 
+#ifdef ZORBA_WITH_JSON
+
+  /**
+   * \brief Check if the Item is a JSON Item, that is, part of the JSONiq
+   * data model.
+   *
+   * Note that this function is available for all types of Items.
+   *
+   * @return true if the Item is a JSON Item, false otherwise.
+   */
+  bool
+  isJSONItem() const;
+
+#endif /* ZORBA_WITH_JSON */
+
   /** \brief Get the atomization value of the Item.
    *
    * The atomization value is the value that is returned by atomization 
@@ -351,6 +366,53 @@
   int
   getNodeKind() const;
 
+#ifdef ZORBA_WITH_JSON
+
+  /** \brief Get the kind of this (JSON) Item.
+   *
+   * Note that this function is only available for JSON Items, that is, Items
+   * which return true from isJSONItem().
+   *
+   * @return the kind of this JSON item
+   * @throw ZorbaException if an error occured (e.g. the Item is not of type JSON).
+   */
+  store::StoreConsts::JSONItemKind
+  getJSONItemKind() const;
+
+  /** \brief Get the members of a JSON Array.
+   *
+   * Note that this function is only available for JSON Arrays.
+   *
+   * @return Iterator over the members of this array.
+   * @throw ZorbaException if an error occure (e.g. the Item is not of type JSON Array).
+   */
+  Iterator_t
+  getArrayMembers() const;
+
+  /** \brief Returns the value with the given name from a JSON Object.
+   *
+   * Note that this function is only available for JSON Objects.
+   *
+   * @param aName the name of the value in the Object to return.
+   * @return Item the named value from the Object.
+   * @throw ZorbaException if an error occured (e.g. the Item is not of type JSON Object).
+   */
+  Item
+  getObjectValue(String aName) const;
+
+  /** \brief Returns the item in the JSON array at the specified index.
+   *
+   * Note that this function is only available for JSON Arrays.
+   *
+   * @param aIndex the index in the array.
+   * @return Item the indexed Item.
+   * @throw ZorbaException if an error occured (e.g. the Item is not of type JSON Array).
+   */
+  Item
+  getArrayMember(uint32_t aIndex) const;
+
+#endif /* ZORBA_WITH_JSON */
+
   /**
    * Checks whether the item's content is streamable.
    *

=== modified file 'include/zorba/item_factory.h'
--- include/zorba/item_factory.h	2012-05-03 12:31:51 +0000
+++ include/zorba/item_factory.h	2012-05-15 14:37:23 +0000
@@ -123,7 +123,7 @@
       /** \brief Creates a Base64Binary Item
        *         see [http://www.w3.org/TR/xmlschema-2/#base64Binary]
        *
-       * @param aBinData a pointer to the base64 binary data.
+       * @param aBinData a pointer to the base6c4 binary data.
        * @param aLength the length of the base64 binary data.
        * @return The Base64Binary Item.
        */
@@ -698,6 +698,40 @@
         Item   parent,
         String content) = 0;
 
+#ifdef ZORBA_WITH_JSON
+
+      /**
+       * Create a JSON null item.
+       */
+      virtual Item createJSONNull() = 0;
+
+      /**
+       * Create a JSON Number item from a string. This will actually be
+       * an xs:integer, xs:double, or xs:decimal, depending on the content
+       * of the string.
+       *
+       * @param aString The input string.
+       */
+      virtual Item createJSONNumber(String aString) = 0;
+
+      /**
+       * Create a JSON Object containing the specified JSON Pairs.
+       *
+       * @param aNames A vector containing the name and value of each pair.
+       */
+      virtual Item createJSONObject(std::vector<std::pair<Item, Item> >& aNames) = 0;
+      
+      /**
+       * Create a JSON Array containing the specified items.
+       *
+       * @param aItems A std::vector<Item> containing Items which may
+       * be stored in a JSON Array (namely JSON Arrays, JSON Objects,
+       * JSON nulls, valid JSON numeric types, or xs:strings).
+       */
+      virtual Item createJSONArray(std::vector<Item>& aItems) = 0;
+
+#endif /* ZORBA_WITH_JSON */
+
       /**
       * @brief Assigns a simple typed value to an element node.
       *

=== modified file 'include/zorba/options.h'
--- include/zorba/options.h	2012-05-03 12:31:51 +0000
+++ include/zorba/options.h	2012-05-15 14:37:23 +0000
@@ -83,7 +83,11 @@
   ZORBA_SERIALIZATION_METHOD_HTML,
   ZORBA_SERIALIZATION_METHOD_XHTML,
   ZORBA_SERIALIZATION_METHOD_TEXT,
-  ZORBA_SERIALIZATION_METHOD_BINARY
+  ZORBA_SERIALIZATION_METHOD_BINARY,
+#ifdef ZORBA_WITH_JSON
+  ZORBA_SERIALIZATION_METHOD_JSON,
+  ZORBA_SERIALIZATION_METHOD_JSONIQ
+#endif
 } Zorba_serialization_method_t;
 
 
@@ -149,6 +153,18 @@
   DONT_SAVE_UNUSED_FUNCTIONS = 0,
   SAVE_UNUSED_FUNCTIONS = 1
 } Zorba_save_plan_options_t;
+
+typedef enum {
+  CLOUDSCRIPT_EXTENSIONS_YES,
+  CLOUDSCRIPT_EXTENSIONS_NO
+} Zorba_cloudscript_extensions_t;
+
+typedef enum {
+  CLOUDSCRIPT_MULTIPLE_ITEMS_NO,
+  CLOUDSCRIPT_MULTIPLE_ITEMS_ARRAY,
+  CLOUDSCRIPT_MULTIPLE_ITEMS_APPENDED
+} Zorba_cloudscript_multiple_items_t;
+
 /** \brief Options that configure the serialization process of a query result.
 *         See http://www.w3.org/TR/2005/CR-xslt-xquery-serialization-20051103/.
 *
@@ -178,6 +194,11 @@
   zorba::String                 cdata_section_elements;
   zorba::String                 version;
 
+#ifdef ZORBA_WITH_JSON
+  Zorba_cloudscript_extensions_t cloudscript_extensions;
+  Zorba_cloudscript_multiple_items_t cloudscript_multiple_items;
+  Zorba_serialization_method_t   cloudscript_xdm_method;
+#endif /* ZORBA_WITH_JSON */
 
   /** \brief Default constructor for SerializerOptions which assigns default values to all
    *         options (C++ only).

=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h	2012-05-13 15:33:57 +0000
+++ include/zorba/pregenerated/diagnostic_list.h	2012-05-15 14:37:23 +0000
@@ -512,6 +512,10 @@
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0042_ITERATOR_CLOSED;
 
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0043_CANNOT_SERIALIZE_JSON_ITEM;
+
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0045_CANNOT_SERIALIZE_MIXED_XDM_JDM;
+
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0070_INVALID_SERIALIZATION_METHOD_FOR_SAX;
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0080_CANNOT_RETRIEVE_NODE_REFERENCE;
@@ -720,6 +724,8 @@
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZSTR0012_COLLECTION_ITEM_MUST_BE_A_NODE;
 
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZSTR0013_COLLECTION_ITEM_MUST_BE_STRUCTURED;
+
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZSTR0015_IC_ALREADY_EXISTS;
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZSTR0016_IC_DOES_NOT_EXIST;
@@ -802,6 +808,56 @@
 
 } // namespace zerr
 
+namespace jerr {
+
+#if defined(ZORBA_WITH_JSON)
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNSE0012;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNSE0013;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNSE0014;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNTY0002;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNTY0003;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNTY0004;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNTY0007;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNTY0011;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNDY0003;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JSDY0040;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0005;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0006;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0007;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0008;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0009;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0010;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0011;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0012;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0018;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0020;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0021;
+
+extern ZORBA_DLL_PUBLIC JSONiqErrorCode JNUP0022;
+#endif
+
+} // namespace jerr
+
 namespace zwarn {
 
 extern ZORBA_DLL_PUBLIC ZorbaWarningCode ZWST0002_UNKNOWN_ANNOTATION;

=== modified file 'include/zorba/store_consts.h'
--- include/zorba/store_consts.h	2012-05-03 12:31:51 +0000
+++ include/zorba/store_consts.h	2012-05-15 14:37:23 +0000
@@ -82,6 +82,8 @@
 
   XS_QNAME                 = 43,
   XS_NOTATION              = 44,
+  
+  JDM_NULL                 = 45,
 
   XS_LAST
 };
@@ -90,6 +92,13 @@
 {
  public:
 
+  enum NsScoping 
+  {
+    ALL_NAMESPACES,
+    ONLY_LOCAL_NAMESPACES,
+    ONLY_PARENT_NAMESPACES
+  };
+
   enum NodeKind
   {
     anyNode        = 0,
@@ -101,16 +110,10 @@
     commentNode    = 6
   };
 
-  enum NsScoping 
-  {
-    ALL_NAMESPACES,
-    ONLY_LOCAL_NAMESPACES,
-    ONLY_PARENT_NAMESPACES
-  };
-
   static std::string toString(NodeKind k)
   {
-    switch(k) {
+    switch(k) 
+    {
       case anyNode:
         return "anyNode";
 
@@ -136,6 +139,39 @@
         return "<unknown NodeKind>";
     }
   }
+
+
+  /* ATTENTION: the ordering of the enum values is important. Do NOT change it! */
+  enum JSONItemKind
+  {
+    jsonItem       = 0,
+    jsonObject     = 1,
+    jsonArray      = 2,
+    jsonPair       = 3
+  };
+
+
+  static std::string toString(JSONItemKind k)
+  {
+    switch(k) 
+    {
+      case jsonItem:
+        return "json-item";
+
+      case jsonObject:
+        return "object";
+
+      case jsonArray:
+        return "array";
+
+      case jsonPair:
+        return "pair";
+
+      default:
+        return "<unknown JSONItemKind>";
+    }
+  }
+ 
 };
 
 } // namespace store

=== modified file 'include/zorba/typeident.h'
--- include/zorba/typeident.h	2012-05-03 12:31:51 +0000
+++ include/zorba/typeident.h	2012-05-15 14:37:23 +0000
@@ -65,45 +65,55 @@
         const String& localName,
         bool localNameWildcard,
         TypeIdentifier_t contentType,
-        IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
-        );
+        IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
 
     static
     TypeIdentifier_t
     createDocumentType(
         TypeIdentifier_t contentType,
-        IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
-        );
-
-    static
-    TypeIdentifier_t
-    createPIType(
-        IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
-        );
-
-    static
-    TypeIdentifier_t
-    createTextType(
-        IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
-        );
-
-    static
-    TypeIdentifier_t
-    createCommentType(
-        IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
-        );
-
-    static
-    TypeIdentifier_t
-    createAnyNodeType(
-        IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
-        );
-
-    static
-    TypeIdentifier_t
-    createItemType(
-        IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
-        );
+        IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
+
+    static
+    TypeIdentifier_t
+    createPIType(IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
+
+    static
+    TypeIdentifier_t
+    createTextType(IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
+
+    static
+    TypeIdentifier_t
+    createCommentType(IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
+
+    static
+    TypeIdentifier_t
+    createAnyNodeType(IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
+
+#ifdef ZORBA_WITH_JSON
+    static
+    TypeIdentifier_t
+    createStructuredItemType(IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
+
+    static
+    TypeIdentifier_t
+    createJSONItemType(IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
+
+    static
+    TypeIdentifier_t
+    createJSONObjectType(IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
+
+    static
+    TypeIdentifier_t
+    createJSONArrayType(IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
+
+    static
+    TypeIdentifier_t
+    createJSONPairType(IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
+#endif
+
+    static
+    TypeIdentifier_t
+    createItemType(IdentTypes::quantifier_t q = IdentTypes::QUANT_ONE);
 
     static
     TypeIdentifier_t

=== modified file 'modules/com/zorba-xquery/www/modules/pregenerated/errors.xq'
--- modules/com/zorba-xquery/www/modules/pregenerated/errors.xq	2012-05-13 15:33:57 +0000
+++ modules/com/zorba-xquery/www/modules/pregenerated/errors.xq	2012-05-15 14:37:23 +0000
@@ -314,6 +314,14 @@
 
 (:~
 :)
+declare variable $zerr:ZAPI0043 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0043");
+
+(:~
+:)
+declare variable $zerr:ZAPI0045 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0045");
+
+(:~
+:)
 declare variable $zerr:ZAPI0070 as xs:QName := fn:QName($zerr:NS, "zerr:ZAPI0070");
 
 (:~
@@ -725,6 +733,10 @@
 
 (:~
 :)
+declare variable $zerr:ZSTR0013 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0013");
+
+(:~
+:)
 declare variable $zerr:ZSTR0015 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0015");
 
 (:~

=== modified file 'modules/com/zorba-xquery/www/modules/store/dynamic/collections/ddl.xq'
--- modules/com/zorba-xquery/www/modules/store/dynamic/collections/ddl.xq	2012-05-03 12:31:51 +0000
+++ modules/com/zorba-xquery/www/modules/store/dynamic/collections/ddl.xq	2012-05-15 14:37:23 +0000
@@ -41,25 +41,6 @@
 
 
 (:~
- : The function returns true if a collection with the given QName is available.
- :
- : @param $name The QName of the collection that is being checked.
- :
- : @return true if the collection is available and false otherwise.
- :
- :)
-declare function ddl:is-available-collection($name as xs:QName) as xs:boolean external;
-
-(:~
- : The function returns a sequence of QNames of the collections that are
- : available. The sequence will be empty if there are no collections.
- :
- : @return A sequence of QNames, one for each available collection, or an emtpy sequence.
- :
- :)
-declare function ddl:available-collections() as xs:QName* external;
-
-(:~
  : The create function is an updating function which creates
  : the collection with the given expanded QName.
  :
@@ -75,17 +56,19 @@
  :)
 declare updating function ddl:create($name as xs:QName) external;
 
+
 (:~
  : The create function is an updating function which creates
  : the collection with the given expanded QName. Moreover, it adds copies
  : of the sequence $content to the new collection.
  :
  : @param $name The QName of the collection to create.
- : @param $content The sequences of nodes that should be added to the new collection.
+ : @param $content The sequences of items (nodes and/or json items) that should
+ :        be added to the new collection.
  :
  : @return The result of the function is an empty XDM instance and a 
  :         pending update list which, once applied, creates a collection
- :         with the given name and inserts the given nodes into it.
+ :         with the given name and inserts the given items into it.
  :
  : @error zerr:ZDDY0002 if a collection with the given expanded QName already
  :        exists.
@@ -94,9 +77,7 @@
  : @see ddl:insert-nodes-last
  :
  :)
-declare updating function ddl:create(
-  $name as xs:QName,
-  $content as node()*) external;
+declare updating function ddl:create($name as xs:QName, $content as item()*) external;
 
 
 (:~
@@ -110,8 +91,29 @@
  :         name.
  :
  : @error zerr:ZDDY0003 if the collection with the given name does not exist.
- : @error zerr:ZDDY0015 if any of the in-scope variables references a node that
+ : @error zerr:ZDDY0015 if any of the in-scope variables references an item that
  :        belongs to the collection with QName $name.
  :
  :)
 declare updating function ddl:delete($coll as xs:QName) external;
+
+
+(:~
+ : The function returns true if a collection with the given QName is available.
+ :
+ : @param $name The QName of the collection that is being checked.
+ :
+ : @return true if the collection is available and false otherwise.
+ :
+ :)
+declare function ddl:is-available-collection($name as xs:QName) as xs:boolean external;
+
+
+(:~
+ : The function returns a sequence of QNames of the collections that are
+ : available. The sequence will be empty if there are no collections.
+ :
+ : @return A sequence of QNames, one for each available collection, or an emtpy sequence.
+ :
+ :)
+declare function ddl:available-collections() as xs:QName* external;

=== modified file 'modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq'
--- modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq	2012-05-03 12:31:51 +0000
+++ modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq	2012-05-15 14:37:23 +0000
@@ -17,7 +17,7 @@
 :)
 
 (:~
- : This modules provides a set of functions to modify a collection and retrieve the nodes
+ : This modules provides a set of functions to modify a collection and retrieve the items
  : contained in a particular collection.
  :
  : <p>Please refer to our documentation for <a href="../../html/data_lifecycle.html">
@@ -40,6 +40,7 @@
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
 declare option ver:module-version "2.0";
 
+
 (:~
  : The insert-nodes-first function is an updating function that inserts copies of the
  : given nodes at the beginning of the collection.
@@ -52,10 +53,29 @@
  :
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
  :
- :)
-declare updating function dml:insert-nodes-first(
-  $name as xs:QName,
-  $content as node()*) external;
+ : @deprecated please use the cdml:insert-first#2 function
+ :
+ :)
+declare updating function 
+dml:insert-nodes-first($name as xs:QName, $content as node()*) external;
+
+
+(:~
+ : The insert-first function is an updating function that inserts copies of the
+ : given items (nodes or json items) at the beginning of the collection.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is an empty XDM instance and a pending update
+ :         list which, once applied, inserts the items into the collection.
+ :
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ :
+ :)
+declare updating function 
+dml:insert-first($name as xs:QName, $content as item()*) external;
+
 
 (:~
  : The insert-nodes-last function is an updating function that inserts copies of the
@@ -69,10 +89,29 @@
  :
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
  :
- :)
-declare updating function dml:insert-nodes-last(
-  $name as xs:QName,
-  $content as node()*) external;
+ : @deprecated please use the cdml:insert-last#2 function
+ :
+ :)
+declare updating function 
+dml:insert-nodes-last($name as xs:QName, $content as node()*) external;
+
+
+(:~
+ : The insert-last function is an updating function that inserts copies of the
+ : given items (nodes or json items) at the end of the collection.
+ :
+ : @param $name The name of the collection to which the items should  be added.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is an empty XDM instance and a pending update list
+ :         which, once applied, inserts the items into the collection.
+ :
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ :
+ :)
+declare updating function 
+dml:insert-last($name as xs:QName, $content as item()*) external;
+
 
 (:~
  : The insert-nodes-before function is an updating function that inserts
@@ -90,13 +129,37 @@
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
  : @error zerr:ZDDY0011 if the target node is not contained in the collection.
  :
+ : @deprecated please use the cdml:insert-before#3 function
+ :
  :)
-declare updating function dml:insert-nodes-before(
+declare updating function 
+dml:insert-nodes-before(
   $name as xs:QName,
   $target as node(),
   $content as node()*) external;
 
 (:~
+ : The insert-before function is an updating function that inserts copies of
+ : the given items (nodes or json items) into a collection at the position 
+ : directly preceding the given target item.
+ :
+ : @param $name The name of the collection to which the items should  be added.
+ : @param $target The item in the collection before which the $content
+ :        sequence should be inserted.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is an empty XDM instance and a pending update list
+ :         which, once applied, inserts the items into the collection.
+ :
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0011 if the target item is not contained in the collection.
+ :
+ :)
+declare updating function 
+dml:insert-before($name as xs:QName, $target as item(), $content as item()*) external;
+
+
+(:~
  : The insert-nodes-after function is an updating function that inserts
  : copies of the given nodes into a collection at the position directly following the
  : given target node.
@@ -112,14 +175,39 @@
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
  : @error zerr:ZDDY0011 if the target node is not contained in the collection.
  :
+ : @deprecated please use the cdml:insert-after#3 function
+ :
  :)
-declare updating function dml:insert-nodes-after(
+declare updating function 
+dml:insert-nodes-after(
   $name as xs:QName,
   $pos as node(),
   $content as node()*) external;
 
-(:~
- : This function does the same as the insert-nodes function except
+
+(:~
+ : The insert-after function is an updating function that inserts copies of
+ : the given items (nodes and/or json items) into a collection at the position
+ : directly following the given target item.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $target The item in the collection after which the $content
+ :        sequence should be inserted.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is an empty XDM instance and a pending update list
+ :         which, once applied, inserts the items into the collection.
+ :
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0011 if the target node is not contained in the collection.
+ :
+ :)
+declare updating function 
+dml:insert-after($name as xs:QName, $pos as item(), $content as item()*) external;
+
+
+(:~
+ : This function does the same as the insert-nodes-first function except
  : it immediately applies the resulting pending updates and returns the
  : nodes that have been inserted.
  :
@@ -133,11 +221,34 @@
  :
  : @see dml:insert-nodes-first
  :
+ : @deprecated please use the cdml:apply-insert-first#2 function
+ :
  :)
-declare %an:sequential function dml:apply-insert-nodes-first(
+declare %an:sequential function 
+dml:apply-insert-nodes-first(
   $name as xs:QName,
   $content as node()*) as node()* external;
 
+
+(:~
+ : This function does the same as the insert-first function except it immediately
+ : applies the resulting pending updates and returns the items that have been inserted.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is the sequence of items that have been
+ :         inserted into the collection.
+ :
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ :
+ : @see dml:insert-first
+ :
+ :)
+declare %an:sequential function 
+dml:apply-insert-first($name as xs:QName, $content as item()*) as item()* external;
+
+
 (:~
  : This function does the same as the insert-nodes-last function except
  : it immediately applies the resulting pending updates and returns the
@@ -153,11 +264,35 @@
  :
  : @see dml:insert-nodes-last
  :
+ : @deprecated please use the cdml:apply-insert-last#2 function
+ :
  :)
 declare %an:sequential function dml:apply-insert-nodes-last(
   $name as xs:QName,
   $content as node()*) as node()* external;
 
+
+(:~
+ : This function does the same as the insert-last function except it immediately
+ : applies the resulting pending updates and returns the items that have been 
+ : inserted.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is the sequence of items that have been
+ :         inserted into the collection.
+ :
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ :
+ : @see dml:insert-last
+ :
+ :)
+declare %an:sequential function dml:apply-insert-last(
+  $name as xs:QName,
+  $content as item()*) as item()* external;
+
+
 (:~
  : This function does the same as the insert-nodes-before function except
  : it immediately applies the resulting pending updates and returns the
@@ -175,12 +310,41 @@
  :
  : @see dml:insert-nodes-before
  :
+ : @deprecated please use the cdml:apply-insert-before#3 function
+ :
  :)
-declare %an:sequential function dml:apply-insert-nodes-before(
+declare %an:sequential function 
+dml:apply-insert-nodes-before(
   $name as xs:QName,
   $target as node(),
   $content as node()*) as node()* external;
 
+
+(:~
+ : This function does the same as the insert-before function except it immediately
+ : applies the resulting pending updates and returns the items that have been 
+ : inserted.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $target The item in the collection before which the $content
+ :        sequence should be inserted.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is the sequence of items that have been
+ :         inserted into the collection.
+ :
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ :
+ : @see dml:insert-before
+ :
+ :)
+declare %an:sequential function 
+dml:apply-insert-before(
+  $name as xs:QName,
+  $target as item(),
+  $content as item()*) as item()* external;
+
+
 (:~
  : This function does the same as the insert-nodes-after function except
  : it immediately applies the resulting pending updates and returns the
@@ -198,12 +362,41 @@
  :
  : @see dml:insert-nodes-after
  :
+ : @deprecated please use the cdml:apply-insert-after#3 function
+ :
  :)
-declare %an:sequential function dml:apply-insert-nodes-after(
+declare %an:sequential function 
+dml:apply-insert-nodes-after(
   $name as xs:QName,
   $pos as node(),
   $content as node()*) as node()* external;
 
+
+(:~
+ : This function does the same as the insert-after function except it immediately
+ : applies the resulting pending updates and returns the items that have been 
+ : inserted.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $target The item in the collection after which the $content
+ :        sequence should be inserted.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is the sequence of items that have been
+ :         inserted into the collection.
+ :
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ :
+ : @see dml:insert-after
+ :
+ :)
+declare %an:sequential function 
+dml:apply-insert-after(
+  $name as xs:QName,
+  $pos as item(),
+  $content as item()*) as item()* external;
+
+
 (:~
  : The delete-nodes function is an updating function that deletes zero of more
  : nodes from a collection. 
@@ -213,11 +406,34 @@
  : @return The result of this function is an empty XDM instance and a pending update
  :         list which, once applied, deletes the nodes from their collections.
  :
- : @error zerr:ZDDY0011 if any nodes in the $target sequence is not a member of a collection
- :        or not all nodes of the $target sequence belong to the same collection.
- :
- :)
-declare updating function dml:delete-nodes($target as node()*) external;
+ : @error zerr:ZDDY0011 if any nodes in the $target sequence is not a member of
+ :        a collection or not all nodes of the $target sequence belong to the same
+ :        collection.
+ :
+ : @deprecated please use the cdml:delete#1 function
+ :
+ :)
+declare updating function 
+dml:delete-nodes($target as node()*) external;
+
+
+(:~
+ : The delete function is an updating function that deletes zero of more items
+ : (nodes and/or json items) from a collection. 
+ :
+ : @param $target the items in the collection that should be deleted.
+ :
+ : @return The result of this function is an empty XDM instance and a pending update
+ :         list which, once applied, deletes the items from their collections.
+ :
+ : @error zerr:ZDDY0011 if any item in the $target sequence is not a member of
+ :        a collection or not all items of the $target sequence belong to the
+ :        same collection.
+ :
+ :)
+declare updating function 
+dml:delete($target as item()*) external;
+
 
 (:~
  : The delete-node-first function is an updating function that deletes the
@@ -230,8 +446,28 @@
  :
  : @error zerr:ZDDY0011 if the collection doesn't contain any node.
  :
- :)
-declare updating function dml:delete-node-first($name as xs:QName) external;
+ : @deprecated please use the cdml:delete-first#1 function
+ :
+ :)
+declare updating function 
+dml:delete-node-first($name as xs:QName) external;
+
+
+(:~
+ : The delete-first function is an updating function that deletes the first item
+ : from a collection.
+ :
+ : @param $name The name of the collection from which the first item should be deleted.
+ :
+ : @return The result of this function is an empty XDM instance and a pending update
+ :         list which, once applied, deletes the first item from the collection.
+ :
+ : @error zerr:ZDDY0011 if the collection doesn't contain any item.
+ :
+ :)
+declare updating function 
+dml:delete-first($name as xs:QName) external;
+
 
 (:~
  : The delete-nodes-first function is an updating function that deletes the
@@ -246,16 +482,36 @@
  :
  : @error zerr:ZDDY0011 if the collection doesn't contain the given number of nodes.
  :
- :)
-declare updating function dml:delete-nodes-first(
-  $name as xs:QName,
-  $number as xs:integer) external;
+ : @deprecated please use the cdml:delete-first#2 function
+ :
+ :)
+declare updating function 
+dml:delete-nodes-first($name as xs:QName, $number as xs:integer) external;
+
+
+(:~
+ : The delete-first function is an updating function that deletes the first N
+ : items from a collection.
+ :
+ : @param $name The name of the collection from which the first N items should be deleted.
+ : @param $number The number N of items that should be removed from the beginning of
+ :        the collection.
+ :
+ : @return The result of this function is an empty XDM instance and a pending update
+ :         list which, once applied, deletes the items from the collection.
+ :
+ : @error zerr:ZDDY0011 if the collection doesn't contain the given number of items.
+ :
+ :)
+declare updating function 
+dml:delete-first($name as xs:QName, $number as xs:integer) external;
+
 
 (:~
  : The delete-node-last function is an updating function that deletes the
  : last node from a collection.
  :
- : @param $name The name of the collection from which the first node should be deleted.
+ : @param $name The name of the collection from which the last node should be deleted.
  :
  : @return The result of this function is an empty XDM instance and a pending update
  :         list which, once applied, deletes the last node from the collection.
@@ -264,8 +520,29 @@
  :        for the expanded QName $name.
  : @error zerr:ZDDY0011 if the collection doesn't contain any node.
  :
- :)
-declare updating function dml:delete-node-last($name as xs:QName) external;
+ : @deprecated please use the cdml:delete-last#1 function
+ :
+ :)
+declare updating function 
+dml:delete-node-last($name as xs:QName) external;
+
+
+(:~
+ : The delete-last function is an updating function that deletes the last item
+ : from a collection.
+ :
+ : @param $name The name of the collection from which the last item should be deleted.
+ :
+ : @return The result of this function is an empty XDM instance and a pending update
+ :         list which, once applied, deletes the last item from the collection.
+ :
+ : @error zerr:ZDDY0003 If available collections does not provide a mapping
+ :        for the expanded QName $name.
+ : @error zerr:ZDDY0011 if the collection doesn't contain any item.
+ :
+ :)
+declare updating function 
+dml:delete-last($name as xs:QName) external;
 
 
 (:~
@@ -282,10 +559,31 @@
  :        for the expanded QName $name.
  : @error zerr:ZDDY0011 if the collection doesn't contain the given number of nodes.
  :
- :)
-declare updating function dml:delete-nodes-last(
-  $name as xs:QName,
-  $number as xs:integer) external;
+ : @deprecated please use the cdml:delete-last#2 function
+ :
+ :)
+declare updating function 
+dml:delete-nodes-last($name as xs:QName, $number as xs:integer) external;
+
+
+(:~
+ : The delete-last function is an updating function that deletes the last N 
+ : items from an ordered collection.
+ :
+ : @param $name The name of the collection from which the lsat N items should be deleted.
+ : @param $number The number N of items to delete.
+ :
+ : @return The result of this function is an empty XDM instance and a pending update
+ :         list which, once applied, deletes the last N items.
+ :
+ : @error zerr:ZDDY0003 If available collections does not provide a mapping
+ :        for the expanded QName $name.
+ : @error zerr:ZDDY0011 if the collection doesn't contain the given number of items.
+ :
+ :)
+declare updating function 
+dml:delete-last($name as xs:QName, $number as xs:integer) external;
+
 
 (:~
  : The truncate function is an updating function that deletes the
@@ -300,21 +598,10 @@
  :)
 declare updating function dml:truncate($name as xs:QName) external;
 
-(:~
- : The index-of function return the index of the given node in the collection.
- :
- : @param $node The node to retrieve the index from.
- :
- : @return Returns the position as xs:integer of the given node in the collection.
- :
- : @error zerr:ZDDY0011 if node is not contained in any collection.
- :
- :)
-declare function dml:index-of($node as node()) as xs:integer external;
 
 (:~
- : The collection function returns the sequence of nodes of the collection
- : identified by the given name.
+ : The collection function returns the sequence of nodes and/or json items
+ : that belong to the collection identified by the given name.
  :
  : @param $name The name of the collection.
  :
@@ -324,17 +611,32 @@
  :        for the expanded QName $name.
  :
  :)
-declare function dml:collection($name as xs:QName) as node()* external;
+declare function dml:collection($name as xs:QName) as item()* external;
+
 
 (:~
- : This function returns the name of the collection the given node belongs
- : to.
+ : The collection-name function returns the name of the collection the given
+ : item (node or json item) belongs to.
  :
- : @param $node The node for which to get the name of the collection
+ : @param $item The item for which to get the name of the collection
  : @return The result of this function is a QName which identifies the collection
- :         to which the given node belongs to.
- :
- : @error zerr:ZDDY0011 if the given node does not belong to a collection.
- :
- :)
-declare function dml:collection-name($node as node()) as xs:QName external;
+ :         to which the given item belongs to.
+ :
+ : @error zerr:ZDDY0011 if the given item does not belong to a collection.
+ :
+ :)
+declare function dml:collection-name($item as item()) as xs:QName external;
+
+
+(:~
+ : The index-of function returns the position of the given item (node or 
+ : json item) within its containing the collection.
+ :
+ : @param $item The item to retrieve the index from.
+ :
+ : @return Returns the position as xs:integer of the given item in the collection.
+ :
+ : @error zerr:ZDDY0011 if the item is not contained in any collection.
+ :
+ :)
+declare function dml:index-of($item as item()) as xs:integer external;

=== modified file 'modules/com/zorba-xquery/www/modules/store/static/collections/ddl.xq'
--- modules/com/zorba-xquery/www/modules/store/static/collections/ddl.xq	2012-05-03 12:31:51 +0000
+++ modules/com/zorba-xquery/www/modules/store/static/collections/ddl.xq	2012-05-15 14:37:23 +0000
@@ -47,28 +47,6 @@
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
 declare option ver:module-version "2.0";
 
-(:~
- : The function returns true if a collection with the given QName is
- : statically declared and available (i.e. has been created).
- :
- : @param $name The QName of the collection that is being checked.
- :
- : @return true if the collection is statically declared and available,
- :   false otherwise.
- :
- :)
-declare function cddl:is-available-collection($name as xs:QName) as xs:boolean external;
-
-(:~
- : The function returns a sequence of QNames of the collections that are
- : statically declared and available. The sequence will be empty if there
- : are no such collections.
- :
- : @return A sequence of QNames, one for each statically declared and available
- :  collection, or an emtpy sequence.
- :
- :)
-declare function cddl:available-collections() as xs:QName*  external;
 
 (:~
  : The create function is an updating function which creates
@@ -88,17 +66,19 @@
  :)
 declare updating function cddl:create($name as xs:QName) external;
 
+
 (:~
  : The create function is an updating function which creates
  : the collection with the given expanded QName. Moreover, it adds copies
  : of the sequence $content to the new collection.
  :
  : @param $name The QName of the collection to create.
- : @param $content The sequences of nodes that should be added to the new collection.
+ : @param $content The sequences of items (nodes and/or json items) that should
+ :        be added to the new collection.
  :
  : @return The result of the function is an empty XDM instance and a 
  :         pending update list which, once applied, creates a collection
- :         with the given name and inserts the given nodes into it.
+ :         with the given name and inserts the given items into it.
  :
  : @error zerr:ZDDY0001 if the expanded QName $name is not equal
  :        to any of the declared collections in the static context.
@@ -109,9 +89,8 @@
  :        for SequenceType Matching.
  :
  :)
-declare updating function cddl:create(
-  $name as xs:QName,
-  $content as node()*)  external;
+declare updating function cddl:create($name as xs:QName, $content as item()*) external;
+
 
 (:~
  : The delete function is an updating function that deletes
@@ -127,14 +106,39 @@
  :        to any of the declared collections in the static context.
  : @error zerr:ZDDY0003 if the expanded QName $name is not equal
  :        to any of the available collections.
- : @error zerr:ZDDY0015 if any of the in-scope variables references a node that
+ : @error zerr:ZDDY0015 if any of the in-scope variables references an item that
  :        belongs to the collection with QName $name.
  : @error zerr:ZDDY0013 if the domain or key expression of any of the available
  :        indexes access the collection with name $name.
  :
  :)
-declare updating function cddl:delete(
-  $name as xs:QName)  external;
+declare updating function cddl:delete($name as xs:QName) external;
+
+
+(:~
+ : The function returns true if a collection with the given QName is
+ : statically declared and available (i.e. has been created).
+ :
+ : @param $name The QName of the collection that is being checked.
+ :
+ : @return true if the collection is statically declared and available,
+ :   false otherwise.
+ :
+ :)
+declare function cddl:is-available-collection($name as xs:QName) as xs:boolean external;
+
+
+(:~
+ : The function returns a sequence of QNames of the collections that are
+ : statically declared and available. The sequence will be empty if there
+ : are no such collections.
+ :
+ : @return A sequence of QNames, one for each statically declared and available
+ :  collection, or an emtpy sequence.
+ :
+ :)
+declare function cddl:available-collections() as xs:QName*  external;
+
 
 (:~
  : The function returns true if a collection with the given
@@ -145,8 +149,8 @@
  : @return true if the collection is declared or false otherwise.
  :
  :)
-declare function cddl:is-declared-collection(
-  $name as xs:QName) as xs:boolean  external;
+declare function cddl:is-declared-collection($name as xs:QName) as xs:boolean external;
+
 
 (:~
  : The function returns a sequence of QNames representing the collections that have

=== modified file 'modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq'
--- modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq	2012-05-03 12:31:51 +0000
+++ modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq	2012-05-15 14:37:23 +0000
@@ -17,7 +17,7 @@
 :)
 
 (:~
- : This modules provides a set of functions to modify a collection and retrieve the nodes
+ : This modules provides a set of functions to modify a collection and retrieve the items
  : contained in a particular collection.
  :
  : <p>This module is part of <a href="../../html/xqddf.html">Zorba's XQuery Data
@@ -48,6 +48,7 @@
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
 declare option ver:module-version "2.0";
 
+
 (:~
  : The insert-nodes function is an updating function that inserts copies of the
  : given nodes into a collection. 
@@ -64,13 +65,39 @@
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
  : @error zerr:ZDDY0006 if the modifier property of the collection $name is append-only,
  :        const, or queue.
- : @error zerr:ZDTY0001 if $content does not match the expected type (i.e. declared by the collection)
- :        according to the rules for SequenceType Matching.
- :
- :)
-declare updating function cdml:insert-nodes(
-  $name as xs:QName,
-  $content as node()*) external;
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ :
+ : @deprecated please use the cdml:insert#2 function
+ :
+ :)
+declare updating function 
+cdml:insert-nodes($name as xs:QName, $content as node()*) external;
+
+
+(:~
+ : The insert function is an updating function that inserts copies of the given
+ : items (nodes and/or json items) into a collection. Please note that the 
+ : insertion position of the items in the collection is not defined.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is an empty XDM instance and a pending update list
+ :         which, once applied, inserts the items into the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is append-only,
+ :        const, or queue.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType 
+ :        Matching.
+ :
+ :)
+declare updating function 
+cdml:insert($name as xs:QName, $content as item()*) external;
+
 
 (:~
  : The insert-nodes-first function is an updating function that inserts copies
@@ -87,13 +114,38 @@
  : @error zerr:ZDDY0006 if the modifier property of the collection $name is append-only,
  :        const, or queue.
  : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
- : @error zerr:ZDTY0001 if $content does not match the expected type (i.e. declared by the collection)
- :        according to the rules for SequenceType Matching.
- :
- :)
-declare updating function cdml:insert-nodes-first(
-  $name as xs:QName,
-  $content as node()*)  external;
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ :
+ : @deprecated please use the cdml:insert-first#2 function
+ :
+ :)
+declare updating function 
+cdml:insert-nodes-first($name as xs:QName, $content as node()*)  external;
+
+
+(:~
+ : The insert-first function is an updating function that inserts copies of the
+ : given items (nodes and/or json items) at the beginning of a collection. 
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is an empty XDM instance and a pending update list
+ :         which, once applied, inserts the items into the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is append-only,
+ :        const, or queue.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ :
+ :)
+declare updating function 
+cdml:insert-first($name as xs:QName, $content as item()*) external;
+
 
 (:~
  : The insert-nodes-last function is an updating function that inserts
@@ -109,13 +161,37 @@
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
  : @error zerr:ZDDY0006 if the modifier property of the collection $name is const.
  : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
- : @error zerr:ZDTY0001 if $content does not match the expected type (i.e. declared by the collection)
- :        according to the rules for SequenceType Matching.
- :
- :)
-declare updating function cdml:insert-nodes-last(
-  $name as xs:QName,
-  $content as node()*)  external;
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ :
+ : @deprecated please use the cdml:insert-last#2 function
+ :
+ :)
+declare updating function 
+cdml:insert-nodes-last($name as xs:QName, $content as node()*)  external;
+
+
+(:~
+ : The insert-last function is an updating function that inserts copies of the
+ : given items (nodes and/or json items) at the end of a collection.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $content The sequences of itemss whose copies should be added to the collection.
+ :
+ : @return The result of the function is an empty XDM instance and a pending update list
+ :         which, once applied, inserts the items into the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is const.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ :
+ :)
+declare updating function 
+cdml:insert-last($name as xs:QName, $content as item()*)  external;
+
 
 (:~
  : The insert-nodes-before function is an updating function that inserts
@@ -132,19 +208,52 @@
  :
  : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
- : @error zerr:ZDDY0006 if the modifier property of the collection $name is const, append-only,
- :        or queue.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is const,
+ :        append-only, or queue.
  : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
- : @error zerr:ZDTY0001 if $content does not match the expected type (i.e. declared by the collection)
- :        according to the rules for SequenceType Matching.
- : @error zerr:ZDDY0011 if the $target node is not a node that is contained in the collection $name.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ : @error zerr:ZDDY0011 if the $target node is not a node that is contained in
+ :        the collection $name.
+ :
+ : @deprecated please use the cdml:insert-before#3 function
  :
  :)
-declare updating function cdml:insert-nodes-before(
+declare updating function 
+cdml:insert-nodes-before(
   $name as xs:QName,
   $target as node(),
   $content as node()*)  external;
 
+
+(:~
+ : The insert-before function is an updating function that inserts copies of the
+ : given items (nodes and/or json items) into a collection at the position 
+ : directly preceding the given target item.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $target The item in the collection before which the $content
+ :        sequence should be inserted.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is an empty XDM instance and a pending update list
+ :         which, once applied, inserts the items into the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is const,
+ :        append-only, or queue.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ : @error zerr:ZDDY0011 if the $target item is not an item that is contained in
+ :        the collection $name.
+ :
+ :)
+declare updating function 
+cdml:insert-before($name as xs:QName, $target as item(), $content as item()*) external;
+
+
 (:~
  : The insert-nodes-after function is an updating function that inserts
  : copies of the given nodes into a collection at the position directlry following the
@@ -160,21 +269,53 @@
  :
  : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
- : @error zerr:ZDDY0006 if the modifier property of the collection $name is const, append-only,
- :        or queue.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is const,
+ :        append-only, or queue.
  : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
- : @error zerr:ZDTY0001 if $content does not match the expected type (i.e. declared by the collection)
- :        according to the rules for SequenceType Matching.
- : @error zerr:ZDDY0011 if the $target node is not a node that is contained in the collection $name.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ : @error zerr:ZDDY0011 if the $target node is not a node that is contained in
+ :        the collection $name.
+ :
+ : @deprecated please use the cdml:insert-after#3 function
  :
  :)
-declare updating function cdml:insert-nodes-after(
+declare updating function 
+cdml:insert-nodes-after(
   $name as xs:QName,
   $target as node(),
   $content as node()*)  external;
 
 
 (:~
+ : The insert-after function is an updating function that inserts copies of the
+ : given items (nodes and/or json items) into a collection at the position 
+ : directlry following the given target item.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $target The item in the collection after which the $content
+ :        sequence should be inserted.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is an empty XDM instance and a pending update list
+ :         which, once applied, inserts the items into the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is const,
+ :        append-only, or queue.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ : @error zerr:ZDDY0011 if the $target node is not a node that is contained in
+ :        the collection $name.
+ :
+ :)
+declare updating function 
+cdml:insert-after($name as xs:QName, $target as item(), $content as item()*) external;
+
+
+(:~
  : This function does the same as the insert-nodes function except
  : it immediately applies the resulting pending updates and returns the
  : nodes that have been inserted.
@@ -189,15 +330,40 @@
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
  : @error zerr:ZDDY0006 if the modifier property of the collection $name is append-only,
  :        const, or queue.
- : @error zerr:ZDTY0001 if $content does not match the expected type (i.e. declared by the collection)
- :        according to the rules for SequenceType Matching.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
  :
  : @see cdml:insert-nodes
  :
- :)
-declare %an:sequential function cdml:apply-insert-nodes(
-  $name as xs:QName,
-  $content as node()*) as node()*  external;
+ : @deprecated please use the cdml:apply-insert#2 function
+ :
+ :)
+declare %an:sequential function 
+cdml:apply-insert-nodes($name as xs:QName, $content as node()*) as node()* external;
+
+
+(:~
+ : This function does the same as the insert function except it immediately applies
+ : the resulting pending updates and returns the items that have been inserted.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is the sequence of items that have been
+ :         inserted into the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is append-only,
+ :        const, or queue.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ :
+ : @see cdml:insert
+ :
+ :)
+declare %an:sequential function 
+cdml:apply-insert($name as xs:QName, $content as item()*) as item()* external;
 
 (:~
  : This function does the same as the insert-nodes-first function except
@@ -220,10 +386,39 @@
  :
  : @see cdml:insert-nodes-first
  :
- :)
-declare %an:sequential function cdml:apply-insert-nodes-first(
-  $name as xs:QName,
-  $content as node()*) as node()*  external;
+ : @deprecated please use the cdml:apply-insert-first#2 function
+ :
+ :)
+declare %an:sequential function 
+cdml:apply-insert-nodes-first(
+  $name as xs:QName, 
+  $content as node()*) as node()* external;
+
+
+(:~
+ : This function does the same as the insert-first function except it immediately
+ : applies the resulting pending updates and returns the items that have been 
+ : inserted.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is the sequence of items that have been
+ :         inserted into the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is append-only,
+ :        const, or queue.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ :
+ : @see cdml:insert-first
+ :
+ :)
+declare %an:sequential function 
+cdml:apply-insert-first($name as xs:QName, $content as item()*) as item()* external;
 
 (:~
  : This function does the same as the insert-nodes-last function except
@@ -240,16 +435,45 @@
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
  : @error zerr:ZDDY0006 if the modifier property of the collection $name is const.
  : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
- : @error zerr:ZDTY0001 if $content does not match the expected type (i.e. declared by the collection)
- :        according to the rules for SequenceType Matching.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
  :
  : @see cdml:insert-nodes-last
  :
+ : @deprecated please use the cdml:apply-insert-last#2 function
+ :
  :)
-declare %an:sequential function cdml:apply-insert-nodes-last(
+declare %an:sequential function 
+cdml:apply-insert-nodes-last(
   $name as xs:QName,
   $content as node()*) as node()*  external;
 
+
+(:~
+ : This function does the same as the insert-last function except it immediately
+ : applies the resulting pending updates and returns the items that have been
+ : inserted.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is the sequence of items that have been
+ :         inserted into the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is const.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ :
+ : @see cdml:insert-last
+ :
+ :)
+declare %an:sequential function 
+cdml:apply-insert-last($name as xs:QName, $content as item()*) as item()*  external;
+
+
 (:~
  : This function does the same as the insert-nodes-before function except
  : it immediately applies the resulting pending updates and returns the
@@ -265,21 +489,59 @@
  :
  : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
- : @error zerr:ZDDY0006 if the modifier property of the collection $name is const, append-only,
- :        or queue.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is const,
+ :        append-only, or queue.
  : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
- : @error zerr:ZDTY0001 if $content does not match the expected type (i.e. declared by the collection)
- :        according to the rules for SequenceType Matching.
- : @error zerr:ZDDY0011 if the $target node is not a node that is contained in the collection $name.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ : @error zerr:ZDDY0011 if the $target node is not a node that is contained in
+ :        the collection $name.
  :
  : @see cdml:insert-nodes-before
  :
+ : @deprecated please use the cdml:apply-insert-before#3 function
+ :
  :)
-declare %an:sequential function cdml:apply-insert-nodes-before(
+declare %an:sequential function 
+cdml:apply-insert-nodes-before(
   $name as xs:QName,
   $target as node(),
   $content as node()*) as node()*  external;
 
+
+(:~
+ : This function does the same as the insert-before function except it immediately
+ : applies the resulting pending updates and returns the items that have been 
+ : inserted.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $target The item in the collection before which the $content
+ :        sequence should be inserted.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is the sequence of items that have been
+ :         inserted into the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is const,
+ :        append-only, or queue.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ : @error zerr:ZDDY0011 if the $target item is not an item that is contained in
+ :        the collection $name.
+ :
+ : @see cdml:insert-before
+ :
+ :)
+declare %an:sequential function 
+cdml:apply-insert-before(
+  $name as xs:QName,
+  $target as item(),
+  $content as item()*) as item()*  external;
+
+
 (:~
  : This function does the same as the insert-nodes-after function except
  : it immediately applies the resulting pending updates and returns the
@@ -295,21 +557,59 @@
  :
  : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
- : @error zerr:ZDDY0006 if the modifier property of the collection $name is const, append-only,
- :        or queue.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is 
+ :        const, append-only, or queue.
  : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
- : @error zerr:ZDTY0001 if $content does not match the expected type (i.e. declared by the collection)
- :        according to the rules for SequenceType Matching.
- : @error zerr:ZDDY0011 if the $target node is not a node that is contained in the collection $name.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ : @error zerr:ZDDY0011 if the $target node is not a node that is contained in
+ :        the collection $name.
  :
  : @see cdml:insert-nodes-after
  :
+ : @deprecated please use the cdml:apply-insert-after#3 function
+ :
  :)
-declare %an:sequential function cdml:apply-insert-nodes-after(
+declare %an:sequential function 
+cdml:apply-insert-nodes-after(
   $name as xs:QName,
   $pos as node(),
   $content as node()*) as node()*  external;
 
+
+(:~
+ : This function does the same as the insert-after function except it immediately
+ : applies the resulting pending updates and returns the items that have been 
+ : inserted.
+ :
+ : @param $name The name of the collection to which the items should be added.
+ : @param $target The item in the collection after which the $content
+ :        sequence should be inserted.
+ : @param $content The sequences of items whose copies should be added to the collection.
+ :
+ : @return The result of the function is the sequence of items that have been
+ :         inserted into the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is 
+ :        const, append-only, or queue.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDTY0001 if $content does not match the expected type (as specified
+ :        in the collection declaration) according to the rules for SequenceType Matching.
+ : @error zerr:ZDDY0011 if the $target item is not an item that is contained in
+ :        the collection $name.
+ :
+ : @see cdml:insert-after
+ :
+ :)
+declare %an:sequential function 
+cdml:apply-insert-after(
+  $name as xs:QName,
+  $pos as item(),
+  $content as item()*) as item()*  external;
+
+
 (:~
  : The delete-nodes function is an updating function that deletes zero of more
  : nodes from a collection. 
@@ -319,16 +619,42 @@
  : @return The result of this function is an empty XDM instance and a pending update
  :         list which, once applied, deletes the nodes from their collections.
  :
- : @error zerr:ZDDY0006 if the modifier property of the collection $name is const, append-only,
-          or queue.
- : @error zerr:ZDTY0001 if $content does not match the expected type according to the
- :        rules for SequenceType Matching.
- : @error zerr:ZDDY0011 if any nodes in the $target sequence is not a member of a collection
- :        or not all nodes of the $target sequence belong to the same collection.
- :        the collection identified by the $name parameter.
- :
- :)
-declare updating function cdml:delete-nodes($target as node()*)  external;
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is const,
+ :        append-only, or queue.
+ : @error zerr:ZDDY0011 if any node in the $target sequence is not a member of a
+ :        collection or not all nodes of the $target sequence belong to the same
+ :        collection.
+ :
+ : @deprecated please use the cdml:delete#1 function
+ :
+ :)
+declare updating function 
+cdml:delete-nodes($target as node()*)  external;
+
+
+(:~
+ : The delete function is an updating function that deletes zero of more items
+ : (nodes and/or json items) from a collection. 
+ :
+ : @param $target the items in the collection that should be deleted.
+ :
+ : @return The result of this function is an empty XDM instance and a pending update
+ :         list which, once applied, deletes the items from their collections.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is const,
+ :        append-only, or queue.
+ : @error zerr:ZDDY0011 if any item in the $target sequence is not a member of a
+ :        collection or not all items of the $target sequence belong to the same
+ :        collection.
+ :
+ :)
+declare updating function 
+cdml:delete($target as item()*)  external;
+
 
 (:~
  : The delete-node-first function is an updating function that deletes the
@@ -338,15 +664,39 @@
  :
  : @return The result of this function is an empty XDM instance and a pending update
  :         list which, once applied, deletes the first node from the collection.
-
- : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
- : @error zerr:ZDDY0003 if the collection identified by $name is not available.
- : @error zerr:ZDDY0006 if the modifier property of the collection $name is const or append-only.
- : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
- : @error zerr:ZDDY0011 If the collection is empty.
- :
- :)
-declare updating function cdml:delete-node-first($name as xs:QName) external;
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is 
+ :        const or append-only.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDDY0011 If the collection is empty.
+ :
+ : @deprecated please use the cdml:delete-first#1 function
+ :
+ :)
+declare updating function 
+cdml:delete-node-first($name as xs:QName) external;
+
+
+(:~
+ : The delete-first function is an updating function that deletes the first 
+ : item from an ordered collection.
+ :
+ : @param $name The name of the collection from which the first item should be deleted.
+ :
+ : @return The result of this function is an empty XDM instance and a pending update
+ :         list which, once applied, deletes the first item from the collection.
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is 
+ :        const or append-only.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDDY0011 If the collection is empty.
+ :
+ :)
+declare updating function 
+cdml:delete-first($name as xs:QName) external;
+
 
 (:~
  : The delete-nodes-first function is an updating function that deletes the
@@ -361,14 +711,40 @@
  :
  : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
- : @error zerr:ZDDY0006 if the modifier property of the collection $name is const or append-only.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is
+ :        const or append-only.
  : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
  : @error zerr:ZDDY0011 If the collection contains less than $number nodes.
  :
- :)
-declare updating function cdml:delete-nodes-first(
-  $name as xs:QName,
-  $number as xs:integer)  external;
+ : @deprecated please use the cdml:delete-first#2 function
+ :
+ :)
+declare updating function 
+cdml:delete-nodes-first($name as xs:QName, $number as xs:integer)  external;
+
+
+(:~
+ : The delete-first function is an updating function that deletes the first N
+ : items from an ordered collection.
+ :
+ : @param $name The name of the collection from which the first N items should be deleted.
+ : @param $number The number N of items that should be removed from the beginning of
+ :        the collection.
+ :
+ : @return The result of this function is an empty XDM instance and a pending update
+ :         list which, once applied, deletes the items from the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is
+ :        const or append-only.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDDY0011 If the collection contains less than $number items.
+ :
+ :)
+declare updating function 
+cdml:delete-first($name as xs:QName, $number as xs:integer)  external;
+
 
 (:~
  : The delete-node-last function is an updating function that deletes the
@@ -385,8 +761,32 @@
  :        append-only, or queue.
  : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
  : @error zerr:ZDDY0011 If the collection is empty.
- :)
-declare updating function cdml:delete-node-last($name as xs:QName)  external;
+ :
+ : @deprecated please use the cdml:delete-last#1 function
+ :)
+declare updating function 
+cdml:delete-node-last($name as xs:QName)  external;
+
+
+(:~
+ : The delete-last function is an updating function that deletes the last item
+ : from an ordered collection.
+ :
+ : @param $name The name of the collection from which the last item should be deleted.
+ :
+ : @return The result of this function is an empty XDM instance and a pending update
+ :         list which, once applied, deletes the last item from the collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0006 if the modifier property of the collection $name is const,
+ :        append-only, or queue.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDDY0011 If the collection is empty.
+ :)
+declare updating function 
+cdml:delete-last($name as xs:QName)  external;
+
 
 (:~
  : The delete-nodes-last function is an updating function that deletes the
@@ -403,15 +803,40 @@
  : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
  : @error zerr:ZDDY0011 If the collection contains less than $number nodes.
  :
- :)
-declare updating function cdml:delete-nodes-last(
-  $name as xs:QName,
-  $number as xs:integer)  external;
+ : @deprecated please use the cdml:delete-last#2 function
+ :
+ :)
+declare updating function 
+cdml:delete-nodes-last($name as xs:QName, $number as xs:integer)  external;
+
+
+(:~
+ : The delete-last function is an updating function that deletes the last N items
+ : from an ordered collection.
+ :
+ : @param $name The name of the collection from which the last N items should be deleted.
+ : @param $number The number of items to delete.
+ :
+ : @return The result of this function is an empty XDM instance and a pending update
+ :         list which, once applied, deletes the items.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZDDY0012 if the order property of the collection $name is unordered.
+ : @error zerr:ZDDY0011 If the collection contains less than $number items.
+ :
+ :)
+declare updating function 
+cdml:delete-last($name as xs:QName, $number as xs:integer)  external;
+
 
 (:~
  : The truncate function is an updating function that deletes the
  : entire contents of collection.
  :
+ : Please note that applying this function can not be undone in case
+ : an error happens during the application of the containing PUL.
+ :
  : @param $name The name of the collection whose content to delete
  :
  : @return The result of this function is an empty XDM instance and a pending update
@@ -421,24 +846,13 @@
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
  :
  :)
-declare updating function cdml:truncate($name as xs:QName) external;
-
-(:~
- : The index-of function that returns the position of the node in its collection.
- :
- : @param $node The node to retrieve the index for.
- :
- : @return Returns the position as xs:integer of the given node in the collection.
- :
- : @error zerr:ZDDY0011 if the node is not stored in any collection.
- : @error zerr:ZDDY0012 if the order property of collection of that node is unordered.
- :
- :)
-declare function cdml:index-of($node as node()) as xs:integer  external;
-
-(:~
- : The collection function returns the sequence of nodes of the collection
- : identified by the given name.
+declare updating function 
+cdml:truncate($name as xs:QName) external;
+
+
+(:~
+ : The collection function returns the sequence of nodes and/or json items
+ : that belong to the collection identified by the given name.
  :
  : @param $name The name of the collection.
  :
@@ -448,17 +862,36 @@
  : @error zerr:ZDDY0003 if the collection identified by $name is not available.
  :
  :)
-declare function cdml:collection($name as xs:QName) as node()*  external;
+declare function 
+cdml:collection($name as xs:QName) as item()*  external;
+
 
 (:~
- : This function returns the name of the collection the given node belongs
- : to.
+ : The collection-name function returns the name of the collection the given
+ : item (node or json item) belongs to.
  :
- : @param $node The node for which to get the name of the collection
+ : @param $item The item for which to get the name of the collection
  : @return The result of this function is a QName which identifies the collection
- :         to which the given node belongs to.
- :
- : @error zerr:ZDDY0011 if the given node does not belong to a collection.
- :
- :)
-declare function cdml:collection-name($node as node()) as xs:QName external;
+ :         to which the given item belongs to.
+ :
+ : @error zerr:ZDDY0011 if the given item does not belong to a collection.
+ :
+ :)
+declare function 
+cdml:collection-name($item as item()) as xs:QName external;
+
+
+(:~
+ : The index-of function returns the position of the given item (node or 
+ : json item) within its containing collection.
+ :
+ : @param $node The item to retrieve the index for.
+ :
+ : @return Returns the position as xs:integer of the given item in the collection.
+ :
+ : @error zerr:ZDDY0011 if the item is not stored in any collection.
+ : @error zerr:ZDDY0012 if the order property of the collection is unordered.
+ :
+ :)
+declare function 
+cdml:index-of($item as item()) as xs:integer external;

=== modified file 'modules/org/CMakeLists.txt'
--- modules/org/CMakeLists.txt	2012-05-03 12:31:51 +0000
+++ modules/org/CMakeLists.txt	2012-05-15 14:37:23 +0000
@@ -12,3 +12,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 ADD_SUBDIRECTORY(expath)
+ADD_SUBDIRECTORY(jsoniq)
+

=== added directory 'modules/org/jsoniq'
=== added file 'modules/org/jsoniq/CMakeLists.txt'
--- modules/org/jsoniq/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ modules/org/jsoniq/CMakeLists.txt	2012-05-15 14:37:23 +0000
@@ -0,0 +1,15 @@
+# Copyright 2011 The FLWOR Foundation.
+# 
+# Licensed 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_SUBDIRECTORY(www)

=== added directory 'modules/org/jsoniq/www'
=== added file 'modules/org/jsoniq/www/CMakeLists.txt'
--- modules/org/jsoniq/www/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ modules/org/jsoniq/www/CMakeLists.txt	2012-05-15 14:37:23 +0000
@@ -0,0 +1,21 @@
+# Copyright 2006-2008 The FLWOR Foundation.
+# 
+# Licensed 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.
+
+IF(ZORBA_WITH_JSON)
+  DECLARE_ZORBA_MODULE(FILE functions.xq VERSION 1.0
+    URI "http://www.jsoniq.org/functions";)
+  DECLARE_ZORBA_MODULE (FILE pregenerated/errors.xq
+    URI "http://www.jsoniq.org/errors";)
+ENDIF(ZORBA_WITH_JSON)
+

=== added file 'modules/org/jsoniq/www/functions.xq'
--- modules/org/jsoniq/www/functions.xq	1970-01-01 00:00:00 +0000
+++ modules/org/jsoniq/www/functions.xq	2012-05-15 14:37:23 +0000
@@ -0,0 +1,146 @@
+xquery version "1.0";
+
+(:
+ : Copyright 2006-2012 The FLWOR Foundation.
+ :
+ : Licensed 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.
+:)
+
+
+(:~
+ : This module provides the functions defined by the JSONiq specification,
+ : sections 1.7 (Functions) and 1.10 (Update Primitives). JSONiq extends
+ : the XQuery specification to also deal with JSON data natively. See
+ :
+ :     http://www.jsoniq.org/
+ :
+ : for details.
+ :
+ : This module depends on having the JSONiq feature enabled in Zorba,
+ : i.e., Zorba must be compiled with ZORBA_WITH_JSON.
+ :
+ : @author Markos Zaharioudakis, Matthias Brantner
+ :)
+module namespace jn = "http://www.jsoniq.org/functions";;
+
+import module namespace schema = "http://www.zorba-xquery.com/modules/schema";;
+
+declare namespace jdm = "http://www.jsoniq.org/";;
+
+declare namespace err = "http://www.w3.org/2005/xqt-errors";;
+
+declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
+declare option ver:module-version "1.0";
+
+
+(:~
+ : This function has the same semantics as fn:parse-xml(), except that
+ : it parses the string as JSON (not XML), and returns an Object or
+ : Array rather than an XML document.
+ :
+ : @param $j A string containing a valid JSON text.
+ : @return a JSON Object or Array item.
+ :)
+declare function jn:parse-json($j as xs:string) as json-item()? external;
+
+
+(:~
+ : Returns the names used in the Pairs of the object. 
+ : The names will be returned in an implementation-defined order
+ :
+ : @param $o A JSON Object.
+ : @return The names of pairs in the object.
+ :)
+declare function jn:keys($o as object()) as xs:string* external;
+
+
+(:~
+ : Returns the values of the pairs within a given JSON object.
+ :
+ : @param $o A JSON Object.
+ : @return the value of each pair within the given object.
+ :)
+declare function jn:values($o as object()) as item()* external;
+
+
+(:~
+ : Returns the value of a JSON Pair with a given name within a given JSON object.
+ : If no such pair exists in the object, returns the empty sequence.
+ :
+ : @param $o A JSON Object.
+ : @param $name The name of the pair whose value is to be retrieved
+ : @return the value of specified pair within the given object, or the empty sequence.
+ :)
+declare function jn:value($o as object(), $name as xs:string) as item()? external;
+
+
+(:~
+ : Creates an object from the specified pairs of another given object. 
+ : Specifically, for each name in $names, if the object $o has a pair with
+ : that name, then a copy of that pair is included in the new object.
+ :
+ : @param $o A JSON Object.
+ : @param $names The names of the pairs to copy out of $o and insert into the new object
+ : @return The new object.
+ :)
+declare function jn:project($o as object(), $names as xs:string*) as object() external;
+
+(:~
+ : Returns the size of a JSON Object or JSON Array. The size of an Object
+ : is the number of Pairs contained within it; the size of an Array is
+ : the number of members contained within it.
+ :
+ : @param $j A JSON Object or JSON Array.
+ : @return The number of items in $j.
+ : @error jn:JUDY0060 if $j is a JSON Pair.
+ :)
+declare function jn:size($j as json-item()) as xs:integer external;
+
+
+(:~
+ : Returns the member of an Array at the specified position (starting from 1).
+ : If the position is out of bounds of the array, returns the empty sequence.
+ :
+ : @param $a A JSON Array.
+ : @param $p The position in the array.
+ : @return The member at the specified position, or empty sequence.
+ :)
+declare function jn:member($o as array(), $p as xs:integer) as item()? external;
+
+
+(:~
+ : Returns the members of an Array.
+ :
+ : @param $a A JSON Array.
+ : @return The members of the specified array.
+ :)
+declare function jn:members($o as array()) as item()* external;
+
+
+(:~
+ : Recursively "flatten" a JSON Array, by replacing any arrays with their
+ : members. Equivalent to
+ :
+ :   define function jn:flatten($arg as array()) {
+ :     for $value in jn:values($arg)
+ :     return
+ :       if ($value instance of array())
+ :       then jn:flatten($value)
+ :       else $value
+ :   };
+ :
+ : @param $a A JSON Array.
+ : @return The flattened version of $a.
+ :)
+declare function jn:flatten($a as array()) as item()* external;
+

=== added directory 'modules/org/jsoniq/www/pregenerated'
=== added file 'modules/org/jsoniq/www/pregenerated/errors.xq'
--- modules/org/jsoniq/www/pregenerated/errors.xq	1970-01-01 00:00:00 +0000
+++ modules/org/jsoniq/www/pregenerated/errors.xq	2012-05-15 14:37:23 +0000
@@ -0,0 +1,156 @@
+(:
+ : Copyright 2006-2011 The FLWOR Foundation.
+ :
+ : Licensed 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.
+ :)
+ 
+ (:
+  : THIS FILE IS GENERATED.
+  : PLEASE DO NOT EDIT.
+  :)
+ (:~
+ : This module contains one declaration of a variable for each
+ : error of the http://www.jsoniq.org/errors namespace.
+ : The variables serves as documentation for the errors but can also
+ : be used in the code. For example, one useful scenario is to compare
+ : an error caught in the catch clause of a try-catch expression with one of
+ : the variables.
+ :
+ : @author Carlos Lopez
+ :
+ : @project error
+ :)
+
+xquery version '1.0';
+
+module namespace jerr = 'http://www.jsoniq.org/errors';
+
+declare variable $jerr:NS := 'http://www.jsoniq.org/errors';
+
+(:~
+ :It is a dynamic error to serialize a sequence of less
+ : or more than one item with the JSON output method if the
+ : cloudscript-serialization-multiple-items is set to no.
+ : 
+:)
+declare variable $jerr:JNSE0012 as xs:QName := fn:QName($jerr:NS, "jerr:JNSE0012");
+
+(:~
+ :It is a dynamic error to serialize an atomic value not
+ : supported by JSON or a node with the JSON output method and with
+ : the cloudscript-serialization-extensions serialization parameter
+ : set to false.
+:)
+declare variable $jerr:JNSE0013 as xs:QName := fn:QName($jerr:NS, "jerr:JNSE0013");
+
+(:~
+ :It is a dynamic error to serialize a function with the
+ : JSON output method.
+:)
+declare variable $jerr:JNSE0014 as xs:QName := fn:QName($jerr:NS, "jerr:JNSE0014");
+
+(:~
+ :Expression computing the value of a pair does not return exactly
+ : one item.
+:)
+declare variable $jerr:JNTY0002 as xs:QName := fn:QName($jerr:NS, "jerr:JNTY0002");
+
+(:~
+ :objects or arrays don't have a string value
+:)
+declare variable $jerr:JNTY0003 as xs:QName := fn:QName($jerr:NS, "jerr:JNTY0003");
+
+(:~
+ :objects or arrays don't have a typed value
+:)
+declare variable $jerr:JNTY0004 as xs:QName := fn:QName($jerr:NS, "jerr:JNTY0004");
+
+(:~
+ :wrong type for object/array selector in update expr
+:)
+declare variable $jerr:JNTY0007 as xs:QName := fn:QName($jerr:NS, "jerr:JNTY0007");
+
+(:~
+ :error raised by node constructor or updating expression indicating that a JSON item cannot appear in the corresponding content sequence
+:)
+declare variable $jerr:JNTY0011 as xs:QName := fn:QName($jerr:NS, "jerr:JNTY0011");
+
+(:~
+ :error raised by object constructor
+:)
+declare variable $jerr:JNDY0003 as xs:QName := fn:QName($jerr:NS, "jerr:JNDY0003");
+
+(:~
+ :parser errors raised by the JSONIQLoader
+:)
+declare variable $jerr:JSDY0040 as xs:QName := fn:QName($jerr:NS, "jerr:JSDY0040");
+
+(:~
+ :duplicate pair to insert
+:)
+declare variable $jerr:JNUP0005 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0005");
+
+(:~
+ :pair to insert already in object
+:)
+declare variable $jerr:JNUP0006 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0006");
+
+(:~
+ :pair to delete not in object
+:)
+declare variable $jerr:JNUP0007 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0007");
+
+(:~
+ :duplicate pair to replace
+:)
+declare variable $jerr:JNUP0008 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0008");
+
+(:~
+ :pair to replace not in object
+:)
+declare variable $jerr:JNUP0009 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0009");
+
+(:~
+ :duplicate pair to rename
+:)
+declare variable $jerr:JNUP0010 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0010");
+
+(:~
+ :pair to rename not in object
+:)
+declare variable $jerr:JNUP0011 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0011");
+
+(:~
+ :pair to rename already in object
+:)
+declare variable $jerr:JNUP0012 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0012");
+
+(:~
+ :position to insert not in array
+:)
+declare variable $jerr:JNUP0018 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0018");
+
+(:~
+ :position to delete not in array
+:)
+declare variable $jerr:JNUP0020 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0020");
+
+(:~
+ :position to replace not in array
+:)
+declare variable $jerr:JNUP0021 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0021");
+
+(:~
+ :duplicate position to replace
+:)
+declare variable $jerr:JNUP0022 as xs:QName := fn:QName($jerr:NS, "jerr:JNUP0022");
\ No newline at end of file

=== modified file 'src/annotations/annotations.h'
--- src/annotations/annotations.h	2012-05-03 12:31:51 +0000
+++ src/annotations/annotations.h	2012-05-15 14:37:23 +0000
@@ -22,7 +22,7 @@
 
 #include "common/shared_types.h"
 
-#include "compiler/parsetree/parsenodes.h"
+//#include "compiler/parsetree/parsenodes.h"
 
 #include "zorbautils/hashmap_itemh.h"
 

=== modified file 'src/api/collectionimpl.cpp'
--- src/api/collectionimpl.cpp	2012-05-03 12:31:51 +0000
+++ src/api/collectionimpl.cpp	2012-05-15 14:37:23 +0000
@@ -429,12 +429,11 @@
 
     store::Store* lStore = & GENV_STORE;
 
-    store::Collection_t lColl = lStore->getCollection(lQName);
+    store::Collection_t lColl = lStore->getCollection(lQName, false);
 
     if (!lColl)
-    {
       lColl = lStore->getCollection(lQName, true);
-    }
+
     // must exist because otherwise we wouldn't have an instance of this class
     ZORBA_ASSERT(lColl);
 

=== modified file 'src/api/dynamiccontextimpl.cpp'
--- src/api/dynamiccontextimpl.cpp	2012-05-03 12:31:51 +0000
+++ src/api/dynamiccontextimpl.cpp	2012-05-15 14:37:23 +0000
@@ -432,7 +432,8 @@
     TypeManager* tm = theStaticContext->get_typemanager();
 
     xqtref_t lItemType = tm->create_named_type(lItem->getType(),
-                                               TypeConstants::QUANT_ONE);
+                                               TypeConstants::QUANT_ONE,
+                                               QueryLoc::null);
 
     if (!TypeOps::is_subtype(tm,
                              *lItemType,

=== modified file 'src/api/item.cpp'
--- src/api/item.cpp	2012-05-03 12:31:51 +0000
+++ src/api/item.cpp	2012-05-15 14:37:23 +0000
@@ -182,6 +182,18 @@
   return Item();
 }
 
+#ifdef ZORBA_WITH_JSON
+
+bool
+Item::isJSONItem() const
+{
+  ITEM_TRY
+    return m_item->isJSONItem();
+  ITEM_CATCH
+  return false;
+}
+
+#endif /* ZORBA_WITH_JSON */
 
 Iterator_t Item::getAtomizationValue() const
 {
@@ -460,6 +472,69 @@
   return -1;
 }
 
+#ifdef ZORBA_WITH_JSON
+
+store::StoreConsts::JSONItemKind
+Item::getJSONItemKind() const
+{
+  ITEM_TRY
+    SYNC_CODE(AutoLock lock(GENV_STORE.getGlobalLock(), Lock::READ);)
+
+    return m_item->getJSONItemKind();
+  ITEM_CATCH
+  return store::StoreConsts::jsonItem;
+}
+
+Iterator_t
+Item::getArrayMembers() const
+{
+  ITEM_TRY
+    SYNC_CODE(AutoLock lock(GENV_STORE.getGlobalLock(), Lock::READ);)
+
+    // TODO, we should have an error handler here
+    return new StoreIteratorImpl(m_item->getMembers(), nullptr);
+
+  ITEM_CATCH
+  return NULL;
+}
+
+Item
+Item::getObjectValue(String aName) const
+{
+  zstring& lName = Unmarshaller::getInternalString(aName);
+  store::Item_t lIndex;
+  if (!GENV_ITEMFACTORY->createString(lIndex, lName)) {
+    // QQQ probably should throw exception here
+    return Item();
+  }
+  ITEM_TRY
+    SYNC_CODE(AutoLock lock(GENV_STORE.getGlobalLock(), Lock::READ););
+  store::Item_t lPair = m_item->getPair(lIndex);
+  if (lPair.isNull()) {
+    return Item();
+  }
+  return &*lPair->getValue();
+  ITEM_CATCH
+  return Item();
+}
+
+Item
+Item::getArrayMember(uint32_t aIndex) const
+{
+  store::Item_t lIndex;
+  if (!GENV_ITEMFACTORY->createInteger(lIndex, Integer(aIndex))) {
+    // QQQ probably should throw exception here
+    return Item();
+  }
+  ITEM_TRY
+    SYNC_CODE(AutoLock lock(GENV_STORE.getGlobalLock(), Lock::READ);)
+      return &*m_item->getMember(lIndex);
+  ITEM_CATCH
+  return Item();
+}
+
+#endif /* ZORBA_WITH_JSON */
+
 bool
 Item::isStreamable() const
 {

=== modified file 'src/api/itemfactoryimpl.cpp'
--- src/api/itemfactoryimpl.cpp	2012-05-03 12:31:51 +0000
+++ src/api/itemfactoryimpl.cpp	2012-05-15 14:37:23 +0000
@@ -24,10 +24,13 @@
 #include "zorbatypes/duration.h"
 #include "system/globalenv.h"
 #include "store/api/item_factory.h"
+#include <store/api/store.h>
+#include "store/api/copymode.h"
 #include "api/unmarshaller.h"
 #include "types/casting.h"
 
 #include "store/api/item.h"
+#include <runtime/util/item_iterator.h>
 
 
 namespace zorba {
@@ -863,6 +866,81 @@
   return &*lItem;
 }
 
+#ifdef ZORBA_WITH_JSON
+
+zorba::Item ItemFactoryImpl::createJSONNull()
+{
+  store::Item_t lItem;
+  theItemFactory->createJSONNull(lItem);
+  return &*lItem;
+}
+
+zorba::Item ItemFactoryImpl::createJSONNumber(String aString)
+{
+  store::Item_t lItem;
+  zstring &lString = Unmarshaller::getInternalString(aString);
+  theItemFactory->createJSONNumber(lItem, lString);
+  return &*lItem;
+}
+
+
+zorba::Item ItemFactoryImpl::createJSONObject(
+    std::vector<std::pair<Item, Item> >& aPairs)
+{
+  csize numPairs = aPairs.size();
+
+  // Convert vector of pairs to a vector of names and a vector of values
+  std::vector<store::Item_t> names;
+  std::vector<store::Item_t> values;
+  names.reserve(numPairs);
+  names.reserve(numPairs);
+
+  std::vector<std::pair<Item, Item> >::iterator i = aPairs.begin();
+  std::vector<std::pair<Item, Item> >::iterator end = aPairs.end();
+  for (; i != end; i++) 
+  {
+    names.push_back(Unmarshaller::getInternalItem((*i).first));
+    values.push_back(Unmarshaller::getInternalItem((*i).second));
+  }
+
+  store::Item_t lItem;
+  theItemFactory->createJSONObject(lItem, names, values);
+
+  return &*lItem;
+}
+
+
+zorba::Item ItemFactoryImpl::createJSONArray(std::vector<Item>& aItems)
+{
+  csize numItems = aItems.size();
+
+  std::vector<store::CopyMode> copyModes(numItems);
+  for (csize i = 0; i < numItems; ++i)
+  {
+    copyModes[i].theDoCopy = false;
+  }
+
+  // Convert vector of Items to vector of store::Item_ts
+  std::vector<store::Item_t> items;
+  items.reserve(numItems);
+  std::vector<Item>::iterator ite = aItems.begin();
+  std::vector<Item>::iterator end = aItems.end();
+  for (; ite != end; ++ite) 
+  {
+    items.push_back(Unmarshaller::getInternalItem(*ite));
+  }
+
+  store::Item_t lItem;
+  theItemFactory->createJSONArray(lItem, items);
+
+  return &*lItem;
+}
+
+
+
+
+#endif /* ZORBA_WITH_JSON */
+
 
 } // namespace zorba
 /* vim:set et sw=2 ts=2: */

=== modified file 'src/api/itemfactoryimpl.h'
--- src/api/itemfactoryimpl.h	2012-05-03 12:31:51 +0000
+++ src/api/itemfactoryimpl.h	2012-05-15 14:37:23 +0000
@@ -259,6 +259,21 @@
         Item   parent,
         String content);
 
+#ifdef ZORBA_WITH_JSON
+      virtual Item
+      createJSONNull();
+
+      virtual Item
+      createJSONNumber(String aString);
+
+      virtual Item
+      createJSONObject(std::vector<std::pair<Item, Item> >& aPairs);
+
+      virtual Item
+      createJSONArray(std::vector<Item>& aItems);
+
+#endif /* ZORBA_WITH_JSON */
+
     protected:
       store::ItemFactory* theItemFactory;
 

=== modified file 'src/api/options.cpp'
--- src/api/options.cpp	2012-05-03 12:31:51 +0000
+++ src/api/options.cpp	2012-05-15 14:37:23 +0000
@@ -17,6 +17,7 @@
 
 #include <string.h>
 #include <zorba/options.h>
+#include "diagnostics/xquery_diagnostics.h"
 
 Zorba_CompilerHints::Zorba_CompilerHints()
   :
@@ -36,7 +37,11 @@
 
 Zorba_SerializerOptions::Zorba_SerializerOptions()
   :
+#ifdef ZORBA_WITH_JSON
+  ser_method(ZORBA_SERIALIZATION_METHOD_JSONIQ),
+#else
   ser_method(ZORBA_SERIALIZATION_METHOD_XML),
+#endif
   byte_order_mark(ZORBA_BYTE_ORDER_MARK_NO),
   escape_uri_attributes(ZORBA_ESCAPE_URI_ATTRIBUTES_NO),
   include_content_type(ZORBA_INCLUDE_CONTENT_TYPE_NO),
@@ -46,9 +51,32 @@
   standalone(ZORBA_STANDALONE_OMIT),
   undeclare_prefixes(ZORBA_UNDECLARE_PREFIXES_NO),
   encoding(ZORBA_ENCODING_UTF8)
+#ifdef ZORBA_WITH_JSON
+  ,
+    cloudscript_extensions(CLOUDSCRIPT_EXTENSIONS_NO),
+    cloudscript_multiple_items(CLOUDSCRIPT_MULTIPLE_ITEMS_NO),
+    cloudscript_xdm_method(ZORBA_SERIALIZATION_METHOD_XML)
+#endif /* ZORBA_WITH_JSON */
 {
 }
 
+Zorba_serialization_method_t convertMethodString(const char* value, const char* parameter)
+{
+  if (strcmp(value, "xml") == 0) return ZORBA_SERIALIZATION_METHOD_XML;
+  else if (strcmp(value, "html") == 0) return ZORBA_SERIALIZATION_METHOD_HTML;
+  else if (strcmp(value, "xhtml") == 0) return ZORBA_SERIALIZATION_METHOD_XHTML;
+  else if (strcmp(value, "text") == 0) return ZORBA_SERIALIZATION_METHOD_TEXT;
+  else if (strcmp(value, "binary") == 0) return ZORBA_SERIALIZATION_METHOD_BINARY;
+#ifdef ZORBA_WITH_JSON
+  else if (strcmp(value, "json") == 0) return ZORBA_SERIALIZATION_METHOD_JSON;
+  else if (strcmp(value, "jsoniq") == 0) return ZORBA_SERIALIZATION_METHOD_JSONIQ;
+#endif
+  else
+  {
+    throw XQUERY_EXCEPTION
+        (err::SEPM0016, ERROR_PARAMS( value, parameter, ZED( GoodValuesAreXMLEtc ) ));
+  }
+}
 
 void Zorba_SerializerOptions::SetSerializerOption(
     const char* parameter,
@@ -59,15 +87,7 @@
 
   if (strcmp(parameter, "method") == 0)
   {
-    if (strcmp(value, "xml") == 0) ser_method = ZORBA_SERIALIZATION_METHOD_XML;
-    else if (strcmp(value, "html") == 0) ser_method = ZORBA_SERIALIZATION_METHOD_HTML;
-    else if (strcmp(value, "xhtml") == 0) ser_method = ZORBA_SERIALIZATION_METHOD_XHTML;
-    else if (strcmp(value, "text") == 0) ser_method = ZORBA_SERIALIZATION_METHOD_TEXT;
-    else if (strcmp(value, "binary") == 0) ser_method = ZORBA_SERIALIZATION_METHOD_BINARY;
-    else
-    {
-      ; // TODO signal errors for incorrect values?
-    }
+    ser_method = convertMethodString(value, parameter);
   }
   else if (strcmp(parameter, "byte-order-mark") == 0)
   {
@@ -127,6 +147,26 @@
   {
     version = value;
   }
+#ifdef ZORBA_WITH_JSON
+  else if (strcmp(parameter, "cloudscript-extensions") == 0)
+  {
+    if (strcmp(value, "yes") == 0) cloudscript_extensions = CLOUDSCRIPT_EXTENSIONS_YES;
+    else if (strcmp(value, "no") == 0) cloudscript_extensions = CLOUDSCRIPT_EXTENSIONS_NO;
+  }
+  else if (strcmp(parameter, "cloudscript-multiple-items") == 0)
+  {
+    if (strcmp(value, "no") == 0)
+      cloudscript_multiple_items = CLOUDSCRIPT_MULTIPLE_ITEMS_NO;
+    else if (strcmp(value, "array") == 0)
+      cloudscript_multiple_items = CLOUDSCRIPT_MULTIPLE_ITEMS_ARRAY;
+    else if (strcmp(value, "appended") == 0)
+      cloudscript_multiple_items = CLOUDSCRIPT_MULTIPLE_ITEMS_APPENDED;
+  }
+  else if (strcmp(parameter, "cloudscript-xdm-node-output-method") == 0)
+  {
+    cloudscript_xdm_method = convertMethodString(value, parameter);
+  }
+#endif /* ZORBA_WITH_JSON */
 }
 
 

=== modified file 'src/api/serialization/serializer.cpp'
--- src/api/serialization/serializer.cpp	2012-05-03 12:31:51 +0000
+++ src/api/serialization/serializer.cpp	2012-05-15 14:37:23 +0000
@@ -16,9 +16,10 @@
 #include "stdafx.h"
 
 #include <sstream>
+#include <iomanip>
 
 #include <zorba/zorba_string.h>
-
+#include <zorbamisc/ns_consts.h>
 #include "zorbatypes/numconversions.h"
 #include "diagnostics/xquery_diagnostics.h"
 #include "diagnostics/assert.h"
@@ -39,7 +40,8 @@
 #include "store/api/iterator.h"
 #include "store/api/iterator_factory.h"
 #include "store/api/item.h"
-
+#include <store/api/item_factory.h>
+#include <store/api/copymode.h>
 
 namespace zorba {
 
@@ -192,9 +194,15 @@
       const unsigned char* temp = chars;
       unicode::code_point cp = utf8::next_char(temp);
 
-      // raise an error iff (1) the serialization format is XML 1.0 and (2) the given character is an invalid XML 1.0 character
-      if (ser && ser->method == PARAMETER_VALUE_XML && ser->version == PARAMETER_VALUE_VERSION_1_0 && !xml::is_valid(cp))
+      // raise an error iff (1) the serialization format is XML 1.0 and 
+      // (2) the given character is an invalid XML 1.0 character
+      if (ser &&
+          ser->method == PARAMETER_VALUE_XML &&
+          ser->version == PARAMETER_VALUE_VERSION_1_0 &&
+          !xml::is_valid(cp))
+      {
         throw XQUERY_EXCEPTION( err::FOCH0001, ERROR_PARAMS( cp ) );
+      }
 
       if (cp >= 0x10000 && cp <= 0x10FFFF)
       {
@@ -342,7 +350,7 @@
 /*******************************************************************************
 
 ********************************************************************************/
-void serializer::emitter::emit_declaration_end()
+void serializer::emitter::emit_end()
 {
   // Do nothing in the default emitter
 }
@@ -416,6 +424,12 @@
 ********************************************************************************/
 void serializer::emitter::emit_item(store::Item* item)
 {
+#ifdef ZORBA_WITH_JSON
+  if (item->isJSONItem())
+  {
+    throw XQUERY_EXCEPTION(zerr::ZAPI0043_CANNOT_SERIALIZE_JSON_ITEM);
+  }
+#endif
   if (item->isAtomic())
   {
     if (previous_item == PREVIOUS_ITEM_WAS_TEXT)
@@ -787,7 +801,6 @@
   return false;
 }
 
-
 /*******************************************************************************
 
 ********************************************************************************/
@@ -832,7 +845,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 //                                                                            //
-//  XML Emitter                                                               //
+//  XML emitter                                                               //
 //                                                                            //
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -916,6 +929,387 @@
 }
 
 
+#ifdef ZORBA_WITH_JSON
+
+////////////////////////////////////////////////////////////////////////////////
+//                                                                            //
+//  JSON emitter - as defined by CloudScript spec                             //
+//                                                                            //
+////////////////////////////////////////////////////////////////////////////////
+
+serializer::json_emitter::json_emitter(
+  serializer* the_serializer,
+  transcoder& the_transcoder)
+  : emitter(the_serializer, the_transcoder),
+    theXMLStringStream(nullptr),
+    theMultipleItems(false)
+{
+}
+
+serializer::json_emitter::~json_emitter()
+{
+  delete theXMLStringStream;
+}
+
+void serializer::json_emitter::emit_item(store::Item *item)
+{
+  // This is called by serializer for each top-level item. Therefore it's the
+  // right place to check for multiple items in the sequence.
+  if (theMultipleItems && ser->cloudscript_multiple_items == PARAMETER_VALUE_NO)
+  {
+    throw XQUERY_EXCEPTION(jerr::JNSE0012);
+  }
+  emit_json_item(item, 0);
+  theMultipleItems = true;
+}
+
+void serializer::json_emitter::emit_declaration()
+{
+}
+
+void serializer::json_emitter::emit_end()
+{
+}
+
+void serializer::json_emitter::emit_json_item(store::Item* item, int depth)
+{
+  // This is called for any item within a JSON array or object, or for a
+  // top-level item. JSON rules for simple types apply here.
+  if (item->isJSONObject()) {
+    emit_json_object(item, depth);
+  }
+  else if (item->isJSONArray()) {
+    emit_json_array(item, depth);
+  }
+  else if (item->isJSONPair()) {
+    emit_json_pair(item, depth);
+  }
+  else if (item->isAtomic()) {
+    store::SchemaTypeCode type = item->getTypeCode();
+    switch (type) {
+    case store::XS_STRING:
+      emit_json_string(item->getStringValue());
+      break;
+
+    case store::XS_DOUBLE:
+    case store::XS_FLOAT:
+      if (item->isNaN()) {
+        emit_cloudscript_value(type == store::XS_DOUBLE ? "double" : "float",
+                               "NaN", depth);
+        break;
+      }
+      else if (item->isPosOrNegInf()) {
+        // QQQ with Cloudscript, this is supposed to be INF or -INF - how can
+        // I tell which I have?
+        emit_cloudscript_value(type == store::XS_DOUBLE ? "double" : "float",
+                               "Infinity", depth);
+        break;
+      }
+      // else fall through
+    case store::XS_INTEGER:
+    case store::XS_DECIMAL:
+    case store::XS_NON_POSITIVE_INTEGER:
+    case store::XS_NEGATIVE_INTEGER:
+    case store::XS_LONG:
+    case store::XS_INT:
+    case store::XS_SHORT:
+    case store::XS_BYTE:
+    case store::XS_NON_NEGATIVE_INTEGER:
+    case store::XS_UNSIGNED_LONG:
+    case store::XS_UNSIGNED_INT:
+    case store::XS_UNSIGNED_SHORT:
+    case store::XS_UNSIGNED_BYTE:
+    case store::XS_POSITIVE_INTEGER:
+      // All numerics get serialized the same way
+      tr << item->getStringValue();
+      break;
+
+    case store::XS_BOOLEAN:
+      tr << (item->getBooleanValue() ? "true" : "false");
+      break;
+
+    case store::JDM_NULL:
+      tr << "null";
+      break;
+
+    default: {
+      emit_cloudscript_value(item->getType()->getStringValue(),
+                        item->getStringValue(), depth);
+      break;
+    }
+    }
+  }
+  else {
+    emit_cloudscript_xdm_node(item, depth);
+  }
+}
+
+/*******************************************************************************
+
+********************************************************************************/
+void serializer::json_emitter::emit_json_object(store::Item* obj, int depth)
+{
+  store::Item_t pair;
+  store::Iterator_t it = obj->getPairs();
+  it->open();
+  bool first = true;
+  if (ser->indent) {
+    tr << "{" <<ser->END_OF_LINE;
+  }
+  else {
+    tr << "{ ";
+  }
+  depth++;
+  while (it->next(pair)) {
+    if (first) {
+      first = false;
+    }
+    else {
+      tr << ", ";
+      if (ser->indent) {
+        tr << ser->END_OF_LINE;
+      }
+    }
+    if (ser->indent) {
+      emit_indentation(depth);
+    }
+    emit_json_pair(pair, depth);
+  }
+  if (ser->indent) {
+    tr << ser->END_OF_LINE;
+    emit_indentation(depth-1);
+    tr << "}";
+  }
+  else {
+    tr << " }";
+  }
+}
+
+/*******************************************************************************
+
+********************************************************************************/
+void serializer::json_emitter::emit_json_array(store::Item* array, int depth)
+{
+  store::Item_t member;
+  store::Iterator_t it = array->getMembers();
+  it->open();
+  bool first = true;
+  tr << "[ ";
+  while (it->next(member)) {
+    if (first) {
+      first = false;
+    }
+    else {
+      tr << ", ";
+    }
+    emit_json_item(member, depth);
+  }
+  tr << " ]";
+}
+
+/*******************************************************************************
+
+********************************************************************************/
+void serializer::json_emitter::emit_json_pair(store::Item* pair, int depth)
+{
+  emit_json_item(pair->getName(), depth);
+  tr << " : ";
+  emit_json_item(pair->getValue(), depth);
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+void serializer::json_emitter::emit_cloudscript_value(
+    zstring type,
+    zstring value,
+    int depth)
+{
+  // First make sure we should be doing these extended values
+  if (ser->cloudscript_extensions == PARAMETER_VALUE_NO) {
+    throw XQUERY_EXCEPTION(jerr::JNSE0013, ERROR_PARAMS(value));
+  }
+
+  // Create items for constant strings, if not already done
+  if (!theCloudScriptValueName)
+  {
+    zstring cloudscriptvaluestring("CloudScript value");
+    zstring typestring("type");
+    zstring valuestring("value");
+    GENV_ITEMFACTORY->createString(theCloudScriptValueName, cloudscriptvaluestring);
+    GENV_ITEMFACTORY->createString(theTypeName, typestring);
+    GENV_ITEMFACTORY->createString(theValueName, valuestring);
+  }
+
+  // Create the inner JSON object, which contains two pairs
+  std::vector<store::Item_t> names(2);
+  std::vector<store::Item_t> values(2);
+
+  names[0] = theTypeName;
+  names[1] = theValueName;
+
+  GENV_ITEMFACTORY->createString(values[0], type);
+  GENV_ITEMFACTORY->createString(values[1], value);
+
+  store::Item_t inner;
+  GENV_ITEMFACTORY->createJSONObject(inner, names, values);
+
+  // Create the outer JSON object with one pair
+  names.resize(1);
+  values.resize(1);
+  names[0] = theCloudScriptValueName;
+  values[0] = inner;
+
+  store::Item_t outer;
+  GENV_ITEMFACTORY->createJSONObject(outer, names, values);
+
+  emit_json_object(outer, depth);
+}
+
+void serializer::json_emitter::emit_cloudscript_xdm_node(
+    store::Item* item,
+    int depth)
+{
+  // First make sure we should be doing these extended values
+  if (ser->cloudscript_extensions == PARAMETER_VALUE_NO) {
+    // QQQ probably should put "XML node" in diagnostics_en.xml
+    throw XQUERY_EXCEPTION(jerr::JNSE0013, ERROR_PARAMS("XML node"));
+  }
+
+  // OK, we've got a non-atomic non-JDM Item here, so serialize it as XML
+  // and output it as a "CloudScript XDM node".
+  if (!theXMLEmitter) {
+    theXMLStringStream = new std::stringstream();
+    theXMLTranscoder = ser->create_transcoder(*theXMLStringStream);
+    theXMLEmitter = new serializer::xml_emitter(ser, *theXMLTranscoder);
+  }
+  theXMLEmitter->emit_item(item);
+  zstring xml(theXMLStringStream->str());
+  theXMLStringStream->str("");
+
+  // Create item for constant string, if not already done
+  if (!theCloudScriptValueName)
+  {
+    zstring xdmnodestring("CloudScript XDM node");
+    GENV_ITEMFACTORY->createString(theCloudScriptXDMNodeName, xdmnodestring);
+  }
+
+  // Create the JSON object, which contains one pair
+  std::vector<store::Item_t> names(1);
+  std::vector<store::Item_t> values(1);
+
+  names[0] = theCloudScriptXDMNodeName;
+  GENV_ITEMFACTORY->createString(values[0], xml);
+
+  store::Item_t object;
+  GENV_ITEMFACTORY->createJSONObject(object, names, values);
+
+  emit_json_object(object, depth);
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
+void serializer::json_emitter::emit_json_string(zstring string)
+{
+  tr << '"';
+  zstring::const_iterator i = string.begin();
+  zstring::const_iterator end = string.end();
+  for (; i < end; i++) 
+  {
+    if (*i < 0x20) 
+    {
+      // Escape control sequences
+      std::stringstream hex;
+      hex << "\\u" << std::setw(4) << std::setfill('0')
+          << std::hex << static_cast<int>(*i);
+      tr << hex.str();
+      continue;
+    }
+    if (*i == '\\' || *i == '"') 
+    {
+      // Output escape char for \ or "
+      tr << '\\';
+      // Fall through to output original character
+    }
+    tr << *i;
+  }
+  tr << '"';
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+//                                                                            //
+//  JSONiq emitter (auto-detects JSON or XML)                                 //
+//                                                                            //
+////////////////////////////////////////////////////////////////////////////////
+
+serializer::jsoniq_emitter::jsoniq_emitter(
+  serializer* the_serializer,
+  transcoder& the_transcoder)
+  :
+    emitter(the_serializer, the_transcoder),
+    theEmitterState(JESTATE_UNDETERMINED),
+    theEmitter(nullptr)
+{
+}
+
+serializer::jsoniq_emitter::~jsoniq_emitter()
+{
+  delete theEmitter;
+}
+
+void serializer::jsoniq_emitter::emit_declaration()
+{
+  // Probably I should set a flag here to note whether emit_declaration() has
+  // been called or not. However, I know that all serializer::serialize()
+  // methods DO call emit_declaration() and call it first, so there's no need.
+}
+
+void serializer::jsoniq_emitter::emit_item(store::Item *item)
+{
+  bool isJson = item->isJSONItem();
+
+  if (theEmitterState == JESTATE_UNDETERMINED) {
+    // Initialize theEmitter based on item type, passing through our serializer
+    // and transcoder.
+    if (isJson) {
+      theEmitterState = JESTATE_JDM;
+      theEmitter = new json_emitter(ser, tr);
+    }
+    else {
+      theEmitterState = JESTATE_XDM;
+      theEmitter = new xml_emitter(ser, tr);
+    }
+    // Since this was the first item, call emit_declaration().
+    theEmitter->emit_declaration();
+  }
+  else {
+    // Error checking
+    if ( (isJson && theEmitterState == JESTATE_XDM) ||
+         (!isJson && theEmitterState == JESTATE_JDM) ) {
+      throw XQUERY_EXCEPTION(zerr::ZAPI0045_CANNOT_SERIALIZE_MIXED_XDM_JDM);
+    }
+  }
+
+  // Pass through
+  theEmitter->emit_item(item);
+}
+
+void serializer::jsoniq_emitter::emit_end()
+{
+  // Not really clear what to do if we serialized no items and hence have
+  // no emitter yet, but doing nothing at all seems reasonable.
+  if (theEmitter) {
+    theEmitter->emit_end();
+  }
+}
+
+
+#endif /* ZORBA_WITH_JSON */
+
 ////////////////////////////////////////////////////////////////////////////////
 //                                                                            //
 //  HTML Emitter                                                              //
@@ -1070,7 +1464,7 @@
 /*******************************************************************************
 
 ********************************************************************************/
-void serializer::html_emitter::emit_declaration_end()
+void serializer::html_emitter::emit_end()
 {
 }
 
@@ -1474,7 +1868,7 @@
 /*******************************************************************************
 
 ********************************************************************************/
-void serializer::sax2_emitter::emit_declaration_end()
+void serializer::sax2_emitter::emit_end()
 {
   theSAX2ContentHandler->endDocument();
 }
@@ -1946,7 +2340,6 @@
   }
 }
 
-
 ////////////////////////////////////////////////////////////////////////////////
 //                                                                            //
 //  Serializer                                                                //
@@ -1993,7 +2386,15 @@
 
   media_type.clear();
 
+  // This default should match the default for ser_method in Zorba_SerializerOptions
+#ifdef ZORBA_WITH_JSON
+  method = PARAMETER_VALUE_JSONIQ;
+  cloudscript_multiple_items = PARAMETER_VALUE_NO;
+  cloudscript_extensions = PARAMETER_VALUE_NO;
+  cloudscript_xdm_method = PARAMETER_VALUE_XML;
+#else
   method = PARAMETER_VALUE_XML;
+#endif
 
   normalization_form.clear();
 
@@ -2010,6 +2411,30 @@
   indent = PARAMETER_VALUE_NO;
 }
 
+static short int
+convertMethodString(const char* aValue, const char* aName) {
+  if (!strcmp(aValue, "xml"))
+    return serializer::PARAMETER_VALUE_XML;
+  else if (!strcmp(aValue, "html"))
+    return serializer::PARAMETER_VALUE_HTML;
+  else if (!strcmp(aValue, "xhtml"))
+    return serializer::PARAMETER_VALUE_XHTML;
+  else if (!strcmp(aValue, "text"))
+    return serializer::PARAMETER_VALUE_TEXT;
+  else if (!strcmp(aValue, "binary"))
+    return serializer::PARAMETER_VALUE_BINARY;
+#ifdef ZORBA_WITH_JSON
+  else if (!strcmp(aValue, "json"))
+    return serializer::PARAMETER_VALUE_JSON;
+  else if (!strcmp(aValue, "jsoniq"))
+    return serializer::PARAMETER_VALUE_JSONIQ;
+#endif
+  else
+    throw XQUERY_EXCEPTION(
+        err::SEPM0016, ERROR_PARAMS( aValue, aName, ZED( GoodValuesAreXMLEtc ) )
+        );
+}
+
 
 /*******************************************************************************
 
@@ -2076,20 +2501,7 @@
   }
   else if (!strcmp(aName, "method"))
   {
-    if (!strcmp(aValue, "xml"))
-      method = PARAMETER_VALUE_XML;
-    else if (!strcmp(aValue, "html"))
-      method = PARAMETER_VALUE_HTML;
-    else if (!strcmp(aValue, "xhtml"))
-      method = PARAMETER_VALUE_XHTML;
-    else if (!strcmp(aValue, "text"))
-      method = PARAMETER_VALUE_TEXT;
-    else if (!strcmp(aValue, "binary"))
-      method = PARAMETER_VALUE_BINARY;
-    else
-      throw XQUERY_EXCEPTION(
-        err::SEPM0016, ERROR_PARAMS( aValue, aName, ZED( GoodValuesAreXMLEtc ) )
-      );
+    method = convertMethodString(aValue, aName);
   }
   else if (!strcmp(aName, "include-content-type"))
   {
@@ -2144,6 +2556,36 @@
   {
     cdata_section_elements = aValue;
   }
+#ifdef ZORBA_WITH_JSON
+  else if (!strcmp(aName, "cloudscript-extensions"))
+  {
+    if (!strcmp(aValue, "yes"))
+      cloudscript_extensions = PARAMETER_VALUE_YES;
+    else if (!strcmp(aValue, "no"))
+      cloudscript_extensions = PARAMETER_VALUE_NO;
+    else
+      throw XQUERY_EXCEPTION(
+        err::SEPM0016, ERROR_PARAMS( aValue, aName, ZED( GoodValuesAreYesNo ) )
+      );
+  }
+  else if (!strcmp(aName, "cloudscript-multiple-items"))
+  {
+    if (!strcmp(aValue, "no"))
+      cloudscript_multiple_items = PARAMETER_VALUE_NO;
+    else if (!strcmp(aValue, "array"))
+      cloudscript_multiple_items = PARAMETER_VALUE_ARRAY;
+    else if (!strcmp(aValue, "appended"))
+      cloudscript_multiple_items = PARAMETER_VALUE_APPENDED;
+    else
+      throw XQUERY_EXCEPTION(
+        err::SEPM0016, ERROR_PARAMS( aValue, aName, ZED( GoodValuesAreYesNo ) )
+      );
+  }
+  else if (!strcmp(aName, "cloudscript-xdm-node-output-method"))
+  {
+    cloudscript_xdm_method = convertMethodString(aValue, aName);
+  }
+#endif /* ZORBA_WITH_JSON */
   else
   {
     throw XQUERY_EXCEPTION( err::SEPM0016, ERROR_PARAMS( aValue, aName ) );
@@ -2223,19 +2665,10 @@
 ********************************************************************************/
 bool serializer::setup(std::ostream& os)
 {
-  if (encoding == PARAMETER_VALUE_UTF_8)
-  {
-    tr = new transcoder(os, false);
-  }
-  else if (encoding == PARAMETER_VALUE_UTF_16)
-  {
-    tr = new transcoder(os, true);
-  }
-  else
-  {
-    ZORBA_ASSERT(false);
-  }
-
+  tr = create_transcoder(os);
+  if (!tr) {
+    return false;
+  }
   if (method == PARAMETER_VALUE_XML)
     e = new xml_emitter(this, *tr);
   else if (method == PARAMETER_VALUE_HTML)
@@ -2246,6 +2679,12 @@
     e = new text_emitter(this, *tr);
   else if (method == PARAMETER_VALUE_BINARY)
     e = new binary_emitter(this, *tr);
+#ifdef ZORBA_WITH_JSON
+  else if (method == PARAMETER_VALUE_JSON)
+    e = new json_emitter(this, *tr);
+  else if (method == PARAMETER_VALUE_JSONIQ)
+    e = new jsoniq_emitter(this, *tr);
+#endif
   else
   {
     ZORBA_ASSERT(0);
@@ -2264,6 +2703,24 @@
   return true;
 }
 
+transcoder* serializer::create_transcoder(std::ostream &os)
+{
+  if (encoding == PARAMETER_VALUE_UTF_8)
+  {
+    return new transcoder(os, false);
+  }
+#ifndef ZORBA_NO_UNICODE
+  else if (encoding == PARAMETER_VALUE_UTF_16)
+  {
+    return new transcoder(os, true);
+  }
+#endif
+  else
+  {
+    ZORBA_ASSERT(0);
+    return nullptr;
+  }
+}
 
 /*******************************************************************************
 
@@ -2297,9 +2754,15 @@
   // in case we use SAX event notifications
   if (aHandler)
   {
-    // only allow XML-based methods for SAX notifications
+    // only allow XML-based methods for SAX notifications. For now at least,
+    // the "JSONIQ" method is consider "XML-based", although you will certainly
+    // get errors if you attempt to serialize JDM this way.
     if (method != PARAMETER_VALUE_XML &&
-        method != PARAMETER_VALUE_XHTML) {
+        method != PARAMETER_VALUE_XHTML
+#ifdef ZORBA_WITH_JSON
+        && method != PARAMETER_VALUE_JSONIQ
+#endif
+      ) {
       throw ZORBA_EXCEPTION(
         zerr::ZAPI0070_INVALID_SERIALIZATION_METHOD_FOR_SAX,
         ERROR_PARAMS( method )
@@ -2325,7 +2788,7 @@
     e->emit_item(&*lItem);
   }
 //+  aObject->close();
-  e->emit_declaration_end();
+  e->emit_end();
 }
 
 
@@ -2371,7 +2834,7 @@
   }
 
   //object->close();
-  e->emit_declaration_end();
+  e->emit_end();
 }
 
 } // namespace zorba

=== modified file 'src/api/serialization/serializer.h'
--- src/api/serialization/serializer.h	2012-05-03 12:31:51 +0000
+++ src/api/serialization/serializer.h	2012-05-15 14:37:23 +0000
@@ -69,6 +69,12 @@
     PARAMETER_VALUE_XHTML,
     PARAMETER_VALUE_TEXT,
     PARAMETER_VALUE_BINARY,
+#ifdef ZORBA_WITH_JSON
+    PARAMETER_VALUE_JSON,
+    PARAMETER_VALUE_JSONIQ,
+    PARAMETER_VALUE_ARRAY,
+    PARAMETER_VALUE_APPENDED,
+#endif
 
     PARAMETER_VALUE_UTF_8,
     PARAMETER_VALUE_UTF_16,
@@ -109,6 +115,11 @@
   short int version;               // "1.0"
   zstring version_string;          // this the version as a string
   short int indent;                // "yes" or "no", implemented
+#ifdef ZORBA_WITH_JSON
+  short int cloudscript_multiple_items;  // "no", "array", "appended", implemented
+  short int cloudscript_extensions;      // implemented
+  short int cloudscript_xdm_method;  // A legal value for "method", implemented
+#endif /* ZORBA_WITH_JSON */
   bool version_has_default_value;  // Used during validation to set version to
                                    // "4.0" when output method is "html"
   rchandle<emitter>    e;
@@ -175,6 +186,7 @@
 
   bool setup(std::ostream& os);
 
+  transcoder* create_transcoder(std::ostream& os);
 
   ///////////////////////////////////////////////////////////
   //                                                       //
@@ -205,8 +217,20 @@
     /**
      * Outputs the end of the serialized document.
      */
-    virtual void emit_declaration_end();
-
+    virtual void emit_end();
+
+    /**
+     * Serializes the given item, depending on its type, and its children. This
+     * will be called by serializer for each top-level item in the sequence.
+     *
+     * @param item the item to serialize
+     */
+    virtual void emit_item(store::Item* item);
+
+    // End of the "public" emitter API. All remaining methods are implementation
+    // details and will not be called from outside.
+
+  protected:
     /**
      * Outputs the doctype declaration. This function is not used by the
      * default emitter, it is intended to be defined by the XML, HTML and XHTML
@@ -215,13 +239,6 @@
     virtual void emit_doctype(const zstring& elementName);
 
     /**
-     * Serializes the given item, depending on its type, and its children.
-     *
-     * @param item the item to serialize
-     */
-    virtual void emit_item(store::Item* item);
-
-    /**
      * Serializes the given streamable item.
      *
      * @param item the item to serialize
@@ -277,7 +294,6 @@
      */
     void emit_indentation(int depth);
 
-  protected:
     bool haveBinding(std::pair<zstring, zstring>& nsBinding) const;
 
     bool havePrefix(const zstring& pre) const;
@@ -323,9 +339,98 @@
 
     virtual void emit_declaration();
 
+  protected:
     virtual void emit_doctype(const zstring& elementName);
   };
 
+  ///////////////////////////////////////////////////////////
+  //                                                       //
+  //  class json_emitter                                   //
+  //                                                       //
+  ///////////////////////////////////////////////////////////
+
+#ifdef ZORBA_WITH_JSON
+
+  class json_emitter : public emitter
+  {
+  public:
+    json_emitter(serializer* the_serializer, transcoder& the_transcoder);
+
+    virtual ~json_emitter();
+
+    virtual void emit_declaration();
+
+    virtual void emit_item(store::Item *item);
+
+    virtual void emit_end();
+
+  private:
+
+    /**
+     * Outputs a JSON item. This method is called both for top-level JSON
+     * items as well as any items within a JSON object or array, so it may
+     * output simple typed values differently than standard XML serialization.
+     */
+    void emit_json_item(store::Item* item, int depth);
+
+    void emit_json_object(store::Item* object, int depth);
+
+    void emit_json_array(store::Item* array, int depth);
+
+    void emit_json_pair(store::Item* pair, int depth);
+
+    void emit_json_value(store::Item* value, int depth);
+
+    void emit_cloudscript_value(zstring type, zstring value, int depth);
+
+    void emit_cloudscript_xdm_node(store::Item *item, int depth);
+
+    void emit_json_string(zstring string);
+
+    store::Item_t theCloudScriptValueName;
+    store::Item_t theTypeName;
+    store::Item_t theValueName;
+    store::Item_t theCloudScriptXDMNodeName;
+
+    rchandle<emitter> theXMLEmitter;
+    rchandle<transcoder> theXMLTranscoder;
+    std::stringstream* theXMLStringStream;
+    bool theMultipleItems;
+  };
+
+
+  ///////////////////////////////////////////////////////////
+  //                                                       //
+  //  class jsoniq_emitter (auto-detects JSON or XML)      //
+  //                                                       //
+  ///////////////////////////////////////////////////////////
+
+  class jsoniq_emitter : public emitter
+  {
+  public:
+    jsoniq_emitter(serializer* the_serializer, transcoder& the_transcoder);
+
+    virtual ~jsoniq_emitter();
+
+    virtual void emit_declaration();
+
+    virtual void emit_item(store::Item *item);
+
+    virtual void emit_end();
+
+  private:
+    enum JSONiqEmitterState {
+      JESTATE_UNDETERMINED,
+      JESTATE_JDM,
+      JESTATE_XDM
+    }                           theEmitterState;
+
+    serializer::emitter*        theEmitter;
+  };
+
+#endif /* ZORBA_WITH_JSON */
+
+
 
   ///////////////////////////////////////////////////////////
   //                                                       //
@@ -338,6 +443,7 @@
   public:
     xhtml_emitter(serializer* the_serializer, transcoder& the_transcoder);
 
+  protected:
     virtual void emit_node(const store::Item* item, int depth);
   };
 
@@ -354,7 +460,9 @@
     html_emitter(serializer* the_serializer, transcoder& the_transcoder);
 
     virtual void emit_declaration();
-    virtual void emit_declaration_end();
+    virtual void emit_end();
+
+  protected:
     virtual void emit_doctype(const zstring& elementName);
     virtual void emit_node(const store::Item* item, int depth);
   };
@@ -373,6 +481,9 @@
 
     virtual void emit_declaration();
 
+    virtual void emit_item(store::Item* item);
+
+  protected:
     virtual void emit_node(const store::Item* item, int depth);
 
     virtual int emit_node_children(
@@ -380,8 +491,6 @@
         int depth,
         bool perform_escaping = true);
 
-    virtual void emit_item(store::Item* item);
-
     virtual void emit_streamable_item(store::Item* item);
   };
 
@@ -407,16 +516,17 @@
           std::stringstream& aSStream,
           SAX2_ContentHandler* aSAX2ContentHandler);
 
+    void emit_declaration();
+    void emit_item(store::Item* item );
+    void emit_end();
+
+  protected:
     void emit_startPrefixMapping(
           const store::Item* item,
           store::NsBindings& nsBindings );
 
     void emit_endPrefixMapping(store::NsBindings& nsBindings );
 
-    void emit_declaration();
-
-    void emit_declaration_end();
-
     void emit_node(const store::Item* item, int depth);
 
     void emit_node(const store::Item* item);
@@ -434,8 +544,6 @@
     void emit_node_children(const store::Item* item);
 
     bool emit_bindings(const store::Item* item, int depth);
-
-    void emit_item(store::Item* item );
   };
 
 

=== modified file 'src/api/serializerimpl.cpp'
--- src/api/serializerimpl.cpp	2012-05-03 12:31:51 +0000
+++ src/api/serializerimpl.cpp	2012-05-15 14:37:23 +0000
@@ -20,8 +20,9 @@
 #include <zorba/singleton_item_sequence.h>
 #include <zorba/diagnostic_handler.h>
 
-#include "api/zorbaimpl.h"
-#include "api/unmarshaller.h"
+#include <diagnostics/assert.h>
+#include <api/zorbaimpl.h>
+#include <api/unmarshaller.h>
 
 #include "serializerimpl.h"
 
@@ -88,6 +89,8 @@
 {
   switch (theInternalSerializer.getSerializationMethod())
   {
+  case serializer::PARAMETER_VALUE_XML:
+    return ZORBA_SERIALIZATION_METHOD_XML;
   case serializer::PARAMETER_VALUE_HTML:
     return ZORBA_SERIALIZATION_METHOD_HTML;
   case serializer::PARAMETER_VALUE_XHTML:
@@ -96,30 +99,51 @@
     return ZORBA_SERIALIZATION_METHOD_TEXT;
   case serializer::PARAMETER_VALUE_BINARY:
     return ZORBA_SERIALIZATION_METHOD_BINARY;
+#ifdef ZORBA_WITH_JSON
+  case serializer::PARAMETER_VALUE_JSON:
+    return ZORBA_SERIALIZATION_METHOD_JSON;
+  case serializer::PARAMETER_VALUE_JSONIQ:
+    return ZORBA_SERIALIZATION_METHOD_JSONIQ;
+#endif
   default:
-    return ZORBA_SERIALIZATION_METHOD_XML;
+    ZORBA_ASSERT(0);
   }
 }
 
-
-void
-SerializerImpl::setSerializationParameters(
-  serializer&                       aInternalSerializer,
-  const Zorba_SerializerOptions_t&  aSerializerOptions)
+static void
+convertSerializationMethod(
+    serializer&            aInternalSerializer,
+    const char*            aParameter,
+    Zorba_serialization_method_t   aMethod)
 {
-  switch (aSerializerOptions.ser_method)
+  switch (aMethod)
   {
   case ZORBA_SERIALIZATION_METHOD_XML:
-    aInternalSerializer.setParameter("method", "xml"); break;
+    aInternalSerializer.setParameter(aParameter, "xml"); break;
   case ZORBA_SERIALIZATION_METHOD_HTML:
-    aInternalSerializer.setParameter("method", "html"); break;
+    aInternalSerializer.setParameter(aParameter, "html"); break;
   case ZORBA_SERIALIZATION_METHOD_XHTML:
-    aInternalSerializer.setParameter("method", "xhtml"); break;
+    aInternalSerializer.setParameter(aParameter, "xhtml"); break;
   case ZORBA_SERIALIZATION_METHOD_TEXT:
-    aInternalSerializer.setParameter("method", "text"); break;
+    aInternalSerializer.setParameter(aParameter, "text"); break;
   case ZORBA_SERIALIZATION_METHOD_BINARY:
-    aInternalSerializer.setParameter("method", "binary"); break;
+    aInternalSerializer.setParameter(aParameter, "binary"); break;
+#ifdef ZORBA_WITH_JSON
+  case ZORBA_SERIALIZATION_METHOD_JSON:
+    aInternalSerializer.setParameter(aParameter, "json"); break;
+  case ZORBA_SERIALIZATION_METHOD_JSONIQ:
+    aInternalSerializer.setParameter(aParameter, "jsoniq"); break;
+#endif
   }
+}
+
+void
+SerializerImpl::setSerializationParameters(
+  serializer&                       aInternalSerializer,
+  const Zorba_SerializerOptions_t&  aSerializerOptions)
+{
+  convertSerializationMethod(aInternalSerializer, "method",
+                             aSerializerOptions.ser_method);
 
   switch (aSerializerOptions.byte_order_mark)
   {
@@ -193,6 +217,36 @@
 
   if (aSerializerOptions.version != "")
     aInternalSerializer.setParameter("version", aSerializerOptions.version.c_str());
+
+#ifdef ZORBA_WITH_JSON
+  switch (aSerializerOptions.cloudscript_extensions)
+  {
+    case CLOUDSCRIPT_EXTENSIONS_YES:
+      aInternalSerializer.setParameter("cloudscript-extensions", "yes");
+      break;
+    case CLOUDSCRIPT_EXTENSIONS_NO:
+      aInternalSerializer.setParameter("cloudscript-extensions", "no");
+      break;
+  }
+
+  switch (aSerializerOptions.cloudscript_multiple_items)
+  {
+    case CLOUDSCRIPT_MULTIPLE_ITEMS_NO:
+      aInternalSerializer.setParameter("cloudscript-multiple-items", "no");
+      break;
+    case CLOUDSCRIPT_MULTIPLE_ITEMS_ARRAY:
+      aInternalSerializer.setParameter("cloudscript-multiple-items", "array");
+      break;
+    case CLOUDSCRIPT_MULTIPLE_ITEMS_APPENDED:
+      aInternalSerializer.setParameter("cloudscript-multiple-items", "appended");
+      break;
+  }
+
+  convertSerializationMethod(aInternalSerializer,
+                             "cloudscript-xdm-node-output-method",
+                             aSerializerOptions.cloudscript_xdm_method);
+
+#endif /* ZORBA_WITH_JSON */
 }
 
 void

=== modified file 'src/api/typeidentimpl.cpp'
--- src/api/typeidentimpl.cpp	2012-05-03 12:31:51 +0000
+++ src/api/typeidentimpl.cpp	2012-05-15 14:37:23 +0000
@@ -199,6 +199,59 @@
 }
 
 
+#ifdef ZORBA_WITH_JSON
+
+TypeIdentifier_t TypeIdentifier::createStructuredItemType(IdentTypes::quantifier_t q)
+{
+  TypeIdentifier_t ti(new TypeIdentifier());
+  ti->m_kind = IdentTypes::STRUCTURED_ITEM_TYPE;
+  ti->m_quantifier = q;
+
+  return ti;
+}
+
+
+TypeIdentifier_t TypeIdentifier::createJSONItemType(IdentTypes::quantifier_t q)
+{
+  TypeIdentifier_t ti(new TypeIdentifier());
+  ti->m_kind = IdentTypes::JSON_ITEM_TYPE;
+  ti->m_quantifier = q;
+
+  return ti;
+}
+
+
+TypeIdentifier_t TypeIdentifier::createJSONObjectType(IdentTypes::quantifier_t q)
+{
+  TypeIdentifier_t ti(new TypeIdentifier());
+  ti->m_kind = IdentTypes::JSON_OBJECT_TYPE;
+  ti->m_quantifier = q;
+
+  return ti;
+}
+
+
+TypeIdentifier_t TypeIdentifier::createJSONArrayType(IdentTypes::quantifier_t q)
+{
+  TypeIdentifier_t ti(new TypeIdentifier());
+  ti->m_kind = IdentTypes::JSON_ARRAY_TYPE;
+  ti->m_quantifier = q;
+
+  return ti;
+}
+
+
+TypeIdentifier_t TypeIdentifier::createJSONPairType(IdentTypes::quantifier_t q)
+{
+  TypeIdentifier_t ti(new TypeIdentifier());
+  ti->m_kind = IdentTypes::JSON_PAIR_TYPE;
+  ti->m_quantifier = q;
+
+  return ti;
+}
+#endif
+
+
 TypeIdentifier_t TypeIdentifier::createItemType(IdentTypes::quantifier_t quantifier)
 {
   TypeIdentifier_t ti(new TypeIdentifier());

=== modified file 'src/compiler/codegen/plan_visitor.cpp'
--- src/compiler/codegen/plan_visitor.cpp	2012-05-03 12:31:51 +0000
+++ src/compiler/codegen/plan_visitor.cpp	2012-05-15 14:37:23 +0000
@@ -38,6 +38,7 @@
 #include "compiler/expression/flwor_expr.h"
 #include "compiler/expression/fo_expr.h"
 #include "compiler/expression/script_exprs.h"
+#include "compiler/expression/json_exprs.h"
 #include "compiler/expression/update_exprs.h"
 #ifndef ZORBA_NO_FULL_TEXT
 #include "compiler/expression/ft_expr.h"
@@ -57,10 +58,12 @@
 #include "runtime/visitors/printer_visitor_api.h"
 #include "runtime/visitors/iterprinter.h"
 #include "runtime/sequences/SequencesImpl.h"
+#include "runtime/sequences/sequences.h"
 #include "runtime/core/sequencetypes.h"
 #include "runtime/core/item_iterator.h"
 #include "runtime/core/var_iterators.h"
 #include "runtime/core/constructors.h"
+#include "runtime/json/json_constructors.h"
 #include "runtime/core/apply_updates.h"
 #include "runtime/core/path_iterators.h"
 #include "runtime/core/nodeid_iterators.h"
@@ -2784,10 +2787,13 @@
     axisItep->setDocTestKind(v.getDocTestKind());
     axisItep->setNodeKind(v.getNodeKind());
     axisItep->setQName(v.getQName());
-    store::Item *typeName = v.getTypeName();
+    store::Item* typeName = v.getTypeName();
     if (typeName != NULL) 
     {
-      axisItep->setType(sctx->get_typemanager()->create_named_type(typeName));
+      axisItep->setType(sctx->get_typemanager()->
+                        create_named_type(typeName,
+                                          TypeConstants::QUANT_ONE,
+                                          qloc));
     }
     axisItep->setNilledAllowed(v.getNilledAllowed());
   }
@@ -2988,25 +2994,26 @@
 {
   CODEGEN_TRACE_OUT("");
 
-  PlanIter_t content = pop_itstack ();
+  PlanIter_t content = pop_itstack();
 
   bool isRoot = false;
   theEnclosedContextStack.pop();
   expr* e = plan_visitor_ns::pop_stack(theConstructorsStack);
   ZORBA_ASSERT(e = &v);
+
   if (theConstructorsStack.empty() || is_enclosed_expr(theConstructorsStack.top()))
   {
     isRoot = true;
   }
 
-  switch (v.get_type ())
+  switch (v.get_type())
   {
   case text_expr::text_constructor:
-    push_itstack (new TextIterator(sctx, qloc, content, isRoot));
+    push_itstack(new TextIterator(sctx, qloc, content, isRoot));
     break;
 
   case text_expr::comment_constructor:
-    push_itstack (new CommentIterator (sctx, qloc, content, isRoot));
+    push_itstack(new CommentIterator(sctx, qloc, content, isRoot));
     break;
 
   default:
@@ -3045,6 +3052,124 @@
 }
 
 
+#ifdef ZORBA_WITH_JSON
+
+/*******************************************************************************
+
+  JSON Constructors
+
+********************************************************************************/
+bool begin_visit(json_array_expr& v)
+{
+  CODEGEN_TRACE_IN("");
+  return true;
+}
+
+
+void end_visit(json_array_expr& v)
+{
+  CODEGEN_TRACE_OUT("");
+
+  std::vector<PlanIter_t> inputs;
+
+  expr* inputExpr = v.get_expr();
+
+  if (inputExpr != NULL)
+  {
+    PlanIter_t inputIter = pop_itstack();
+
+    if (dynamic_cast<FnConcatIterator*>(inputIter.getp()) != NULL)
+    {
+      inputs = static_cast<FnConcatIterator*>(inputIter.getp())->getChildren();
+    }
+    else
+    {
+      inputs.push_back(inputIter);
+    }
+  }
+
+  bool copyInput = true;
+
+  push_itstack(new JSONArrayIterator(sctx, qloc, inputs, copyInput));
+}
+
+
+bool begin_visit(json_object_expr& v)
+{
+  CODEGEN_TRACE_IN("");
+  return true;
+}
+
+
+void end_visit(json_object_expr& v)
+{
+  CODEGEN_TRACE_OUT("");
+
+  std::vector<PlanIter_t> inputs;
+
+  expr* inputExpr = v.get_expr();
+
+  if (inputExpr != NULL)
+  {
+    PlanIter_t inputIter = pop_itstack();
+
+    if (dynamic_cast<FnConcatIterator*>(inputIter.getp()) != NULL)
+    {
+      inputs = static_cast<FnConcatIterator*>(inputIter.getp())->getChildren();
+    }
+    else
+    {
+      inputs.push_back(inputIter);
+    }
+  }
+
+  bool copyInput = true;
+
+  push_itstack(new JSONObjectIterator(sctx, 
+                                      qloc, 
+                                      inputs, 
+                                      copyInput, 
+                                      v.is_accumulating()));
+}
+
+
+
+bool begin_visit(json_direct_object_expr& v)
+{
+  CODEGEN_TRACE_IN("");
+  return true;
+}
+
+
+void end_visit(json_direct_object_expr& v)
+{
+  CODEGEN_TRACE_OUT("");
+
+  csize numPairs = v.num_pairs();
+
+  std::vector<PlanIter_t> names(numPairs);
+  std::vector<PlanIter_t> values(numPairs);
+
+  for (csize i = numPairs; i > 0; --i)
+  {
+    values[i-1] = pop_itstack();
+  }
+
+  for (csize i = numPairs; i > 0; --i)
+  {
+    names[i-1] = pop_itstack();
+  }
+
+  bool copyInput = true;
+
+  push_itstack(new JSONDirectObjectIterator(sctx, qloc, names, values, copyInput));
+}
+
+
+
+#endif // ZORBA_WITH_JSON
+
+
 bool begin_visit(const_expr& v)
 {
   CODEGEN_TRACE_IN("");

=== modified file 'src/compiler/expression/CMakeLists.txt'
--- src/compiler/expression/CMakeLists.txt	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/CMakeLists.txt	2012-05-15 14:37:23 +0000
@@ -18,6 +18,7 @@
     expr_type.cpp
     expr.cpp
     expr_put.cpp
+    json_exprs.cpp
     var_expr.cpp
     path_expr.cpp
     flwor_expr.cpp

=== modified file 'src/compiler/expression/abstract_expr_visitor.h'
--- src/compiler/expression/abstract_expr_visitor.h	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/abstract_expr_visitor.h	2012-05-15 14:37:23 +0000
@@ -50,6 +50,14 @@
   EXPR_VISITOR_METHODS (const_expr);
   EXPR_VISITOR_METHODS (doc_expr);
   EXPR_VISITOR_METHODS (elem_expr);
+  EXPR_VISITOR_METHODS (pi_expr);
+  EXPR_VISITOR_METHODS (text_expr);
+#ifdef ZORBA_WITH_JSON
+  EXPR_VISITOR_METHODS (json_pair_expr);
+  EXPR_VISITOR_METHODS (json_object_expr);
+  EXPR_VISITOR_METHODS (json_array_expr);
+#endif
+
   EXPR_VISITOR_METHODS (expr);
   EXPR_VISITOR_METHODS (extension_expr);
   EXPR_VISITOR_METHODS (flwor_expr);
@@ -63,10 +71,9 @@
   EXPR_VISITOR_METHODS (name_cast_expr);
   EXPR_VISITOR_METHODS (order_expr);
   EXPR_VISITOR_METHODS (order_modifier);
-  EXPR_VISITOR_METHODS (pi_expr);
+
   EXPR_VISITOR_METHODS (promote_expr);
   EXPR_VISITOR_METHODS (relpath_expr);
-  EXPR_VISITOR_METHODS (text_expr);
   EXPR_VISITOR_METHODS (treat_expr);
   EXPR_VISITOR_METHODS (validate_expr);
   EXPR_VISITOR_METHODS (var_expr);

=== modified file 'src/compiler/expression/expr.cpp'
--- src/compiler/expression/expr.cpp	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/expr.cpp	2012-05-15 14:37:23 +0000
@@ -457,7 +457,7 @@
 
 bool cast_expr::is_optional() const 
 {
-  return TypeOps::quantifier(*theTargetType) == TypeConstants::QUANT_QUESTION; 
+  return theTargetType->get_quantifier() == TypeConstants::QUANT_QUESTION; 
 }
 
 
@@ -589,7 +589,7 @@
 
 bool castable_expr::is_optional() const 
 {
-  return TypeOps::quantifier(*theTargetType) == TypeConstants::QUANT_QUESTION; 
+  return theTargetType->get_quantifier() == TypeConstants::QUANT_QUESTION; 
 }
 
 
@@ -1479,10 +1479,9 @@
     const QueryLoc& loc,
     expr_t aChild)
   :
-  expr(sctx, loc, aChild->get_expr_kind()),
+  expr(sctx, loc, function_trace_expr_kind),
   theExpr(aChild)
 {
-  theKind = function_trace_expr_kind;
   bool modified;
   compute_return_type(false, &modified);
   compute_scripting_kind();
@@ -1491,10 +1490,9 @@
 
 function_trace_expr::function_trace_expr(expr_t aExpr)
   :
-  expr(aExpr->get_sctx(), aExpr->get_loc(), aExpr->get_expr_kind()),
+  expr(aExpr->get_sctx(), aExpr->get_loc(), function_trace_expr_kind),
   theExpr(aExpr)
 {
-  theKind = function_trace_expr_kind;
   bool modified;
   compute_return_type(false, &modified);
   compute_scripting_kind();

=== modified file 'src/compiler/expression/expr.h'
--- src/compiler/expression/expr.h	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/expr.h	2012-05-15 14:37:23 +0000
@@ -254,11 +254,11 @@
 
 public:
   cast_base_expr(
-        static_context* sctx, 
-        const QueryLoc& loc,
-        expr_kind_t kind,
-        expr_t input,
-        xqtref_t type);
+      static_context* sctx, 
+      const QueryLoc& loc,
+      expr_kind_t kind,
+      expr_t input,
+      xqtref_t type);
 };
 
 
@@ -374,6 +374,12 @@
      - F(I) = error
 
   4. Put F(I) in the output sequence.
+
+  theFnQName:
+  -----------
+  Stores the QName of the function, if the promote expr is used to cast the
+  function's body to its result type
+  
 ********************************************************************************/
 class promote_expr : public cast_base_expr
 {
@@ -381,8 +387,7 @@
   friend class expr;
 
 protected:
-  store::Item_t theFnQName;    // Stores the QName of the function, if the promote expr
-                               // is used to cast the function's body to its result type
+  store::Item_t theFnQName;
   
 public:
   SERIALIZABLE_CLASS(promote_expr)

=== removed file 'src/compiler/expression/expr_annotations.cpp'
--- src/compiler/expression/expr_annotations.cpp	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/expr_annotations.cpp	1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- * 
- * Licensed 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.
- */
-#include "compiler/expression/expr_annotations.h"
-#include "compiler/expression/expr.h"
-#include "functions/function.h"
-
-namespace zorba {
-
-
-bool ExpressionPropertyComputer::returnsDuplicateNodes(expr *e)
-{
-  return true;
-}
-
-
-bool ExpressionPropertyComputer::returnsDescendantNodes(expr *e)
-{
-  switch(e->get_expr_kind()) {
-    case relpath_expr_kind:
-      {
-        relpath_expr *re = static_cast<relpath_expr *>(e);
-        uint32_t numSteps = re->size();
-        for(uint32_t i = 0; i < numSteps; ++i) {
-          expr *rec = &*(*re)[i];
-          axis_step_expr *axis = dynamic_cast<axis_step_expr *>(rec);
-          if (axis != NULL) {
-            if (axis->getAxis() == axis_kind_descendant
-              || axis->getAxis() == axis_kind_descendant_or_self) {
-              return true;
-            }
-          } else {
-            return returnsDescendantNodes(rec);
-          }
-        }
-      }
-      break;
-
-    default:
-      for(expr_iterator i = e->expr_begin(); !i.done(); ++i) {
-        if (*i != NULL) {
-          if (returnsDescendantNodes(*i)) {
-            return true;
-          }
-        }
-      }
-      break;
-  }
-  return false;
-}
-
-
-bool ExpressionPropertyComputer::returnsAncestorNodes(expr *e)
-{
-  return true;
-}
-
-}
-/* vim:set et sw=2 ts=2: */

=== removed file 'src/compiler/expression/expr_annotations.h'
--- src/compiler/expression/expr_annotations.h	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/expr_annotations.h	1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- * 
- * Licensed 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.
- */
-#pragma once
-#ifndef ZORBA_EXPR_ANNOTATIONS_H
-#define ZORBA_EXPR_ANNOTATIONS_H
-
-#include <set>
-#include "compiler/expression/expr_base.h"
-
-namespace zorba {
-
-class ExpressionPropertyComputer {
-  public:
-    bool returnsDuplicateNodes(expr *e);
-    bool returnsAncestorNodes(expr *e);
-    bool returnsDescendantNodes(expr *e);
-};
-
-#if 0 // Fix before using!! 
-class SourceFinder {
-  public:
-    typedef std::set<expr *> sources_t;
-
-    SourceFinder() { }
-    ~SourceFinder() { }
-
-    void reset() { m_sources.clear(); }
-    void findSources(expr *e);
-    const sources_t& getSources() const;
-
-  private:
-    sources_t m_sources;
-
-    void findSourcesInChildren(expr *e);
-};
-#endif
-
-}
-
-#endif /* ZORBA_EXPR_ANNOTATIONS_H */
-/* vim:set et sw=2 ts=2: */

=== modified file 'src/compiler/expression/expr_base.cpp'
--- src/compiler/expression/expr_base.cpp	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/expr_base.cpp	2012-05-15 14:37:23 +0000
@@ -1047,6 +1047,11 @@
   case attr_expr_kind:
   case text_expr_kind:
   case pi_expr_kind:
+#ifdef ZORBA_WITH_JSON
+  case json_object_expr_kind:
+  case json_direct_object_expr_kind:
+  case json_array_expr_kind:
+#endif
   {
     return !contains_expr(e);
   }

=== modified file 'src/compiler/expression/expr_base.h'
--- src/compiler/expression/expr_base.h	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/expr_base.h	2012-05-15 14:37:23 +0000
@@ -108,6 +108,12 @@
   wrapper_expr_kind,
   function_trace_expr_kind,
 
+#ifdef ZORBA_WITH_JSON
+  json_direct_object_expr_kind,
+  json_object_expr_kind,
+  json_array_expr_kind,
+#endif
+
   unknown_expr_kind
 };
 

=== modified file 'src/compiler/expression/expr_classes.h'
--- src/compiler/expression/expr_classes.h	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/expr_classes.h	2012-05-15 14:37:23 +0000
@@ -70,5 +70,11 @@
   class debugger_expr;
   class function_trace_expr;
   class wrapper_expr;
+
+#ifdef ZORBA_WITH_JSON
+  class json_direct_object_expr;
+  class json_object_expr;
+  class json_array_expr;
+#endif
 }
 /* vim:set et sw=2 ts=2: */

=== modified file 'src/compiler/expression/expr_iter.cpp'
--- src/compiler/expression/expr_iter.cpp	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/expr_iter.cpp	2012-05-15 14:37:23 +0000
@@ -22,6 +22,7 @@
 #include "compiler/expression/path_expr.h"
 #include "compiler/expression/fo_expr.h"
 #include "compiler/expression/script_exprs.h"
+#include "compiler/expression/json_exprs.h"
 #include "compiler/expression/update_exprs.h"
 #include "compiler/expression/flwor_expr.h"
 #include "compiler/expression/function_item_expr.h"
@@ -380,6 +381,57 @@
     break;
   }
 
+#ifdef ZORBA_WITH_JSON
+  case json_array_expr_kind:
+  {
+    json_array_expr* e = static_cast<json_array_expr*>(theExpr);
+
+    EXPR_ITER_BEGIN();
+
+    EXPR_ITER_NEXT(e->theContentExpr);
+
+    EXPR_ITER_END();
+    break;
+  }
+
+  case json_object_expr_kind:
+  {
+    json_object_expr* e = static_cast<json_object_expr*>(theExpr);
+
+    EXPR_ITER_BEGIN();
+
+    EXPR_ITER_NEXT(e->theContentExpr);
+
+    EXPR_ITER_END();
+    break;
+  }
+
+  case json_direct_object_expr_kind:
+  {
+    json_direct_object_expr* e = static_cast<json_direct_object_expr*>(theExpr);
+
+    EXPR_ITER_BEGIN();
+
+    theArgsIter = e->theNames.begin();
+    theArgsEnd = e->theNames.end();
+    for (; theArgsIter != theArgsEnd; ++theArgsIter)
+    {
+      EXPR_ITER_NEXT(*theArgsIter);
+    }
+
+    theArgsIter = e->theValues.begin();
+    theArgsEnd = e->theValues.end();
+    for (; theArgsIter != theArgsEnd; ++theArgsIter)
+    {
+      EXPR_ITER_NEXT(*theArgsIter);
+    }
+
+    EXPR_ITER_END();
+    break;
+  }
+
+#endif
+
   case if_expr_kind:
   {
     if_expr* ifExpr = static_cast<if_expr*>(theExpr);

=== modified file 'src/compiler/expression/expr_put.cpp'
--- src/compiler/expression/expr_put.cpp	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/expr_put.cpp	2012-05-15 14:37:23 +0000
@@ -30,6 +30,7 @@
 #include "compiler/expression/expr.h"
 #include "compiler/expression/fo_expr.h"
 #include "compiler/expression/script_exprs.h"
+#include "compiler/expression/json_exprs.h"
 #include "compiler/expression/update_exprs.h"
 #ifndef ZORBA_NO_FULL_TEXT
 #include "compiler/expression/ft_expr.h"
@@ -249,7 +250,7 @@
 
   os << expr_addr(theVarExpr.getp());
 
-  os << endl << indent << " [\n" << inc_indent;
+  os << endl << indent << "[\n" << inc_indent;
 
   theDomainExpr->put(os);
 #endif
@@ -530,7 +531,8 @@
 
 
 #ifndef ZORBA_NO_FULL_TEXT
-ostream& ftcontains_expr::put( ostream &os ) const {
+ostream& ftcontains_expr::put( ostream &os ) const 
+{
   BEGIN_PUT( ftcontains_expr );
   PUT_SUB( "RANGE", range_ );
   ftselection_->put( os );
@@ -822,7 +824,7 @@
   BEGIN_PUT(attr_expr);
 
   theQNameExpr->put(os);
-  PUT_SUB( "=", theValueExpr );
+  PUT_SUB("=", theValueExpr);
 
   END_PUT();
 }
@@ -830,21 +832,58 @@
 
 ostream& text_expr::put(ostream& os) const
 {
-  BEGIN_PUT( text_expr );
+  BEGIN_PUT(text_expr);
   theContentExpr->put(os);
   END_PUT();
 }
 
-ostream& pi_expr::put( ostream& os) const
-{
-  BEGIN_PUT( pi_expr );
-  PUT_SUB( "TARGET", theTargetExpr );
-  PUT_SUB( "CONTENT", theContentExpr );
-  END_PUT();
-}
-
-
-ostream& insert_expr::put( ostream& os) const
+ostream& pi_expr::put(ostream& os) const
+{
+  BEGIN_PUT(pi_expr);
+  PUT_SUB("TARGET", theTargetExpr);
+  PUT_SUB("CONTENT", theContentExpr);
+  END_PUT();
+}
+
+
+#ifdef ZORBA_WITH_JSON
+ostream& json_array_expr::put(ostream& os) const
+{
+  BEGIN_PUT(json_array_expr);
+  if (theContentExpr)
+    theContentExpr->put(os);
+  END_PUT();
+}
+
+
+ostream& json_object_expr::put(ostream& os) const
+{
+  BEGIN_PUT(json_object_expr);
+  if (theContentExpr)
+    theContentExpr->put(os);
+  END_PUT();
+}
+
+
+ostream& json_direct_object_expr::put(ostream& os) const
+{
+  BEGIN_PUT(json_direct_object_expr);
+
+  std::vector<expr_t>::const_iterator ite1 = theNames.begin();
+  std::vector<expr_t>::const_iterator end1 = theNames.end();
+  std::vector<expr_t>::const_iterator ite2 = theValues.begin();
+  for (; ite1 != end1; ++ite1, ++ite2)
+  {
+    (*ite1)->put(os);
+    (*ite2)->put(os);
+  }
+
+  END_PUT();
+}
+#endif
+
+
+ostream& insert_expr::put(ostream& os) const
 {
   BEGIN_PUT( insert_expr );
   theSourceExpr->put(os);
@@ -852,14 +891,14 @@
   END_PUT();
 }
 
-ostream& delete_expr::put( ostream& os) const
+ostream& delete_expr::put(ostream& os) const
 {
   BEGIN_PUT( delete_expr );
   theTargetExpr->put(os);
   END_PUT();
 }
 
-ostream& replace_expr::put( ostream& os) const
+ostream& replace_expr::put(ostream& os) const
 {
   BEGIN_PUT( replace_expr );
   theTargetExpr->put(os);

=== modified file 'src/compiler/expression/expr_type.cpp'
--- src/compiler/expression/expr_type.cpp	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/expr_type.cpp	2012-05-15 14:37:23 +0000
@@ -18,6 +18,7 @@
 #include <zorba/config.h>
 
 #include "diagnostics/assert.h"
+#include "diagnostics/util_macros.h"
 #include "diagnostics/xquery_diagnostics.h"
 
 #include "system/globalenv.h"
@@ -89,6 +90,7 @@
 
   expr_kind_t kind = get_expr_kind();
 
+  xqtref_t contentType;
   xqtref_t newType;
 
   switch (kind)
@@ -243,8 +245,7 @@
     {
       xqtref_t sourceType = e->theSteps[0]->get_return_type();
 
-      if (TypeOps::is_empty(get_type_manager(), *sourceType) ||
-          TypeOps::is_none(get_type_manager(), *sourceType))
+      if (sourceType->is_empty() || sourceType->is_none())
       {
         newType = sourceType;
       }
@@ -256,7 +257,7 @@
       {
         xqtref_t stepType = sourceType;
 
-        for (ulong i = 1; i < e->size(); ++i)
+        for (csize i = 1; i < e->size(); ++i) 
         {
           const axis_step_expr* axisStep = e->theSteps[i].cast<axis_step_expr>();
 
@@ -302,7 +303,7 @@
 
     switch (funcKind)
     {
-    case FunctionConsts::ZORBA_STORE_COLLECTIONS_STATIC_DML_COLLECTION_1:
+    case FunctionConsts::STATIC_COLLECTIONS_DML_COLLECTION_1:
     {
       const store::Item* qname = e->theArgs[0]->getQName(theSctx);
 
@@ -315,11 +316,8 @@
         }
         else
         {
-          throw XQUERY_EXCEPTION(
-            zerr::ZDDY0001_COLLECTION_NOT_DECLARED,
-            ERROR_PARAMS( qname->getStringValue() ),
-            ERROR_LOC( get_loc() )
-          );
+          RAISE_ERROR(zerr::ZDDY0001_COLLECTION_NOT_DECLARED, get_loc(),
+          ERROR_PARAMS(qname->getStringValue()));
         }
       }
       break;
@@ -384,8 +382,8 @@
     xqtref_t target_ptype = TypeOps::prime_type(tm, *e->theTargetType);
 
     TypeConstants::quantifier_t q =
-    TypeOps::intersect_quant(TypeOps::quantifier(*input_type),
-                             TypeOps::quantifier(*e->theTargetType));
+    TypeOps::intersect_quant(input_type->get_quantifier(),
+                             e->theTargetType->get_quantifier());
 
     if (TypeOps::is_subtype(tm, *input_ptype, *target_ptype, get_loc()))
     {
@@ -407,8 +405,8 @@
     xqtref_t target_ptype = TypeOps::prime_type(tm, *e->theTargetType);
 
     TypeConstants::quantifier_t q =
-    TypeOps::intersect_quant(TypeOps::quantifier(*in_type),
-                             TypeOps::quantifier(*e->theTargetType));
+    TypeOps::intersect_quant(in_type->get_quantifier(),
+                             e->theTargetType->get_quantifier());
 
     if (TypeOps::is_subtype(tm, *in_ptype, *target_ptype, get_loc()))
     {
@@ -465,13 +463,13 @@
 
   case doc_expr_kind:
   {
-    doc_expr* e = static_cast<doc_expr*>(this);
+    contentType = (theSctx->construction_mode() == StaticContextConsts::cons_preserve ?
+                   rtm.ANY_TYPE : 
+                   rtm.UNTYPED_TYPE);
 
     newType = tm->create_node_type(store::StoreConsts::documentNode,
                                    NULL,
-                                   (e->theContent == NULL ?
-                                    NULL :
-                                    e->theContent->get_return_type()),
+                                   contentType,
                                    TypeConstants::QUANT_ONE,
                                    false,
                                    false);
@@ -480,14 +478,13 @@
 
   case elem_expr_kind:
   {
-    xqtref_t typeName =
-      (theSctx->construction_mode() == StaticContextConsts::cons_preserve ?
-       rtm.ANY_TYPE :
-       rtm.UNTYPED_TYPE);
+    contentType = (theSctx->construction_mode() == StaticContextConsts::cons_preserve ?
+                   rtm.ANY_TYPE :
+                   rtm.UNTYPED_TYPE);
 
     newType = tm->create_node_type(store::StoreConsts::elementNode,
                                    NULL,
-                                   typeName,
+                                   contentType,
                                    TypeConstants::QUANT_ONE,
                                    false,
                                    false);
@@ -496,13 +493,9 @@
 
   case attr_expr_kind:
   {
-    attr_expr* e = static_cast<attr_expr*>(this);
-
     newType = tm->create_node_type(store::StoreConsts::attributeNode,
                                    NULL,
-                                   (e->theValueExpr == NULL ?
-                                    NULL :
-                                    e->theValueExpr->get_return_type()),
+                                   rtm.UNTYPED_ATOMIC_TYPE_ONE,
                                    TypeConstants::QUANT_ONE,
                                    false,
                                    false);
@@ -523,10 +516,10 @@
     {
       xqtref_t t = e->get_text()->get_return_type();
 
-      if (TypeOps::is_empty(get_type_manager(), *t))
+      if (t->is_empty())
         newType = t;
 
-      else if (TypeOps::type_min_cnt(tm, *t) == 0)
+      else if (t->min_card() == 0)
         q = TypeConstants::QUANT_QUESTION;
 
       nodeKind = store::StoreConsts::textNode;
@@ -545,7 +538,7 @@
     if (newType == NULL)
       newType = tm->create_node_type(nodeKind,
                                      NULL,
-                                     NULL,
+                                     contentType,
                                      q,
                                      false,
                                      false);
@@ -556,13 +549,28 @@
   {
     newType = tm->create_node_type(store::StoreConsts::piNode,
                                    NULL,
-                                   NULL,
+                                   contentType,
                                    TypeConstants::QUANT_ONE,
                                    false,
                                    false);
     break;
   }
 
+#ifdef ZORBA_WITH_JSON
+  case json_object_expr_kind:
+  case json_direct_object_expr_kind:
+  {
+    newType = rtm.JSON_OBJECT_TYPE_ONE;
+    break;
+  }
+
+  case json_array_expr_kind:
+  {
+    newType = rtm.JSON_ARRAY_TYPE_ONE;
+    break;
+  }
+#endif
+
   case const_expr_kind:
   {
     const_expr* e = static_cast<const_expr*>(this);
@@ -788,7 +796,7 @@
     {
       const NodeXQType* rootElemType = reinterpret_cast<const NodeXQType*>(
                                        inContentType.getp());
-      if (rootElemType->get_content_type() == RTM.UNTYPED_TYPE)
+      if (rootElemType->get_content_type() == RTM.UNTYPED_TYPE.getp())
         inUntyped = true;
     }
   }

=== modified file 'src/compiler/expression/expr_visitor.h'
--- src/compiler/expression/expr_visitor.h	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/expr_visitor.h	2012-05-15 14:37:23 +0000
@@ -69,6 +69,12 @@
   DECL_EXPR_VISITOR_VISIT_MEM_FNS( text_expr );
   DECL_EXPR_VISITOR_VISIT_MEM_FNS( pi_expr );
 
+#ifdef ZORBA_WITH_JSON
+  DECL_EXPR_VISITOR_VISIT_MEM_FNS( json_object_expr );
+  DECL_EXPR_VISITOR_VISIT_MEM_FNS( json_direct_object_expr );
+  DECL_EXPR_VISITOR_VISIT_MEM_FNS( json_array_expr );
+#endif
+
   DECL_EXPR_VISITOR_VISIT_MEM_FNS( trycatch_expr );
   DECL_EXPR_VISITOR_VISIT_MEM_FNS( function_item_expr );
   DECL_EXPR_VISITOR_VISIT_MEM_FNS( dynamic_function_invocation_expr );

=== modified file 'src/compiler/expression/flwor_expr.cpp'
--- src/compiler/expression/flwor_expr.cpp	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/flwor_expr.cpp	2012-05-15 14:37:23 +0000
@@ -160,7 +160,7 @@
     xqtref_t declaredType = varExpr->get_type();
     if (declaredType != NULL)
     {
-      if (TypeOps::is_empty(tm, *declaredType))
+      if (declaredType->is_empty())
         RAISE_ERROR(err::XPTY0004, loc,
         ERROR_PARAMS(ZED(BadType_23o), "empty-sequence"));
 

=== modified file 'src/compiler/expression/fo_expr.cpp'
--- src/compiler/expression/fo_expr.cpp	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/fo_expr.cpp	2012-05-15 14:37:23 +0000
@@ -261,8 +261,7 @@
 
 expr_t fo_expr::clone(substitution_t& subst) const
 {
-  if (get_func()->getKind() == 
-      FunctionConsts::ZORBA_STORE_COLLECTIONS_STATIC_DML_COLLECTION_1)
+  if (get_func()->getKind() == FunctionConsts::STATIC_COLLECTIONS_DML_COLLECTION_1)
   {
     expr::subst_iter_t i = subst.find(this);
 

=== added file 'src/compiler/expression/json_exprs.cpp'
--- src/compiler/expression/json_exprs.cpp	1970-01-01 00:00:00 +0000
+++ src/compiler/expression/json_exprs.cpp	2012-05-15 14:37:23 +0000
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ * 
+ * Licensed 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.
+ */
+
+#include "compiler/expression/json_exprs.h"
+#include "compiler/expression/expr_visitor.h"
+
+#include "zorbaserialization/serialize_template_types.h"
+#include "zorbaserialization/serialize_zorba_types.h"
+
+#ifdef ZORBA_WITH_JSON
+
+namespace zorba 
+{
+
+SERIALIZABLE_CLASS_VERSIONS(json_array_expr)
+
+SERIALIZABLE_CLASS_VERSIONS(json_object_expr)
+
+SERIALIZABLE_CLASS_VERSIONS(json_direct_object_expr)
+
+DEF_EXPR_ACCEPT(json_array_expr)
+DEF_EXPR_ACCEPT(json_object_expr)
+DEF_EXPR_ACCEPT(json_direct_object_expr)
+
+/*******************************************************************************
+ JSONArrayConstructor ::= "[" Expr? "]"
+********************************************************************************/
+json_array_expr::json_array_expr(
+    static_context* sctx,
+    const QueryLoc& loc,
+    const expr_t& content)
+  :
+  expr(sctx, loc, json_array_expr_kind),
+  theContentExpr(content)
+{
+  compute_scripting_kind();
+}
+
+
+void json_array_expr::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar, (expr*)this);
+  ar & theContentExpr;
+}
+
+
+void json_array_expr::compute_scripting_kind() 
+{
+  if (theContentExpr)
+  {
+    checkNonUpdating(theContentExpr);
+
+    theScriptingKind = theContentExpr->get_scripting_detail();
+
+    theScriptingKind &= ~VACUOUS_EXPR;
+  }
+  else
+  {
+    theScriptingKind = SIMPLE_EXPR;
+  }
+}
+
+
+expr_t json_array_expr::clone(substitution_t& subst) const
+{
+  return new json_array_expr(theSctx,
+                             get_loc(),
+                             theContentExpr->clone(subst));
+}
+
+
+/*******************************************************************************
+  SimpleObjectUnion ::= "{|" Expr? "|}"
+
+  AccumulatorObjectUnion ::= "{[" Expr? "]}"
+
+  The Expr must return a sequence of zero or more objects
+********************************************************************************/
+json_object_expr::json_object_expr(
+    static_context* sctx,
+    const QueryLoc& loc,
+    const expr_t& content,
+    bool accumulate)
+  :
+  expr(sctx, loc, json_object_expr_kind),
+  theContentExpr(content),
+  theAccumulate(accumulate)
+{
+  compute_scripting_kind();
+}
+
+
+void json_object_expr::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar, (expr*)this);
+  ar & theContentExpr;
+  ar & theAccumulate;
+}
+
+
+void json_object_expr::compute_scripting_kind() 
+{
+  if (theContentExpr)
+  {
+    checkNonUpdating(theContentExpr);
+
+    theScriptingKind = theContentExpr->get_scripting_detail();
+
+    theScriptingKind &= ~VACUOUS_EXPR;
+  }
+  else
+  {
+    theScriptingKind = SIMPLE_EXPR;
+  }
+}
+
+
+expr_t json_object_expr::clone(substitution_t& subst) const
+{
+  return new json_object_expr(theSctx,
+                              get_loc(),
+                              (theContentExpr ?
+                               theContentExpr->clone(subst) :
+                               NULL),
+                              theAccumulate);
+}
+
+
+/*******************************************************************************
+  DirectObjectConstructor ::= "{" PairConstructor ("," PairConstructor )* "}"
+
+  PairConstructor ::= ExprSingle ":" ExprSingle
+
+  The 1st ExprSingle must return exactly one string.
+  The 2nd ExprSingle must contain exactly one item of any kind.
+********************************************************************************/
+json_direct_object_expr::json_direct_object_expr(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<expr_t>& names,
+    std::vector<expr_t>& values)
+  :
+  expr(sctx, loc, json_direct_object_expr_kind)
+{
+  assert(names.size() == values.size());
+
+  theNames.swap(names);
+  theValues.swap(values);
+
+  compute_scripting_kind();
+}
+
+
+void json_direct_object_expr::serialize(::zorba::serialization::Archiver& ar)
+{
+  serialize_baseclass(ar, (expr*)this);
+  ar & theNames;
+  ar & theValues;
+}
+
+
+void json_direct_object_expr::compute_scripting_kind() 
+{
+  theScriptingKind = SIMPLE_EXPR;
+
+  std::vector<expr_t>::const_iterator ite = theNames.begin();
+  std::vector<expr_t>::const_iterator end = theNames.end();
+  for (; ite != end; ++ite)
+  {
+    theScriptingKind |= (*ite)->get_scripting_detail();
+  }
+
+  ite = theValues.begin();
+  end = theValues.end();
+  for (; ite != end; ++ite)
+  {
+    theScriptingKind |= (*ite)->get_scripting_detail();
+  }
+
+  theScriptingKind &= ~VACUOUS_EXPR;
+
+  if (theScriptingKind & UPDATING_EXPR)
+    theScriptingKind &= ~SIMPLE_EXPR;
+
+  if (is_sequential(theScriptingKind))
+    theScriptingKind &= ~SIMPLE_EXPR;
+
+  checkScriptingKind();
+}
+
+
+expr_t json_direct_object_expr::clone(substitution_t& subst) const
+{
+  std::vector<expr_t> names;
+  std::vector<expr_t> values;
+
+  names.reserve(theNames.size());
+  values.reserve(theValues.size());
+
+  std::vector<expr_t>::const_iterator ite = theNames.begin();
+  std::vector<expr_t>::const_iterator end = theNames.end();
+  for (; ite != end; ++ite)
+  {
+    names.push_back((*ite)->clone(subst));
+  }
+
+  ite = theValues.begin();
+  end = theValues.end();
+  for (; ite != end; ++ite)
+  {
+    values.push_back((*ite)->clone(subst));
+  }
+
+  return new json_direct_object_expr(theSctx, get_loc(), names, values);
+}
+
+
+}
+#endif // ZORBA_WITH_JSON
+

=== added file 'src/compiler/expression/json_exprs.h'
--- src/compiler/expression/json_exprs.h	1970-01-01 00:00:00 +0000
+++ src/compiler/expression/json_exprs.h	2012-05-15 14:37:23 +0000
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ * 
+ * Licensed 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.
+ */
+#pragma once
+#ifndef ZORBA_COMPILER_JSON_EXPRS
+#define ZORBA_COMPILER_JSON_EXPRS
+
+#include <string>
+#include <vector>
+
+#include <zorba/store_consts.h>
+
+#include "compiler/expression/expr_base.h"
+
+#ifdef ZORBA_WITH_JSON
+
+
+namespace zorba 
+{
+
+/*******************************************************************************
+  ArrayConstructor ::= "[" Expr? "]"
+********************************************************************************/
+class json_array_expr : public expr 
+{
+  friend class ExprIterator;
+
+protected:
+  expr_t  theContentExpr;
+
+public:
+  SERIALIZABLE_CLASS(json_array_expr)
+  SERIALIZABLE_CLASS_CONSTRUCTOR2(json_array_expr, expr)
+  void serialize(::zorba::serialization::Archiver& ar);
+
+public:
+  json_array_expr(
+      static_context* sctx,
+      const QueryLoc& loc,
+      const expr_t& content);
+
+  expr* get_expr() const { return theContentExpr.getp(); }
+
+  void compute_scripting_kind();
+
+  expr_t clone(substitution_t& s) const;
+
+  void accept(expr_visitor&);
+
+	std::ostream& put(std::ostream&) const;
+};
+
+
+/*******************************************************************************
+  SimpleObjectUnion ::= "{|" Expr? "|}"
+
+  AccumulatorObjectUnion ::= "{[" Expr? "]}"
+
+  The Expr must return a sequence of zero or more objects
+********************************************************************************/
+class json_object_expr : public expr 
+{
+  friend class ExprIterator;
+
+protected:
+  expr_t  theContentExpr;
+  bool    theAccumulate;
+
+public:
+  SERIALIZABLE_CLASS(json_object_expr)
+  SERIALIZABLE_CLASS_CONSTRUCTOR2(json_object_expr, expr)
+  void serialize(::zorba::serialization::Archiver& ar);
+
+public:
+  json_object_expr(
+      static_context* sctx,
+      const QueryLoc& loc,
+      const expr_t& content,
+      bool accumulate);
+
+  expr* get_expr() const { return theContentExpr.getp(); }
+
+  bool is_accumulating() const { return theAccumulate; }
+
+  void compute_scripting_kind();
+
+  expr_t clone(substitution_t& s) const;
+
+  void accept(expr_visitor&);
+
+	std::ostream& put(std::ostream&) const;
+};
+
+
+/*******************************************************************************
+  DirectObjectConstructor ::= "{" PairConstructor ("," PairConstructor )* "}"
+
+  PairConstructor ::= ExprSingle ":" ExprSingle
+
+  The 1st ExprSingle must return exactly one string.
+  The 2nd ExprSingle must contain exactly one item of any kind.
+********************************************************************************/
+class json_direct_object_expr : public expr 
+{
+  friend class ExprIterator;
+
+protected:
+  std::vector<expr_t>  theNames;
+  std::vector<expr_t>  theValues;
+
+public:
+  SERIALIZABLE_CLASS(json_direct_object_expr)
+  SERIALIZABLE_CLASS_CONSTRUCTOR2(json_direct_object_expr, expr)
+  void serialize(::zorba::serialization::Archiver& ar);
+
+public:
+  json_direct_object_expr(
+      static_context* sctx,
+      const QueryLoc& loc,
+      std::vector<expr_t>& names,
+      std::vector<expr_t>& values);
+
+  csize num_pairs() const { return theNames.size(); }
+
+  expr* get_value_expr(csize i) const { return theValues[i].getp(); }
+
+  expr* get_name_expr(csize i) const { return theNames[i].getp(); }
+
+  void compute_scripting_kind();
+
+  expr_t clone(substitution_t& s) const;
+
+  void accept(expr_visitor&);
+
+	std::ostream& put(std::ostream&) const;
+};
+
+
+
+}
+
+#endif // ZORBA_WITH_JSON
+
+#endif
+
+/*
+ * Local variables:
+ * mode: c++
+ * End:
+ */
+/* vim:set et sw=2 ts=2: */

=== modified file 'src/compiler/expression/script_exprs.h'
--- src/compiler/expression/script_exprs.h	2012-05-03 12:31:51 +0000
+++ src/compiler/expression/script_exprs.h	2012-05-15 14:37:23 +0000
@@ -17,24 +17,10 @@
 #ifndef ZORBA_COMPILER_SCRIPT_EXPRS
 #define ZORBA_COMPILER_SCRIPT_EXPRS
 
-#include <string>
 #include <vector>
 
-#include <zorba/store_consts.h>
-
 #include "compiler/expression/expr_base.h"
 
-#include "zorbautils/checked_vector.h"
-
-#include "zorbatypes/schema_types.h"
-
-#include "diagnostics/xquery_diagnostics.h"
-
-#include "context/static_context.h"
-
-#include "types/typeimpl.h"
-
-#include "store/api/item.h"
 
 namespace zorba 
 {

=== modified file 'src/compiler/parser/location.hh'
--- src/compiler/parser/location.hh	2012-05-03 12:31:51 +0000
+++ src/compiler/parser/location.hh	2012-05-15 14:37:23 +0000
@@ -1,9 +1,8 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1.  */
+/* A Bison parser, made by GNU Bison 2.5.  */
 
 /* Locations for Bison parsers in C++
    
-      Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+      Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -44,13 +43,10 @@
 # include "position.hh"
 
 
-/* Line 162 of location.cc  */
-#line 1 "[Bison:b4_percent_define_default]"
-
 namespace zorba {
 
 /* Line 162 of location.cc  */
-#line 54 "/Users/dagraf/work/28msec/software/zorba/build/src/compiler/parser/location.hh"
+#line 50 "/home/jsoniq/zorba/debug/src/compiler/parser/location.hh"
 
   /// Abstract a location.
   class location
@@ -160,12 +156,9 @@
   }
 
 
-/* Line 271 of location.cc  */
-#line 1 "[Bison:b4_percent_define_default]"
-
 } // zorba
 
 /* Line 271 of location.cc  */
-#line 170 "/Users/dagraf/work/28msec/software/zorba/build/src/compiler/parser/location.hh"
+#line 163 "/home/jsoniq/zorba/debug/src/compiler/parser/location.hh"
 
 #endif // not BISON_LOCATION_HH

=== modified file 'src/compiler/parser/position.hh'
--- src/compiler/parser/position.hh	2012-05-03 12:31:51 +0000
+++ src/compiler/parser/position.hh	2012-05-15 14:37:23 +0000
@@ -1,9 +1,8 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1.  */
+/* A Bison parser, made by GNU Bison 2.5.  */
 
 /* Positions for Bison parsers in C++
    
-      Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+      Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -44,13 +43,10 @@
 # include <algorithm>
 
 
-/* Line 38 of location.cc  */
-#line 1 "[Bison:b4_percent_define_default]"
-
 namespace zorba {
 
-/* Line 38 of location.cc  */
-#line 54 "/Users/dagraf/work/28msec/software/zorba/build/src/compiler/parser/position.hh"
+/* Line 37 of location.cc  */
+#line 50 "/home/jsoniq/zorba/debug/src/compiler/parser/position.hh"
   /// Abstract a position.
   class position
   {
@@ -84,12 +80,7 @@
     /// (column related) Advance to the COUNT next columns.
     inline void columns (int count = 1)
     {
-// zorba patch: std::max is not available on windows!
-//      column = std::max (1u, column + count);
-      if (1u <= (column+count))
-        column += count;
-      else
-        column = 1u;
+      column = std::max (1u, column + count);
     }
     /** \} */
 
@@ -136,10 +127,11 @@
   inline bool
   operator== (const position& pos1, const position& pos2)
   {
-    return
-      (pos1.filename == pos2.filename
-       || pos1.filename && pos2.filename && *pos1.filename == *pos2.filename)
-      && pos1.line == pos2.line && pos1.column == pos2.column;
+    return (pos1.line == pos2.line
+            && pos1.column == pos2.column
+            && (pos1.filename == pos2.filename
+                || (pos1.filename && pos2.filename
+                    && *pos1.filename == *pos2.filename)));
   }
 
   /// Compare two position objects.
@@ -162,11 +154,8 @@
   }
 
 
-/* Line 144 of location.cc  */
-#line 1 "[Bison:b4_percent_define_default]"
-
 } // zorba
 
 /* Line 144 of location.cc  */
-#line 167 "/Users/dagraf/work/28msec/software/zorba/build/src/compiler/parser/position.hh"
+#line 161 "/home/jsoniq/zorba/debug/src/compiler/parser/position.hh"
 #endif // not BISON_POSITION_HH

=== modified file 'src/compiler/parser/stack.hh'
--- src/compiler/parser/stack.hh	2012-05-03 12:31:51 +0000
+++ src/compiler/parser/stack.hh	2012-05-15 14:37:23 +0000
@@ -1,10 +1,8 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1.  */
+/* A Bison parser, made by GNU Bison 2.5.  */
 
 /* Stack handling for Bison parsers in C++
    
-      Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
-   Foundation, Inc.
+      Copyright (C) 2002-2011 Free Software Foundation, Inc.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -38,13 +36,10 @@
 #include <deque>
 
 
-/* Line 1067 of lalr1.cc  */
-#line 1 "[Bison:b4_percent_define_default]"
-
 namespace zorba {
 
-/* Line 1067 of lalr1.cc  */
-#line 48 "/Users/dagraf/work/28msec/software/zorba/build/src/compiler/parser/stack.hh"
+/* Line 1149 of lalr1.cc  */
+#line 43 "/home/jsoniq/zorba/debug/src/compiler/parser/stack.hh"
   template <class T, class S = std::deque<T> >
   class stack
   {
@@ -131,13 +126,10 @@
     unsigned int range_;
   };
 
-/* Line 1153 of lalr1.cc  */
-#line 1 "[Bison:b4_percent_define_default]"
-
 } // zorba
 
-/* Line 1153 of lalr1.cc  */
-#line 141 "/Users/dagraf/work/28msec/software/zorba/build/src/compiler/parser/stack.hh"
+/* Line 1235 of lalr1.cc  */
+#line 133 "/home/jsoniq/zorba/debug/src/compiler/parser/stack.hh"
 
 #endif // not BISON_STACK_HH[]dnl
 

=== modified file 'src/compiler/parser/xquery_parser.cpp'
--- src/compiler/parser/xquery_parser.cpp	2012-05-08 23:49:22 +0000
+++ src/compiler/parser/xquery_parser.cpp	2012-05-15 14:37:23 +0000
@@ -36,7 +36,7 @@
 /* First part of user declarations.  */
 
 /* Line 293 of lalr1.cc  */
-#line 87 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
+#line 87 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
 
 
 #include "common/common.h"
@@ -73,7 +73,7 @@
 
 
 /* Line 293 of lalr1.cc  */
-#line 77 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
+#line 77 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
 
 
 #include "xquery_parser.hpp"
@@ -81,7 +81,7 @@
 /* User implementation prologue.  */
 
 /* Line 299 of lalr1.cc  */
-#line 878 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
+#line 902 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
 
 // HACK to trigger rchandle release: rchandles are freed when refcount == 0
 // (not <= 0); but Bison never increments the refcount, so we do it manually...
@@ -93,7 +93,7 @@
 }
 
 /* Line 299 of lalr1.cc  */
-#line 978 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
+#line 1018 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
 
 #include "compiler/parser/xquery_scanner.h"
 
@@ -103,7 +103,7 @@
 
 
 /* Line 299 of lalr1.cc  */
-#line 107 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
+#line 107 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
 
 #ifndef YY_
 # if defined YYENABLE_NLS && YYENABLE_NLS
@@ -189,7 +189,7 @@
 namespace zorba {
 
 /* Line 382 of lalr1.cc  */
-#line 193 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
+#line 193 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
 
   /* Return YYSTR after stripping away unnecessary quotes and
      backslashes, so that it's suitable for yyerror.  The heuristic is
@@ -290,2423 +290,2513 @@
         case 110: /* "\"'DECIMAL'\"" */
 
 /* Line 480 of lalr1.cc  */
-#line 876 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
+#line 900 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
 	{ delete (yyvaluep->decval); };
 
 /* Line 480 of lalr1.cc  */
-#line 298 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
+#line 298 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
 	break;
       case 124: /* "\"'DOUBLE'\"" */
 
 /* Line 480 of lalr1.cc  */
-#line 875 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
+#line 899 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
 	{ delete (yyvaluep->dval); };
 
 /* Line 480 of lalr1.cc  */
-#line 307 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
+#line 307 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
 	break;
       case 149: /* "\"'INTEGER'\"" */
 
 /* Line 480 of lalr1.cc  */
-#line 874 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
+#line 898 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
 	{ delete (yyvaluep->ival); };
 
 /* Line 480 of lalr1.cc  */
-#line 316 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 327: /* "VersionDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 325 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 328: /* "MainModule" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 334 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 329: /* "LibraryModule" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 343 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 330: /* "ModuleDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 352 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 331: /* "SIND_DeclList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 361 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 332: /* "SIND_Decl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 370 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 333: /* "Setter" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 379 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 334: /* "BoundarySpaceDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 388 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 335: /* "DefaultCollationDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 397 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 336: /* "BaseURIDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 406 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 337: /* "ConstructionDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 415 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 338: /* "OrderingModeDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 424 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 339: /* "EmptyOrderDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 433 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 340: /* "CopyNamespacesDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 442 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 341: /* "Import" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 451 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 342: /* "SchemaImport" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 460 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 343: /* "URILiteralList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 469 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 344: /* "SchemaPrefix" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 478 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 345: /* "ModuleImport" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 487 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 346: /* "NamespaceDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 496 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 347: /* "DefaultNamespaceDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 505 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 348: /* "VFO_DeclList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 514 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 349: /* "VFO_Decl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 523 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 350: /* "DecimalFormatDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 532 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 351: /* "DecimalFormatParamList" */
-
-/* Line 480 of lalr1.cc  */
-#line 899 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
+#line 316 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 335: /* "VersionDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 325 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 336: /* "MainModule" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 334 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 337: /* "LibraryModule" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 343 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 338: /* "ModuleDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 352 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 339: /* "SIND_DeclList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 361 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 340: /* "SIND_Decl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 370 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 341: /* "Setter" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 379 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 342: /* "BoundarySpaceDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 388 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 343: /* "DefaultCollationDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 397 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 344: /* "BaseURIDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 406 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 345: /* "ConstructionDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 415 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 346: /* "OrderingModeDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 424 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 347: /* "EmptyOrderDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 433 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 348: /* "CopyNamespacesDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 442 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 349: /* "Import" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 451 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 350: /* "SchemaImport" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 460 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 351: /* "URILiteralList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 469 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 352: /* "SchemaPrefix" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 478 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 353: /* "ModuleImport" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 487 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 354: /* "NamespaceDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 496 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 355: /* "DefaultNamespaceDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 505 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 356: /* "VFO_DeclList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 514 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 357: /* "VFO_Decl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 523 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 358: /* "DecimalFormatDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 532 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 359: /* "DecimalFormatParamList" */
+
+/* Line 480 of lalr1.cc  */
+#line 926 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
 	{ delete (yyvaluep->vstrpair); };
 
 /* Line 480 of lalr1.cc  */
-#line 541 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
+#line 541 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
 	break;
-      case 352: /* "DecimalFormatParam" */
+      case 360: /* "DecimalFormatParam" */
 
 /* Line 480 of lalr1.cc  */
-#line 899 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
+#line 926 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
 	{ delete (yyvaluep->strpair); };
 
 /* Line 480 of lalr1.cc  */
-#line 550 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 354: /* "OptionDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 559 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 355: /* "FTOptionDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 568 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 356: /* "CtxItemDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 577 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 357: /* "CtxItemDecl2" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 586 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 358: /* "CtxItemDecl3" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 595 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 359: /* "CtxItemDecl4" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 604 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 360: /* "VarDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 613 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 361: /* "VarNameAndType" */
-
-/* Line 480 of lalr1.cc  */
-#line 899 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
+#line 550 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 362: /* "OptionDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 559 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 363: /* "FTOptionDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 568 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 364: /* "CtxItemDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 577 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 365: /* "CtxItemDecl2" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 586 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 366: /* "CtxItemDecl3" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 595 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 367: /* "CtxItemDecl4" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 604 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 368: /* "VarDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 613 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 369: /* "VarNameAndType" */
+
+/* Line 480 of lalr1.cc  */
+#line 926 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
 	{ delete (yyvaluep->varnametype); };
 
 /* Line 480 of lalr1.cc  */
-#line 622 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 362: /* "AnnotationList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 631 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 363: /* "Annotation" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 640 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 364: /* "AnnotationLiteralList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 649 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 365: /* "FunctionDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 658 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 366: /* "FunctionDecl2" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 667 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 367: /* "FunctionDeclSimple" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 676 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 368: /* "FunctionDeclUpdating" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 685 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 369: /* "FunctionSig" */
-
-/* Line 480 of lalr1.cc  */
-#line 899 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
+#line 622 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 370: /* "AnnotationList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 631 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 371: /* "Annotation" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 640 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 372: /* "AnnotationLiteralList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 649 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 373: /* "FunctionDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 658 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 374: /* "FunctionDecl2" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 667 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 375: /* "FunctionDeclSimple" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 676 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 376: /* "FunctionDeclUpdating" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 685 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 377: /* "FunctionSig" */
+
+/* Line 480 of lalr1.cc  */
+#line 926 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
 	{ delete (yyvaluep->fnsig); };
 
 /* Line 480 of lalr1.cc  */
-#line 694 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 370: /* "ParamList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 703 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 371: /* "Param" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 712 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 372: /* "CollectionDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 721 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 374: /* "IndexDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 730 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 375: /* "IndexKeyList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 739 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 376: /* "IndexKeySpec" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 748 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 377: /* "IntegrityConstraintDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 757 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 378: /* "QueryBody" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 766 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 379: /* "StatementsAndOptionalExprTop" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 775 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 380: /* "StatementsAndOptionalExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 784 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 381: /* "StatementsAndExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 793 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 382: /* "Statements" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 802 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 383: /* "Statement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 811 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 384: /* "BlockStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 820 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 385: /* "BlockExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 829 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 386: /* "EnclosedStatementsAndOptionalExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 838 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 387: /* "VarDeclStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 847 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 390: /* "AssignStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 856 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 391: /* "ApplyStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 865 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 392: /* "ExitStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 874 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 393: /* "WhileStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 883 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 394: /* "FlowCtlStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 892 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 395: /* "FLWORStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 901 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 396: /* "ReturnStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 910 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 397: /* "IfStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 919 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 398: /* "TryStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 928 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 399: /* "CatchListStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 937 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 400: /* "CatchStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 946 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 401: /* "Expr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 955 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 402: /* "ExprSingle" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 964 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 403: /* "ExprSimple" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 973 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 404: /* "FLWORExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 982 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 405: /* "ReturnExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 991 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 408: /* "FLWORWinCond" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1000 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 409: /* "WindowClause" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1009 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 410: /* "CountClause" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1018 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 411: /* "ForLetWinClause" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1027 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 413: /* "FLWORClauseList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1036 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 414: /* "ForClause" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1045 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 415: /* "VarInDeclList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1054 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 416: /* "VarInDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1063 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 417: /* "PositionalVar" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1072 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 418: /* "FTScoreVar" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1081 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 419: /* "LetClause" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1090 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 420: /* "VarGetsDeclList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1099 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 421: /* "VarGetsDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1108 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 422: /* "WindowVarDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1117 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 423: /* "WindowVars" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1126 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 424: /* "WindowVars3" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1135 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 425: /* "WindowVars2" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1144 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 426: /* "WhereClause" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1153 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 427: /* "GroupByClause" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1162 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 428: /* "GroupSpecList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1171 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 429: /* "GroupSpec" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1180 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 430: /* "GroupCollationSpec" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1189 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 431: /* "OrderByClause" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1198 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 432: /* "OrderSpecList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1207 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 433: /* "OrderSpec" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1216 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 434: /* "OrderModifier" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1225 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 435: /* "OrderDirSpec" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1234 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 436: /* "OrderEmptySpec" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1243 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 437: /* "OrderCollationSpec" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1252 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 438: /* "QuantifiedExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1261 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 439: /* "QVarInDeclList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1270 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 440: /* "QVarInDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1279 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 441: /* "SwitchExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1288 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 442: /* "SwitchCaseClauseList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1297 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 443: /* "SwitchCaseClause" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1306 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 444: /* "SwitchCaseOperandList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1315 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 445: /* "SwitchStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1324 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 448: /* "TypeswitchExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1333 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 449: /* "TypeswitchStatement" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1342 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 450: /* "CaseClauseList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1351 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 451: /* "CaseClause" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1360 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 454: /* "IfExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1369 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 455: /* "OrExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1378 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 456: /* "AndExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1387 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 457: /* "ComparisonExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1396 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 459: /* "FTContainsExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1405 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 460: /* "StringConcatExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1414 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 461: /* "opt_FTIgnoreOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1423 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 462: /* "RangeExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1432 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 463: /* "AdditiveExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1441 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 464: /* "MultiplicativeExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1450 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 465: /* "UnionExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1459 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 466: /* "IntersectExceptExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1468 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 467: /* "InstanceofExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1477 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 468: /* "TreatExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1486 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 469: /* "CastableExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1495 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 470: /* "CastExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1504 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 471: /* "UnaryExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1513 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 472: /* "SignList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1522 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 473: /* "ValueExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1531 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 474: /* "ValueComp" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1540 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 475: /* "NodeComp" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1549 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 476: /* "ValidateExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1558 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 477: /* "ExtensionExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1567 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 478: /* "Pragma_list" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1576 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 479: /* "Pragma" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1585 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 480: /* "PathExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1594 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 482: /* "RelativePathExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1603 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 483: /* "StepExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1612 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 484: /* "AxisStep" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1621 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 485: /* "ForwardStep" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1630 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 486: /* "ForwardAxis" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1639 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 487: /* "AbbrevForwardStep" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1648 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 488: /* "ReverseStep" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1657 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 489: /* "ReverseAxis" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1666 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 490: /* "NodeTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1675 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 491: /* "NameTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1684 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 492: /* "Wildcard" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1693 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 493: /* "FilterExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1702 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 494: /* "PredicateList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1711 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 495: /* "Predicate" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1720 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 496: /* "PrimaryExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1729 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 497: /* "Literal" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1738 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 498: /* "NumericLiteral" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1747 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 499: /* "VarRef" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1756 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 500: /* "ParenthesizedExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1765 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 501: /* "ContextItemExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1774 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 502: /* "OrderedExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1783 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 503: /* "UnorderedExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1792 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 504: /* "FunctionCall" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1801 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 505: /* "ArgList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1810 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 506: /* "Constructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1819 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 507: /* "DirectConstructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1828 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 508: /* "DirElemConstructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1837 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 509: /* "DirElemContentList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1846 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 510: /* "DirAttributeList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1855 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 511: /* "DirAttr" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1864 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 513: /* "DirAttributeValue" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1873 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 514: /* "opt_QuoteAttrContentList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1882 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 515: /* "QuoteAttrContentList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1891 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 516: /* "opt_AposAttrContentList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1900 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 517: /* "AposAttrContentList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1909 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 518: /* "QuoteAttrValueContent" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1918 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 519: /* "AposAttrValueContent" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1927 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 520: /* "DirElemContent" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1936 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 521: /* "CommonContent" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1945 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 522: /* "DirCommentConstructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1954 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 523: /* "DirPIConstructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1963 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 524: /* "CDataSection" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1972 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 525: /* "ComputedConstructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1981 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 526: /* "CompDocConstructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1990 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 527: /* "CompElemConstructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 1999 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 528: /* "CompAttrConstructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2008 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 529: /* "CompTextConstructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2017 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 530: /* "CompCommentConstructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2026 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 531: /* "CompPIConstructor" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2035 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 532: /* "SingleType" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2044 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 533: /* "TypeDeclaration" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2053 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 534: /* "SequenceType" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2062 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 535: /* "OccurrenceIndicator" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2071 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 536: /* "ItemType" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2080 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 537: /* "TypeList" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2089 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 538: /* "AtomicType" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2098 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 539: /* "KindTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2107 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 540: /* "AnyKindTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2116 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 541: /* "DocumentTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2125 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 542: /* "TextTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2134 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 543: /* "CommentTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2143 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 544: /* "PITest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2152 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 545: /* "AttributeTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2161 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 546: /* "SchemaAttributeTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2170 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 547: /* "ElementTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2179 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 548: /* "SchemaElementTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2188 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 549: /* "TypeName" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2197 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 550: /* "TypeName_WITH_HOOK" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2206 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 551: /* "StringLiteral" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2215 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 556: /* "AnyFunctionTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2224 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 557: /* "TypedFunctionTest" */
-
-/* Line 480 of lalr1.cc  */
-#line 890 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2233 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 560: /* "InsertExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2242 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 561: /* "DeleteExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2251 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 562: /* "ReplaceExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2260 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 563: /* "RenameExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2269 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 564: /* "TransformExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2278 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 565: /* "VarNameList" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2287 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 566: /* "VarNameDecl" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2296 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 567: /* "TryExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2305 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 568: /* "CatchListExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2314 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 569: /* "CatchExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2323 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 570: /* "BracedExpr" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2332 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 571: /* "NameTestList" */
-
-/* Line 480 of lalr1.cc  */
-#line 899 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
+#line 694 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 378: /* "ParamList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 703 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 379: /* "Param" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 712 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 380: /* "CollectionDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 721 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 382: /* "IndexDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 730 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 383: /* "IndexKeyList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 739 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 384: /* "IndexKeySpec" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 748 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 385: /* "IntegrityConstraintDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 757 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 386: /* "QueryBody" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 766 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 387: /* "StatementsAndOptionalExprTop" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 775 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 388: /* "StatementsAndOptionalExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 784 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 389: /* "StatementsAndExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 793 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 390: /* "Statements" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 802 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 391: /* "Statement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 811 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 392: /* "BlockStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 820 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 393: /* "BlockExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 829 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 394: /* "EnclosedStatementsAndOptionalExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 838 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 395: /* "VarDeclStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 847 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 398: /* "AssignStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 856 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 399: /* "ApplyStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 865 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 400: /* "ExitStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 874 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 401: /* "WhileStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 883 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 402: /* "FlowCtlStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 892 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 403: /* "FLWORStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 901 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 404: /* "ReturnStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 910 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 405: /* "IfStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 919 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 406: /* "TryStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 928 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 407: /* "CatchListStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 937 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 408: /* "CatchStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 946 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 409: /* "Expr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 955 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 410: /* "ExprSingle" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 964 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 411: /* "ExprSimple" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 973 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 412: /* "FLWORExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 982 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 413: /* "ReturnExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 991 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 416: /* "FLWORWinCond" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1000 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 417: /* "WindowClause" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1009 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 418: /* "CountClause" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1018 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 419: /* "ForLetWinClause" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1027 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 421: /* "FLWORClauseList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1036 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 422: /* "ForClause" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1045 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 423: /* "VarInDeclList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1054 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 424: /* "VarInDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1063 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 425: /* "PositionalVar" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1072 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 426: /* "FTScoreVar" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1081 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 427: /* "LetClause" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1090 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 428: /* "VarGetsDeclList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1099 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 429: /* "VarGetsDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1108 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 430: /* "WindowVarDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1117 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 431: /* "WindowVars" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1126 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 432: /* "WindowVars3" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1135 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 433: /* "WindowVars2" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1144 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 434: /* "WhereClause" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1153 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 435: /* "GroupByClause" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1162 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 436: /* "GroupSpecList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1171 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 437: /* "GroupSpec" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1180 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 438: /* "GroupCollationSpec" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1189 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 439: /* "OrderByClause" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1198 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 440: /* "OrderSpecList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1207 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 441: /* "OrderSpec" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1216 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 442: /* "OrderModifier" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1225 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 443: /* "OrderDirSpec" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1234 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 444: /* "OrderEmptySpec" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1243 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 445: /* "OrderCollationSpec" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1252 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 446: /* "QuantifiedExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1261 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 447: /* "QVarInDeclList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1270 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 448: /* "QVarInDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1279 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 449: /* "SwitchExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1288 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 450: /* "SwitchCaseClauseList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1297 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 451: /* "SwitchCaseClause" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1306 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 452: /* "SwitchCaseOperandList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1315 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 453: /* "SwitchStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1324 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 456: /* "TypeswitchExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1333 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 457: /* "TypeswitchStatement" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1342 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 458: /* "CaseClauseList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1351 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 459: /* "CaseClause" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1360 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 462: /* "IfExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1369 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 463: /* "OrExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1378 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 464: /* "AndExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1387 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 465: /* "ComparisonExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1396 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 467: /* "FTContainsExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1405 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 468: /* "StringConcatExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1414 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 469: /* "opt_FTIgnoreOption" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1423 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 470: /* "RangeExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1432 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 471: /* "AdditiveExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1441 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 472: /* "MultiplicativeExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1450 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 473: /* "UnionExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1459 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 474: /* "IntersectExceptExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1468 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 475: /* "InstanceofExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1477 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 476: /* "TreatExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1486 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 477: /* "CastableExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1495 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 478: /* "CastExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1504 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 479: /* "UnaryExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1513 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 480: /* "SignList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1522 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 481: /* "ValueExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1531 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 482: /* "ValueComp" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1540 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 483: /* "NodeComp" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1549 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 484: /* "ValidateExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1558 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 485: /* "ExtensionExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1567 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 486: /* "Pragma_list" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1576 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 487: /* "Pragma" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1585 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 488: /* "PathExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1594 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 490: /* "RelativePathExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1603 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 491: /* "StepExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1612 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 492: /* "AxisStep" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1621 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 493: /* "ForwardStep" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1630 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 494: /* "ForwardAxis" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1639 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 495: /* "AbbrevForwardStep" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1648 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 496: /* "ReverseStep" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1657 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 497: /* "ReverseAxis" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1666 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 498: /* "NodeTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1675 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 499: /* "NameTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1684 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 500: /* "Wildcard" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1693 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 501: /* "FilterExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1702 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 502: /* "PredicateList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1711 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 503: /* "Predicate" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1720 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 504: /* "PrimaryExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1729 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 505: /* "Literal" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1738 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 506: /* "NumericLiteral" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1747 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 507: /* "VarRef" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1756 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 508: /* "ParenthesizedExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1765 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 509: /* "ContextItemExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1774 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 510: /* "OrderedExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1783 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 511: /* "UnorderedExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1792 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 512: /* "FunctionCall" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1801 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 513: /* "ArgList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1810 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 514: /* "Constructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1819 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 515: /* "DirectConstructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1828 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 516: /* "DirElemConstructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1837 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 517: /* "DirElemContentList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1846 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 518: /* "DirAttributeList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1855 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 519: /* "DirAttr" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1864 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 521: /* "DirAttributeValue" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1873 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 522: /* "opt_QuoteAttrContentList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1882 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 523: /* "QuoteAttrContentList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1891 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 524: /* "opt_AposAttrContentList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1900 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 525: /* "AposAttrContentList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1909 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 526: /* "QuoteAttrValueContent" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1918 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 527: /* "AposAttrValueContent" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1927 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 528: /* "DirElemContent" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1936 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 529: /* "CommonContent" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1945 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 530: /* "DirCommentConstructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1954 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 531: /* "DirPIConstructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1963 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 532: /* "CDataSection" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1972 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 533: /* "ComputedConstructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1981 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 534: /* "CompDocConstructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1990 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 535: /* "CompElemConstructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 1999 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 536: /* "CompAttrConstructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2008 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 537: /* "CompTextConstructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2017 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 538: /* "CompCommentConstructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2026 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 539: /* "CompPIConstructor" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2035 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 540: /* "SingleType" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2044 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 541: /* "TypeDeclaration" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2053 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 542: /* "SequenceType" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2062 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 543: /* "OccurrenceIndicator" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2071 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 544: /* "ItemType" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2080 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 545: /* "TypeList" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2089 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 546: /* "AtomicType" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2098 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 547: /* "KindTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2107 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 548: /* "AnyKindTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2116 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 549: /* "DocumentTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2125 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 550: /* "TextTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2134 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 551: /* "CommentTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2143 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 552: /* "PITest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2152 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 553: /* "AttributeTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2161 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 554: /* "SchemaAttributeTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2170 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 555: /* "ElementTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2179 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 556: /* "SchemaElementTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2188 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 557: /* "TypeName" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2197 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 558: /* "TypeName_WITH_HOOK" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2206 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 559: /* "StringLiteral" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2215 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 564: /* "AnyFunctionTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2224 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 565: /* "TypedFunctionTest" */
+
+/* Line 480 of lalr1.cc  */
+#line 914 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2233 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 568: /* "InsertExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2242 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 569: /* "DeleteExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2251 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 570: /* "ReplaceExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2260 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 571: /* "RenameExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2269 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 572: /* "TransformExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2278 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 573: /* "VarNameList" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2287 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 574: /* "VarNameDecl" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2296 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 575: /* "TryExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2305 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 576: /* "CatchListExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2314 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 577: /* "CatchExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2323 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 578: /* "BracedExpr" */
+
+/* Line 480 of lalr1.cc  */
+#line 923 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->expr) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2332 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 579: /* "NameTestList" */
+
+/* Line 480 of lalr1.cc  */
+#line 926 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
 	{ delete (yyvaluep->name_test_list); };
 
 /* Line 480 of lalr1.cc  */
-#line 2341 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 572: /* "FTSelection" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2350 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 575: /* "FTOr" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2359 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 576: /* "FTAnd" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2368 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 577: /* "FTMildNot" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2377 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 578: /* "FTUnaryNot" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2386 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 579: /* "FTPrimaryWithOptions" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2395 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 580: /* "opt_FTMatchOptions" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2404 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 582: /* "FTWeight" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2413 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 583: /* "FTPrimary" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2422 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 584: /* "opt_FTTimes" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2431 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 585: /* "FTExtensionSelection" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2440 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 587: /* "FTWords" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2449 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 588: /* "FTWordsValue" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2458 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 590: /* "FTAnyallOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2467 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 593: /* "FTPosFilter" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2476 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 594: /* "FTOrder" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2485 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 595: /* "FTWindow" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2494 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 596: /* "FTDistance" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2503 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 597: /* "FTUnit" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2512 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 598: /* "FTMatchOptions" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2521 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 599: /* "FTMatchOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2530 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 600: /* "FTCaseOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2539 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 601: /* "FTDiacriticsOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2548 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 602: /* "FTExtensionOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2557 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 603: /* "FTStemOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2566 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 604: /* "FTThesaurusOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2575 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 608: /* "FTThesaurusID" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2584 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 611: /* "FTStopWordOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2593 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 612: /* "FTStopWords" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2602 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 616: /* "FTStopWordsInclExcl" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2611 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 617: /* "FTLanguageOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2620 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 618: /* "FTWildCardOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2629 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 619: /* "FTContent" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2638 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 620: /* "FTTimes" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2647 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 621: /* "FTRange" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2656 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 622: /* "FTScope" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2665 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 623: /* "FTBigUnit" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2674 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 624: /* "FTIgnoreOption" */
-
-/* Line 480 of lalr1.cc  */
-#line 893 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->node) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2683 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 627: /* "QNAME" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2692 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 628: /* "FUNCTION_NAME" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2701 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
-	break;
-      case 629: /* "EQNAME" */
-
-/* Line 480 of lalr1.cc  */
-#line 896 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parser/xquery_parser.y"
-	{ release_hack( (yyvaluep->expr) ); };
-
-/* Line 480 of lalr1.cc  */
-#line 2710 "/Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/build/src/compiler/parser/xquery_parser.cpp"
+#line 2341 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 580: /* "FTSelection" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2350 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 583: /* "FTOr" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2359 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 584: /* "FTAnd" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2368 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 585: /* "FTMildNot" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2377 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 586: /* "FTUnaryNot" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2386 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 587: /* "FTPrimaryWithOptions" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2395 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 588: /* "opt_FTMatchOptions" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2404 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 590: /* "FTWeight" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2413 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 591: /* "FTPrimary" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2422 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 592: /* "opt_FTTimes" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2431 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 593: /* "FTExtensionSelection" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2440 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 595: /* "FTWords" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2449 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 596: /* "FTWordsValue" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2458 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 598: /* "FTAnyallOption" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2467 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 601: /* "FTPosFilter" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2476 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 602: /* "FTOrder" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2485 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 603: /* "FTWindow" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2494 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 604: /* "FTDistance" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2503 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 605: /* "FTUnit" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2512 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 606: /* "FTMatchOptions" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2521 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 607: /* "FTMatchOption" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2530 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 608: /* "FTCaseOption" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2539 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 609: /* "FTDiacriticsOption" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2548 "/Users/zorba/Code/zorba/debug/src/compiler/parser/xquery_parser.cpp"
+	break;
+      case 610: /* "FTExtensionOption" */
+
+/* Line 480 of lalr1.cc  */
+#line 917 "/Users/zorba/Code/zorba/sandbox/src/compiler/parser/xquery_parser.y"
+	{ release_hack( (yyvaluep->node) ); };
+
+/* Line 480 of lalr1.cc  */
+#line 2557 "/Users/zorba/Code/zorb

Follow ups