com.steadystate.css.parser
public class SACParser extends java.lang.Object implements Parser, SACParserConstants
| Modifier and Type | Field and Description |
|---|---|
Token |
jj_nt |
boolean |
lookingAhead |
Token |
token |
SACParserTokenManager |
token_source |
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 and Description |
|---|
SACParser() |
SACParser(CharStream stream) |
SACParser(SACParserTokenManager tm) |
public SACParserTokenManager token_source
public Token token
public Token jj_nt
public boolean lookingAhead
public SACParser()
public SACParser(CharStream stream)
public SACParser(SACParserTokenManager tm)
public void setLocale(java.util.Locale locale)
throws CSSException
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 - Throws an exception
(using the previous or default locale) if the
requested locale is not supported.CSSException,
CSSParseExceptionpublic 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.DocumentHandlerpublic void setSelectorFactory(SelectorFactory selectorFactory)
setSelectorFactory in interface Parserpublic void setConditionFactory(ConditionFactory conditionFactory)
setConditionFactory in interface Parserpublic void setErrorHandler(ErrorHandler handler)
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 Parserhandler - The error handler.ErrorHandler,
CSSExceptionpublic void parseStyleSheet(InputSource source) throws CSSException, java.io.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.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.InputSource,
Parser.parseStyleSheet(java.lang.String),
Parser.setDocumentHandler(org.w3c.css.sac.DocumentHandler),
Parser.setErrorHandler(org.w3c.css.sac.ErrorHandler)public void parseStyleSheet(java.lang.String uri)
throws CSSException,
java.io.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.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.Parser.parseStyleSheet(InputSource)public void parseStyleDeclaration(InputSource source) throws CSSException, java.io.IOException
ParserparseStyleDeclaration in interface ParserCSSException - 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(InputSource source) throws CSSException, java.io.IOException
ParserparseRule in interface ParserCSSException - 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 java.lang.String getParserVersion()
ParsergetParserVersion in interface Parserpublic SelectorList parseSelectors(InputSource source) throws CSSException, java.io.IOException
ParserparseSelectors in interface ParserCSSException - 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(InputSource source) throws CSSException, java.io.IOException
ParserparsePropertyValue in interface ParserCSSException - 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(InputSource source) throws CSSException, java.io.IOException
ParserparsePriority in interface ParserCSSException - 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 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 unknownRule()
throws ParseException
ParseExceptionpublic final void importRule()
throws ParseException
ParseExceptionpublic final void mediaRule()
throws ParseException
ParseExceptionpublic final void mediaQuery(SACMediaListImpl ml) throws ParseException
ParseExceptionpublic final void mediaListOrExpression(SACMediaListImpl ml) throws ParseException
ParseExceptionpublic final void mediaExpression(SACMediaListImpl ml) throws ParseException
ParseExceptionpublic final void mediaFeature(SACMediaListImpl ml) throws ParseException
ParseExceptionpublic final void mediaList(SACMediaListImpl ml) throws ParseException
ParseExceptionpublic final void mediaRuleList()
throws ParseException
ParseExceptionpublic final void mediaRuleSingle()
throws ParseException
ParseExceptionpublic final java.lang.String medium()
throws ParseException
ParseExceptionpublic final void pageRule()
throws ParseException
ParseExceptionpublic final java.lang.String pseudoPage()
throws ParseException
ParseExceptionpublic final void fontFaceRule()
throws ParseException
ParseExceptionpublic final LexicalUnit operator(LexicalUnit prev) throws ParseException
ParseExceptionpublic final char combinator()
throws ParseException
ParseExceptionpublic final char unaryOperator()
throws ParseException
ParseExceptionpublic final java.lang.String property()
throws ParseException
ParseExceptionpublic final void styleRule()
throws ParseException
ParseExceptionpublic final void styleRuleDeclarations()
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) throws ParseException
ParseExceptionpublic final SimpleSelector elementName() throws ParseException
ParseExceptionpublic final Condition attrib(Condition pred) throws ParseException
ParseExceptionpublic final Condition pseudo(Condition pred) throws ParseException
ParseExceptionpublic final Condition hash(Condition pred) 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 rgb(LexicalUnit prev) throws ParseException
ParseExceptionpublic final LexicalUnit hexcolor(LexicalUnit prev) throws ParseException
ParseExceptionpublic void ReInit(CharStream stream)
public void ReInit(SACParserTokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public ParseException generateParseException()
public final void enable_tracing()
public final void disable_tracing()