Nicolae Brinza has proposed merging lp:~nbrinza/zorba/bugs3 into lp:zorba.

Commit message:
Unrecognized options in the XQuery namespace now raise an error, fixes 
K-OptionDeclarationProlog-1b

Requested reviews:
  Nicolae Brinza (nbrinza)
  Chris Hillery (ceejatec)
Related bugs:
  Bug #1114228 in Zorba: ""prod-OptionDecl" failure"
  https://bugs.launchpad.net/zorba/+bug/1114228

For more details, see:
https://code.launchpad.net/~nbrinza/zorba/bugs3/+merge/156703

Unrecognized options in the XQuery namespace now raise an error, fixes 
K-OptionDeclarationProlog-1b
-- 
https://code.launchpad.net/~nbrinza/zorba/bugs3/+merge/156703
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2013-04-01 02:48:23 +0000
+++ ChangeLog	2013-04-02 21:49:23 +0000
@@ -36,6 +36,7 @@
   * Extented index join  rule to general flwor expressions. 
 
 Bug Fixes/Other Changes:
+  * Fixed bug #1114228 (unrecognized options in the XQuery namespace now raise an error)
   * Fixed bug #1124273 (xqdoc crash because of annotation literals)
   * Fixed bug #867027 (XQST0059 error messages inconsistent)
   * Fixed bug #1095889 (Improve error message for xml-parsing error).

=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h	2013-03-28 05:32:59 +0000
+++ include/zorba/pregenerated/diagnostic_list.h	2013-04-02 21:49:23 +0000
@@ -158,6 +158,8 @@
 
 extern ZORBA_DLL_PUBLIC XQueryErrorCode XQST0111;
 
+extern ZORBA_DLL_PUBLIC XQueryErrorCode XQST0123;
+
 extern ZORBA_DLL_PUBLIC XQueryErrorCode XPDY0002;
 
 extern ZORBA_DLL_PUBLIC XQueryErrorCode XPDY0050;

=== modified file 'modules/w3c/pregenerated/xqt-errors.xq'
--- modules/w3c/pregenerated/xqt-errors.xq	2013-03-28 05:32:59 +0000
+++ modules/w3c/pregenerated/xqt-errors.xq	2013-04-02 21:49:23 +0000
@@ -674,6 +674,14 @@
 
 (:~
  :
+ : It is a static error if the name of a feature in require-feature is not recognized by the implementation.
+ : 
+ : @see http://www.w3.org/2005/xqt-errors
+:)
+declare variable $err:XQST0123 as xs:QName := fn:QName($err:NS, "err:XQST0123");
+
+(:~
+ :
  : It is a dynamic error if evaluation of an expression relies on some part
  : of the dynamic context that has not been assigned a value.
  : 

=== modified file 'src/compiler/parser/xquery_scanner.l'
--- src/compiler/parser/xquery_scanner.l	2013-03-18 18:10:14 +0000
+++ src/compiler/parser/xquery_scanner.l	2013-04-02 21:49:23 +0000
@@ -295,7 +295,9 @@
    |
    |  Entity definitions
    |______________________________________________________________________*/
-CharRef               "&#"([0-9]+|x([0-9]|[a-f]|[A-F])+)";"
+  // CharRef               "&#"([0-9]+|x([0-9]|[a-f]|[A-F])+)";"
+
+CharRef               "&#"([1-9][0-9]*|x(([1-9]|[a-f]|[A-F])([0-9]|[a-f]|[A-F])*))";"
 PredefinedEntityRef   "&"(lt|gt|amp|quot|apos|nbsp)";"
 Ref                   {CharRef}|{PredefinedEntityRef}
 

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2013-03-27 12:40:41 +0000
+++ src/compiler/translator/translator.cpp	2013-04-02 21:49:23 +0000
@@ -3525,7 +3525,7 @@
       {
         theSctx->expand_qname(
            qnameItem,
-           static_context::XQUERY_OPTION_NS,
+           static_context::XQUERY_NS,
            "",
            lQName->get_localname(),
            lQName->get_location());
@@ -3539,6 +3539,14 @@
         }
       }
 
+      if (qnameItem->getNamespace() == static_context::XQUERY_NS
+          &&
+          qnameItem->getLocalName() != "require-feature"
+          &&
+          qnameItem->getLocalName() != "prohibit-feature")
+      {
+        RAISE_ERROR(err::XQST0123, loc, ERROR_PARAMS(ZED(UnrecognizedXQueryOption), qnameItem->getLocalName()));
+      }
 
       if (qnameItem->getNamespace() == static_context::ZORBA_OPTION_FEATURE_NS &&
           value == "http-uri-resolution")

=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2013-03-22 00:49:51 +0000
+++ src/context/static_context.cpp	2013-04-02 21:49:23 +0000
@@ -512,6 +512,10 @@
 "http://www.zorba-xquery.com/options/optimizer";;
 
 const char*
+static_context::XQUERY_NS =
+"http://www.w3.org/2012/xquery";;
+
+const char*
 static_context::XQUERY_OPTION_NS =
 "http://www.w3.org/2011/xquery-options";;
 

=== modified file 'src/context/static_context.h'
--- src/context/static_context.h	2013-03-22 00:49:51 +0000
+++ src/context/static_context.h	2013-04-02 21:49:23 +0000
@@ -567,7 +567,8 @@
   static const char* ZORBA_OPTION_WARN_NS;
   static const char* ZORBA_OPTION_FEATURE_NS;
   static const char* ZORBA_OPTION_OPTIM_NS;
-  static const char* XQUERY_OPTION_NS;
+  static const char* XQUERY_NS;                 // http://www.w3.org/2012/xquery
+  static const char* XQUERY_OPTION_NS;          // http://www.w3.org/2011/xquery-options
   static const char* ZORBA_VERSIONING_NS;
 
 protected:

=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2013-04-01 02:22:49 +0000
+++ src/diagnostics/diagnostic_en.xml	2013-04-02 21:49:23 +0000
@@ -814,6 +814,13 @@
       <value>$1</value>
     </diagnostic>
 
+    <diagnostic code="XQST0123">
+      <comment>
+       It is a static error if the name of a feature in require-feature is not recognized by the implementation.
+      </comment>
+      <value>$1</value>
+    </diagnostic>
+
     <diagnostic code="XPDY0002">
       <comment>
        It is a dynamic error if evaluation of an expression relies on some part
@@ -5007,6 +5014,10 @@
       <value>"$5": duplicate attribute enumeration value token</value>
     </entry>
 
+    <entry key="UnrecognizedXQueryOption">
+      <value>"$2": unrecognized XQuery namespace option</value>
+    </entry>
+
   </subvalues>
 
 </diagnostic-list>

=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp	2013-03-28 05:32:59 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp	2013-04-02 21:49:23 +0000
@@ -220,6 +220,9 @@
 XQueryErrorCode XQST0111( "XQST0111" );
 
 
+XQueryErrorCode XQST0123( "XQST0123" );
+
+
 XQueryErrorCode XPDY0002( "XPDY0002" );
 
 

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2013-04-01 02:22:49 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2013-04-02 21:49:23 +0000
@@ -260,6 +260,7 @@
   { "XQST0103", "$1: non-distinct variable in window clause" },
   { "XQST0106", "$1: multiple annotations with $2 names" },
   { "XQST0111", "$1" },
+  { "XQST0123", "$1" },
   { "XQTY0024", "element constructor content sequence must not have an attribute node following a non-attribute node" },
   { "XQTY0030", "validate argument must be exactly one document or element node" },
   { "XQTY0086", "typed value of copied element or attribute node is namespace-sensitive when construction mode is preserve and copy-namespaces mode is no-preserve" },
@@ -925,6 +926,7 @@
   { "~UnescapedChar_3", "character '$3' must be escaped here" },
 #endif
   { "~UnexpectedElement", "unexpected element" },
+  { "~UnrecognizedXQueryOption", "\"$2\": unrecognized XQuery namespace option" },
   { "~VarValMustBeSingleItem_2", "\"$2\": variable value must be single item" },
   { "~XMLParserInitFailed", "XML parser initialization failed" },
   { "~XMLParserNoCreateTree", "XML tree creation failed" },

=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
--- src/diagnostics/pregenerated/dict_zed_keys.h	2013-04-01 02:22:49 +0000
+++ src/diagnostics/pregenerated/dict_zed_keys.h	2013-04-02 21:49:23 +0000
@@ -515,6 +515,7 @@
 #define ZED_libxml_ERR_539 "~libxml_ERR_539"
 #define ZED_libxml_ERR_540 "~libxml_ERR_540"
 #define ZED_libxml_ERR_541 "~libxml_ERR_541"
+#define ZED_UnrecognizedXQueryOption "~UnrecognizedXQueryOption"
 
 #endif /* ZORBA_DIAGNOSTICS_ZED_KEYS */
 /*

=== modified file 'test/fots/CMakeLists.txt'
--- test/fots/CMakeLists.txt	2013-04-02 18:29:15 +0000
+++ test/fots/CMakeLists.txt	2013-04-02 21:49:23 +0000
@@ -474,7 +474,6 @@
 EXPECTED_FOTS_FAILURE (prod-ModuleImport modules-pub-priv-30 0)
 EXPECTED_FOTS_FAILURE (prod-ModuleImport modules-pub-priv-34 0)
 EXPECTED_FOTS_FAILURE (prod-ModuleImport cbcl-module-004 0)
-EXPECTED_FOTS_FAILURE (prod-OptionDecl K-OptionDeclarationProlog-1b 0)
 EXPECTED_FOTS_FAILURE (prod-OptionDecl.serialization Serialization-003 0)
 EXPECTED_FOTS_FAILURE (prod-OptionDecl.serialization Serialization-004 0)
 EXPECTED_FOTS_FAILURE (prod-OptionDecl.serialization Serialization-005 0)

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

Reply via email to