From e7e0dd157fff38425a7864fba4a0a508dc5064fa Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sun, 23 Jun 2002 15:02:18 +0000 Subject: [PATCH] Added SLASH processing git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@194913 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/fo/expr/PropertyParser.java | 54 ++++++++++++++++++- .../apache/fop/fo/expr/PropertyTokenizer.java | 11 ++-- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/src/org/apache/fop/fo/expr/PropertyParser.java b/src/org/apache/fop/fo/expr/PropertyParser.java index e4945c4fa..694ef4ff0 100644 --- a/src/org/apache/fop/fo/expr/PropertyParser.java +++ b/src/org/apache/fop/fo/expr/PropertyParser.java @@ -27,6 +27,7 @@ import org.apache.fop.datatypes.Bool; import org.apache.fop.datatypes.Inherit; import org.apache.fop.datatypes.Auto; import org.apache.fop.datatypes.None; +import org.apache.fop.datatypes.Slash; import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.StringType; import org.apache.fop.datatypes.MimeType; @@ -69,8 +70,53 @@ public class PropertyParser extends PropertyTokenizer { /** * Parse the property expression described in the instance variables. - *

- * Note: If the property expression String is empty, a StringProperty + * + *

The PropertyValue returned by this function has the + * following characteristics: + * If the expression resolves to a single element that object is returned + * directly in an object which implements . + * + *

If the expression cannot be resolved into a single object, the set + * to which it resolves is returned in a PropertyValueList object + * (which itself implements PropertyValue). + * + *

The PropertyValueList contains objects whose corresponding + * elements in the original expression were separated by commas. + * + *

Objects whose corresponding elements in the original expression + * were separated by spaces are composed into a sublist contained in + * another PropertyValueList. If all of the elements in the + * expression were separated by spaces, the returned + * PropertyValueList will contain one element, a + * PropertyValueList containing objects representing each of + * the space-separated elements in the original expression. + * + *

E.g., if a font-family property is assigned the string + * Palatino, New Century Schoolbook, serif, the returned value + * will look like this: + *

+     * PropertyValueList(NCName('Palatino')
+     *                   PropertyValueList(NCName('New')
+     *                                     NCName('Century')
+     *                                     NCName('Schoolbook') )
+     *                   NCName('serif') )
+     * 
+ *

If the property had been assigned the string + * Palatino, "New Century Schoolbook", serif, the returned value + * would look like this: + *

+     * PropertyValueList(NCName('Palatino')
+     *                   NCName('New Century Schoolbook')
+     *                   NCName('serif') )
+     * 
+ *

If a background-position property is assigned the string + * top center, the returned value will look like this: + *

+     * PropertyValueList(PropertyValueList(NCName('top')
+     *                                     NCName('center') ) )
+     * 
+ * + *

Note: If the property expression String is empty, a StringProperty * object holding an empty String is returned. * @param property an int containing the property index. * which the property expression is to be evaluated. @@ -362,6 +408,10 @@ public class PropertyParser extends PropertyTokenizer { prop = new MimeType(property, currentTokenValue); break; + case SLASH: + prop = new Slash(property); + break; + case FUNCTION_LPAR: { // N.B. parseArgs() invokes expectRpar at the end of argument // processing, so, like LPAR processing, next() is not called diff --git a/src/org/apache/fop/fo/expr/PropertyTokenizer.java b/src/org/apache/fop/fo/expr/PropertyTokenizer.java index 590b9b42c..15764ea31 100644 --- a/src/org/apache/fop/fo/expr/PropertyTokenizer.java +++ b/src/org/apache/fop/fo/expr/PropertyTokenizer.java @@ -56,11 +56,12 @@ class PropertyTokenizer { ,BOOL = 24 ,URI = 25 ,MIMETYPE = 26 + ,SLASH = 27 // NO_UNIT is a transient token for internal use only. It is // never set as the end result of parsing a token. - ,NO_UNIT = 27 - //,NSPREFIX = 28 - //,WHITESPACE = 29 + ,NO_UNIT = 28 + //,NSPREFIX = 29 + //,WHITESPACE = 30 ; /* @@ -244,6 +245,10 @@ class PropertyTokenizer { throw new PropertyException("illegal character '#'"); } + case '/': + currentToken = SLASH; + return; + default: --exprIndex; scanName(); -- 2.39.5