org.apache.batik.css.parser

Class Parser

public class Parser extends Object implements ExtendedParser, Localizable

This class implements the {@link org.w3c.css.sac.Parser} interface.
Field Summary
static StringBUNDLE_CLASSNAME
The default resource bundle base name.
protected ConditionFactoryconditionFactory
The condition factory.
protected intcurrent
The current lexical unit.
protected DocumentHandlerdocumentHandler
The document handler.
protected StringdocumentURI
The document URI.
protected ErrorHandlererrorHandler
The error handler.
protected LocalizableSupportlocalizableSupport
The localizable support.
protected StringpseudoElement
To store the current pseudo element.
protected Scannerscanner
The scanner used to scan the input source.
protected SelectorFactoryselectorFactory
The selector factory.
Method Summary
protected CSSParseExceptioncreateCSSParseException(String key)
Creates a parse exception.
protected CSSParseExceptioncreateCSSParseException(String key, Object[] params)
Creates a parse exception.
protected ScannercreateScanner(InputSource source)
Creates a scanner, given an InputSource.
protected LexicalUnitdimension(boolean positive, LexicalUnit prev)
Converts the current lexical unit to a dimension.
StringformatMessage(String key, Object[] args)
Implements {@link org.apache.batik.i18n.Localizable#formatMessage(String,Object[])}.
LocalegetLocale()
Implements {@link org.apache.batik.i18n.Localizable#getLocale()}.
StringgetParserVersion()
SAC: Implements {@link org.w3c.css.sac.Parser#getParserVersion()}.
protected LexicalUnithexcolor(LexicalUnit prev)
Converts a hash unit to a RGB color.
protected booleanisPseudoElement(String s)
Tells whether or not the given string represents a pseudo-element.
protected intnext()
Advances to the next token, ignoring comments.
protected intnextIgnoreSpaces()
Advances to the next token and skip the spaces, ignoring comments.
protected floatnumber(boolean positive)
Converts the current lexical unit to a float.
protected voidparseAtRule()
Parses an unknown rule.
protected LexicalUnitparseExpression(boolean param)
Parses a CSS2 expression.
protected voidparseFontFaceRule()
Parses a font-face rule.
protected LexicalUnitparseFunction(boolean positive, LexicalUnit prev)
Parses a CSS2 function.
protected voidparseImportRule()
Parses an import rule.
SACMediaListparseMedia(String mediaText)
Implements {@link ExtendedParser#parseMedia(String)}.
protected CSSSACMediaListparseMediaList()
Parses a media list.
protected voidparseMediaRule()
Parses a media rule.
protected voidparsePageRule()
Parses a page rule.
booleanparsePriority(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parsePriority(InputSource)}.
booleanparsePriority(String source)
Implements {@link ExtendedParser#parsePriority(String)}.
protected booleanparsePriorityInternal()
Parses the priority using the current scanner.
LexicalUnitparsePropertyValue(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parsePropertyValue(InputSource)}.
LexicalUnitparsePropertyValue(String source)
Implements {@link ExtendedParser#parsePropertyValue(String)}.
protected LexicalUnitparsePropertyValueInternal()
Parses property value using the current scanner.
voidparseRule(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parseRule(InputSource)}.
protected voidparseRule()
Parses a rule.
voidparseRule(String source)
Implements {@link ExtendedParser#parseRule(String)}.
protected voidparseRuleInternal()
Parses a rule using the current scanner.
protected voidparseRuleSet()
Parses a ruleset.
protected SelectorparseSelector()
Parses a selector.
protected SelectorListparseSelectorList()
Parses a selector list
SelectorListparseSelectors(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parseSelectors(InputSource)}.
SelectorListparseSelectors(String source)
Implements {@link ExtendedParser#parseSelectors(String)}.
protected SelectorListparseSelectorsInternal()
Parses selectors using the current scanner.
protected SimpleSelectorparseSimpleSelector()
Parses a simple selector.
voidparseStyleDeclaration(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parseStyleDeclaration(InputSource)}.
protected voidparseStyleDeclaration(boolean inSheet)
Parses the given reader.
voidparseStyleDeclaration(String source)
Implements {@link ExtendedParser#parseStyleDeclaration(String)}.
protected voidparseStyleDeclarationInternal()
Parses a style declaration using the current scanner.
voidparseStyleSheet(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parseStyleSheet(InputSource)}.
voidparseStyleSheet(String uri)
SAC: Implements {@link org.w3c.css.sac.Parser#parseStyleSheet(String)}.
protected LexicalUnitparseTerm(LexicalUnit prev)
Parses a CSS2 term.
protected voidreportError(String key)
Reports a parsing error.
protected voidreportError(String key, Object[] params)
Reports a parsing error.
protected voidreportError(CSSParseException e)
Reports a parsing error.
voidsetConditionFactory(ConditionFactory factory)
SAC: Implements {@link org.w3c.css.sac.Parser#setConditionFactory(ConditionFactory)}.
voidsetDocumentHandler(DocumentHandler handler)
SAC: Implements {@link org.w3c.css.sac.Parser#setDocumentHandler(DocumentHandler)}.
voidsetErrorHandler(ErrorHandler handler)
SAC: Implements {@link org.w3c.css.sac.Parser#setErrorHandler(ErrorHandler)}.
voidsetLocale(Locale locale)
SAC: Implements {@link org.w3c.css.sac.Parser#setLocale(Locale)}.
voidsetSelectorFactory(SelectorFactory factory)
SAC: Implements {@link org.w3c.css.sac.Parser#setSelectorFactory(SelectorFactory)}.
protected intskipSpaces()
Skips the white spaces.
protected intskipSpacesAndCDOCDC()
Skips the white spaces and CDO/CDC units.

Field Detail

BUNDLE_CLASSNAME

public static final String BUNDLE_CLASSNAME
The default resource bundle base name.

conditionFactory

protected ConditionFactory conditionFactory
The condition factory.

current

protected int current
The current lexical unit.

documentHandler

protected DocumentHandler documentHandler
The document handler.

documentURI

protected String documentURI
The document URI.

errorHandler

protected ErrorHandler errorHandler
The error handler.

localizableSupport

protected LocalizableSupport localizableSupport
The localizable support.

pseudoElement

protected String pseudoElement
To store the current pseudo element.

scanner

protected Scanner scanner
The scanner used to scan the input source.

selectorFactory

protected SelectorFactory selectorFactory
The selector factory.

Method Detail

createCSSParseException

protected CSSParseException createCSSParseException(String key)
Creates a parse exception.

createCSSParseException

protected CSSParseException createCSSParseException(String key, Object[] params)
Creates a parse exception.

createScanner

protected Scanner createScanner(InputSource source)
Creates a scanner, given an InputSource.

dimension

protected LexicalUnit dimension(boolean positive, LexicalUnit prev)
Converts the current lexical unit to a dimension.

formatMessage

public String formatMessage(String key, Object[] args)
Implements {@link org.apache.batik.i18n.Localizable#formatMessage(String,Object[])}.

getLocale

public Locale getLocale()
Implements {@link org.apache.batik.i18n.Localizable#getLocale()}.

getParserVersion

public String getParserVersion()
SAC: Implements {@link org.w3c.css.sac.Parser#getParserVersion()}.

Returns: "http://www.w3.org/TR/REC-CSS2".

hexcolor

protected LexicalUnit hexcolor(LexicalUnit prev)
Converts a hash unit to a RGB color.

isPseudoElement

protected boolean isPseudoElement(String s)
Tells whether or not the given string represents a pseudo-element.

next

protected int next()
Advances to the next token, ignoring comments.

nextIgnoreSpaces

protected int nextIgnoreSpaces()
Advances to the next token and skip the spaces, ignoring comments.

number

protected float number(boolean positive)
Converts the current lexical unit to a float.

parseAtRule

protected void parseAtRule()
Parses an unknown rule.

parseExpression

protected LexicalUnit parseExpression(boolean param)
Parses a CSS2 expression.

Parameters: param whether the expression to be parsed is a function parameter

parseFontFaceRule

protected void parseFontFaceRule()
Parses a font-face rule.

parseFunction

protected LexicalUnit parseFunction(boolean positive, LexicalUnit prev)
Parses a CSS2 function.

parseImportRule

protected void parseImportRule()
Parses an import rule. Assumes the current token is '@import'.

parseMedia

public SACMediaList parseMedia(String mediaText)
Implements {@link ExtendedParser#parseMedia(String)}.

parseMediaList

protected CSSSACMediaList parseMediaList()
Parses a media list.

parseMediaRule

protected void parseMediaRule()
Parses a media rule.

parsePageRule

protected void parsePageRule()
Parses a page rule.

parsePriority

public boolean parsePriority(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parsePriority(InputSource)}.

parsePriority

public boolean parsePriority(String source)
Implements {@link ExtendedParser#parsePriority(String)}.

parsePriorityInternal

protected boolean parsePriorityInternal()
Parses the priority using the current scanner.

parsePropertyValue

public LexicalUnit parsePropertyValue(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parsePropertyValue(InputSource)}.

parsePropertyValue

public LexicalUnit parsePropertyValue(String source)
Implements {@link ExtendedParser#parsePropertyValue(String)}.

parsePropertyValueInternal

protected LexicalUnit parsePropertyValueInternal()
Parses property value using the current scanner.

parseRule

public void parseRule(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parseRule(InputSource)}.

parseRule

protected void parseRule()
Parses a rule.

parseRule

public void parseRule(String source)
Implements {@link ExtendedParser#parseRule(String)}.

parseRuleInternal

protected void parseRuleInternal()
Parses a rule using the current scanner.

parseRuleSet

protected void parseRuleSet()
Parses a ruleset.

parseSelector

protected Selector parseSelector()
Parses a selector.

parseSelectorList

protected SelectorList parseSelectorList()
Parses a selector list

parseSelectors

public SelectorList parseSelectors(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parseSelectors(InputSource)}.

parseSelectors

public SelectorList parseSelectors(String source)
Implements {@link ExtendedParser#parseSelectors(String)}.

parseSelectorsInternal

protected SelectorList parseSelectorsInternal()
Parses selectors using the current scanner.

parseSimpleSelector

protected SimpleSelector parseSimpleSelector()
Parses a simple selector.

parseStyleDeclaration

public void parseStyleDeclaration(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parseStyleDeclaration(InputSource)}.

parseStyleDeclaration

protected void parseStyleDeclaration(boolean inSheet)
Parses the given reader.

parseStyleDeclaration

public void parseStyleDeclaration(String source)
Implements {@link ExtendedParser#parseStyleDeclaration(String)}.

parseStyleDeclarationInternal

protected void parseStyleDeclarationInternal()
Parses a style declaration using the current scanner.

parseStyleSheet

public void parseStyleSheet(InputSource source)
SAC: Implements {@link org.w3c.css.sac.Parser#parseStyleSheet(InputSource)}.

parseStyleSheet

public void parseStyleSheet(String uri)
SAC: Implements {@link org.w3c.css.sac.Parser#parseStyleSheet(String)}.

parseTerm

protected LexicalUnit parseTerm(LexicalUnit prev)
Parses a CSS2 term.

reportError

protected void reportError(String key)
Reports a parsing error.

reportError

protected void reportError(String key, Object[] params)
Reports a parsing error.

reportError

protected void reportError(CSSParseException e)
Reports a parsing error.

setConditionFactory

public void setConditionFactory(ConditionFactory factory)
SAC: Implements {@link org.w3c.css.sac.Parser#setConditionFactory(ConditionFactory)}.

setDocumentHandler

public void setDocumentHandler(DocumentHandler handler)
SAC: Implements {@link org.w3c.css.sac.Parser#setDocumentHandler(DocumentHandler)}.

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
SAC: Implements {@link org.w3c.css.sac.Parser#setErrorHandler(ErrorHandler)}.

setLocale

public void setLocale(Locale locale)
SAC: Implements {@link org.w3c.css.sac.Parser#setLocale(Locale)}.

setSelectorFactory

public void setSelectorFactory(SelectorFactory factory)
SAC: Implements {@link org.w3c.css.sac.Parser#setSelectorFactory(SelectorFactory)}.

skipSpaces

protected int skipSpaces()
Skips the white spaces.

skipSpacesAndCDOCDC

protected int skipSpacesAndCDOCDC()
Skips the white spaces and CDO/CDC units.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.