Class SACParser
- All Implemented Interfaces:
SACParserConstants
,Parser
- Version:
- $Release$
- Author:
- David Schweinsberg
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
Fields inherited from interface com.steadystate.css.parser.SACParserConstants
AND, ANGLE_DEG, ANGLE_GRAD, ANGLE_RAD, ASTERISK, ATKEYWORD, CDC, CDO, CHARSET_SYM, COLON, COMMA, COMMENT, DASHMATCH, DEFAULT, DIMEN, DOT, EMS, EOF, EQUALS, ESCAPE, EXS, FONT_FACE_SYM, FREQ_HZ, FREQ_KHZ, FUNCTION, GT, H, HASH, HNUM, IDENT, IMPORT_SYM, IMPORTANT_SYM, INCLUDES, INHERIT, LBRACE, LENGTH_CM, LENGTH_IN, LENGTH_MM, LENGTH_PC, LENGTH_PT, LENGTH_PX, LPAREN, LSQUARE, MEDIA_SYM, MEDIUM, MINUS, NAME, NL, NMCHAR, NMSTART, NONASCII, NOT, NUM, NUMBER, ONLY, PAGE_SYM, PERCENTAGE, PLUS, Q11, Q12, Q13, Q14, Q15, Q16, RANGE, RBRACE, RGB, RROUND, RSQUARE, S, SEMICOLON, SLASH, STRING, STRING1, STRING2, TIME_MS, TIME_S, tokenImage, UNICODE, UNICODERANGE, UNKNOWN, URI, URL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Condition
final Condition
final void
final char
final void
final void
final SimpleSelector
final void
final LexicalUnit
expr()
final void
final LexicalUnit
function
(LexicalUnit prev) final Token
Returns a string about which CSS language is supported by this parser.final Token
getToken
(int index) final Condition
final LexicalUnit
hexcolor
(LexicalUnit prev) final void
final void
final void
final void
final void
final void
final void
final void
final void
final String
medium()
final LexicalUnit
operator
(LexicalUnit prev) final void
pageRule()
boolean
parsePriority
(InputSource source) Parse a CSS priority value (e.g.parsePropertyValue
(InputSource source) Parse a CSS property value.void
parseRule
(InputSource source) Parse a CSS rule.parseSelectors
(InputSource source) Parse a comma separated list of selectors.void
parseStyleDeclaration
(InputSource source) Parse a CSS style declaration (without '{' and '}').void
parseStyleSheet
(String uri) Parse a CSS document from a URI.void
parseStyleSheet
(InputSource source) Parse a CSS document.final boolean
prio()
final String
property()
final Condition
final String
void
ReInit
(CharStream stream) void
final LexicalUnit
rgb
(LexicalUnit prev) final Selector
selector()
final SelectorList
void
setConditionFactory
(ConditionFactory conditionFactory) void
setDocumentHandler
(DocumentHandler handler) Allow an application to register a document event handler.void
setErrorHandler
(ErrorHandler handler) Allow an application to register an error event handler.void
Allow an application to request a locale for errors and warnings.void
setSelectorFactory
(SelectorFactory selectorFactory) final Selector
simpleSelector
(Selector sel, char comb) final void
final void
final void
final void
final void
final void
final LexicalUnit
term
(LexicalUnit prev) final char
final void
-
Field Details
-
token_source
-
token
-
jj_nt
-
lookingAhead
public boolean lookingAhead
-
-
Constructor Details
-
SACParser
public SACParser() -
SACParser
-
SACParser
-
-
Method Details
-
setLocale
Description copied from interface:Parser
Allow an application to request a locale for errors and warnings.CSS 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.
- Specified by:
setLocale
in interfaceParser
- Parameters:
locale
- A Java Locale object.- Throws:
CSSException
- Throws an exception (using the previous or default locale) if the requested locale is not supported.- See Also:
-
setDocumentHandler
Description copied from interface:Parser
Allow an application to register a document event handler.If 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.
- Specified by:
setDocumentHandler
in interfaceParser
- Parameters:
handler
- The document handler.- See Also:
-
setSelectorFactory
- Specified by:
setSelectorFactory
in interfaceParser
-
setConditionFactory
- Specified by:
setConditionFactory
in interfaceParser
-
setErrorHandler
Description copied from interface:Parser
Allow an application to register an error event handler.If 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.
- Specified by:
setErrorHandler
in interfaceParser
- Parameters:
handler
- The error handler.- See Also:
-
parseStyleSheet
Description copied from interface:Parser
Parse a CSS document.The 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.
- Specified by:
parseStyleSheet
in interfaceParser
- Parameters:
source
- The input source for the top-level of the CSS document.- Throws:
CSSException
- Any CSS exception, possibly wrapping another exception.IOException
- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.- See Also:
-
parseStyleSheet
Description copied from interface:Parser
Parse a CSS document from a URI.This 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.
- Specified by:
parseStyleSheet
in interfaceParser
- Parameters:
uri
- The URI.- Throws:
CSSException
- Any CSS exception, possibly wrapping another exception.IOException
- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.- See Also:
-
parseStyleDeclaration
Description copied from interface:Parser
Parse a CSS style declaration (without '{' and '}').- Specified by:
parseStyleDeclaration
in interfaceParser
- Throws:
CSSException
- Any CSS exception, possibly wrapping another exception.IOException
- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
-
parseRule
Description copied from interface:Parser
Parse a CSS rule.- Specified by:
parseRule
in interfaceParser
- Throws:
CSSException
- Any CSS exception, possibly wrapping another exception.IOException
- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
-
getParserVersion
Description copied from interface:Parser
Returns a string about which CSS language is supported by this parser. For CSS Level 1, it returns "http://www.w3.org/TR/REC-CSS1", for CSS Level 2, it returns "http://www.w3.org/TR/REC-CSS2". Note that a "CSSx" parser can return lexical unit other than those allowed by CSS Level x but this usage is not recommended.- Specified by:
getParserVersion
in interfaceParser
-
parseSelectors
Description copied from interface:Parser
Parse a comma separated list of selectors.- Specified by:
parseSelectors
in interfaceParser
- Throws:
CSSException
- Any CSS exception, possibly wrapping another exception.IOException
- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
-
parsePropertyValue
Description copied from interface:Parser
Parse a CSS property value.- Specified by:
parsePropertyValue
in interfaceParser
- Throws:
CSSException
- Any CSS exception, possibly wrapping another exception.IOException
- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
-
parsePriority
Description copied from interface:Parser
Parse a CSS priority value (e.g. "!important").- Specified by:
parsePriority
in interfaceParser
- Throws:
CSSException
- Any CSS exception, possibly wrapping another exception.IOException
- An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
-
styleSheet
- Throws:
ParseException
-
styleSheetRuleList
- Throws:
ParseException
-
styleSheetRuleSingle
- Throws:
ParseException
-
charsetRule
- Throws:
ParseException
-
unknownRule
- Throws:
ParseException
-
importRule
- Throws:
ParseException
-
mediaRule
- Throws:
ParseException
-
mediaQuery
- Throws:
ParseException
-
mediaListOrExpression
- Throws:
ParseException
-
mediaExpression
- Throws:
ParseException
-
mediaFeature
- Throws:
ParseException
-
mediaList
- Throws:
ParseException
-
mediaRuleList
- Throws:
ParseException
-
mediaRuleSingle
- Throws:
ParseException
-
medium
- Throws:
ParseException
-
pageRule
- Throws:
ParseException
-
pseudoPage
- Throws:
ParseException
-
fontFaceRule
- Throws:
ParseException
-
operator
- Throws:
ParseException
-
combinator
- Throws:
ParseException
-
unaryOperator
- Throws:
ParseException
-
property
- Throws:
ParseException
-
styleRule
- Throws:
ParseException
-
styleRuleDeclarations
- Throws:
ParseException
-
selectorList
- Throws:
ParseException
-
selector
- Throws:
ParseException
-
simpleSelector
- Throws:
ParseException
-
_class
- Throws:
ParseException
-
elementName
- Throws:
ParseException
-
attrib
- Throws:
ParseException
-
pseudo
- Throws:
ParseException
-
hash
- Throws:
ParseException
-
styleDeclaration
- Throws:
ParseException
-
declaration
- Throws:
ParseException
-
prio
- Throws:
ParseException
-
expr
- Throws:
ParseException
-
term
- Throws:
ParseException
-
function
- Throws:
ParseException
-
rgb
- Throws:
ParseException
-
hexcolor
- Throws:
ParseException
-
ReInit
-
ReInit
-
getNextToken
-
getToken
-
generateParseException
-
enable_tracing
public final void enable_tracing() -
disable_tracing
public final void disable_tracing()
-