|
From: <pm_...@us...> - 2011-06-08 08:54:41
|
Revision: 4393
http://mxquery.svn.sourceforge.net/mxquery/?rev=4393&view=rev
Author: pm_fischer
Date: 2011-06-08 08:54:35 +0000 (Wed, 08 Jun 2011)
Log Message:
-----------
- removed unneeded b:log function, use fn:trace instead
- support annotations also for inline functions
Modified Paths:
--------------
trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java
Removed Paths:
-------------
trunk/MXQuery/xqib_src/ch/ethz/mxquery/functions/b/Log.java
Modified: trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java 2011-06-08 08:52:53 UTC (rev 4392)
+++ trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java 2011-06-08 08:54:35 UTC (rev 4393)
@@ -1751,10 +1751,12 @@
logger.log(LogLevel.INFO, "Completed parsing function "+qname.toString()+ " took "+(System.currentTimeMillis()-startTime));
return true;
- } else {
- index = declareIndex;
- }
-
+ } else
+ if (annotations.size() > 0)
+ generateParseError("function");
+ else
+ index = declareIndex;
+
if (parseKeyword("option")) {
XQName qname = EQName();
@@ -6586,8 +6588,9 @@
private Iterator InlineFunction() throws MXQueryException {
int startIndex = index;
+ Hashtable annotations = Annotation();
if (parseKeyword("function")) {
- Function fn = parseFunctionDef(new Hashtable(), null, false);
+ Function fn = parseFunctionDef(annotations, null, false);
if (fn == null) {
index = startIndex;
return null;
@@ -6599,6 +6602,9 @@
FunctionItemToken fTok = new FunctionItemToken(fn);
return new TokenIterator(getCurrentContext(), fTok, getCurrentLoc(),false);
}
+ } else {
+ if (annotations.size() > 0)
+ generateParseError("function");
}
return null;
}
Deleted: trunk/MXQuery/xqib_src/ch/ethz/mxquery/functions/b/Log.java
===================================================================
--- trunk/MXQuery/xqib_src/ch/ethz/mxquery/functions/b/Log.java 2011-06-08 08:52:53 UTC (rev 4392)
+++ trunk/MXQuery/xqib_src/ch/ethz/mxquery/functions/b/Log.java 2011-06-08 08:54:35 UTC (rev 4393)
@@ -1,80 +0,0 @@
-package ch.ethz.mxquery.functions.b;
-
-import java.util.Vector;
-
-import com.google.gwt.user.client.Window;
-
-import ch.ethz.mxqjs.client.Environment;
-import ch.ethz.mxquery.contextConfig.Context;
-import ch.ethz.mxquery.datamodel.MXQueryBigDecimal;
-import ch.ethz.mxquery.datamodel.MXQueryDouble;
-import ch.ethz.mxquery.datamodel.MXQueryFloat;
-import ch.ethz.mxquery.datamodel.types.Type;
-import ch.ethz.mxquery.datamodel.types.TypeInfo;
-import ch.ethz.mxquery.datamodel.xdm.DecimalToken;
-import ch.ethz.mxquery.datamodel.xdm.DoubleToken;
-import ch.ethz.mxquery.datamodel.xdm.FloatToken;
-import ch.ethz.mxquery.datamodel.xdm.LongToken;
-import ch.ethz.mxquery.datamodel.xdm.Token;
-import ch.ethz.mxquery.datamodel.xdm.TokenInterface;
-import ch.ethz.mxquery.exceptions.DynamicException;
-import ch.ethz.mxquery.exceptions.ErrorCodes;
-import ch.ethz.mxquery.exceptions.MXQueryException;
-import ch.ethz.mxquery.exceptions.TypeException;
-import ch.ethz.mxquery.functions.fn.Abs;
-import ch.ethz.mxquery.model.TokenBasedIterator;
-import ch.ethz.mxquery.model.XDMIterator;
-
-public class Log extends TokenBasedIterator {
-
- @Override
- protected void init() throws MXQueryException {
- currentToken = Token.END_SEQUENCE_TOKEN;
- if (subIters[0] == null) {
- throw new IllegalArgumentException();
- }
- XDMIterator iter = subIters[0];
- //if (iter instanceof DataValuesIterator) ((DataValuesIterator)iter).setFnData(true);
- TokenInterface tok;
- try {
- tok = iter.next();
- } catch (TypeException de) {
- if (de.getErrorCode().equals(ErrorCodes.E0004_TYPE_INAPPROPRIATE_TYPE))
- throw new DynamicException(ErrorCodes.F0023_INVALID_VALUE_FOR_CAST_CONSTRUCTOR,de.getMessage(), loc);
- else throw de;
- }
-
- int type = Type.getEventTypeSubstituted(tok.getEventType(), Context.getDictionary());
-
- if ( Type.isAttribute(type) ){
- type = Type.getAttributeValueType(type);
- }
-
- switch (type) {
- case Type.END_SEQUENCE:
- break;
- default:
- Environment.log(tok.getValueAsString());
-
- }
-
- }
-
-
-
- @Override
- public TypeInfo getStaticType() {
- return new TypeInfo();
- }
-
-
- @Override
- protected XDMIterator copy(Context context, XDMIterator[] subIters,
- Vector nestedPredCtxStack) throws MXQueryException {
- XDMIterator copy = new Log();
- copy.setContext(context, true);
- copy.setSubIters(subIters);
- return copy;
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|