Package org.w3c.flute.parser
Class Parser
- java.lang.Object
-
- org.w3c.flute.parser.Parser
-
- All Implemented Interfaces:
org.w3c.css.sac.Parser,ParserConstants
public class Parser extends java.lang.Object implements org.w3c.css.sac.Parser, ParserConstants
A CSS2 parser- Version:
- $Revision: 6653 $
- Author:
- Philippe Le Hegaret
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classParser.JJCalls
-
Field Summary
Fields Modifier and Type Field Description protected org.w3c.css.sac.ConditionFactoryconditionFactoryprotected org.w3c.css.sac.DocumentHandlerdocumentHandlerprotected org.w3c.css.sac.ErrorHandlererrorHandlerTokenjj_ntbooleanlookingAheadprotected java.lang.StringpseudoEltprotected org.w3c.css.sac.SelectorFactoryselectorFactoryprotected org.w3c.css.sac.InputSourcesource(package private) static java.lang.StringBufferSPACETokentokenParserTokenManagertoken_source-
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
Constructors Constructor Description Parser()Creates a new ParserParser(CharStream stream)Parser(ParserTokenManager tm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()voidafterImportDeclaration()voidatRuleDeclaration()org.w3c.css.sac.Conditionattrib(org.w3c.css.sac.Condition pred)voidcharset()charcombinator()(package private) java.lang.StringconvertIdent(java.lang.String s)(package private) java.lang.StringconvertString(java.lang.String s)(package private) java.lang.StringconvertStringIndex(java.lang.String s, int start, int len)voiddeclaration()voiddisable_tracing()org.w3c.css.sac.SimpleSelectorelement_name()voidenable_tracing()org.w3c.css.sac.LexicalUnitexpr()voidfontFace()LexicalUnitImplfunction(char operator, LexicalUnitImpl prev)Handle all CSS2 functions.ParseExceptiongenerateParseException()TokengetNextToken()java.lang.StringgetParserVersion()This methods returns "http://www.w3.org/TR/REC-CSS2".TokengetToken(int index)org.w3c.css.sac.Conditionhash(org.w3c.css.sac.Condition pred)LexicalUnitImplhexcolor(LexicalUnitImpl prev)voidignoreStatement()voidimportDeclaration()The import statementvoidmedia()voidmediaStatement(MediaListImpl ml)java.lang.Stringmedium()voidnamespaceDeclaration()The namespace statement(package private) floatnumber(char operator, Token n, int lengthUnit)LexicalUnitImploperator(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)java.lang.StringparseNamespaceToken(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).voidparserUnit()The 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(java.lang.String systemId)Convenient method for URIs.voidparseStyleSheet(org.w3c.css.sac.InputSource source)Main parse methodsbooleanprio()java.lang.Stringproperty()org.w3c.css.sac.Conditionpseudo(org.w3c.css.sac.Condition pred)java.lang.Stringpseudo_page()voidReInit(CharStream stream)voidReInit(ParserTokenManager tm)(package private) voidrejectToken(Token t)org.w3c.css.sac.Selectorselector()org.w3c.css.sac.SelectorListselectorList()voidsetConditionFactory(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 parservoidsetLocale(java.util.Locale locale)voidsetSelectorFactory(org.w3c.css.sac.SelectorFactory selectorFactory)org.w3c.css.sac.Selectorsimple_selector(org.w3c.css.sac.Selector selector, char comb)(package private) java.lang.Stringskip_to_matching_brace()(package private) java.lang.StringskipAfterExpression()(package private) java.lang.StringskipStatement()(package private) java.lang.StringskipStatementNoSemicolon()voidskipUnknownRule()voidstyleRule()LexicalUnitImplterm(LexicalUnitImpl prev)charunaryOperator()LexicalUnitImplunicode(LexicalUnitImpl prev)LexicalUnitImplurl(LexicalUnitImpl prev)
-
-
-
Field Detail
-
SPACE
static final java.lang.StringBuffer 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
protected java.lang.String pseudoElt
-
token_source
public ParserTokenManager token_source
-
token
public Token token
-
jj_nt
public Token jj_nt
-
lookingAhead
public boolean lookingAhead
-
-
Constructor Detail
-
Parser
public Parser()
Creates a new Parser
-
Parser
public Parser(CharStream stream)
-
Parser
public Parser(ParserTokenManager tm)
-
-
Method Detail
-
setLocale
public void setLocale(java.util.Locale locale) throws org.w3c.css.sac.CSSException- 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, java.io.IOExceptionMain parse methods- Specified by:
parseStyleSheetin interfaceorg.w3c.css.sac.Parser- Parameters:
source- the source of the style sheet.- Throws:
java.io.IOException- the source can't be parsed.org.w3c.css.sac.CSSException- the source is not CSS valid.
-
parseStyleSheet
public void parseStyleSheet(java.lang.String systemId) throws org.w3c.css.sac.CSSException, java.io.IOExceptionConvenient method for URIs.- Specified by:
parseStyleSheetin interfaceorg.w3c.css.sac.Parser- Parameters:
systemId- the fully resolved URI of the style sheet.- Throws:
java.io.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, java.io.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:
java.io.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, java.io.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:
java.io.IOException- the source can't be parsed.org.w3c.css.sac.CSSException- the source is not CSS valid.
-
getParserVersion
public java.lang.String 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, java.io.IOExceptionParse methods used by DOM Level 2 implementation.- Throws:
org.w3c.css.sac.CSSExceptionjava.io.IOException
-
parseMediaRule
public void parseMediaRule(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, java.io.IOException- Throws:
org.w3c.css.sac.CSSExceptionjava.io.IOException
-
parseSelectors
public org.w3c.css.sac.SelectorList parseSelectors(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, java.io.IOException- Specified by:
parseSelectorsin interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionjava.io.IOException
-
parseNamespaceToken
public java.lang.String parseNamespaceToken(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, java.io.IOException- Throws:
org.w3c.css.sac.CSSExceptionjava.io.IOException
-
parsePropertyValue
public org.w3c.css.sac.LexicalUnit parsePropertyValue(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, java.io.IOException- Specified by:
parsePropertyValuein interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionjava.io.IOException
-
parsePriority
public boolean parsePriority(org.w3c.css.sac.InputSource source) throws org.w3c.css.sac.CSSException, java.io.IOException- Specified by:
parsePriorityin interfaceorg.w3c.css.sac.Parser- Throws:
org.w3c.css.sac.CSSExceptionjava.io.IOException
-
parserUnit
public final void parserUnit() throws ParseExceptionThe main entry for the parser.- Throws:
ParseException- exception during the parse
-
charset
public final void charset() throws ParseException- Throws:
ParseException
-
afterImportDeclaration
public final void afterImportDeclaration() throws ParseException- Throws:
ParseException
-
ignoreStatement
public final void ignoreStatement() throws ParseException- Throws:
ParseException
-
importDeclaration
public final void importDeclaration() throws ParseExceptionThe import statement- Throws:
ParseException- exception during the parse
-
namespaceDeclaration
public final void namespaceDeclaration() throws ParseExceptionThe namespace statement- Throws:
ParseException- exception during the parse
-
media
public final void media() throws ParseException- Throws:
ParseException- exception during the parse
-
mediaStatement
public final void mediaStatement(MediaListImpl ml) throws ParseException
- Throws:
ParseException
-
medium
public final java.lang.String medium() throws ParseException- Throws:
ParseException- exception during the parse
-
page
public final void page() throws ParseException- Throws:
ParseException- exception during the parse
-
pseudo_page
public final java.lang.String pseudo_page() throws ParseException- Throws:
ParseException
-
fontFace
public final void fontFace() throws ParseException- Throws:
ParseException
-
atRuleDeclaration
public final void atRuleDeclaration() throws ParseException- Throws:
ParseException- exception during the parse
-
skipUnknownRule
public final void skipUnknownRule() throws ParseException- Throws:
ParseException
-
combinator
public final char combinator() throws ParseException- Throws:
ParseException- exception during the parse
-
property
public final java.lang.String property() throws ParseException- Throws:
ParseException- exception during the parse
-
styleRule
public final void styleRule() throws ParseException- Throws:
ParseException- exception during the parse
-
selectorList
public final org.w3c.css.sac.SelectorList selectorList() throws ParseException- Throws:
ParseException
-
selector
public final org.w3c.css.sac.Selector selector() throws ParseException- 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
public final org.w3c.css.sac.SimpleSelector element_name() throws ParseException- 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
public final org.w3c.css.sac.Condition hash(org.w3c.css.sac.Condition pred) throws ParseException- Throws:
ParseException- exception during the parse
-
declaration
public final void declaration() throws ParseException- Throws:
ParseException- exception during the parse
-
prio
public final boolean prio() throws ParseException- Throws:
ParseException- exception during the parse
-
operator
public final LexicalUnitImpl operator(LexicalUnitImpl prev) throws ParseException
- Throws:
ParseException- exception during the parse
-
expr
public final org.w3c.css.sac.LexicalUnit expr() throws ParseException- Throws:
ParseException- exception during the parse
-
unaryOperator
public final char unaryOperator() throws ParseException- Throws:
ParseException- exception during the parse
-
term
public final LexicalUnitImpl term(LexicalUnitImpl prev) throws ParseException
- Throws:
ParseException- exception during the parse
-
function
public final LexicalUnitImpl function(char operator, LexicalUnitImpl prev) throws ParseException
Handle all CSS2 functions.- Throws:
ParseException- exception during the parse
-
unicode
public final LexicalUnitImpl unicode(LexicalUnitImpl prev) throws ParseException
- Throws:
ParseException
-
url
public final LexicalUnitImpl url(LexicalUnitImpl prev) throws ParseException
- Throws:
ParseException
-
hexcolor
public final LexicalUnitImpl hexcolor(LexicalUnitImpl prev) throws ParseException
- Throws:
ParseException- exception during the parse
-
number
float number(char operator, Token n, int lengthUnit) throws ParseException- Throws:
ParseException
-
skipStatementNoSemicolon
java.lang.String skipStatementNoSemicolon() throws ParseException- Throws:
ParseException
-
skipStatement
java.lang.String skipStatement() throws ParseException- Throws:
ParseException
-
skip_to_matching_brace
java.lang.String skip_to_matching_brace() throws ParseException- Throws:
ParseException
-
convertStringIndex
java.lang.String convertStringIndex(java.lang.String s, int start, int len) throws ParseException- Throws:
ParseException
-
convertIdent
java.lang.String convertIdent(java.lang.String s) throws ParseException- Throws:
ParseException
-
convertString
java.lang.String convertString(java.lang.String s) throws ParseException- Throws:
ParseException
-
rejectToken
void rejectToken(Token t) throws ParseException
- Throws:
ParseException
-
skipAfterExpression
java.lang.String skipAfterExpression() throws ParseException- Throws:
ParseException
-
_parseRule
public final void _parseRule() throws ParseExceptionThe following functions are useful for a DOM CSS implementation only and are not part of the general CSS2 parser.- Throws:
ParseException
-
_parseImportRule
public final void _parseImportRule() throws ParseException- Throws:
ParseException
-
_parseMediaRule
public final void _parseMediaRule() throws ParseException- Throws:
ParseException
-
_parseDeclarationBlock
public final void _parseDeclarationBlock() throws ParseException- Throws:
ParseException
-
_parseSelectors
public final org.w3c.css.sac.SelectorList _parseSelectors() throws ParseException- Throws:
ParseException
-
_parseNamespaceToken
public final java.lang.String _parseNamespaceToken() throws ParseException- Throws:
ParseException
-
ReInit
public void ReInit(CharStream stream)
-
ReInit
public void ReInit(ParserTokenManager tm)
-
getNextToken
public final Token getNextToken()
-
getToken
public final Token getToken(int index)
-
generateParseException
public ParseException generateParseException()
-
enable_tracing
public final void enable_tracing()
-
disable_tracing
public final void disable_tracing()
-
-