morten 01/10/29 03:47:26
Modified: java/src/org/apache/xalan/xsltc/compiler BinOpExpr.java
Choose.java DocumentCall.java Number.java
Otherwise.java StepPattern.java Stylesheet.java
VariableBase.java VariableRef.java
VariableRefBase.java When.java XSLTC.java xpath.cup
java/src/org/apache/xalan/xsltc/compiler/util ErrorMsg.java
Log:
Implemented code to resolve forward references and dependencies between
global variables and parameters.
PR: n/a
Obtained from: n/a
Submitted by: [EMAIL PROTECTED]
Reviewed by: [EMAIL PROTECTED]
Revision Changes Path
1.4 +2 -3
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/BinOpExpr.java
Index: BinOpExpr.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/BinOpExpr.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BinOpExpr.java 2001/06/07 15:15:50 1.3
+++ BinOpExpr.java 2001/10/29 11:47:25 1.4
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: BinOpExpr.java,v 1.3 2001/06/07 15:15:50 morten Exp $
+ * @(#)$Id: BinOpExpr.java,v 1.4 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -136,8 +136,7 @@
il.append(_type.REM());
break;
default:
- final ErrorMsg msg =
- new ErrorMsg("Unknown operator for binary expression");
+ final ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLBINOP_ERR, this);
getParser().reportError(Constants.ERROR, msg);
}
}
1.4 +4 -11 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Choose.java
Index: Choose.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Choose.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Choose.java 2001/06/29 12:04:33 1.3
+++ Choose.java 2001/10/29 11:47:25 1.4
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Choose.java,v 1.3 2001/06/29 12:04:33 morten Exp $
+ * @(#)$Id: Choose.java,v 1.4 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -73,13 +73,6 @@
final class Choose extends Instruction {
- private final static String MISSING_WHEN_ERROR =
- "At least one When element required in Choose";
- private final static String ILLEGAL_ELEMENT_ERROR =
- "Only When|Otherwise elements allowed in Choose";
- private final static String MULTIPLE_OTHERWISE_ERROR =
- "Only one Otherwise element allowed in Choose";
-
/**
* Display the element contents (a lot of when's and an otherwise)
*/
@@ -116,20 +109,20 @@
otherwise = (Otherwise)element;
}
else {
- error = new ErrorMsg(MULTIPLE_OTHERWISE_ERROR, line);
+ error = new ErrorMsg(ErrorMsg.MULTIPLE_OTHERWISE_ERR, this);
getParser().reportError(Constants.ERROR, error);
}
}
// It is an error if we find some other element here
else {
- error = new ErrorMsg(ILLEGAL_ELEMENT_ERROR, line);
+ error = new ErrorMsg(ErrorMsg.WHEN_ELEMENT_ERR, this);
getParser().reportError(Constants.ERROR, error);
}
}
// Make sure that there is at least one <xsl:when> element
if (whenElements.size() == 0) {
- error = new ErrorMsg(MISSING_WHEN_ERROR, getLineNumber());
+ error = new ErrorMsg(ErrorMsg.MISSING_WHEN_ERR, this);
getParser().reportError(Constants.ERROR, error);
return;
}
1.10 +4 -7
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/DocumentCall.java
Index: DocumentCall.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/DocumentCall.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DocumentCall.java 2001/10/25 10:23:32 1.9
+++ DocumentCall.java 2001/10/29 11:47:25 1.10
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: DocumentCall.java,v 1.9 2001/10/25 10:23:32 morten Exp $
+ * @(#)$Id: DocumentCall.java,v 1.10 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -94,8 +94,7 @@
// At least one argument - two at most
final int ac = argumentCount();
if ((ac < 1) || (ac > 2)) {
- ErrorMsg msg = new ErrorMsg("Illegal number of arguments "+
- "to document() function");
+ ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGARG_ERR, this);
throw new TypeCheckError(msg);
}
@@ -106,8 +105,7 @@
if (expr.getValue().equals(Constants.EMPTYSTRING)) {
Stylesheet stylesheet = getStylesheet();
if (stylesheet == null) {
- ErrorMsg msg = new ErrorMsg("Illegal argument "+
- "to document() function");
+ ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGARG_ERR, this);
throw new TypeCheckError(msg);
}
_uri = new LiteralExpr(stylesheet.getSystemId(),
@@ -124,8 +122,7 @@
if (ac == 2) {
_base = argument(1);
if (!_base.typeCheck(stable).identicalTo(Type.NodeSet)) {
- ErrorMsg msg = new ErrorMsg("Second argument to document() "+
- "function must be a node-set.");
+ ErrorMsg msg = new ErrorMsg(ErrorMsg.DOCUMARG_ERR, this);
throw new TypeCheckError(msg);
}
}
1.6 +3 -3 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Number.java
Index: Number.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Number.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Number.java 2001/10/08 09:22:37 1.5
+++ Number.java 2001/10/29 11:47:25 1.6
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Number.java,v 1.5 2001/10/08 09:22:37 morten Exp $
+ * @(#)$Id: Number.java,v 1.6 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -77,7 +77,7 @@
private static final int LEVEL_ANY = 2;
private Pattern _from = null;
- private Pattern _count = null;
+ private Expression _count = null;
private Expression _value = null;
private AttributeValueTemplate _lang = null;
@@ -112,7 +112,7 @@
_value = parser.parseExpression(this, name, null);
}
else if (name.equals("count")) {
- _count = parser.parsePattern(this, name, null);
+ _count = parser.parseExpression(this, name, null);
}
else if (name.equals("from")) {
_from = parser.parsePattern(this, name, null);
1.3 +3 -5
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Otherwise.java
Index: Otherwise.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Otherwise.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Otherwise.java 2001/06/07 15:15:55 1.2
+++ Otherwise.java 2001/10/29 11:47:25 1.3
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Otherwise.java,v 1.2 2001/06/07 15:15:55 morten Exp $
+ * @(#)$Id: Otherwise.java,v 1.3 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -82,9 +82,7 @@
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final Parser parser = getParser();
- final ErrorMsg msg =
- new ErrorMsg("'otherwise' must be used within a 'choose'.",
- getLineNumber());
- parser.reportError(Constants.ERROR, msg);
+ final ErrorMsg err = new ErrorMsg(ErrorMsg.STRAY_OTHERWISE_ERR, this);
+ parser.reportError(Constants.ERROR, err);
}
}
1.8 +3 -1
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/StepPattern.java
Index: StepPattern.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/StepPattern.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- StepPattern.java 2001/10/09 12:08:09 1.7
+++ StepPattern.java 2001/10/29 11:47:25 1.8
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: StepPattern.java,v 1.7 2001/10/09 12:08:09 morten Exp $
+ * @(#)$Id: StepPattern.java,v 1.8 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -254,7 +254,9 @@
final int n = _predicates.size();
for (int i = 0; i < n; i++) {
Predicate pred = (Predicate)_predicates.elementAt(i);
+ System.err.println("pred: "+pred);
Expression exp = pred.getExpr();
+ System.err.println("exp: "+exp);
exp.translateDesynthesized(classGen, methodGen);
_trueList.append(exp._trueList);
_falseList.append(exp._falseList);
1.27 +65 -31
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Stylesheet.java
Index: Stylesheet.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Stylesheet.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Stylesheet.java 2001/10/26 08:07:01 1.26
+++ Stylesheet.java 2001/10/29 11:47:25 1.27
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Stylesheet.java,v 1.26 2001/10/26 08:07:01 morten Exp $
+ * @(#)$Id: Stylesheet.java,v 1.27 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -95,7 +95,7 @@
private Stylesheet _parentStylesheet;
// Contains global variables and parameters defined in the stylesheet
- private final Vector _globals = new Vector();
+ private Vector _globals = new Vector();
// Used to cache the result returned by <code>hasLocalParams()</code>.
private Boolean _hasLocalParams = null;
@@ -127,6 +127,12 @@
private boolean _compileTemplatesAsMethods;
+ private boolean _forwardReference = false;
+
+ public void setForwardReference() {
+ _forwardReference = true;
+ }
+
public void compileTemplatesAsMethods() {
_compileTemplatesAsMethods = true;
}
@@ -304,17 +310,27 @@
public void parseContents(Parser parser) {
final SymbolTable stable = parser.getSymbolTable();
+ // Make sure the XSL version set in this stylesheet
_version = getAttribute("version");
+ if ((_version == null) || (_version.equals(EMPTYSTRING))) {
+ ErrorMsg err = new ErrorMsg(ErrorMsg.NREQATTR_ERR, "version", this);
+ parser.reportError(Constants.ERROR, err);
+ }
+ // Verify that the version is 1.0 and nothing else
+ else if (!_version.equals("1.0")) {
+ ErrorMsg err = new ErrorMsg(ErrorMsg.UNSUPVER_ERR, _version, this);
+ parser.reportError(Constants.ERROR, err);
+ }
- //addPrefixMapping("xml", "xml"); // Make sure 'xml' maps to 'xml'
+ // Add the implicit mapping of 'xml' to the XML namespace URI
addPrefixMapping("xml", "http://www.w3.org/XML/1998/namespace");
// Report and error if more than one stylesheet defined
final Stylesheet sheet = stable.addStylesheet(_name, this);
if (sheet != null) {
// Error: more that one stylesheet defined
- final ErrorMsg msg = new ErrorMsg(ErrorMsg.STLREDEF_ERR, this);
- parser.reportError(Constants.ERROR, msg);
+ ErrorMsg err = new ErrorMsg(ErrorMsg.STLREDEF_ERR, this);
+ parser.reportError(Constants.ERROR, err);
}
// If this is a simplified stylesheet we must create a template that
@@ -334,8 +350,7 @@
}
/**
- * Parse all the children of <tt>element</tt>.
- * XSLT commands are recognized by the XSLT namespace
+ * Parse all direct children of the <xsl:stylesheet/> element.
*/
public final void parseOwnChildren(Parser parser) {
@@ -370,6 +385,8 @@
parser.getSymbolTable().setCurrentNode(child);
child.parseContents(parser);
}
+ // All template code should be compiled as methods if the
+ // <xsl:apply-imports/> element was ever used in this stylesheet
if (_compileTemplatesAsMethods && (child instanceof Template)) {
Template template = (Template)child;
String name = "template$dot$"+template.getPosition();
@@ -487,7 +504,6 @@
processModes();
compileModes(classGen);
-
compileConstructor(classGen, lastOutputElement);
if (!getParser().errorsFound()) {
@@ -611,30 +627,18 @@
il.append(new PUSH(cpg, DOM.ROOTNODE));
il.append(new ISTORE(current.getIndex()));
- // Initialize global variables and parameterns
- final int m = _globals.size();
- for (int i = 0; i < m; i++) {
- TopLevelElement elem = (TopLevelElement)_globals.elementAt(i);
- elem.translate(classGen, toplevel);
+ // Resolve any forward referenes and translate global variables/params
+ _globals = resolveReferences(_globals);
+ final int count = _globals.size();
+ for (int i = 0; i < count; i++) {
+ final VariableBase var = (VariableBase)_globals.elementAt(i);
+ var.translate(classGen,toplevel);
}
- Vector whitespaceRules = new Vector();
-
// Compile code for other top-level elements
+ Vector whitespaceRules = new Vector();
while (elements.hasMoreElements()) {
final Object element = elements.nextElement();
- /*
- // xsl:output
- if (element instanceof Output) {
- ((Output)element).translate(classGen, toplevel);
- }
- // xsl:key
- else if (element instanceof Key) {
- final Key key = (Key)element;
- key.translate(classGen, toplevel);
- _keys.put(key.getName(),key);
- }
- */
// xsl:decimal-format
if (element instanceof DecimalFormatting) {
((DecimalFormatting)element).translate(classGen,toplevel);
@@ -643,12 +647,9 @@
else if (element instanceof Whitespace) {
whitespaceRules.addAll(((Whitespace)element).getRules());
}
- // xsl:variable or xsl:param
- else if (element instanceof VariableBase) {
- ((VariableBase)element).translate(classGen,toplevel);
- }
}
+ // Translate all whitespace strip/preserve rules
if (whitespaceRules.size() > 0) {
Whitespace.translateRules(whitespaceRules,classGen);
}
@@ -672,6 +673,39 @@
return("("+DOM_INTF_SIG+NODE_ITERATOR_SIG+TRANSLET_OUTPUT_SIG+")V");
}
+
+ private Vector resolveReferences(Vector input) {
+ Vector result = new Vector();
+
+ while (input.size() > 0) {
+ boolean changed = false;
+ for (int i = 0; i < input.size(); ) {
+ final VariableBase var = (VariableBase)input.elementAt(i);
+ final Vector dep = var.getDependencies();
+ if (dep == null) {
+ result.insertElementAt(var, 0);
+ input.remove(i);
+ changed = true;
+ }
+ else if (result.containsAll(dep)) {
+ result.addElement(var);
+ input.remove(i);
+ changed = true;
+ }
+ else {
+ i++;
+ }
+ }
+ // If nothing was changed in this pass then we have a circular ref
+ if (!changed) {
+ final String refs = input.toString();
+ ErrorMsg err = new ErrorMsg(ErrorMsg.CIRCULAR_ERR, refs, this);
+ getParser().reportError(Constants.ERROR, err);
+ return(result);
+ }
+ }
+ return(result);
+ }
/**
* Compile a buildKeys() method into the output class. This method is
1.11 +22 -1
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/VariableBase.java
Index: VariableBase.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/VariableBase.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- VariableBase.java 2001/10/18 11:59:04 1.10
+++ VariableBase.java 2001/10/29 11:47:25 1.11
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: VariableBase.java,v 1.10 2001/10/18 11:59:04 morten Exp $
+ * @(#)$Id: VariableBase.java,v 1.11 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -89,9 +89,15 @@
// References to this variable (when local)
protected Vector _refs = new Vector(2);
+ // Dependencies to other variables/parameters (for globals only)
+ protected Vector _dependencies = null;
+
// Used to make sure parameter field is not added twice
protected boolean _ignore = false;
+ // Used to order top-level variables so that there are no forward references
+ protected int _weight = 0;
+
/**
* Disable this variable/parameter
*/
@@ -113,6 +119,21 @@
*/
public void removeReference(VariableRefBase vref) {
_refs.remove(vref);
+ }
+
+ /**
+ *
+ */
+ public void addDependency(VariableBase other) {
+ if (_dependencies == null) _dependencies = new Vector();
+ _dependencies.addElement(other);
+ }
+
+ /**
+ *
+ */
+ public Vector getDependencies() {
+ return _dependencies;
}
/**
1.10 +4 -6
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/VariableRef.java
Index: VariableRef.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/VariableRef.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- VariableRef.java 2001/09/19 16:29:36 1.9
+++ VariableRef.java 2001/10/29 11:47:25 1.10
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: VariableRef.java,v 1.9 2001/09/19 16:29:36 morten Exp $
+ * @(#)$Id: VariableRef.java,v 1.10 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -101,11 +101,9 @@
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
-
- if (_type.implementedAsMethod()) {
- // Fall-through for variables that are implemented as methods
- return;
- }
+
+ // Fall-through for variables that are implemented as methods
+ if (_type.implementedAsMethod()) return;
final String name = _variable.getVariable();
1.5 +21 -1
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/VariableRefBase.java
Index: VariableRefBase.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/VariableRefBase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- VariableRefBase.java 2001/09/19 17:54:15 1.4
+++ VariableRefBase.java 2001/10/29 11:47:25 1.5
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: VariableRefBase.java,v 1.4 2001/09/19 17:54:15 morten Exp $
+ * @(#)$Id: VariableRefBase.java,v 1.5 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -83,6 +83,10 @@
variable.addReference(this);
}
+ public VariableRefBase() {
+ _variable = null;
+ }
+
/**
* Returns a reference to the associated variable
* @return The referenced variable
@@ -92,6 +96,18 @@
}
/**
+ * Returns a reference to any parent variable
+ * @return Parent variable (or null if none)
+ */
+ public VariableBase findParentVariable() {
+ SyntaxTreeNode node = this;
+ while ((node != null) && (!(node instanceof VariableBase)))
+ node = node.getParent();
+ return (VariableBase)node;
+ }
+
+
+ /**
* Returns a string representation of this variable reference on the
* format 'variable-ref(<var-name>)'.
* @return Variable reference description
@@ -101,6 +117,10 @@
}
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
+
+ // Insert a dependency link from one variable to another
+ VariableBase parent = findParentVariable();
+ if (parent != null) parent.addDependency(_variable);
// Attempt to get the cached variable type
_type = _variable.getType();
1.8 +2 -5 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/When.java
Index: When.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/When.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- When.java 2001/08/01 11:52:58 1.7
+++ When.java 2001/10/29 11:47:25 1.8
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: When.java,v 1.7 2001/08/01 11:52:58 morten Exp $
+ * @(#)$Id: When.java,v 1.8 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -68,9 +68,6 @@
final class When extends Instruction {
- private static final String NO_CHOOSE_ERROR =
- "Instruction 'when' must be used within a 'choose'.";
-
private Expression _test;
private boolean _ignore = false;
@@ -135,7 +132,7 @@
* translate the "test" expression and and contents of this element.
*/
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
- final ErrorMsg msg = new ErrorMsg(NO_CHOOSE_ERROR, getLineNumber());
+ final ErrorMsg msg = new ErrorMsg(ErrorMsg.STRAY_WHEN_ERR, this);
getParser().reportError(Constants.ERROR, msg);
}
}
1.31 +5 -1 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XSLTC.java
Index: XSLTC.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XSLTC.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- XSLTC.java 2001/10/26 09:38:06 1.30
+++ XSLTC.java 2001/10/29 11:47:25 1.31
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: XSLTC.java,v 1.30 2001/10/26 09:38:06 morten Exp $
+ * @(#)$Id: XSLTC.java,v 1.31 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -321,6 +321,10 @@
}
}
catch (Exception e) {
+ if (_debug) e.printStackTrace();
+ _parser.reportError(Constants.FATAL, new ErrorMsg(e.getMessage()));
+ }
+ catch (Error e) {
if (_debug) e.printStackTrace();
_parser.reportError(Constants.FATAL, new ErrorMsg(e.getMessage()));
}
1.26 +3 -5 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/xpath.cup
Index: xpath.cup
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/xpath.cup,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- xpath.cup 2001/10/17 10:45:07 1.25
+++ xpath.cup 2001/10/29 11:47:25 1.26
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: xpath.cup,v 1.25 2001/10/17 10:45:07 morten Exp $
+ * @(#)$Id: xpath.cup,v 1.26 2001/10/29 11:47:25 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -736,14 +736,12 @@
RESULT = new ParameterRef((Param)node);
}
else {
- node = null;
+ RESULT = new UnresolvedRef(varName);
}
}
if (node == null) {
- RESULT = parser.DummyVarRef;
- parser.addError(new ErrorMsg(ErrorMsg.VARUNDEF_ERR,
- parser.getLineNumber(), varName));
+ RESULT = new UnresolvedRef(varName);
}
:};
1.6 +23 -2
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java
Index: ErrorMsg.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ErrorMsg.java 2001/10/18 09:43:44 1.5
+++ ErrorMsg.java 2001/10/29 11:47:26 1.6
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: ErrorMsg.java,v 1.5 2001/10/18 09:43:44 morten Exp $
+ * @(#)$Id: ErrorMsg.java,v 1.6 2001/10/29 11:47:26 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -101,7 +101,18 @@
public static final int CIRCULAR_INC = 21;
public static final int TREESORT_ERR = 22;
public static final int DFSREDEF_ERR = 23;
+ public static final int UNSUPVER_ERR = 24;
+ public static final int CIRCULAR_ERR = 25;
+ public static final int ILLBINOP_ERR = 26;
+ public static final int ILLEGARG_ERR = 27;
+ public static final int DOCUMARG_ERR = 28;
+ public static final int MISSING_WHEN_ERR = 29;
+ public static final int MULTIPLE_OTHERWISE_ERR = 30;
+ public static final int STRAY_OTHERWISE_ERR = 31;
+ public static final int STRAY_WHEN_ERR = 32;
+ public static final int WHEN_ELEMENT_ERR = 33;
+
static final String messages_d[] = {
"More than one stylesheet defined in the same file.",
"Template ''{0}'' already defined in this stylesheet.",
@@ -128,7 +139,17 @@
"Applying <xsl:sort> to a result tree is not supported (<xsl:sort> "+
"elements are ignored). You can, and should, sort the nodes when "+
"creating the result tree.",
- "Decimal formatting ''{0}'' is already defined."
+ "Decimal formatting ''{0}'' is already defined.",
+ "XSL version ''{0}'' is not supported by XSLTC.",
+ "Circular variable/parameter references: ''{0}''.",
+ "Unknown operator for binary expression.",
+ "Illegal argument(s) for function call.",
+ "Second argument to document() function must be a node-set.",
+ "At least one <xsl:when> element required in <xsl:choose>.",
+ "Only one <xsl:otherwise> element allowed in <xsl:choose>.",
+ "<xsl:otherwise> can only be used within <xsl:choose>.",
+ "<xsl:whe> can only be used within <xsl:choose>.",
+ "Only <xsl:when> and <xsl:otherwise> elements allowed in <xsl:choose>."
};
public ErrorMsg(int code) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]