org.w3c.flute.parser

Class Parser

public class Parser extends Object implements Parser, ParserConstants

A CSS2 parser

Version: $Revision: 6653 $

Author: Philippe Le Hegaret

Nested Class Summary
static classParser.JJCalls
Field Summary
protected ConditionFactoryconditionFactory
protected DocumentHandlerdocumentHandler
protected ErrorHandlererrorHandler
Tokenjj_nt
booleanlookingAhead
protected StringpseudoElt
protected SelectorFactoryselectorFactory
protected InputSourcesource
static StringBufferSPACE
Tokentoken
ParserTokenManagertoken_source
Constructor Summary
Parser()
Creates a new Parser
Parser(CharStream stream)
Parser(ParserTokenManager tm)
Method Summary
voidafterImportDeclaration()
voidatRuleDeclaration()
Conditionattrib(Condition pred)
voidcharset()
charcombinator()
StringconvertIdent(String s)
StringconvertString(String s)
StringconvertStringIndex(String s, int start, int len)
voiddeclaration()
voiddisable_tracing()
SimpleSelectorelement_name()
voidenable_tracing()
LexicalUnitexpr()
voidfontFace()
LexicalUnitImplfunction(char operator, LexicalUnitImpl prev)
Handle all CSS2 functions.
ParseExceptiongenerateParseException()
TokengetNextToken()
StringgetParserVersion()
This methods returns "http://www.w3.org/TR/REC-CSS2".
TokengetToken(int index)
Conditionhash(Condition pred)
LexicalUnitImplhexcolor(LexicalUnitImpl prev)
voidignoreStatement()
voidimportDeclaration()
The import statement
voidmedia()
voidmediaStatement(MediaListImpl ml)
Stringmedium()
voidnamespaceDeclaration()
The namespace statement
floatnumber(char operator, Token n, int lengthUnit)
LexicalUnitImploperator(LexicalUnitImpl prev)
voidpage()
voidparseImportRule(InputSource source)
Parse methods used by DOM Level 2 implementation.
voidparseMediaRule(InputSource source)
StringparseNamespaceToken(InputSource source)
booleanparsePriority(InputSource source)
LexicalUnitparsePropertyValue(InputSource source)
voidparserUnit()
The main entry for the parser.
voidparseRule(InputSource source)
This method parses only one rule (style rule or at-rule, except @charset).
SelectorListparseSelectors(InputSource source)
voidparseStyleDeclaration(InputSource source)
This method parses a style declaration (including the surrounding curly braces).
voidparseStyleSheet(InputSource source)
Main parse methods
voidparseStyleSheet(String systemId)
Convenient method for URIs.
booleanprio()
Stringproperty()
Conditionpseudo(Condition pred)
Stringpseudo_page()
voidrejectToken(Token t)
voidReInit(CharStream stream)
voidReInit(ParserTokenManager tm)
Selectorselector()
SelectorListselectorList()
voidsetConditionFactory(ConditionFactory conditionFactory)
voidsetDocumentHandler(DocumentHandler handler)
Set the document handler for this parser
voidsetErrorHandler(ErrorHandler error)
Set the error handler for this parser
voidsetLocale(Locale locale)
voidsetSelectorFactory(SelectorFactory selectorFactory)
Selectorsimple_selector(Selector selector, char comb)
StringskipAfterExpression()
StringskipStatement()
StringskipStatementNoSemicolon()
voidskipUnknownRule()
Stringskip_to_matching_brace()
voidstyleRule()
LexicalUnitImplterm(LexicalUnitImpl prev)
charunaryOperator()
LexicalUnitImplunicode(LexicalUnitImpl prev)
LexicalUnitImplurl(LexicalUnitImpl prev)
Condition_class(Condition pred)
void_parseDeclarationBlock()
void_parseImportRule()
void_parseMediaRule()
String_parseNamespaceToken()
void_parseRule()
The following functions are useful for a DOM CSS implementation only and are not part of the general CSS2 parser.
SelectorList_parseSelectors()

Field Detail

conditionFactory

protected ConditionFactory conditionFactory

documentHandler

protected DocumentHandler documentHandler

errorHandler

protected ErrorHandler errorHandler

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead

pseudoElt

protected String pseudoElt

selectorFactory

protected SelectorFactory selectorFactory

source

protected InputSource source

SPACE

static final StringBuffer SPACE

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

afterImportDeclaration

public final void afterImportDeclaration()

atRuleDeclaration

public final void atRuleDeclaration()

Throws: ParseException exception during the parse

attrib

public final Condition attrib(Condition pred)

Throws: ParseException exception during the parse

charset

public final void charset()

combinator

public final char combinator()

Throws: ParseException exception during the parse

convertIdent

String convertIdent(String s)

convertString

String convertString(String s)

convertStringIndex

String convertStringIndex(String s, int start, int len)

declaration

public final void declaration()

Throws: ParseException exception during the parse

disable_tracing

public final void disable_tracing()

element_name

public final SimpleSelector element_name()

Throws: ParseException exception during the parse

enable_tracing

public final void enable_tracing()

expr

public final LexicalUnit expr()

Throws: ParseException exception during the parse

fontFace

public final void fontFace()

function

public final LexicalUnitImpl function(char operator, LexicalUnitImpl prev)
Handle all CSS2 functions.

Throws: ParseException exception during the parse

generateParseException

public ParseException generateParseException()

getNextToken

public final Token getNextToken()

getParserVersion

public String getParserVersion()
This methods returns "http://www.w3.org/TR/REC-CSS2".

Returns: the string "http://www.w3.org/TR/REC-CSS2".

getToken

public final Token getToken(int index)

hash

public final Condition hash(Condition pred)

Throws: ParseException exception during the parse

hexcolor

public final LexicalUnitImpl hexcolor(LexicalUnitImpl prev)

Throws: ParseException exception during the parse

ignoreStatement

public final void ignoreStatement()

importDeclaration

public final void importDeclaration()
The import statement

Throws: ParseException exception during the parse

media

public final void media()

Throws: ParseException exception during the parse

mediaStatement

public final void mediaStatement(MediaListImpl ml)

medium

public final String medium()

Throws: ParseException exception during the parse

namespaceDeclaration

public final void namespaceDeclaration()
The namespace statement

Throws: ParseException exception during the parse

number

float number(char operator, Token n, int lengthUnit)

operator

public final LexicalUnitImpl operator(LexicalUnitImpl prev)

Throws: ParseException exception during the parse

page

public final void page()

Throws: ParseException exception during the parse

parseImportRule

public void parseImportRule(InputSource source)
Parse methods used by DOM Level 2 implementation.

parseMediaRule

public void parseMediaRule(InputSource source)

parseNamespaceToken

public String parseNamespaceToken(InputSource source)

parsePriority

public boolean parsePriority(InputSource source)

parsePropertyValue

public LexicalUnit parsePropertyValue(InputSource source)

parserUnit

public final void parserUnit()
The main entry for the parser.

Throws: ParseException exception during the parse

parseRule

public void parseRule(InputSource source)
This method parses only one rule (style rule or at-rule, except @charset).

Parameters: source the source of the rule.

Throws: IOException the source can't be parsed. CSSException the source is not CSS valid.

parseSelectors

public SelectorList parseSelectors(InputSource source)

parseStyleDeclaration

public void parseStyleDeclaration(InputSource source)
This method parses a style declaration (including the surrounding curly braces).

Parameters: source the source of the style declaration.

Throws: IOException the source can't be parsed. CSSException the source is not CSS valid.

parseStyleSheet

public void parseStyleSheet(InputSource source)
Main parse methods

Parameters: source the source of the style sheet.

Throws: IOException the source can't be parsed. CSSException the source is not CSS valid.

parseStyleSheet

public void parseStyleSheet(String systemId)
Convenient method for URIs.

Parameters: systemId the fully resolved URI of the style sheet.

Throws: IOException the source can't be parsed. CSSException the source is not CSS valid.

prio

public final boolean prio()

Throws: ParseException exception during the parse

property

public final String property()

Throws: ParseException exception during the parse

pseudo

public final Condition pseudo(Condition pred)

Throws: ParseException exception during the parse

pseudo_page

public final String pseudo_page()

rejectToken

void rejectToken(Token t)

ReInit

public void ReInit(CharStream stream)

ReInit

public void ReInit(ParserTokenManager tm)

selector

public final Selector selector()

Throws: ParseException exception during the parse

selectorList

public final SelectorList selectorList()

setConditionFactory

public void setConditionFactory(ConditionFactory conditionFactory)

setDocumentHandler

public void setDocumentHandler(DocumentHandler handler)
Set the document handler for this parser

setErrorHandler

public void setErrorHandler(ErrorHandler error)
Set the error handler for this parser

setLocale

public void setLocale(Locale locale)

Throws: CSSException Not yet implemented

UNKNOWN:

setSelectorFactory

public void setSelectorFactory(SelectorFactory selectorFactory)

simple_selector

public final Selector simple_selector(Selector selector, char comb)

Throws: ParseException exception during the parse

skipAfterExpression

String skipAfterExpression()

skipStatement

String skipStatement()

skipStatementNoSemicolon

String skipStatementNoSemicolon()

skipUnknownRule

public final void skipUnknownRule()

skip_to_matching_brace

String skip_to_matching_brace()

styleRule

public final void styleRule()

Throws: ParseException exception during the parse

term

public final LexicalUnitImpl term(LexicalUnitImpl prev)

Throws: ParseException exception during the parse

unaryOperator

public final char unaryOperator()

Throws: ParseException exception during the parse

unicode

public final LexicalUnitImpl unicode(LexicalUnitImpl prev)

url

public final LexicalUnitImpl url(LexicalUnitImpl prev)

_class

public final Condition _class(Condition pred)

Throws: ParseException exception during the parse

_parseDeclarationBlock

public final void _parseDeclarationBlock()

_parseImportRule

public final void _parseImportRule()

_parseMediaRule

public final void _parseMediaRule()

_parseNamespaceToken

public final String _parseNamespaceToken()

_parseRule

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

_parseSelectors

public final SelectorList _parseSelectors()