public class Parser extends java.lang.Object implements org.w3c.css.sac.Parser, ParserConstants
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
Parser.JJCalls |
| Modifier and Type | Field and Description |
|---|---|
protected org.w3c.css.sac.ConditionFactory |
conditionFactory |
protected org.w3c.css.sac.DocumentHandler |
documentHandler |
protected org.w3c.css.sac.ErrorHandler |
errorHandler |
Token |
jj_nt |
boolean |
lookingAhead |
protected java.lang.String |
pseudoElt |
protected org.w3c.css.sac.SelectorFactory |
selectorFactory |
protected org.w3c.css.sac.InputSource |
source |
(package private) static java.lang.StringBuffer |
SPACE |
Token |
token |
ParserTokenManager |
token_source |
_URL, ANY, ATKEYWORD, CDC, CDO, CHARSET_SYM, CM, COLON, COMMA, D, DASHMATCH, DEFAULT, DEG, DIMEN, DIV, DOT, EMS, EOF, EQ, ESCAPE, EXS, FONT_FACE_SYM, FUNCTION, GRAD, H, HASH, HZ, IDENT, IMPORT_SYM, IMPORTANT_SYM, IN, IN_COMMENT, INCLUDES, KHZ, LBRACE, LBRACKET, LPARAN, MEDIA_SYM, MINUS, MM, MS, NAME, NAMESPACE_IDENT, NAMESPACE_SYM, NMCHAR, NMSTART, NNAME, NONASCII, NUMBER, PAGE_SYM, PC, PERCENTAGE, PLUS, PRECEDES, PT, PX, RAD, RANGE, RANGE0, RANGE1, RANGE2, RANGE3, RANGE4, RANGE5, RANGE6, RBRACE, RBRACKET, RPARAN, S, SECOND, SEMICOLON, STRING, STRINGCHAR, tokenImage, UNI, UNICODE, UNICODERANGE, UNKNOWN, URL| Constructor and Description |
|---|
Parser()
Creates a new Parser
|
Parser(CharStream stream) |
Parser(ParserTokenManager tm) |
| Modifier and Type | Method and Description |
|---|---|
org.w3c.css.sac.Condition |
_class(org.w3c.css.sac.Condition pred) |
void |
_parseDeclarationBlock() |
void |
_parseImportRule() |
void |
_parseMediaRule() |
java.lang.String |
_parseNamespaceToken() |
void |
_parseRule()
The following functions are useful for a DOM CSS implementation only and are
not part of the general CSS2 parser.
|
org.w3c.css.sac.SelectorList |
_parseSelectors() |
void |
afterImportDeclaration() |
void |
atRuleDeclaration() |
org.w3c.css.sac.Condition |
attrib(org.w3c.css.sac.Condition pred) |
void |
charset() |
char |
combinator() |
(package private) java.lang.String |
convertIdent(java.lang.String s) |
(package private) java.lang.String |
convertString(java.lang.String s) |
(package private) java.lang.String |
convertStringIndex(java.lang.String s,
int start,
int len) |
void |
declaration() |
void |
disable_tracing() |
org.w3c.css.sac.SimpleSelector |
element_name() |
void |
enable_tracing() |
org.w3c.css.sac.LexicalUnit |
expr() |
void |
fontFace() |
LexicalUnitImpl |
function(char operator,
LexicalUnitImpl prev)
Handle all CSS2 functions.
|
ParseException |
generateParseException() |
Token |
getNextToken() |
java.lang.String |
getParserVersion()
This methods returns "http://www.w3.org/TR/REC-CSS2".
|
Token |
getToken(int index) |
org.w3c.css.sac.Condition |
hash(org.w3c.css.sac.Condition pred) |
LexicalUnitImpl |
hexcolor(LexicalUnitImpl prev) |
void |
ignoreStatement() |
void |
importDeclaration()
The import statement
|
void |
media() |
void |
mediaStatement(MediaListImpl ml) |
java.lang.String |
medium() |
void |
namespaceDeclaration()
The namespace statement
|
(package private) float |
number(char operator,
Token n,
int lengthUnit) |
LexicalUnitImpl |
operator(LexicalUnitImpl prev) |
void |
page() |
void |
parseImportRule(org.w3c.css.sac.InputSource source)
Parse methods used by DOM Level 2 implementation.
|
void |
parseMediaRule(org.w3c.css.sac.InputSource source) |
java.lang.String |
parseNamespaceToken(org.w3c.css.sac.InputSource source) |
boolean |
parsePriority(org.w3c.css.sac.InputSource source) |
org.w3c.css.sac.LexicalUnit |
parsePropertyValue(org.w3c.css.sac.InputSource source) |
void |
parseRule(org.w3c.css.sac.InputSource source)
This method parses only one rule (style rule or at-rule, except @charset).
|
void |
parserUnit()
The main entry for the parser.
|
org.w3c.css.sac.SelectorList |
parseSelectors(org.w3c.css.sac.InputSource source) |
void |
parseStyleDeclaration(org.w3c.css.sac.InputSource source)
This method parses a style declaration (including the surrounding curly
braces).
|
void |
parseStyleSheet(org.w3c.css.sac.InputSource source)
Main parse methods
|
void |
parseStyleSheet(java.lang.String systemId)
Convenient method for URIs.
|
boolean |
prio() |
java.lang.String |
property() |
java.lang.String |
pseudo_page() |
org.w3c.css.sac.Condition |
pseudo(org.w3c.css.sac.Condition pred) |
void |
ReInit(CharStream stream) |
void |
ReInit(ParserTokenManager tm) |
(package private) void |
rejectToken(Token t) |
org.w3c.css.sac.Selector |
selector() |
org.w3c.css.sac.SelectorList |
selectorList() |
void |
setConditionFactory(org.w3c.css.sac.ConditionFactory conditionFactory) |
void |
setDocumentHandler(org.w3c.css.sac.DocumentHandler handler)
Set the document handler for this parser
|
void |
setErrorHandler(org.w3c.css.sac.ErrorHandler error)
Set the error handler for this parser
|
void |
setLocale(java.util.Locale locale) |
void |
setSelectorFactory(org.w3c.css.sac.SelectorFactory selectorFactory) |
org.w3c.css.sac.Selector |
simple_selector(org.w3c.css.sac.Selector selector,
char comb) |
(package private) java.lang.String |
skip_to_matching_brace() |
(package private) java.lang.String |
skipAfterExpression() |
(package private) java.lang.String |
skipStatement() |
(package private) java.lang.String |
skipStatementNoSemicolon() |
void |
skipUnknownRule() |
void |
styleRule() |
LexicalUnitImpl |
term(LexicalUnitImpl prev) |
char |
unaryOperator() |
LexicalUnitImpl |
unicode(LexicalUnitImpl prev) |
LexicalUnitImpl |
url(LexicalUnitImpl prev) |
static final java.lang.StringBuffer SPACE
protected org.w3c.css.sac.DocumentHandler documentHandler
protected org.w3c.css.sac.ErrorHandler errorHandler
protected org.w3c.css.sac.InputSource source
protected org.w3c.css.sac.ConditionFactory conditionFactory
protected org.w3c.css.sac.SelectorFactory selectorFactory
protected java.lang.String pseudoElt
public ParserTokenManager token_source
public Token token
public Token jj_nt
public boolean lookingAhead
public Parser()
public Parser(CharStream stream)
public Parser(ParserTokenManager tm)
public void setLocale(java.util.Locale locale)
throws org.w3c.css.sac.CSSException
setLocale in interface org.w3c.css.sac.Parserorg.w3c.css.sac.CSSException - Not yet implementedpublic void setDocumentHandler(org.w3c.css.sac.DocumentHandler handler)
setDocumentHandler in interface org.w3c.css.sac.Parserpublic void setSelectorFactory(org.w3c.css.sac.SelectorFactory selectorFactory)
setSelectorFactory in interface org.w3c.css.sac.Parserpublic void setConditionFactory(org.w3c.css.sac.ConditionFactory conditionFactory)
setConditionFactory in interface org.w3c.css.sac.Parserpublic void setErrorHandler(org.w3c.css.sac.ErrorHandler error)
setErrorHandler in interface org.w3c.css.sac.Parserpublic void parseStyleSheet(org.w3c.css.sac.InputSource source)
throws org.w3c.css.sac.CSSException,
java.io.IOException
parseStyleSheet in interface org.w3c.css.sac.Parsersource - the source of the style sheet.java.io.IOException - the source can't be parsed.org.w3c.css.sac.CSSException - the source is not CSS valid.public void parseStyleSheet(java.lang.String systemId)
throws org.w3c.css.sac.CSSException,
java.io.IOException
parseStyleSheet in interface org.w3c.css.sac.ParsersystemId - the fully resolved URI of the style sheet.java.io.IOException - the source can't be parsed.org.w3c.css.sac.CSSException - the source is not CSS valid.public void parseRule(org.w3c.css.sac.InputSource source)
throws org.w3c.css.sac.CSSException,
java.io.IOException
parseRule in interface org.w3c.css.sac.Parsersource - the source of the rule.java.io.IOException - the source can't be parsed.org.w3c.css.sac.CSSException - the source is not CSS valid.public void parseStyleDeclaration(org.w3c.css.sac.InputSource source)
throws org.w3c.css.sac.CSSException,
java.io.IOException
parseStyleDeclaration in interface org.w3c.css.sac.Parsersource - the source of the style declaration.java.io.IOException - the source can't be parsed.org.w3c.css.sac.CSSException - the source is not CSS valid.public java.lang.String getParserVersion()
getParserVersion in interface org.w3c.css.sac.Parserpublic void parseImportRule(org.w3c.css.sac.InputSource source)
throws org.w3c.css.sac.CSSException,
java.io.IOException
org.w3c.css.sac.CSSExceptionjava.io.IOExceptionpublic void parseMediaRule(org.w3c.css.sac.InputSource source)
throws org.w3c.css.sac.CSSException,
java.io.IOException
org.w3c.css.sac.CSSExceptionjava.io.IOExceptionpublic org.w3c.css.sac.SelectorList parseSelectors(org.w3c.css.sac.InputSource source)
throws org.w3c.css.sac.CSSException,
java.io.IOException
parseSelectors in interface org.w3c.css.sac.Parserorg.w3c.css.sac.CSSExceptionjava.io.IOExceptionpublic java.lang.String parseNamespaceToken(org.w3c.css.sac.InputSource source)
throws org.w3c.css.sac.CSSException,
java.io.IOException
org.w3c.css.sac.CSSExceptionjava.io.IOExceptionpublic org.w3c.css.sac.LexicalUnit parsePropertyValue(org.w3c.css.sac.InputSource source)
throws org.w3c.css.sac.CSSException,
java.io.IOException
parsePropertyValue in interface org.w3c.css.sac.Parserorg.w3c.css.sac.CSSExceptionjava.io.IOExceptionpublic boolean parsePriority(org.w3c.css.sac.InputSource source)
throws org.w3c.css.sac.CSSException,
java.io.IOException
parsePriority in interface org.w3c.css.sac.Parserorg.w3c.css.sac.CSSExceptionjava.io.IOExceptionpublic final void parserUnit()
throws ParseException
ParseException - exception during the parsepublic final void charset()
throws ParseException
ParseExceptionpublic final void afterImportDeclaration()
throws ParseException
ParseExceptionpublic final void ignoreStatement()
throws ParseException
ParseExceptionpublic final void importDeclaration()
throws ParseException
ParseException - exception during the parsepublic final void namespaceDeclaration()
throws ParseException
ParseException - exception during the parsepublic final void media()
throws ParseException
ParseException - exception during the parsepublic final void mediaStatement(MediaListImpl ml) throws ParseException
ParseExceptionpublic final java.lang.String medium()
throws ParseException
ParseException - exception during the parsepublic final void page()
throws ParseException
ParseException - exception during the parsepublic final java.lang.String pseudo_page()
throws ParseException
ParseExceptionpublic final void fontFace()
throws ParseException
ParseExceptionpublic final void atRuleDeclaration()
throws ParseException
ParseException - exception during the parsepublic final void skipUnknownRule()
throws ParseException
ParseExceptionpublic final char combinator()
throws ParseException
ParseException - exception during the parsepublic final java.lang.String property()
throws ParseException
ParseException - exception during the parsepublic final void styleRule()
throws ParseException
ParseException - exception during the parsepublic final org.w3c.css.sac.SelectorList selectorList()
throws ParseException
ParseExceptionpublic final org.w3c.css.sac.Selector selector()
throws ParseException
ParseException - exception during the parsepublic final org.w3c.css.sac.Selector simple_selector(org.w3c.css.sac.Selector selector,
char comb)
throws ParseException
ParseException - exception during the parsepublic final org.w3c.css.sac.Condition _class(org.w3c.css.sac.Condition pred)
throws ParseException
ParseException - exception during the parsepublic final org.w3c.css.sac.SimpleSelector element_name()
throws ParseException
ParseException - exception during the parsepublic final org.w3c.css.sac.Condition attrib(org.w3c.css.sac.Condition pred)
throws ParseException
ParseException - exception during the parsepublic final org.w3c.css.sac.Condition pseudo(org.w3c.css.sac.Condition pred)
throws ParseException
ParseException - exception during the parsepublic final org.w3c.css.sac.Condition hash(org.w3c.css.sac.Condition pred)
throws ParseException
ParseException - exception during the parsepublic final void declaration()
throws ParseException
ParseException - exception during the parsepublic final boolean prio()
throws ParseException
ParseException - exception during the parsepublic final LexicalUnitImpl operator(LexicalUnitImpl prev) throws ParseException
ParseException - exception during the parsepublic final org.w3c.css.sac.LexicalUnit expr()
throws ParseException
ParseException - exception during the parsepublic final char unaryOperator()
throws ParseException
ParseException - exception during the parsepublic final LexicalUnitImpl term(LexicalUnitImpl prev) throws ParseException
ParseException - exception during the parsepublic final LexicalUnitImpl function(char operator, LexicalUnitImpl prev) throws ParseException
ParseException - exception during the parsepublic final LexicalUnitImpl unicode(LexicalUnitImpl prev) throws ParseException
ParseExceptionpublic final LexicalUnitImpl url(LexicalUnitImpl prev) throws ParseException
ParseExceptionpublic final LexicalUnitImpl hexcolor(LexicalUnitImpl prev) throws ParseException
ParseException - exception during the parsefloat number(char operator,
Token n,
int lengthUnit)
throws ParseException
ParseExceptionjava.lang.String skipStatementNoSemicolon()
throws ParseException
ParseExceptionjava.lang.String skipStatement()
throws ParseException
ParseExceptionjava.lang.String skip_to_matching_brace()
throws ParseException
ParseExceptionjava.lang.String convertStringIndex(java.lang.String s,
int start,
int len)
throws ParseException
ParseExceptionjava.lang.String convertIdent(java.lang.String s)
throws ParseException
ParseExceptionjava.lang.String convertString(java.lang.String s)
throws ParseException
ParseExceptionvoid rejectToken(Token t) throws ParseException
ParseExceptionjava.lang.String skipAfterExpression()
throws ParseException
ParseExceptionpublic final void _parseRule()
throws ParseException
ParseExceptionpublic final void _parseImportRule()
throws ParseException
ParseExceptionpublic final void _parseMediaRule()
throws ParseException
ParseExceptionpublic final void _parseDeclarationBlock()
throws ParseException
ParseExceptionpublic final org.w3c.css.sac.SelectorList _parseSelectors()
throws ParseException
ParseExceptionpublic final java.lang.String _parseNamespaceToken()
throws ParseException
ParseExceptionpublic void ReInit(CharStream stream)
public void ReInit(ParserTokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public ParseException generateParseException()
public final void enable_tracing()
public final void disable_tracing()