Package org.w3c.flute.parser
Class Parser
java.lang.Object
org.w3c.flute.parser.Parser
- All Implemented Interfaces:
org.w3c.css.sac.Parser
,ParserConstants
A CSS2 parser
- Version:
- $Revision$
- Author:
- Philippe Le Hegaret
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.w3c.css.sac.ConditionFactory
protected org.w3c.css.sac.DocumentHandler
protected org.w3c.css.sac.ErrorHandler
boolean
protected String
protected org.w3c.css.sac.SelectorFactory
protected org.w3c.css.sac.InputSource
Fields inherited from interface org.w3c.flute.parser.ParserConstants
_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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal org.w3c.css.sac.Condition
_class
(org.w3c.css.sac.Condition pred) final void
final void
final void
final String
final void
The following functions are useful for a DOM CSS implementation only and are not part of the general CSS2 parser.final org.w3c.css.sac.SelectorList
final void
final void
final org.w3c.css.sac.Condition
attrib
(org.w3c.css.sac.Condition pred) final void
charset()
final char
final void
final void
final org.w3c.css.sac.SimpleSelector
final void
final org.w3c.css.sac.LexicalUnit
expr()
final void
fontFace()
final org.w3c.flute.parser.LexicalUnitImpl
function
(char operator, org.w3c.flute.parser.LexicalUnitImpl prev) Handle all CSS2 functions.final Token
This methods returns "http://www.w3.org/TR/REC-CSS2".final Token
getToken
(int index) final org.w3c.css.sac.Condition
hash
(org.w3c.css.sac.Condition pred) final org.w3c.flute.parser.LexicalUnitImpl
hexcolor
(org.w3c.flute.parser.LexicalUnitImpl prev) final void
final void
The import statementfinal void
media()
final void
final String
medium()
final void
The namespace statementfinal org.w3c.flute.parser.LexicalUnitImpl
operator
(org.w3c.flute.parser.LexicalUnitImpl prev) final 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) 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).final void
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
(String systemId) Convenient method for URIs.void
parseStyleSheet
(org.w3c.css.sac.InputSource source) Main parse methodsfinal boolean
prio()
final String
property()
final org.w3c.css.sac.Condition
pseudo
(org.w3c.css.sac.Condition pred) final String
void
ReInit
(CharStream stream) void
final org.w3c.css.sac.Selector
selector()
final org.w3c.css.sac.SelectorList
void
setConditionFactory
(org.w3c.css.sac.ConditionFactory conditionFactory) void
setDocumentHandler
(org.w3c.css.sac.DocumentHandler handler) Set the document handler for this parservoid
setErrorHandler
(org.w3c.css.sac.ErrorHandler error) Set the error handler for this parservoid
void
setSelectorFactory
(org.w3c.css.sac.SelectorFactory selectorFactory) final org.w3c.css.sac.Selector
simple_selector
(org.w3c.css.sac.Selector selector, char comb) final void
final void
final org.w3c.flute.parser.LexicalUnitImpl
term
(org.w3c.flute.parser.LexicalUnitImpl prev) final char
final org.w3c.flute.parser.LexicalUnitImpl
unicode
(org.w3c.flute.parser.LexicalUnitImpl prev) final org.w3c.flute.parser.LexicalUnitImpl
url
(org.w3c.flute.parser.LexicalUnitImpl prev)
-
Field Details
-
documentHandler
protected org.w3c.css.sac.DocumentHandler documentHandler -
errorHandler
protected org.w3c.css.sac.ErrorHandler errorHandler -
source
protected org.w3c.css.sac.InputSource source -
conditionFactory
protected org.w3c.css.sac.ConditionFactory conditionFactory -
selectorFactory
protected org.w3c.css.sac.SelectorFactory selectorFactory -
pseudoElt
-
token_source
-
token
-
jj_nt
-
lookingAhead
public boolean lookingAhead
-
-
Constructor Details
-
Parser
public Parser()Creates a new Parser -
Parser
-
Parser
-
-
Method Details
-
setLocale
- Specified by:
setLocale
in interfaceorg.w3c.css.sac.Parser
- Throws:
org.w3c.css.sac.CSSException
- Not yet implemented
-
setDocumentHandler
public void setDocumentHandler(org.w3c.css.sac.DocumentHandler handler) Set the document handler for this parser- Specified by:
setDocumentHandler
in interfaceorg.w3c.css.sac.Parser
-
setSelectorFactory
public void setSelectorFactory(org.w3c.css.sac.SelectorFactory selectorFactory) - Specified by:
setSelectorFactory
in interfaceorg.w3c.css.sac.Parser
-
setConditionFactory
public void setConditionFactory(org.w3c.css.sac.ConditionFactory conditionFactory) - Specified by:
setConditionFactory
in interfaceorg.w3c.css.sac.Parser
-
setErrorHandler
public void setErrorHandler(org.w3c.css.sac.ErrorHandler error) Set the error handler for this parser- Specified by:
setErrorHandler
in interfaceorg.w3c.css.sac.Parser
-
parseStyleSheet
public void parseStyleSheet(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException Main parse methods- Specified by:
parseStyleSheet
in interfaceorg.w3c.css.sac.Parser
- Parameters:
source
- the source of the style sheet.- Throws:
IOException
- the source can't be parsed.org.w3c.css.sac.CSSException
- the source is not CSS valid.
-
parseStyleSheet
Convenient method for URIs.- Specified by:
parseStyleSheet
in interfaceorg.w3c.css.sac.Parser
- Parameters:
systemId
- the fully resolved URI of the style sheet.- Throws:
IOException
- the source can't be parsed.org.w3c.css.sac.CSSException
- the source is not CSS valid.
-
parseRule
public void parseRule(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException This method parses only one rule (style rule or at-rule, except @charset).- Specified by:
parseRule
in interfaceorg.w3c.css.sac.Parser
- Parameters:
source
- the source of the rule.- Throws:
IOException
- the source can't be parsed.org.w3c.css.sac.CSSException
- the source is not CSS valid.
-
parseStyleDeclaration
public void parseStyleDeclaration(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException This method parses a style declaration (including the surrounding curly braces).- Specified by:
parseStyleDeclaration
in interfaceorg.w3c.css.sac.Parser
- Parameters:
source
- the source of the style declaration.- Throws:
IOException
- the source can't be parsed.org.w3c.css.sac.CSSException
- the source is not CSS valid.
-
getParserVersion
This methods returns "http://www.w3.org/TR/REC-CSS2".- Specified by:
getParserVersion
in interfaceorg.w3c.css.sac.Parser
- Returns:
- the string "http://www.w3.org/TR/REC-CSS2".
-
parseImportRule
public void parseImportRule(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException Parse methods used by DOM Level 2 implementation.- Throws:
org.w3c.css.sac.CSSException
IOException
-
parseMediaRule
public void parseMediaRule(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException - Throws:
org.w3c.css.sac.CSSException
IOException
-
parseSelectors
public org.w3c.css.sac.SelectorList parseSelectors(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException - Specified by:
parseSelectors
in interfaceorg.w3c.css.sac.Parser
- Throws:
org.w3c.css.sac.CSSException
IOException
-
parseNamespaceToken
public String parseNamespaceToken(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException - Throws:
org.w3c.css.sac.CSSException
IOException
-
parsePropertyValue
public org.w3c.css.sac.LexicalUnit parsePropertyValue(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException - Specified by:
parsePropertyValue
in interfaceorg.w3c.css.sac.Parser
- Throws:
org.w3c.css.sac.CSSException
IOException
-
parsePriority
public boolean parsePriority(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException - Specified by:
parsePriority
in interfaceorg.w3c.css.sac.Parser
- Throws:
org.w3c.css.sac.CSSException
IOException
-
parserUnit
The main entry for the parser.- Throws:
ParseException
- exception during the parse
-
charset
- Throws:
ParseException
-
afterImportDeclaration
- Throws:
ParseException
-
ignoreStatement
- Throws:
ParseException
-
importDeclaration
The import statement- Throws:
ParseException
- exception during the parse
-
namespaceDeclaration
The namespace statement- Throws:
ParseException
- exception during the parse
-
media
- Throws:
ParseException
- exception during the parse
-
mediaStatement
- Throws:
ParseException
-
medium
- Throws:
ParseException
- exception during the parse
-
page
- Throws:
ParseException
- exception during the parse
-
pseudo_page
- Throws:
ParseException
-
fontFace
- Throws:
ParseException
-
atRuleDeclaration
- Throws:
ParseException
- exception during the parse
-
skipUnknownRule
- Throws:
ParseException
-
combinator
- Throws:
ParseException
- exception during the parse
-
property
- Throws:
ParseException
- exception during the parse
-
styleRule
- Throws:
ParseException
- exception during the parse
-
selectorList
- Throws:
ParseException
-
selector
- Throws:
ParseException
- exception during the parse
-
simple_selector
public final org.w3c.css.sac.Selector simple_selector(org.w3c.css.sac.Selector selector, char comb) throws ParseException - Throws:
ParseException
- exception during the parse
-
_class
- Throws:
ParseException
- exception during the parse
-
element_name
- Throws:
ParseException
- exception during the parse
-
attrib
- Throws:
ParseException
- exception during the parse
-
pseudo
- Throws:
ParseException
- exception during the parse
-
hash
- Throws:
ParseException
- exception during the parse
-
declaration
- Throws:
ParseException
- exception during the parse
-
prio
- Throws:
ParseException
- exception during the parse
-
operator
public final org.w3c.flute.parser.LexicalUnitImpl operator(org.w3c.flute.parser.LexicalUnitImpl prev) throws ParseException - Throws:
ParseException
- exception during the parse
-
expr
- Throws:
ParseException
- exception during the parse
-
unaryOperator
- Throws:
ParseException
- exception during the parse
-
term
public final org.w3c.flute.parser.LexicalUnitImpl term(org.w3c.flute.parser.LexicalUnitImpl prev) throws ParseException - Throws:
ParseException
- exception during the parse
-
function
public final org.w3c.flute.parser.LexicalUnitImpl function(char operator, org.w3c.flute.parser.LexicalUnitImpl prev) throws ParseException Handle all CSS2 functions.- Throws:
ParseException
- exception during the parse
-
unicode
public final org.w3c.flute.parser.LexicalUnitImpl unicode(org.w3c.flute.parser.LexicalUnitImpl prev) throws ParseException - Throws:
ParseException
-
url
public final org.w3c.flute.parser.LexicalUnitImpl url(org.w3c.flute.parser.LexicalUnitImpl prev) throws ParseException - Throws:
ParseException
-
hexcolor
public final org.w3c.flute.parser.LexicalUnitImpl hexcolor(org.w3c.flute.parser.LexicalUnitImpl prev) throws ParseException - Throws:
ParseException
- exception during the parse
-
_parseRule
The following functions are useful for a DOM CSS implementation only and are not part of the general CSS2 parser.- Throws:
ParseException
-
_parseImportRule
- Throws:
ParseException
-
_parseMediaRule
- Throws:
ParseException
-
_parseDeclarationBlock
- Throws:
ParseException
-
_parseSelectors
- Throws:
ParseException
-
_parseNamespaceToken
- Throws:
ParseException
-
ReInit
-
ReInit
-
getNextToken
-
getToken
-
generateParseException
-
enable_tracing
public final void enable_tracing() -
disable_tracing
public final void disable_tracing()
-