Property values are parsed in PropertyParser.parseProperty:
[1] org.apache.fop.fo.expr.PropertyParser.parseProperty (PropertyParser.java:111) [2] org.apache.fop.fo.expr.PropertyParser.parse (PropertyParser.java:88) [3] org.apache.fop.fo.properties.PropertyMaker.make (PropertyMaker.java:389) [4] org.apache.fop.fo.PropertyList.convertAttributeToProperty (PropertyList.java:418) [5] org.apache.fop.fo.PropertyList.addAttributesToList (PropertyList.java:374) [6] org.apache.fop.fo.FObj.addProperties (FObj.java:133)
Example: <fo:simple-page-master master-name="simpleA4" margin="4pt">, property being parsed: margin="4pt", propId = 134.
The PropertyParser object:
this = "org.apache.fop.fo.expr.PropertyParser@8530b8"
this = {
propInfo: instance of org.apache.fop.fo.expr.PropertyInfo(id=729)
org.apache.fop.fo.expr.PropertyTokenizer.currentToken: 0
org.apache.fop.fo.expr.PropertyTokenizer.currentTokenValue: null
org.apache.fop.fo.expr.PropertyTokenizer.currentUnitLength: 0
org.apache.fop.fo.expr.PropertyTokenizer.currentTokenStartIndex: 0
org.apache.fop.fo.expr.PropertyTokenizer.expr: "4pt"
org.apache.fop.fo.expr.PropertyTokenizer.exprIndex: 0
org.apache.fop.fo.expr.PropertyTokenizer.exprLength: 3
org.apache.fop.fo.expr.PropertyTokenizer.recognizeOperator: false
}
It has a member of type PropertyInfo, which contains contextual information:
propInfo = "org.apache.fop.fo.expr.PropertyInfo@1abcc03"
propInfo = {
maker: instance of org.apache.fop.fo.properties.ListProperty$Maker(id=705)
plist: instance of org.apache.fop.fo.PropertyList(id=737)
fo: instance of org.apache.fop.fo.pagination.LayoutMasterSet(id=738)
stkFunction: null
}
fo is the parent FO.
The property list of the current FO node:
propInfo.plist = {
writingModeTable: null
writingMode: 0
inheritableProperty: null
parentPropertyList: instance of org.apache.fop.fo.PropertyList(id=743)
namespace: "http://www.w3.org/1999/XSL/Format"
elementName: "fo:simple-page-master"
fobj: instance of org.apache.fop.fo.pagination.SimplePageMaster(id=746)
}
The property list up to now:
propInfo.plist = "{master-name=simpleA4}"
Property master-name's maker is StringPropertyMaker, which does not parse its value.
PropertyParser.parseProperty
next(), which scans the next token; at its return:
this = {
propInfo: instance of org.apache.fop.fo.expr.PropertyInfo(id=667)
org.apache.fop.fo.expr.PropertyTokenizer.currentToken: 12
org.apache.fop.fo.expr.PropertyTokenizer.currentTokenValue: "4pt"
org.apache.fop.fo.expr.PropertyTokenizer.currentUnitLength: 2
org.apache.fop.fo.expr.PropertyTokenizer.currentTokenStartIndex: 0
org.apache.fop.fo.expr.PropertyTokenizer.expr: "4pt"
org.apache.fop.fo.expr.PropertyTokenizer.exprIndex: 3
org.apache.fop.fo.expr.PropertyTokenizer.exprLength: 3
org.apache.fop.fo.expr.PropertyTokenizer.recognizeOperator: true
}
i.e. the whole expression is a single token, it is of type PropertyTokenizer.TOK_NUMERIC (= 12), the unit is 2 chars long.
Loop forever.
Analyse the expression. Start with parseAdditiveExpr
parseMultiplicativeExpr
parseUnaryExpr
parsePrimaryExpr; the unit may be a relative unit (em) which must be resolved against the font size
construct a property value object:
prop = "4000mpt" prop.getClass() = "class org.apache.fop.fo.properties.FixedLength"
next(): scan the next token;
this = {
propInfo: instance of org.apache.fop.fo.expr.PropertyInfo(id=729)
org.apache.fop.fo.expr.PropertyTokenizer.currentToken: 0
org.apache.fop.fo.expr.PropertyTokenizer.currentTokenValue: null
org.apache.fop.fo.expr.PropertyTokenizer.currentUnitLength: 2
org.apache.fop.fo.expr.PropertyTokenizer.currentTokenStartIndex: 3
org.apache.fop.fo.expr.PropertyTokenizer.expr: "4pt"
org.apache.fop.fo.expr.PropertyTokenizer.exprIndex: 3
org.apache.fop.fo.expr.PropertyTokenizer.exprLength: 3
org.apache.fop.fo.expr.PropertyTokenizer.recognizeOperator: true
}
the next token is of type currentToken = PropertyTokenizer.TOK_EOF.
If currentToken = PropertyTokenizer.TOK_EOF, break the loop.
Return the property: p = "4000mpt".