W3C logo

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: 1.15 $

Field Summary
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  org.w3c.css.sac.SelectorFactory selectorFactory
           
protected  org.w3c.css.sac.InputSource source
           
 Token token
           
 ParserTokenManager token_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, NMCHAR, NMSTART, 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
Parser()
          Creates a new Parser
Parser(CharStream stream)
           
Parser(ParserTokenManager tm)
           
 
Method Summary
 org.w3c.css.sac.Condition _class(org.w3c.css.sac.Condition pred)
           
 void _parseDeclarationBlock()
           
 void _parseImportRule()
           
 void _parseMediaRule()
           
 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()
           
 void declaration()
           
 void disable_tracing()
           
 org.w3c.css.sac.SimpleSelector element_name()
           
 void enable_tracing()
           
 org.w3c.css.sac.LexicalUnit expr()
           
 void fontFace()
           
 org.w3c.flute.parser.LexicalUnitImpl function(char operator, org.w3c.flute.parser.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)
           
 org.w3c.flute.parser.LexicalUnitImpl hexcolor(org.w3c.flute.parser.LexicalUnitImpl prev)
           
 void ignoreStatement()
           
 void importDeclaration()
          The import statement
 void media()
           
 void mediaStatement(MediaListImpl ml)
           
 java.lang.String medium()
           
 org.w3c.flute.parser.LexicalUnitImpl operator(org.w3c.flute.parser.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)
           
 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)
           
 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)
           
 void skipUnknownRule()
           
 void styleRule()
           
 org.w3c.flute.parser.LexicalUnitImpl term(org.w3c.flute.parser.LexicalUnitImpl prev)
           
 char unaryOperator()
           
 org.w3c.flute.parser.LexicalUnitImpl unicode(org.w3c.flute.parser.LexicalUnitImpl prev)
           
 org.w3c.flute.parser.LexicalUnitImpl url(org.w3c.flute.parser.LexicalUnitImpl prev)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conditionFactory

protected org.w3c.css.sac.ConditionFactory conditionFactory

documentHandler

protected org.w3c.css.sac.DocumentHandler documentHandler

errorHandler

protected org.w3c.css.sac.ErrorHandler errorHandler

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead

selectorFactory

protected org.w3c.css.sac.SelectorFactory selectorFactory

source

protected org.w3c.css.sac.InputSource source

token

public Token token

token_source

public ParserTokenManager token_source
Constructor Detail

Parser

public Parser()
Creates a new Parser

Parser

public Parser(CharStream stream)

Parser

public Parser(ParserTokenManager tm)
Method Detail

_class

public final org.w3c.css.sac.Condition _class(org.w3c.css.sac.Condition pred)
                                       throws ParseException
Throws:
ParseException - exception during the parse

_parseDeclarationBlock

public final void _parseDeclarationBlock()
                                  throws ParseException

_parseImportRule

public final void _parseImportRule()
                            throws ParseException

_parseMediaRule

public final void _parseMediaRule()
                           throws ParseException

_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.

_parseSelectors

public final org.w3c.css.sac.SelectorList _parseSelectors()
                                                   throws ParseException

afterImportDeclaration

public final void afterImportDeclaration()
                                  throws ParseException

atRuleDeclaration

public final void atRuleDeclaration()
                             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

charset

public final void charset()
                   throws ParseException

combinator

public final char combinator()
                      throws ParseException
Throws:
ParseException - exception during the parse

declaration

public final void declaration()
                       throws ParseException
Throws:
ParseException - exception during the parse

disable_tracing

public final void disable_tracing()

element_name

public final org.w3c.css.sac.SimpleSelector element_name()
                                                  throws ParseException
Throws:
ParseException - exception during the parse

enable_tracing

public final void enable_tracing()

expr

public final org.w3c.css.sac.LexicalUnit expr()
                                       throws ParseException
Throws:
ParseException - exception during the parse

fontFace

public final void fontFace()
                    throws ParseException

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

generateParseException

public final ParseException generateParseException()

getNextToken

public final Token getNextToken()

getParserVersion

public java.lang.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".

getToken

public final Token getToken(int index)

hash

public final org.w3c.css.sac.Condition hash(org.w3c.css.sac.Condition pred)
                                     throws ParseException
Throws:
ParseException - exception during the parse

hexcolor

public final org.w3c.flute.parser.LexicalUnitImpl hexcolor(org.w3c.flute.parser.LexicalUnitImpl prev)
                                                    throws ParseException
Throws:
ParseException - exception during the parse

ignoreStatement

public final void ignoreStatement()
                           throws ParseException

importDeclaration

public final void importDeclaration()
                             throws ParseException
The import 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

medium

public final java.lang.String medium()
                              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

page

public final void page()
                throws ParseException
Throws:
ParseException - exception during the parse

parseImportRule

public void parseImportRule(org.w3c.css.sac.InputSource source)
                     throws org.w3c.css.sac.CSSException,
                            java.io.IOException
Parse methods used by DOM Level 2 implementation.

parseMediaRule

public void parseMediaRule(org.w3c.css.sac.InputSource source)
                    throws org.w3c.css.sac.CSSException,
                           java.io.IOException

parsePriority

public boolean parsePriority(org.w3c.css.sac.InputSource source)
                      throws org.w3c.css.sac.CSSException,
                             java.io.IOException
Specified by:
parsePriority in interface org.w3c.css.sac.Parser

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:
parsePropertyValue in interface org.w3c.css.sac.Parser

parseRule

public void parseRule(org.w3c.css.sac.InputSource source)
               throws org.w3c.css.sac.CSSException,
                      java.io.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:
java.io.IOException - the source can't be parsed.
org.w3c.css.sac.CSSException - the source is not CSS valid.

parserUnit

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

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:
parseSelectors in interface org.w3c.css.sac.Parser

parseStyleDeclaration

public void parseStyleDeclaration(org.w3c.css.sac.InputSource source)
                           throws org.w3c.css.sac.CSSException,
                                  java.io.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:
java.io.IOException - the source can't be parsed.
org.w3c.css.sac.CSSException - the source is not CSS valid.

parseStyleSheet

public void parseStyleSheet(org.w3c.css.sac.InputSource source)
                     throws org.w3c.css.sac.CSSException,
                            java.io.IOException
Main parse methods
Specified by:
parseStyleSheet in interface org.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.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:
java.io.IOException - the source can't be parsed.
org.w3c.css.sac.CSSException - the source is not CSS valid.

prio

public final boolean prio()
                   throws ParseException
Throws:
ParseException - exception during the parse

property

public final java.lang.String property()
                                throws ParseException
Throws:
ParseException - exception during the parse

pseudo_page

public final java.lang.String pseudo_page()
                                   throws ParseException

pseudo

public final org.w3c.css.sac.Condition pseudo(org.w3c.css.sac.Condition pred)
                                       throws ParseException
Throws:
ParseException - exception during the parse

ReInit

public void ReInit(CharStream stream)

ReInit

public void ReInit(ParserTokenManager tm)

selector

public final org.w3c.css.sac.Selector selector()
                                        throws ParseException
Throws:
ParseException - exception during the parse

selectorList

public final org.w3c.css.sac.SelectorList selectorList()
                                                throws ParseException

setConditionFactory

public void setConditionFactory(org.w3c.css.sac.ConditionFactory conditionFactory)
Specified by:
setConditionFactory in interface org.w3c.css.sac.Parser

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

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

setLocale

public void setLocale(java.util.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

setSelectorFactory

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

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

skipUnknownRule

public final void skipUnknownRule()
                           throws ParseException

styleRule

public final void styleRule()
                     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

unaryOperator

public final char unaryOperator()
                         throws ParseException
Throws:
ParseException - exception during the parse

unicode

public final org.w3c.flute.parser.LexicalUnitImpl unicode(org.w3c.flute.parser.LexicalUnitImpl prev)
                                                   throws ParseException

url

public final org.w3c.flute.parser.LexicalUnitImpl url(org.w3c.flute.parser.LexicalUnitImpl prev)
                                               throws ParseException


Copyright © 2002 W3C® (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public and Member privacy statements.