public class Parser extends java.lang.Object implements ExtendedParser, Localizable
Parser
interface.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUNDLE_CLASSNAME
The default resource bundle base name.
|
protected org.w3c.css.sac.ConditionFactory |
conditionFactory
The condition factory.
|
protected int |
current
The current lexical unit.
|
protected org.w3c.css.sac.DocumentHandler |
documentHandler
The document handler.
|
protected java.lang.String |
documentURI
The document URI.
|
protected org.w3c.css.sac.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 org.w3c.css.sac.SelectorFactory |
selectorFactory
The selector factory.
|
Constructor and Description |
---|
Parser() |
Modifier and Type | Method and Description |
---|---|
protected org.w3c.css.sac.CSSParseException |
createCSSParseException(java.lang.String key)
Creates a parse exception.
|
protected org.w3c.css.sac.CSSParseException |
createCSSParseException(java.lang.String key,
java.lang.Object[] params)
Creates a parse exception.
|
protected Scanner |
createScanner(org.w3c.css.sac.InputSource source)
Creates a scanner, given an InputSource.
|
protected org.w3c.css.sac.LexicalUnit |
dimension(boolean positive,
org.w3c.css.sac.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
Parser.getParserVersion() . |
protected org.w3c.css.sac.LexicalUnit |
hexcolor(org.w3c.css.sac.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 org.w3c.css.sac.LexicalUnit |
parseExpression(boolean param)
Parses a CSS2 expression.
|
protected void |
parseFontFaceRule()
Parses a font-face rule.
|
protected org.w3c.css.sac.LexicalUnit |
parseFunction(boolean positive,
org.w3c.css.sac.LexicalUnit prev)
Parses a CSS2 function.
|
protected void |
parseImportRule()
Parses an import rule.
|
org.w3c.css.sac.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(org.w3c.css.sac.InputSource source)
SAC: Implements
Parser.parsePriority(InputSource) . |
boolean |
parsePriority(java.lang.String source)
Implements
ExtendedParser.parsePriority(String) . |
protected boolean |
parsePriorityInternal()
Parses the priority using the current scanner.
|
org.w3c.css.sac.LexicalUnit |
parsePropertyValue(org.w3c.css.sac.InputSource source)
SAC: Implements
Parser.parsePropertyValue(InputSource) . |
org.w3c.css.sac.LexicalUnit |
parsePropertyValue(java.lang.String source)
Implements
ExtendedParser.parsePropertyValue(String) . |
protected org.w3c.css.sac.LexicalUnit |
parsePropertyValueInternal()
Parses property value using the current scanner.
|
protected void |
parseRule()
Parses a rule.
|
void |
parseRule(org.w3c.css.sac.InputSource source)
SAC: Implements
Parser.parseRule(InputSource) . |
void |
parseRule(java.lang.String source)
Implements
ExtendedParser.parseRule(String) . |
protected void |
parseRuleInternal()
Parses a rule using the current scanner.
|
protected void |
parseRuleSet()
Parses a ruleset.
|
protected org.w3c.css.sac.Selector |
parseSelector()
Parses a selector.
|
protected org.w3c.css.sac.SelectorList |
parseSelectorList()
Parses a selector list
|
org.w3c.css.sac.SelectorList |
parseSelectors(org.w3c.css.sac.InputSource source)
SAC: Implements
Parser.parseSelectors(InputSource) . |
org.w3c.css.sac.SelectorList |
parseSelectors(java.lang.String source)
Implements
ExtendedParser.parseSelectors(String) . |
protected org.w3c.css.sac.SelectorList |
parseSelectorsInternal()
Parses selectors using the current scanner.
|
protected org.w3c.css.sac.SimpleSelector |
parseSimpleSelector()
Parses a simple selector.
|
protected void |
parseStyleDeclaration(boolean inSheet)
Parses the given reader.
|
void |
parseStyleDeclaration(org.w3c.css.sac.InputSource source)
SAC: Implements
Parser.parseStyleDeclaration(InputSource) . |
void |
parseStyleDeclaration(java.lang.String source)
Implements
ExtendedParser.parseStyleDeclaration(String) . |
protected void |
parseStyleDeclarationInternal()
Parses a style declaration using the current scanner.
|
void |
parseStyleSheet(org.w3c.css.sac.InputSource source)
SAC: Implements
Parser.parseStyleSheet(InputSource) . |
void |
parseStyleSheet(java.lang.String uri)
SAC: Implements
Parser.parseStyleSheet(String) . |
protected org.w3c.css.sac.LexicalUnit |
parseTerm(org.w3c.css.sac.LexicalUnit prev)
Parses a CSS2 term.
|
protected void |
reportError(org.w3c.css.sac.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(org.w3c.css.sac.ConditionFactory factory)
SAC: Implements
Parser.setConditionFactory(ConditionFactory) . |
void |
setDocumentHandler(org.w3c.css.sac.DocumentHandler handler)
SAC: Implements
Parser.setDocumentHandler(DocumentHandler) . |
void |
setErrorHandler(org.w3c.css.sac.ErrorHandler handler)
SAC: Implements
Parser.setErrorHandler(ErrorHandler) . |
void |
setLocale(java.util.Locale locale)
SAC: Implements
Parser.setLocale(Locale) . |
void |
setSelectorFactory(org.w3c.css.sac.SelectorFactory factory)
SAC: Implements
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 org.w3c.css.sac.DocumentHandler documentHandler
protected org.w3c.css.sac.SelectorFactory selectorFactory
protected org.w3c.css.sac.ConditionFactory conditionFactory
protected org.w3c.css.sac.ErrorHandler errorHandler
protected java.lang.String pseudoElement
protected java.lang.String documentURI
public java.lang.String getParserVersion()
Parser.getParserVersion()
.getParserVersion
in interface org.w3c.css.sac.Parser
public void setLocale(java.util.Locale locale) throws org.w3c.css.sac.CSSException
Parser.setLocale(Locale)
.setLocale
in interface Localizable
setLocale
in interface org.w3c.css.sac.Parser
locale
- The locale to set.org.w3c.css.sac.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(org.w3c.css.sac.DocumentHandler handler)
Parser.setDocumentHandler(DocumentHandler)
.setDocumentHandler
in interface org.w3c.css.sac.Parser
public void setSelectorFactory(org.w3c.css.sac.SelectorFactory factory)
Parser.setSelectorFactory(SelectorFactory)
.setSelectorFactory
in interface org.w3c.css.sac.Parser
public void setConditionFactory(org.w3c.css.sac.ConditionFactory factory)
Parser.setConditionFactory(ConditionFactory)
.setConditionFactory
in interface org.w3c.css.sac.Parser
public void setErrorHandler(org.w3c.css.sac.ErrorHandler handler)
Parser.setErrorHandler(ErrorHandler)
.setErrorHandler
in interface org.w3c.css.sac.Parser
public void parseStyleSheet(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, java.io.IOException
Parser.parseStyleSheet(InputSource)
.parseStyleSheet
in interface org.w3c.css.sac.Parser
org.w3c.css.sac.CSSException
java.io.IOException
public void parseStyleSheet(java.lang.String uri) throws org.w3c.css.sac.CSSException, java.io.IOException
Parser.parseStyleSheet(String)
.parseStyleSheet
in interface org.w3c.css.sac.Parser
org.w3c.css.sac.CSSException
java.io.IOException
public void parseStyleDeclaration(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, java.io.IOException
Parser.parseStyleDeclaration(InputSource)
.parseStyleDeclaration
in interface org.w3c.css.sac.Parser
org.w3c.css.sac.CSSException
java.io.IOException
protected void parseStyleDeclarationInternal() throws org.w3c.css.sac.CSSException, java.io.IOException
org.w3c.css.sac.CSSException
java.io.IOException
public void parseRule(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, java.io.IOException
Parser.parseRule(InputSource)
.parseRule
in interface org.w3c.css.sac.Parser
org.w3c.css.sac.CSSException
java.io.IOException
protected void parseRuleInternal() throws org.w3c.css.sac.CSSException, java.io.IOException
org.w3c.css.sac.CSSException
java.io.IOException
public org.w3c.css.sac.SelectorList parseSelectors(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, java.io.IOException
Parser.parseSelectors(InputSource)
.parseSelectors
in interface org.w3c.css.sac.Parser
org.w3c.css.sac.CSSException
java.io.IOException
protected org.w3c.css.sac.SelectorList parseSelectorsInternal() throws org.w3c.css.sac.CSSException, java.io.IOException
org.w3c.css.sac.CSSException
java.io.IOException
public org.w3c.css.sac.LexicalUnit parsePropertyValue(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, java.io.IOException
Parser.parsePropertyValue(InputSource)
.parsePropertyValue
in interface org.w3c.css.sac.Parser
org.w3c.css.sac.CSSException
java.io.IOException
protected org.w3c.css.sac.LexicalUnit parsePropertyValueInternal() throws org.w3c.css.sac.CSSException, java.io.IOException
org.w3c.css.sac.CSSException
java.io.IOException
public boolean parsePriority(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, java.io.IOException
Parser.parsePriority(InputSource)
.parsePriority
in interface org.w3c.css.sac.Parser
org.w3c.css.sac.CSSException
java.io.IOException
protected boolean parsePriorityInternal() throws org.w3c.css.sac.CSSException, java.io.IOException
org.w3c.css.sac.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 org.w3c.css.sac.SelectorList parseSelectorList()
protected org.w3c.css.sac.Selector parseSelector()
protected org.w3c.css.sac.SimpleSelector parseSimpleSelector()
protected boolean isPseudoElement(java.lang.String s)
protected void parseStyleDeclaration(boolean inSheet) throws org.w3c.css.sac.CSSException
org.w3c.css.sac.CSSException
protected org.w3c.css.sac.LexicalUnit parseExpression(boolean param)
param
- whether the expression to be parsed is a function parameterprotected org.w3c.css.sac.LexicalUnit parseTerm(org.w3c.css.sac.LexicalUnit prev)
protected org.w3c.css.sac.LexicalUnit parseFunction(boolean positive, org.w3c.css.sac.LexicalUnit prev)
protected org.w3c.css.sac.LexicalUnit hexcolor(org.w3c.css.sac.LexicalUnit prev)
protected Scanner createScanner(org.w3c.css.sac.InputSource source)
protected int skipSpaces()
protected int skipSpacesAndCDOCDC()
protected float number(boolean positive)
protected org.w3c.css.sac.LexicalUnit dimension(boolean positive, org.w3c.css.sac.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(org.w3c.css.sac.CSSParseException e)
protected org.w3c.css.sac.CSSParseException createCSSParseException(java.lang.String key)
protected org.w3c.css.sac.CSSParseException createCSSParseException(java.lang.String key, java.lang.Object[] params)
public void parseStyleDeclaration(java.lang.String source) throws org.w3c.css.sac.CSSException, java.io.IOException
ExtendedParser.parseStyleDeclaration(String)
.parseStyleDeclaration
in interface ExtendedParser
source
- The declaration.org.w3c.css.sac.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 void parseRule(java.lang.String source) throws org.w3c.css.sac.CSSException, java.io.IOException
ExtendedParser.parseRule(String)
.parseRule
in interface ExtendedParser
org.w3c.css.sac.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 org.w3c.css.sac.SelectorList parseSelectors(java.lang.String source) throws org.w3c.css.sac.CSSException, java.io.IOException
ExtendedParser.parseSelectors(String)
.parseSelectors
in interface ExtendedParser
org.w3c.css.sac.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 org.w3c.css.sac.LexicalUnit parsePropertyValue(java.lang.String source) throws org.w3c.css.sac.CSSException, java.io.IOException
ExtendedParser.parsePropertyValue(String)
.parsePropertyValue
in interface ExtendedParser
org.w3c.css.sac.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 boolean parsePriority(java.lang.String source) throws org.w3c.css.sac.CSSException, java.io.IOException
ExtendedParser.parsePriority(String)
.parsePriority
in interface ExtendedParser
org.w3c.css.sac.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 org.w3c.css.sac.SACMediaList parseMedia(java.lang.String mediaText) throws org.w3c.css.sac.CSSException, java.io.IOException
ExtendedParser.parseMedia(String)
.parseMedia
in interface ExtendedParser
org.w3c.css.sac.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 © 2022 Apache Software Foundation. All Rights Reserved.