Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch into lp:zorba.
Requested reviews: Markos Zaharioudakis (markos-za) For more details, see: https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/95950 Fixed bug #867024 -- https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/95950 Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog' --- ChangeLog 2012-03-01 21:22:16 +0000 +++ ChangeLog 2012-03-05 17:06:29 +0000 @@ -17,6 +17,7 @@ of the annotations map in expressions. * Fixed bug 909126 (bug in cloning of var_expr) * Fixed bug in destruction of exit_catcher_expr + * Fixed bug #867024 (error messages) * Types-related optimizations for runtime operators (comparisons, FnBoolean, Or, And, Compare, instance-of, cast, castable, treat, promote). * Fixed bug #911585 (management of variables during eval) === modified file 'src/compiler/translator/translator.cpp' --- src/compiler/translator/translator.cpp 2012-02-29 17:15:09 +0000 +++ src/compiler/translator/translator.cpp 2012-03-05 17:06:29 +0000 @@ -3157,8 +3157,7 @@ { if (theSctx->xquery_version() < StaticContextConsts::xquery_version_3_0) { - RAISE_ERROR(err::XPST0003, loc, - ERROR_PARAMS("functions and variables annotations only available in XQuery 1.1 or later")); + RAISE_ERROR(err::XPST0003, loc, ERROR_PARAMS(ZED(XPST0003_Annotations))); } lAnns->accept(*this); @@ -3916,7 +3915,7 @@ if (theSctx->xquery_version() <= StaticContextConsts::xquery_version_1_0) RAISE_ERROR(err::XPST0003, loc, - ERROR_PARAMS(ZED(XQueryVersionAtLeast10_2), theSctx->xquery_version())); + ERROR_PARAMS(ZED(XPST0003_XQueryVersionAtLeast30_2), theSctx->xquery_version())); theHaveContextItemDecl = true; @@ -5333,12 +5332,10 @@ return NULL; } - if ( !theSctx->is_feature_set(feature::scripting) ) + if (!theSctx->is_feature_set(feature::scripting)) { - throw XQUERY_EXCEPTION( - err::XPST0003, - ERROR_LOC( v.get_location() ) - ); + RAISE_ERROR(zerr::ZXQP0050_FEATURE_NOT_AVAILABLE, v.get_location(), + ERROR_PARAMS(ZED(ZXQP0050_Scripting))); } bool topLevel = v.isTopLevel(); @@ -5354,14 +5351,14 @@ push_scope(); - ulong numScopes = theAssignedVars.size(); + csize numScopes = theAssignedVars.size(); theAssignedVars.resize(numScopes + 1); - ulong numExprs = v.size(); + csize numExprs = v.size(); bool declaresVars = false; - for (ulong i = 0; i < numExprs; ++i) + for (csize i = 0; i < numExprs; ++i) { v[i]->accept(*this); @@ -5469,12 +5466,10 @@ { TRACE_VISIT(); - if ( !theSctx->is_feature_set(feature::scripting) ) + if (!theSctx->is_feature_set(feature::scripting)) { - throw XQUERY_EXCEPTION( - err::XPST0003, - ERROR_LOC( v.get_location() ) - ); + RAISE_ERROR(zerr::ZXQP0050_FEATURE_NOT_AVAILABLE, v.get_location(), + ERROR_PARAMS(ZED(ZXQP0050_Scripting))); } return no_state; } @@ -5772,7 +5767,7 @@ v.is_non_10()) { RAISE_ERROR(err::XPST0003, loc, - ERROR_PARAMS(ZED(XQueryVersionAtLeast10_2), theSctx->xquery_version())); + ERROR_PARAMS(ZED(XPST0003_XQueryVersionAtLeast30_2), theSctx->xquery_version())); } rchandle<flwor_expr> flwor = new flwor_expr(theRootSctx, loc, v.is_general()); @@ -5877,7 +5872,7 @@ if (v.has_allowing_empty()) { if (theSctx->xquery_version() < StaticContextConsts::xquery_version_3_0) - RAISE_ERROR(err::XPST0003, loc, ERROR_PARAMS(ZED(OuterForClause11))); + RAISE_ERROR(err::XPST0003, loc, ERROR_PARAMS(ZED(XPST0003_OuterForClause11))); theFlworClausesStack.push_back(NULL); } @@ -6087,9 +6082,7 @@ TRACE_VISIT(); if (theSctx->xquery_version() < StaticContextConsts::xquery_version_3_0) - throw XQUERY_EXCEPTION( - err::XPST0003, ERROR_PARAMS( ZED( WindowClause11 ) ), ERROR_LOC( loc ) - ); + RAISE_ERROR(err::XPST0003, loc, ERROR_PARAMS(ZED(XPST0003_WindowClause11))); return no_state; } @@ -6708,9 +6701,7 @@ TRACE_VISIT (); if (theSctx->xquery_version() < StaticContextConsts::xquery_version_3_0) - throw XQUERY_EXCEPTION( - err::XPST0003, ERROR_PARAMS( ZED( CountClause11 ) ), ERROR_LOC( loc ) - ); + RAISE_ERROR(err::XPST0003, loc, ERROR_PARAMS(ZED(XPST0003_CountClause11))); return no_state; } @@ -6774,9 +6765,7 @@ if (theSctx->xquery_version() < StaticContextConsts::xquery_version_3_0) { - throw XQUERY_EXCEPTION(err::XPST0003, - ERROR_PARAMS(ZED(SwitchExpr11)), - ERROR_LOC(loc)); + RAISE_ERROR(err::XPST0003, loc, ERROR_PARAMS(ZED(XPST0003_SwitchExpr11))); } v.get_switch_expr()->accept(*this); @@ -7175,9 +7164,7 @@ if (theSctx->xquery_version() < StaticContextConsts::xquery_version_3_0) { - throw XQUERY_EXCEPTION(err::XPST0003, - ERROR_PARAMS(ZED(TryCatchExpr11)), - ERROR_LOC(loc)); + RAISE_ERROR(err::XPST0003, loc, ERROR_PARAMS(ZED(XPST0003_TryCatchExpr11))); } theTryStack.push_back(&v); @@ -10388,11 +10375,8 @@ TRACE_VISIT(); if ( !theSctx->is_feature_set(feature::hof) ) { - throw XQUERY_EXCEPTION( - zerr::ZXQP0050_FEATURE_NOT_AVAILABLE, - ERROR_PARAMS( "higher-order functions (hof)" ), - ERROR_LOC( v.get_location() ) - ); + RAISE_ERROR(zerr::ZXQP0050_FEATURE_NOT_AVAILABLE, v.get_location(), + ERROR_PARAMS("higher-order functions (hof)" )); } return no_state; } @@ -11418,7 +11402,7 @@ utf8::to_upper(target_str, &target_upper); if (target_upper == "XML") - throw XQUERY_EXCEPTION(err::XPST0003, ERROR_LOC(loc)); + RAISE_ERROR(err::XPST0003, loc, ERROR_PARAMS(ZED(XPST0003_PiTarget))); expr_t target = new const_expr(theRootSctx, loc, target_str); expr_t content = new const_expr(theRootSctx, loc, v.get_pi_content().str()); @@ -12487,7 +12471,8 @@ #ifndef ZORBA_NO_FULL_TEXT -template<typename FTNodeType> bool flatten( ftnode *n ) { +template<typename FTNodeType> bool flatten( ftnode *n ) +{ if ( FTNodeType *const n2 = dynamic_cast<FTNodeType*>( n ) ) { typename FTNodeType::ftnode_list_t &list = n2->get_node_list(); typename FTNodeType::ftnode_list_t::iterator i = list.begin(); @@ -12502,7 +12487,8 @@ } #endif /* ZORBA_NO_FULL_TEXT */ -void *begin_visit (const FTAnd& v) { +void *begin_visit (const FTAnd& v) +{ TRACE_VISIT (); #ifndef ZORBA_NO_FULL_TEXT push_ftstack( NULL ); // sentinel @@ -12510,7 +12496,8 @@ return no_state; } -void end_visit (const FTAnd& v, void* /*visit_state*/) { +void end_visit (const FTAnd& v, void* /*visit_state*/) +{ TRACE_VISIT_OUT (); #ifndef ZORBA_NO_FULL_TEXT ftand::ftnode_list_t list; @@ -12530,35 +12517,46 @@ #endif /* ZORBA_NO_FULL_TEXT */ } -void *begin_visit (const FTAnyallOption& v) { - TRACE_VISIT (); - // nothing to do - return no_state; -} - -void end_visit (const FTAnyallOption& v, void* /*visit_state*/) { - TRACE_VISIT_OUT (); - // nothing to do -} - -void *begin_visit (const FTBigUnit& v) { - TRACE_VISIT (); - // nothing to do - return no_state; -} - -void end_visit (const FTBigUnit& v, void* /*visit_state*/) { - TRACE_VISIT_OUT (); - // nothing to do -} - -void *begin_visit (const FTCaseOption& v) { - TRACE_VISIT (); - // nothing to do - return no_state; -} - -void end_visit (const FTCaseOption& v, void* /*visit_state*/) { + +void *begin_visit (const FTAnyallOption& v) +{ + TRACE_VISIT (); + // nothing to do + return no_state; +} + + +void end_visit (const FTAnyallOption& v, void* /*visit_state*/) +{ + TRACE_VISIT_OUT (); + // nothing to do +} + + +void *begin_visit (const FTBigUnit& v) +{ + TRACE_VISIT (); + // nothing to do + return no_state; +} + + +void end_visit (const FTBigUnit& v, void* /*visit_state*/) +{ + TRACE_VISIT_OUT (); + // nothing to do +} + +void *begin_visit (const FTCaseOption& v) +{ + TRACE_VISIT (); + // nothing to do + return no_state; +} + + +void end_visit (const FTCaseOption& v, void* /*visit_state*/) +{ TRACE_VISIT_OUT (); #ifndef ZORBA_NO_FULL_TEXT ftmatch_options *const mo = dynamic_cast<ftmatch_options*>( top_ftstack() ); @@ -12571,7 +12569,9 @@ #endif /* ZORBA_NO_FULL_TEXT */ } -void *begin_visit (const FTContainsExpr& v) { + +void *begin_visit (const FTContainsExpr& v) +{ TRACE_VISIT (); #ifdef ZORBA_NO_FULL_TEXT throw XQUERY_EXCEPTION( @@ -12581,7 +12581,8 @@ return no_state; } -void end_visit (const FTContainsExpr& v, void* /*visit_state*/) { +void end_visit (const FTContainsExpr& v, void* /*visit_state*/) +{ TRACE_VISIT_OUT (); #ifndef ZORBA_NO_FULL_TEXT expr_t ftignore = NULL; @@ -13326,10 +13327,8 @@ std::map<zstring, zstring> modulesStack; if (typeid(root) != typeid(MainModule)) - throw XQUERY_EXCEPTION( - err::XPST0003, ERROR_PARAMS( ZED( ModuleDeclNotInMain ) ), - ERROR_LOC( root.get_location() ) - ); + RAISE_ERROR(err::XPST0003, root.get_location(), + ERROR_PARAMS(ZED(ModuleDeclNotInMain))); ModulesInfo minfo(ccb); === modified file 'src/diagnostics/diagnostic_en.xml' --- src/diagnostics/diagnostic_en.xml 2012-02-29 20:55:00 +0000 +++ src/diagnostics/diagnostic_en.xml 2012-03-05 17:06:29 +0000 @@ -39,7 +39,40 @@ It is a static error if an expression is not a valid instance of the grammar. </comment> + <value>invalid expression${: 1}</value> + + <entry key="XQueryVersionAtLeast30_2"> + <value>"$2": XQuery version must be at least 3.0</value> + </entry> + + <entry key="OuterForClause11"> + <value>"outer-for" clause only available in XQuery 3.0 or later</value> + </entry> + + <entry key="WindowClause11"> + <value>"window" clause only available in XQuery 3.0 or later</value> + </entry> + + <entry key="CountClause11"> + <value>"count" clause only available in XQuery 3.0 or later</value> + </entry> + + <entry key="SwitchExpr11"> + <value>"switch" expressions only available in XQuery 3.0 or later</value> + </entry> + + <entry key="TryCatchExpr11"> + <value>"try/catch" expressions only available in XQuery 3.0 or later</value> + </entry> + + <entry key="Anotations"> + <value>function and variable annotations only available in XQuery 3.0 or later</value> + </entry> + + <entry key="PiTarget"> + <value>"XML" not allowed as target of a direct processing-instruction constructor</value> + </entry> </diagnostic> <diagnostic code="XPTY0004"> @@ -1674,7 +1707,12 @@ </diagnostic> <diagnostic code="ZXQP0050" name="FEATURE_NOT_AVAILABLE"> + <value>"$1": feature not available</value> + + <entry key="Scripting"> + <value>scripting</value> + </entry> </diagnostic> <diagnostic code="ZXQP0060" name="OPTION_NOT_KNOWN"> @@ -2626,10 +2664,6 @@ <value>collection iterator not open</value> </entry> - <entry key="CountClause11"> - <value>"count" clause only available in XQuery 1.1 or later</value> - </entry> - <entry key="DefaultCollation"> <value>default collation</value> </entry> @@ -3046,10 +3080,6 @@ <value>"$2": operation not possible with parameters of type "$3" and "$4"</value> </entry> - <entry key="OuterForClause11"> - <value>"outer-for" clause only available in XQuery 1.1 or later</value> - </entry> - <entry key="ParserInitFailed"> <value>parser initialization failed</value> </entry> @@ -3134,18 +3164,10 @@ <value>sum not possible with parameters of type "$2" and "$3"</value> </entry> - <entry key="SwitchExpr11"> - <value>"switch" expressions only available in XQuery 1.1 or later</value> - </entry> - <entry key="TrailingChar_3"> <value>trailing '$3'</value> </entry> - <entry key="TryCatchExpr11"> - <value>"try/catch" expressions only available in XQuery 1.1 or later</value> - </entry> - <entry key="TwoDecimalFormatsSameName_2"> <value>"$2": two decimal formats with this name</value> </entry> @@ -3266,18 +3288,10 @@ <value>undeclared variable</value> </entry> - <entry key="WindowClause11"> - <value>"window" clause only available in XQuery 1.1 or later</value> - </entry> - <entry key="XMLSchema"> <value>XML schema</value> </entry> - <entry key="XQueryVersionAtLeast10_2"> - <value>"$2": XQuery version must be at least 1.0</value> - </entry> - <entry key="XUST0002_Transform"> <value>transform expression witn non-updating or vacuous modify clause</value> </entry> === modified file 'src/diagnostics/pregenerated/dict_en.cpp' --- src/diagnostics/pregenerated/dict_en.cpp 2012-02-29 20:55:00 +0000 +++ src/diagnostics/pregenerated/dict_en.cpp 2012-03-05 17:06:29 +0000 @@ -474,7 +474,6 @@ { "~CloneNotImplemented", "clone() not implemented for expression" }, { "~ClosingBraceWithoutOpen", "'}' encountered without '{' first" }, { "~CollectionIteratorNotOpen", "collection iterator not open" }, - { "~CountClause11", "\"count\" clause only available in XQuery 1.1 or later" }, { "~DefaultCollation", "default collation" }, { "~DivisionNoINF", "division can not have +-INF dividend" }, { "~DivisionNoNaN", "division can not involve NaN" }, @@ -581,7 +580,6 @@ { "~OpNodeBeforeMustHaveNodes", "op:node-before() must have nodes as parameters" }, { "~OperationNotDef_23", "$2 not defined for type \"$3\"" }, { "~OperationNotPossibleWithTypes_234", "\"$2\": operation not possible with parameters of type \"$3\" and \"$4\"" }, - { "~OuterForClause11", "\"outer-for\" clause only available in XQuery 1.1 or later" }, { "~ParseFragmentOptionCombinationNotAllowed", "specifying both $2 and $3 is an error" }, { "~ParseFragmentOptionDSLNotAllowed", "if the e option is specified, none of the options d, s, or l may be enabled" }, { "~ParserInitFailed", "parser initialization failed" }, @@ -605,9 +603,7 @@ { "~StingLiteral", "string literal" }, { "~StringValue", "string value" }, { "~SumImpossibleWithTypes_23", "sum not possible with parameters of type \"$2\" and \"$3\"" }, - { "~SwitchExpr11", "\"switch\" expressions only available in XQuery 1.1 or later" }, { "~TrailingChar_3", "trailing '$3'" }, - { "~TryCatchExpr11", "\"try/catch\" expressions only available in XQuery 1.1 or later" }, { "~TwoDecimalFormatsSameName_2", "\"$2\": two decimal formats with this name" }, { "~TwoDefaultDecimalFormats", "two default decimal formats" }, { "~TypeIsNotSubtype", "item type is not a subtype of \"$3\"" }, @@ -678,12 +674,18 @@ { "~Variable", "variable" }, { "~VariabledHasNoValue", "variable has no value" }, { "~VariabledUndeclared", "undeclared variable" }, - { "~WindowClause11", "\"window\" clause only available in XQuery 1.1 or later" }, { "~XMLSchema", "XML schema" }, + { "~XPST0003_Anotations", "function and variable annotations only available in XQuery 3.0 or later" }, + { "~XPST0003_CountClause11", "\"count\" clause only available in XQuery 3.0 or later" }, + { "~XPST0003_OuterForClause11", "\"outer-for\" clause only available in XQuery 3.0 or later" }, + { "~XPST0003_PiTarget", "\"XML\" not allowed as target of a direct processing-instruction constructor" }, + { "~XPST0003_SwitchExpr11", "\"switch\" expressions only available in XQuery 3.0 or later" }, + { "~XPST0003_TryCatchExpr11", "\"try/catch\" expressions only available in XQuery 3.0 or later" }, + { "~XPST0003_WindowClause11", "\"window\" clause only available in XQuery 3.0 or later" }, + { "~XPST0003_XQueryVersionAtLeast30_2", "\"$2\": XQuery version must be at least 3.0" }, { "~XPTY0004_FormatNumber_2", "\"the first parameter to the format-number() function is of type $2, which is not allowed" }, { "~XQST0106_CONFLICTING", "conflicting" }, { "~XQST0106_THE_SAME", "the same" }, - { "~XQueryVersionAtLeast10_2", "\"$2\": XQuery version must be at least 1.0" }, { "~XUST0001_CONCAT", "comma expression with updating and non-updating branches" }, { "~XUST0001_Generic", "updating expression illegal here" }, { "~XUST0001_IF", "conditional expression with updating and non-updating branch" }, @@ -699,6 +701,7 @@ { "~ZXQD0004_NON_NEGATIVE", "given value must be non-negative ($2)" }, { "~ZXQD0004_NOT_WITHIN_RANGE", "not within allowed range ($2)" }, { "~ZXQP0004_TypeOps_is_in_scope_ForFunctionItemTypes", "TypeOps::is_in_scope() for function-item types" }, + { "~ZXQP0050_Scripting", "scripting" }, { "~ZeroLenURI", "zero-length URI (and no base URI given)" }, { "~Zorba API error", "Zorba API error" }, { "~Zorba data-definition error", "Zorba data-definition error" },
-- 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