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: 6653 $
- Author:
- Philippe Le Hegaret
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.w3c.css.sac.ConditionFactoryprotected org.w3c.css.sac.DocumentHandlerprotected org.w3c.css.sac.ErrorHandlerbooleanprotected Stringprotected org.w3c.css.sac.SelectorFactoryprotected org.w3c.css.sac.InputSource(package private) static StringBufferFields 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
ConstructorsConstructorDescriptionParser()Creates a new ParserParser(CharStream stream)Parser(ParserTokenManager tm) -
Method Summary
Modifier and TypeMethodDescriptionorg.w3c.css.sac.Condition_class(org.w3c.css.sac.Condition pred)voidvoidvoidvoidThe following functions are useful for a DOM CSS implementation only and are not part of the general CSS2 parser.org.w3c.css.sac.SelectorListvoidvoidorg.w3c.css.sac.Conditionattrib(org.w3c.css.sac.Condition pred)voidcharset()char(package private) StringconvertIdent(String s)(package private) StringconvertString(String s)(package private) StringconvertStringIndex(String s, int start, int len)voidvoidorg.w3c.css.sac.SimpleSelectorvoidorg.w3c.css.sac.LexicalUnitexpr()voidfontFace()function(char operator, LexicalUnitImpl prev)Handle all CSS2 functions.This methods returns "http://www.w3.org/TR/REC-CSS2".getToken(int index)org.w3c.css.sac.Conditionhash(org.w3c.css.sac.Condition pred)hexcolor(LexicalUnitImpl prev)voidvoidThe import statementvoidmedia()voidmedium()voidThe namespace statement(package private) floatoperator(LexicalUnitImpl prev)voidpage()voidparseImportRule(org.w3c.css.sac.InputSource source)Parse methods used by DOM Level 2 implementation.voidparseMediaRule(org.w3c.css.sac.InputSource source)parseNamespaceToken(org.w3c.css.sac.InputSource source)booleanparsePriority(org.w3c.css.sac.InputSource source)org.w3c.css.sac.LexicalUnitparsePropertyValue(org.w3c.css.sac.InputSource source)voidparseRule(org.w3c.css.sac.InputSource source)This method parses only one rule (style rule or at-rule, except @charset).voidThe main entry for the parser.org.w3c.css.sac.SelectorListparseSelectors(org.w3c.css.sac.InputSource source)voidparseStyleDeclaration(org.w3c.css.sac.InputSource source)This method parses a style declaration (including the surrounding curly braces).voidparseStyleSheet(String systemId)Convenient method for URIs.voidparseStyleSheet(org.w3c.css.sac.InputSource source)Main parse methodsbooleanprio()property()org.w3c.css.sac.Conditionpseudo(org.w3c.css.sac.Condition pred)voidReInit(CharStream stream)voidReInit(ParserTokenManager tm)(package private) voidrejectToken(Token t)org.w3c.css.sac.Selectorselector()org.w3c.css.sac.SelectorListvoidsetConditionFactory(org.w3c.css.sac.ConditionFactory conditionFactory)voidsetDocumentHandler(org.w3c.css.sac.DocumentHandler handler)Set the document handler for this parservoidsetErrorHandler(org.w3c.css.sac.ErrorHandler error)Set the error handler for this parservoidvoidsetSelectorFactory(org.w3c.css.sac.SelectorFactory selectorFactory)org.w3c.css.sac.Selectorsimple_selector(org.w3c.css.sac.Selector selector, char comb)(package private) String(package private) String(package private) String(package private) Stringvoidvoidterm(LexicalUnitImpl prev)charunicode(LexicalUnitImpl prev)url(LexicalUnitImpl prev)
-
Field Details
-
SPACE
-
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:
setLocalein 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:
setDocumentHandlerin interfaceorg.w3c.css.sac.Parser
-
setSelectorFactory
public void setSelectorFactory(org.w3c.css.sac.SelectorFactory selectorFactory)- Specified by:
setSelectorFactoryin interfaceorg.w3c.css.sac.Parser
-
setConditionFactory
public void setConditionFactory(org.w3c.css.sac.ConditionFactory conditionFactory)- Specified by:
setConditionFactoryin interfaceorg.w3c.css.sac.Parser
-
setErrorHandler
public void setErrorHandler(org.w3c.css.sac.ErrorHandler error)Set the error handler for this parser- Specified by:
setErrorHandlerin interfaceorg.w3c.css.sac.Parser
-
parseStyleSheet
public void parseStyleSheet(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOExceptionMain parse methods- Specified by:
parseStyleSheetin 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:
parseStyleSheetin 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, IOExceptionThis method parses only one rule (style rule or at-rule, except @charset).- Specified by:
parseRulein 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, IOExceptionThis method parses a style declaration (including the surrounding curly braces).- Specified by:
parseStyleDeclarationin 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:
getParserVersionin 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, IOExceptionParse methods used by DOM Level 2 implementation.- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parseMediaRule
public void parseMediaRule(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parseSelectors
public org.w3c.css.sac.SelectorList parseSelectors(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException- Specified by:
parseSelectorsin interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parseNamespaceToken
public String parseNamespaceToken(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parsePropertyValue
public org.w3c.css.sac.LexicalUnit parsePropertyValue(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException- Specified by:
parsePropertyValuein interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
parsePriority
public boolean parsePriority(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, IOException- Specified by:
parsePriorityin interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionIOException
-
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
public final org.w3c.css.sac.Condition _class(org.w3c.css.sac.Condition pred) throws ParseException- Throws:
ParseException- exception during the parse
-
element_name
- Throws:
ParseException- exception during the parse
-
attrib
public final org.w3c.css.sac.Condition attrib(org.w3c.css.sac.Condition pred) throws ParseException- Throws:
ParseException- exception during the parse
-
pseudo
public final org.w3c.css.sac.Condition pseudo(org.w3c.css.sac.Condition pred) throws ParseException- 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
- Throws:
ParseException- exception during the parse
-
expr
- Throws:
ParseException- exception during the parse
-
unaryOperator
- Throws:
ParseException- exception during the parse
-
term
- Throws:
ParseException- exception during the parse
-
function
Handle all CSS2 functions.- Throws:
ParseException- exception during the parse
-
unicode
- Throws:
ParseException
-
url
- Throws:
ParseException
-
hexcolor
- Throws:
ParseException- exception during the parse
-
number
- Throws:
ParseException
-
skipStatementNoSemicolon
- Throws:
ParseException
-
skipStatement
- Throws:
ParseException
-
skip_to_matching_brace
- Throws:
ParseException
-
convertStringIndex
- Throws:
ParseException
-
convertIdent
- Throws:
ParseException
-
convertString
- Throws:
ParseException
-
rejectToken
- Throws:
ParseException
-
skipAfterExpression
- Throws:
ParseException
-
_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()
-