pbwest 2002/10/02 00:23:18 Modified: src/org/apache/fop/fo/expr Tag: FOP_0-20-0_Alt-Design PropertyParser.java Log: Add explicit reset()s. Add InheritedValue handling. Access tokenizer expr value via method call. Revision Changes Path No revision No revision 1.5.2.12 +32 -17 xml-fop/src/org/apache/fop/fo/expr/PropertyParser.java Index: PropertyParser.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/expr/PropertyParser.java,v retrieving revision 1.5.2.11 retrieving revision 1.5.2.12 diff -u -r1.5.2.11 -r1.5.2.12 --- PropertyParser.java 24 Sep 2002 05:26:42 -0000 1.5.2.11 +++ PropertyParser.java 2 Oct 2002 07:23:18 -0000 1.5.2.12 @@ -127,11 +127,13 @@ public PropertyValue parse(FONode node, int property, String expr) throws PropertyException { + //System.out.println("-----Entering parse:" + // + PropNames.getPropertyName(property) + " " + expr); synchronized (this) { // make sure this parser is available - if (expr != null) // the parser is currently active + if (getExpr() != null) // the parser is currently active throw new PropertyException - ("PropertyParser is currently active."); + ("PropertyParser is currently active: " + getExpr()); initialize(property, expr); this.node = node; } @@ -149,8 +151,10 @@ // end of the expression - add to list and go if (propList.size() != 0) { propList.add(prop); + reset(); return propList; } else { // list is empty + reset(); return prop; } } @@ -164,8 +168,10 @@ propList.add(prop); } else { // whitespace separates list elements; make a sublist propList.add(parseSublist(prop)); - if (currentToken == EOF) + if (currentToken == EOF) { + reset(); return propList; + } } } } @@ -489,29 +495,38 @@ } // Property value functions + if (currentTokenValue.equals("label-end")) { + PropertyValue[] args = parseArgs(0); + throw new FunctionNotImplementedException("label-end"); + //break; + } + if (currentTokenValue.equals("body-start")) { + PropertyValue[] args = parseArgs(0); + throw new FunctionNotImplementedException("body-start"); + //break; + } if (currentTokenValue.equals("inherited-property-value")) { int propindex = property; PropertyValue[] args = parseArgs(0, 1); if (args.length != 0) propindex = PropertyConsts.getPropertyIndex( ((StringType)args[0]).getString()); - if (PropertyConsts.inheritance(propindex) == Properties.NO) + + // If it's a compound, return an InheritedValue object + if (PropertyConsts.isCompound(propindex)) { + prop = new InheritedValue(property, propindex); + break; + } + // Is it an inherited property? + if (PropertyConsts.inheritance(propindex) + == Properties.NO) throw new PropertyException ("inherited-property-value: " + PropNames.getPropertyName(propindex) + " is not inherited."); - prop = new InheritedValue(property, propindex); + // Not a compound, and inherited - try to resolve it + prop = node.fromParent(property, propindex); break; - } - if (currentTokenValue.equals("label-end")) { - PropertyValue[] args = parseArgs(0); - throw new FunctionNotImplementedException("label-end"); - //break; - } - if (currentTokenValue.equals("body-start")) { - PropertyValue[] args = parseArgs(0); - throw new FunctionNotImplementedException("body-start"); - //break; } // N.B. see comments on classes FromNearestSpecified and // FromParent for explanation of this section
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]