Class Parser

  • All Implemented Interfaces:
    org.w3c.css.sac.Parser, ParserConstants

    public class Parser
    extends Object
    implements org.w3c.css.sac.Parser, ParserConstants
    A CSS2 parser
    Version:
    $Revision$
    Author:
    Philippe Le Hegaret
    • Field Detail

      • 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 String pseudoElt
      • token

        public Token token
      • jj_nt

        public Token jj_nt
      • lookingAhead

        public boolean lookingAhead
    • Method Detail

      • setLocale

        public void setLocale​(Locale locale)
                       throws org.w3c.css.sac.CSSException
        Specified by:
        setLocale in interface org.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 interface org.w3c.css.sac.Parser
      • setSelectorFactory

        public void setSelectorFactory​(org.w3c.css.sac.SelectorFactory selectorFactory)
        Specified by:
        setSelectorFactory in interface org.w3c.css.sac.Parser
      • setConditionFactory

        public void setConditionFactory​(org.w3c.css.sac.ConditionFactory conditionFactory)
        Specified by:
        setConditionFactory in interface org.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 interface org.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 interface org.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

        public void parseStyleSheet​(String systemId)
                             throws org.w3c.css.sac.CSSException,
                                    IOException
        Convenient method for URIs.
        Specified by:
        parseStyleSheet in interface org.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 interface org.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 interface org.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

        public String getParserVersion()
        This methods returns "http://www.w3.org/TR/REC-CSS2".
        Specified by:
        getParserVersion in interface org.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 interface org.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 interface org.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 interface org.w3c.css.sac.Parser
        Throws:
        org.w3c.css.sac.CSSException
        IOException
      • parserUnit

        public final void parserUnit()
                              throws ParseException
        The main entry for the parser.
        Throws:
        ParseException - exception during the parse
      • importDeclaration

        public final void importDeclaration()
                                     throws ParseException
        The import statement
        Throws:
        ParseException - exception during the parse
      • namespaceDeclaration

        public final void namespaceDeclaration()
                                        throws ParseException
        The namespace statement
        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
      • operator

        public final org.w3c.flute.parser.LexicalUnitImpl operator​(org.w3c.flute.parser.LexicalUnitImpl prev)
                                                            throws ParseException
        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

        public final void _parseRule()
                              throws ParseException
        The following functions are useful for a DOM CSS implementation only and are not part of the general CSS2 parser.
        Throws:
        ParseException
      • ReInit

        public void ReInit​(CharStream stream)
      • 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()