Package org.apache.fop.fo.expr
Class PropertyTokenizer
- java.lang.Object
-
- org.apache.fop.fo.expr.PropertyTokenizer
-
- Direct Known Subclasses:
PropertyParser
class PropertyTokenizer extends java.lang.ObjectClass to tokenize XSL FO property expression. This class is heavily based on the epxression tokenizer in James Clark's XT, an XSLT processor.
-
-
Field Summary
Fields Modifier and Type Field Description protected intcurrentTokenprivate intcurrentTokenStartIndexprotected java.lang.StringcurrentTokenValueprotected intcurrentUnitLengthprivate static java.lang.StringDIGITSprivate java.lang.Stringexprprivate intexprIndexprivate intexprLengthprivate static java.lang.StringHEX_CHARSprivate static java.lang.StringNAME_CHARSprivate static java.lang.StringNAME_START_CHARS(package private) static intTOK_COLORSPEC(package private) static intTOK_COMMA(package private) static intTOK_DIV(package private) static intTOK_EOF(package private) static intTOK_FLOAT(package private) static intTOK_FUNCTION_LPAR(package private) static intTOK_INTEGER(package private) static intTOK_LITERAL(package private) static intTOK_LPAR(package private) static intTOK_MINUS(package private) static intTOK_MOD(package private) static intTOK_MULTIPLY(package private) static intTOK_NCNAME(package private) static intTOK_NUMBER(package private) static intTOK_NUMERIC(package private) static intTOK_PERCENT(package private) static intTOK_PLUS(package private) static intTOK_RPAR
-
Constructor Summary
Constructors Constructor Description PropertyTokenizer(java.lang.String s)Construct a new PropertyTokenizer object to tokenize the passed String.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanfollowingParen()Return a boolean value indicating whether the following non-whitespace character is an opening parenthesis.private static booleanisDigit(char c)Return a boolean value indicating whether the argument is a decimal digit (0-9).private static booleanisHexDigit(char c)Return a boolean value indicating whether the argument is a hexadecimal digit (0-9, A-F, a-f).private static booleanisNameChar(char c)Return a boolean value indicating whether the argument is a valid name character, ie.private static booleanisNameStartChar(char c)Return a boolean value indicating whether the argument is a valid name start character, ie.(package private) voidnext()Parse the next token in the expression string.private voidnextColor()private voidnextDecimalPoint()private voidscanDigits()Attempt to recognize a valid sequence of decimal DIGITS in the input expression.private voidscanHexDigits()Attempt to recognize a valid sequence of hexadecimal DIGITS in the input expression.private voidscanName()Attempt to recognize a valid NAME token in the input expression.private voidscanRestOfName()
-
-
-
Field Detail
-
TOK_EOF
static final int TOK_EOF
- See Also:
- Constant Field Values
-
TOK_NCNAME
static final int TOK_NCNAME
- See Also:
- Constant Field Values
-
TOK_MULTIPLY
static final int TOK_MULTIPLY
- See Also:
- Constant Field Values
-
TOK_LPAR
static final int TOK_LPAR
- See Also:
- Constant Field Values
-
TOK_RPAR
static final int TOK_RPAR
- See Also:
- Constant Field Values
-
TOK_LITERAL
static final int TOK_LITERAL
- See Also:
- Constant Field Values
-
TOK_NUMBER
static final int TOK_NUMBER
- See Also:
- Constant Field Values
-
TOK_FUNCTION_LPAR
static final int TOK_FUNCTION_LPAR
- See Also:
- Constant Field Values
-
TOK_PLUS
static final int TOK_PLUS
- See Also:
- Constant Field Values
-
TOK_MINUS
static final int TOK_MINUS
- See Also:
- Constant Field Values
-
TOK_MOD
static final int TOK_MOD
- See Also:
- Constant Field Values
-
TOK_DIV
static final int TOK_DIV
- See Also:
- Constant Field Values
-
TOK_NUMERIC
static final int TOK_NUMERIC
- See Also:
- Constant Field Values
-
TOK_COMMA
static final int TOK_COMMA
- See Also:
- Constant Field Values
-
TOK_PERCENT
static final int TOK_PERCENT
- See Also:
- Constant Field Values
-
TOK_COLORSPEC
static final int TOK_COLORSPEC
- See Also:
- Constant Field Values
-
TOK_FLOAT
static final int TOK_FLOAT
- See Also:
- Constant Field Values
-
TOK_INTEGER
static final int TOK_INTEGER
- See Also:
- Constant Field Values
-
currentToken
protected int currentToken
-
currentTokenValue
protected java.lang.String currentTokenValue
-
currentUnitLength
protected int currentUnitLength
-
currentTokenStartIndex
private int currentTokenStartIndex
-
expr
private java.lang.String expr
-
exprIndex
private int exprIndex
-
exprLength
private int exprLength
-
NAME_START_CHARS
private static final java.lang.String NAME_START_CHARS
- See Also:
- Constant Field Values
-
NAME_CHARS
private static final java.lang.String NAME_CHARS
- See Also:
- Constant Field Values
-
DIGITS
private static final java.lang.String DIGITS
- See Also:
- Constant Field Values
-
HEX_CHARS
private static final java.lang.String HEX_CHARS
- See Also:
- Constant Field Values
-
-
Method Detail
-
next
void next() throws PropertyException
Parse the next token in the expression string. This sets the following package visible variables: currentToken An enumerated value identifying the recognized token currentTokenValue A String containing the token contents currentUnitLength If currentToken = TOK_NUMERIC, the number of characters in the unit name.- Throws:
PropertyException- If un unrecognized token is encountered.
-
nextDecimalPoint
private void nextDecimalPoint() throws PropertyException- Throws:
PropertyException
-
nextColor
private void nextColor() throws PropertyException- Throws:
PropertyException
-
scanName
private void scanName()
Attempt to recognize a valid NAME token in the input expression.
-
scanRestOfName
private void scanRestOfName()
-
scanDigits
private void scanDigits()
Attempt to recognize a valid sequence of decimal DIGITS in the input expression.
-
scanHexDigits
private void scanHexDigits()
Attempt to recognize a valid sequence of hexadecimal DIGITS in the input expression.
-
followingParen
private boolean followingParen()
Return a boolean value indicating whether the following non-whitespace character is an opening parenthesis.
-
isDigit
private static boolean isDigit(char c)
Return a boolean value indicating whether the argument is a decimal digit (0-9).- Parameters:
c- The character to check
-
isHexDigit
private static boolean isHexDigit(char c)
Return a boolean value indicating whether the argument is a hexadecimal digit (0-9, A-F, a-f).- Parameters:
c- The character to check
-
isNameStartChar
private static boolean isNameStartChar(char c)
Return a boolean value indicating whether the argument is a valid name start character, ie. can start a NAME as defined by XSL.- Parameters:
c- The character to check
-
isNameChar
private static boolean isNameChar(char c)
Return a boolean value indicating whether the argument is a valid name character, ie. can occur in a NAME as defined by XSL.- Parameters:
c- The character to check
-
-