]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Added SLASH processing
authorPeter Bernard West <pbwest@apache.org>
Sun, 23 Jun 2002 15:02:18 +0000 (15:02 +0000)
committerPeter Bernard West <pbwest@apache.org>
Sun, 23 Jun 2002 15:02:18 +0000 (15:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@194913 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/expr/PropertyParser.java
src/org/apache/fop/fo/expr/PropertyTokenizer.java

index e4945c4fac3344c8418461974079c4c905c4e81e..694ef4ff073914ea5c05c2d38ef52bf15e0e63cc 100644 (file)
@@ -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.
-     * <p>
-     * Note: If the property expression String is empty, a StringProperty
+     * 
+     * <p>The <tt>PropertyValue</tt> 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 <PropertyValue</tt>.
+     *
+     * <p>If the expression cannot be resolved into a single object, the set
+     * to which it resolves is returned in a <tt>PropertyValueList</tt> object
+     * (which itself implements <tt>PropertyValue</tt>).
+     *
+     * <p>The <tt>PropertyValueList</tt> contains objects whose corresponding
+     * elements in the original expression were separated by <em>commas</em>.
+     *
+     * <p>Objects whose corresponding elements in the original expression
+     * were separated by spaces are composed into a sublist contained in
+     * another <tt>PropertyValueList</tt>.  If all of the elements in the
+     * expression were separated by spaces, the returned
+     * <tt>PropertyValueList</tt> will contain one element, a
+     * <tt>PropertyValueList</tt> containing objects representing each of
+     * the space-separated elements in the original expression.
+     *
+     * <p>E.g., if a <b>font-family</b> property is assigned the string
+     * <em>Palatino, New Century Schoolbook, serif</em>, the returned value
+     * will look like this:
+     * <pre>
+     * PropertyValueList(NCName('Palatino')
+     *                   PropertyValueList(NCName('New')
+     *                                     NCName('Century')
+     *                                     NCName('Schoolbook') )
+     *                   NCName('serif') )
+     * </pre>
+     * <p>If the property had been assigned the string
+     * <em>Palatino, "New Century Schoolbook", serif</em>, the returned value
+     * would look like this:
+     * <pre>
+     * PropertyValueList(NCName('Palatino')
+     *                   NCName('New Century Schoolbook')
+     *                   NCName('serif') )
+     * </pre>
+     * <p>If a <b>background-position</b> property is assigned the string
+     * <em>top center</em>, the returned value will look like this:
+     * <pre>
+     * PropertyValueList(PropertyValueList(NCName('top')
+     *                                     NCName('center') ) )
+     * </pre>
+     *
+     * <p>Note: If the property expression String is empty, a StringProperty
      * object holding an empty String is returned.
      * @param property an <tt>int</tt> 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
index 590b9b42ccb09e2e040914c8a3abde323dff74bb..15764ea310bec05f75829396f0dd7c0ca8f62bc2 100644 (file)
@@ -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();