public class Parser extends java.lang.Object implements ExtendedParser, Localizable
org.w3c.css.sac.Parser
interface.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUNDLE_CLASSNAME
The default resource bundle base name.
|
protected ConditionFactory |
conditionFactory
The condition factory.
|
protected int |
current
The current lexical unit.
|
protected DocumentHandler |
documentHandler
The document handler.
|
protected java.lang.String |
documentURI
The document URI.
|
protected ErrorHandler |
errorHandler
The error handler.
|
protected LocalizableSupport |
localizableSupport
The localizable support.
|
protected java.lang.String |
pseudoElement
To store the current pseudo element.
|
protected Scanner |
scanner
The scanner used to scan the input source.
|
protected SelectorFactory |
selectorFactory
The selector factory.
|
Constructor and Description |
---|
Parser() |
Modifier and Type | Method and Description |
---|---|
protected CSSParseException |
createCSSParseException(java.lang.String key)
Creates a parse exception.
|
protected CSSParseException |
createCSSParseException(java.lang.String key,
java.lang.Object[] params)
Creates a parse exception.
|
protected Scanner |
createScanner(InputSource source)
Creates a scanner, given an InputSource.
|
protected LexicalUnit |
dimension(boolean positive,
LexicalUnit prev)
Converts the current lexical unit to a dimension.
|
java.lang.String |
formatMessage(java.lang.String key,
java.lang.Object[] args)
Implements
Localizable.formatMessage(String,Object[]) . |
java.util.Locale |
getLocale()
Implements
Localizable.getLocale() . |
java.lang.String |
getParserVersion()
SAC: Implements
org.w3c.css.sac.Parser#getParserVersion() . |
protected LexicalUnit |
hexcolor(LexicalUnit prev)
Converts a hash unit to a RGB color.
|
protected boolean |
isPseudoElement(java.lang.String s)
Tells whether or not the given string represents a pseudo-element.
|
protected int |
next()
Advances to the next token, ignoring comments.
|
protected int |
nextIgnoreSpaces()
Advances to the next token and skip the spaces, ignoring comments.
|
protected float |
number(boolean positive)
Converts the current lexical unit to a float.
|
protected void |
parseAtRule()
Parses an unknown rule.
|
protected LexicalUnit |
parseExpression(boolean param)
Parses a CSS2 expression.
|
protected void |
parseFontFaceRule()
Parses a font-face rule.
|
protected LexicalUnit |
parseFunction(boolean positive,
LexicalUnit prev)
Parses a CSS2 function.
|
protected void |
parseImportRule()
Parses an import rule.
|
SACMediaList |
parseMedia(java.lang.String mediaText)
Implements
ExtendedParser.parseMedia(String) . |
protected CSSSACMediaList |
parseMediaList()
Parses a media list.
|
protected void |
parseMediaRule()
Parses a media rule.
|
protected void |
parsePageRule()
Parses a page rule.
|
boolean |
parsePriority(InputSource source)
SAC: Implements
org.w3c.css.sac.Parser#parsePriority(InputSource) . |
protected boolean |
parsePriorityInternal()
Parses the priority using the current scanner.
|
LexicalUnit |
parsePropertyValue(InputSource source)
SAC: Implements
org.w3c.css.sac.Parser#parsePropertyValue(InputSource) . |
LexicalUnit |
parsePropertyValue(java.lang.String source)
Implements
ExtendedParser.parsePropertyValue(String) . |
protected LexicalUnit |
parsePropertyValueInternal()
Parses property value using the current scanner.
|
protected void |
parseRule()
Parses a rule.
|
void |
parseRule(InputSource source)
SAC: Implements
org.w3c.css.sac.Parser#parseRule(InputSource) . |
protected void |
parseRuleInternal()
Parses a rule using the current scanner.
|
protected void |
parseRuleSet()
Parses a ruleset.
|
protected Selector |
parseSelector()
Parses a selector.
|
protected SelectorList |
parseSelectorList()
Parses a selector list
|
SelectorList |
parseSelectors(InputSource source)
SAC: Implements
org.w3c.css.sac.Parser#parseSelectors(InputSource) . |
SelectorList |
parseSelectors(java.lang.String source)
Implements
ExtendedParser.parseSelectors(String) . |
protected SelectorList |
parseSelectorsInternal()
Parses selectors using the current scanner.
|
protected SimpleSelector |
parseSimpleSelector()
Parses a simple selector.
|
void |
parseStyleDeclaration(InputSource source)
SAC: Implements
org.w3c.css.sac.Parser#parseStyleDeclaration(InputSource) . |
protected void |
parseStyleDeclarationInternal()
Parses a style declaration using the current scanner.
|
void |
parseStyleSheet(InputSource source)
SAC: Implements
org.w3c.css.sac.Parser#parseStyleSheet(InputSource) . |
protected LexicalUnit |
parseTerm(LexicalUnit prev)
Parses a CSS2 term.
|
protected void |
reportError(CSSParseException e)
Reports a parsing error.
|
protected void |
reportError(java.lang.String key)
Reports a parsing error.
|
protected void |
reportError(java.lang.String key,
java.lang.Object[] params)
Reports a parsing error.
|
void |
setConditionFactory(ConditionFactory factory)
SAC: Implements
org.w3c.css.sac.Parser#setConditionFactory(ConditionFactory) . |
void |
setDocumentHandler(DocumentHandler handler)
SAC: Implements
org.w3c.css.sac.Parser#setDocumentHandler(DocumentHandler) . |
void |
setErrorHandler(ErrorHandler handler)
SAC: Implements
org.w3c.css.sac.Parser#setErrorHandler(ErrorHandler) . |
void |
setLocale(java.util.Locale locale)
SAC: Implements
org.w3c.css.sac.Parser#setLocale(Locale) . |
void |
setSelectorFactory(SelectorFactory factory)
SAC: Implements
org.w3c.css.sac.Parser#setSelectorFactory(SelectorFactory) . |
protected int |
skipSpaces()
Skips the white spaces.
|
protected int |
skipSpacesAndCDOCDC()
Skips the white spaces and CDO/CDC units.
|
public static final java.lang.String BUNDLE_CLASSNAME
protected LocalizableSupport localizableSupport
protected Scanner scanner
protected int current
protected DocumentHandler documentHandler
protected SelectorFactory selectorFactory
protected ConditionFactory conditionFactory
protected ErrorHandler errorHandler
protected java.lang.String pseudoElement
protected java.lang.String documentURI
public java.lang.String getParserVersion()
org.w3c.css.sac.Parser#getParserVersion()
.public void setLocale(java.util.Locale locale) throws CSSException
org.w3c.css.sac.Parser#setLocale(Locale)
.setLocale
in interface Localizable
locale
- The locale to set.CSSException
public java.util.Locale getLocale()
Localizable.getLocale()
.getLocale
in interface Localizable
public java.lang.String formatMessage(java.lang.String key, java.lang.Object[] args) throws java.util.MissingResourceException
Localizable.formatMessage(String,Object[])
.formatMessage
in interface Localizable
key
- The key used to retreive the message from the resource
bundle.args
- The objects that compose the message.java.util.MissingResourceException
- if the key is not in the bundle.public void setDocumentHandler(DocumentHandler handler)
org.w3c.css.sac.Parser#setDocumentHandler(DocumentHandler)
.public void setSelectorFactory(SelectorFactory factory)
org.w3c.css.sac.Parser#setSelectorFactory(SelectorFactory)
.public void setConditionFactory(ConditionFactory factory)
org.w3c.css.sac.Parser#setConditionFactory(ConditionFactory)
.public void setErrorHandler(ErrorHandler handler)
org.w3c.css.sac.Parser#setErrorHandler(ErrorHandler)
.public void parseStyleSheet(InputSource source) throws CSSException, java.io.IOException
org.w3c.css.sac.Parser#parseStyleSheet(InputSource)
.CSSException
java.io.IOException
public void parseStyleDeclaration(InputSource source) throws CSSException, java.io.IOException
org.w3c.css.sac.Parser#parseStyleDeclaration(InputSource)
.parseStyleDeclaration
in interface ExtendedParser
source
- The declaration.CSSException
- Any CSS exception, possibly
wrapping another exception.java.io.IOException
- An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.protected void parseStyleDeclarationInternal() throws CSSException, java.io.IOException
CSSException
java.io.IOException
public void parseRule(InputSource source) throws CSSException, java.io.IOException
org.w3c.css.sac.Parser#parseRule(InputSource)
.parseRule
in interface ExtendedParser
CSSException
- Any CSS exception, possibly
wrapping another exception.java.io.IOException
- An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.protected void parseRuleInternal() throws CSSException, java.io.IOException
CSSException
java.io.IOException
public SelectorList parseSelectors(InputSource source) throws CSSException, java.io.IOException
org.w3c.css.sac.Parser#parseSelectors(InputSource)
.parseSelectors
in interface ExtendedParser
CSSException
- Any CSS exception, possibly
wrapping another exception.java.io.IOException
- An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.protected SelectorList parseSelectorsInternal() throws CSSException, java.io.IOException
CSSException
java.io.IOException
public LexicalUnit parsePropertyValue(InputSource source) throws CSSException, java.io.IOException
org.w3c.css.sac.Parser#parsePropertyValue(InputSource)
.parsePropertyValue
in interface ExtendedParser
CSSException
- Any CSS exception, possibly
wrapping another exception.java.io.IOException
- An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.protected LexicalUnit parsePropertyValueInternal() throws CSSException, java.io.IOException
CSSException
java.io.IOException
public boolean parsePriority(InputSource source) throws CSSException, java.io.IOException
org.w3c.css.sac.Parser#parsePriority(InputSource)
.parsePriority
in interface ExtendedParser
CSSException
- Any CSS exception, possibly
wrapping another exception.java.io.IOException
- An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.protected boolean parsePriorityInternal() throws CSSException, java.io.IOException
CSSException
java.io.IOException
protected void parseRule()
protected void parseAtRule()
protected void parseImportRule()
protected CSSSACMediaList parseMediaList()
protected void parseFontFaceRule()
protected void parsePageRule()
protected void parseMediaRule()
protected void parseRuleSet()
protected SelectorList parseSelectorList()
protected Selector parseSelector()
protected SimpleSelector parseSimpleSelector()
protected boolean isPseudoElement(java.lang.String s)
protected LexicalUnit parseExpression(boolean param)
param
- whether the expression to be parsed is a function parameterprotected LexicalUnit parseTerm(LexicalUnit prev)
protected LexicalUnit parseFunction(boolean positive, LexicalUnit prev)
protected LexicalUnit hexcolor(LexicalUnit prev)
protected Scanner createScanner(InputSource source)
protected int skipSpaces()
protected int skipSpacesAndCDOCDC()
protected float number(boolean positive)
protected LexicalUnit dimension(boolean positive, LexicalUnit prev)
protected int next()
protected int nextIgnoreSpaces()
protected void reportError(java.lang.String key)
protected void reportError(java.lang.String key, java.lang.Object[] params)
protected void reportError(CSSParseException e)
protected CSSParseException createCSSParseException(java.lang.String key)
protected CSSParseException createCSSParseException(java.lang.String key, java.lang.Object[] params)
public SelectorList parseSelectors(java.lang.String source) throws CSSException, java.io.IOException
ExtendedParser.parseSelectors(String)
.parseSelectors
in interface ExtendedParser
CSSException
- Any CSS exception, possibly
wrapping another exception.java.io.IOException
- An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.public LexicalUnit parsePropertyValue(java.lang.String source) throws CSSException, java.io.IOException
ExtendedParser.parsePropertyValue(String)
.parsePropertyValue
in interface ExtendedParser
CSSException
- Any CSS exception, possibly
wrapping another exception.java.io.IOException
- An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.public SACMediaList parseMedia(java.lang.String mediaText) throws CSSException, java.io.IOException
ExtendedParser.parseMedia(String)
.parseMedia
in interface ExtendedParser
CSSException
- Any CSS exception, possibly
wrapping another exception.java.io.IOException
- An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.Copyright ? 2015 Apache Software Foundation. All Rights Reserved.