public class SACParserCSS21 extends Object implements SACParserCSS21Constants
| Modifier and Type | Field and Description |
|---|---|
Token |
jj_nt
Next token.
|
Token |
token
Current token.
|
SACParserCSS21TokenManager |
token_source
Generated Token Manager.
|
A_LETTER, ANGLE_DEG, ANGLE_GRAD, ANGLE_RAD, ASTERISK, ATKEYWORD, C_LETTER, CDC, CDO, CHARSET_SYM, COLON, COMMA, COMMENT, COMMENT_, D_LETTER, DASHMATCH, DEFAULT, DIMENSION, DOT, E_LETTER, EMS, EOF, EQUALS, ESCAPE, EXS, FREQ_HZ, FREQ_KHZ, FUNCTION, FUNCTION_LANG, G_LETTER, GREATER, H, H_LETTER, HASH, HNUM, I_LETTER, IDENT, IMPORT_SYM, IMPORTANT_SYM, INCLUDES, INHERIT, K_LETTER, L_LETTER, LBRACE, LENGTH_CM, LENGTH_IN, LENGTH_MM, LENGTH_PC, LENGTH_PT, LENGTH_PX, LROUND, LSQUARE, M_LETTER, MEDIA_SYM, MINUS, N_LETTER, NAME, NL, NMCHAR, NMSTART, NONASCII, NUM, NUMBER, O_LETTER, P_LETTER, PAGE_SYM, PERCENTAGE, PLUS, R_LETTER, RBRACE, RROUND, RSQUARE, S, S_LETTER, SEMICOLON, SLASH, STRING, STRING1, STRING2, T_LETTER, TIME_MS, TIME_S, tokenImage, UNICODE, UNKNOWN, URI, URL, W, X_LETTER, Z_LETTER| Constructor and Description |
|---|
SACParserCSS21() |
SACParserCSS21(CharStream stream)
Constructor with user supplied CharStream.
|
SACParserCSS21(SACParserCSS21TokenManager tm)
Constructor with generated Token Manager.
|
| Modifier and Type | Method and Description |
|---|---|
Condition |
_class(Condition pred,
boolean pseudoElementFound) |
protected String |
add_escapes(String str) |
Condition |
attrib(Condition pred,
boolean pseudoElementFound) |
void |
charsetRule() |
char |
combinator() |
protected Locator |
createLocator(Token t) |
protected CSSParseException |
createSkipWarning(String key,
CSSParseException e) |
void |
declaration() |
void |
disable_tracing()
Disable tracing.
|
SimpleSelector |
elementName() |
void |
enable_tracing()
Enable tracing.
|
LexicalUnit |
expr() |
LexicalUnit |
function(LexicalUnit prev) |
protected LexicalUnit |
functionInternal(LexicalUnit prev,
String funct,
LexicalUnit params) |
ParseException |
generateParseException()
Generate ParseException.
|
protected ConditionFactoryExt |
getConditionFactory() |
protected DocumentHandlerExt |
getDocumentHandler() |
protected ErrorHandler |
getErrorHandler() |
protected String |
getGrammarUri() |
protected InputSource |
getInputSource() |
protected Locale |
getLocale() |
Token |
getNextToken()
Get the next Token.
|
String |
getParserVersion()
Returns a string about which CSS language is supported by this
parser.
|
protected ResourceBundle |
getSACParserMessages() |
protected SelectorFactoryExt |
getSelectorFactory() |
Token |
getToken(int index)
Get the specific Token.
|
protected void |
handleCharset(String characterEncoding,
Locator locator) |
protected void |
handleEndDocument() |
protected void |
handleEndFontFace() |
protected void |
handleEndMedia(SACMediaList media) |
protected void |
handleEndPage(String name,
String pseudoPage) |
protected void |
handleEndSelector(SelectorList selectors) |
protected void |
handleIgnorableAtRule(String s,
Locator locator) |
protected void |
handleImportStyle(String uri,
SACMediaList media,
String defaultNamespaceURI,
Locator locator) |
protected void |
handleMedium(String medium,
Locator locator) |
protected void |
handleProperty(String name,
LexicalUnit value,
boolean important,
Locator locator) |
protected void |
handleSelector(Selector selector) |
protected void |
handleStartDocument() |
protected void |
handleStartFontFace(Locator locator) |
protected void |
handleStartMedia(SACMediaList media,
Locator locator) |
protected void |
handleStartPage(String name,
String pseudoPage,
Locator locator) |
protected void |
handleStartSelector(SelectorList selectors,
Locator locator) |
Condition |
hash(Condition pred,
boolean pseudoElementFound) |
LexicalUnit |
hexcolor(LexicalUnit prev) |
protected LexicalUnit |
hexcolorInternal(LexicalUnit prev,
Token t) |
void |
importRule(boolean nonImportRuleFoundBefore) |
boolean |
isIeStarHackAccepted() |
void |
mediaList(SACMediaListImpl ml) |
void |
mediaRule() |
void |
mediaRuleList() |
String |
medium() |
LexicalUnit |
operator(LexicalUnit prev) |
void |
pageRule() |
SACMediaList |
parseMedia(InputSource source) |
boolean |
parsePriority(InputSource source)
Parse a CSS priority value (e.g. "!
|
LexicalUnit |
parsePropertyValue(InputSource source)
Parse a CSS property value.
|
void |
parseRule(InputSource source)
Parse a CSS rule.
|
SelectorList |
parseSelectors(InputSource source)
Parse a comma separated list of selectors.
|
SelectorList |
parseSelectorsInternal() |
void |
parseStyleDeclaration(InputSource source)
Parse a CSS style declaration (without '{' and '}').
|
void |
parseStyleSheet(InputSource source)
Parse a CSS document.
|
void |
parseStyleSheet(String uri)
Parse a CSS document from a URI.
|
boolean |
prio() |
String |
property() |
Object |
pseudo(Condition pred,
boolean pseudoElementFound) |
String |
pseudoPage() |
void |
ReInit(CharStream stream)
Reinitialise.
|
void |
ReInit(SACParserCSS21TokenManager tm)
Reinitialise.
|
Selector |
selector() |
SelectorList |
selectorList() |
void |
setConditionFactory(ConditionFactory conditionFactory) |
void |
setDocumentHandler(DocumentHandler handler)
Allow an application to register a document event handler.
|
void |
setErrorHandler(ErrorHandler eh)
Allow an application to register an error event handler.
|
void |
setIeStarHackAccepted(boolean accepted) |
void |
setLocale(Locale locale)
Allow an application to request a locale for errors and warnings.
|
void |
setSelectorFactory(SelectorFactory selectorFactory) |
Selector |
simpleSelector(Selector sel,
char comb) |
void |
styleDeclaration() |
void |
styleRule() |
void |
styleSheet() |
void |
styleSheetRuleList() |
void |
styleSheetRuleSingle() |
LexicalUnit |
term(LexicalUnit prev) |
protected CSSParseException |
toCSSParseException(DOMException e) |
protected CSSParseException |
toCSSParseException(String messageKey,
Object[] msgParams,
Locator locator) |
protected CSSParseException |
toCSSParseException(String key,
ParseException e) |
protected CSSParseException |
toCSSParseException(TokenMgrError e) |
boolean |
trace_enabled()
Trace enabled.
|
char |
unaryOperator() |
String |
unescape(String s,
boolean unescapeDoubleQuotes)
Unescapes escaped characters in the specified string, according to the
CSS specification.
|
void |
unknownAtRule() |
public SACParserCSS21TokenManager token_source
public Token token
public Token jj_nt
public SACParserCSS21()
public SACParserCSS21(CharStream stream)
public SACParserCSS21(SACParserCSS21TokenManager tm)
public String getParserVersion()
ParsergetParserVersion in interface Parserprotected String getGrammarUri()
public final void styleSheet()
throws ParseException
ParseExceptionpublic final void styleSheetRuleList()
throws ParseException
ParseExceptionpublic final void styleSheetRuleSingle()
throws ParseException
ParseExceptionpublic final void charsetRule()
throws ParseException
ParseExceptionpublic final void unknownAtRule()
throws ParseException
ParseExceptionpublic final void importRule(boolean nonImportRuleFoundBefore)
throws ParseException
ParseExceptionpublic final void mediaRule()
throws ParseException
ParseExceptionpublic final void mediaList(SACMediaListImpl ml) throws ParseException
ParseExceptionpublic final void mediaRuleList()
throws ParseException
ParseExceptionpublic final String medium() throws ParseException
ParseExceptionpublic final void pageRule()
throws ParseException
ParseExceptionpublic final String pseudoPage() throws ParseException
ParseExceptionpublic final LexicalUnit operator(LexicalUnit prev) throws ParseException
ParseExceptionpublic final char combinator()
throws ParseException
ParseExceptionpublic final char unaryOperator()
throws ParseException
ParseExceptionpublic final String property() throws ParseException
ParseExceptionpublic final void styleRule()
throws ParseException
ParseExceptionpublic final SelectorList parseSelectorsInternal() throws ParseException
ParseExceptionpublic final SelectorList selectorList() throws ParseException
ParseExceptionpublic final Selector selector() throws ParseException
ParseExceptionpublic final Selector simpleSelector(Selector sel, char comb) throws ParseException
ParseExceptionpublic final Condition _class(Condition pred, boolean pseudoElementFound) throws ParseException
ParseExceptionpublic final SimpleSelector elementName() throws ParseException
ParseExceptionpublic final Condition attrib(Condition pred, boolean pseudoElementFound) throws ParseException
ParseExceptionpublic final Object pseudo(Condition pred, boolean pseudoElementFound) throws ParseException
ParseExceptionpublic final Condition hash(Condition pred, boolean pseudoElementFound) throws ParseException
ParseExceptionpublic final void styleDeclaration()
throws ParseException
ParseExceptionpublic final void declaration()
throws ParseException
ParseExceptionpublic final boolean prio()
throws ParseException
ParseExceptionpublic final LexicalUnit expr() throws ParseException
ParseExceptionpublic final LexicalUnit term(LexicalUnit prev) throws ParseException
ParseExceptionpublic final LexicalUnit function(LexicalUnit prev) throws ParseException
ParseExceptionpublic final LexicalUnit hexcolor(LexicalUnit prev) throws ParseException
ParseExceptionpublic void ReInit(CharStream stream)
public void ReInit(SACParserCSS21TokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public ParseException generateParseException()
public final boolean trace_enabled()
public final void enable_tracing()
public final void disable_tracing()
protected DocumentHandlerExt getDocumentHandler()
public void setDocumentHandler(DocumentHandler handler)
ParserIf the application does not register a document handler, all document events reported by the CSS parser will be silently ignored (this is the default behaviour implemented by HandlerBase).
Applications may register a new or different handler in the middle of a parse, and the CSS parser must begin using the new handler immediately.
setDocumentHandler in interface Parserhandler - The document handler.DocumentHandlerprotected ErrorHandler getErrorHandler()
public void setErrorHandler(ErrorHandler eh)
ParserIf the application does not register an error event handler, all error events reported by the CSS parser will be silently ignored, except for fatalError, which will throw a CSSException (this is the default behaviour implemented by HandlerBase).
Applications may register a new or different handler in the middle of a parse, and the CSS parser must begin using the new handler immediately.
setErrorHandler in interface Parsereh - The error handler.ErrorHandler,
CSSExceptionprotected InputSource getInputSource()
public void setIeStarHackAccepted(boolean accepted)
setIeStarHackAccepted in interface SACParserpublic boolean isIeStarHackAccepted()
isIeStarHackAccepted in interface SACParserpublic void setLocale(Locale locale)
ParserCSS parsers are not required to provide localisation for errors and warnings; if they cannot support the requested locale, however, they must throw a CSS exception. Applications may not request a locale change in the middle of a parse.
setLocale in interface Parserlocale - A Java Locale object.CSSException,
CSSParseExceptionprotected Locale getLocale()
protected SelectorFactoryExt getSelectorFactory()
public void setSelectorFactory(SelectorFactory selectorFactory)
setSelectorFactory in interface Parserprotected ConditionFactoryExt getConditionFactory()
public void setConditionFactory(ConditionFactory conditionFactory)
setConditionFactory in interface Parserprotected ResourceBundle getSACParserMessages()
protected CSSParseException toCSSParseException(String key, ParseException e)
protected CSSParseException toCSSParseException(DOMException e)
protected CSSParseException toCSSParseException(TokenMgrError e)
protected CSSParseException toCSSParseException(String messageKey, Object[] msgParams, Locator locator)
protected CSSParseException createSkipWarning(String key, CSSParseException e)
public void parseStyleSheet(InputSource source) throws IOException
ParserThe application can use this method to instruct the CSS parser to begin parsing an CSS document from any valid input source (a character stream, a byte stream, or a URI).
Applications may not invoke this method while a parse is in progress (they should create a new Parser instead for each additional CSS document). Once a parse is complete, an application may reuse the same Parser object, possibly with a different input source.
parseStyleSheet in interface Parsersource - The input source for the top-level of the
CSS document.IOException - An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.InputSource,
Parser.parseStyleSheet(java.lang.String),
Parser.setDocumentHandler(org.w3c.css.sac.DocumentHandler),
Parser.setErrorHandler(org.w3c.css.sac.ErrorHandler)public void parseStyleSheet(String uri) throws IOException
ParserThis method is a shortcut for the common case of reading a document from a URI. It is the exact equivalent of the following:
parse(new InputSource(uri));
The URI must be fully resolved by the application before it is passed to the parser.
parseStyleSheet in interface Parseruri - The URI.IOException - An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.Parser.parseStyleSheet(InputSource)public void parseStyleDeclaration(InputSource source) throws IOException
ParserparseStyleDeclaration in interface ParserIOException - An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.public void parseRule(InputSource source) throws IOException
ParserparseRule in interface ParserIOException - An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.public SelectorList parseSelectors(InputSource source) throws IOException
ParserparseSelectors in interface ParserIOException - An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.public LexicalUnit parsePropertyValue(InputSource source) throws IOException
ParserparsePropertyValue in interface ParserIOException - An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.public boolean parsePriority(InputSource source) throws IOException
ParserparsePriority in interface ParserIOException - An IO exception from the parser,
possibly from a byte stream or character stream
supplied by the application.public SACMediaList parseMedia(InputSource source) throws IOException
IOExceptionprotected void handleStartDocument()
protected void handleEndDocument()
protected void handleImportStyle(String uri, SACMediaList media, String defaultNamespaceURI, Locator locator)
protected void handleStartMedia(SACMediaList media, Locator locator)
protected void handleEndMedia(SACMediaList media)
protected void handleStartFontFace(Locator locator)
protected void handleEndFontFace()
protected void handleSelector(Selector selector)
protected void handleStartSelector(SelectorList selectors, Locator locator)
protected void handleEndSelector(SelectorList selectors)
protected void handleProperty(String name, LexicalUnit value, boolean important, Locator locator)
protected LexicalUnit functionInternal(LexicalUnit prev, String funct, LexicalUnit params)
protected LexicalUnit hexcolorInternal(LexicalUnit prev, Token t)
public String unescape(String s, boolean unescapeDoubleQuotes)
Copyright © 2026. All rights reserved.