Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.w3c.flute.parser
Class Parser  view Parser download Parser.java

java.lang.Object
  extended byorg.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 $

Nested Class Summary
(package private) static class Parser.JJCalls
           
 
Field Summary
protected  org.w3c.css.sac.ConditionFactory conditionFactory
           
private  LocatorImpl currentLocator
           
protected  org.w3c.css.sac.DocumentHandler documentHandler
           
protected  org.w3c.css.sac.ErrorHandler errorHandler
           
private  Parser.JJCalls[] jj_2_rtns
           
private  int jj_endpos
           
private  java.util.Vector jj_expentries
           
private  int[] jj_expentry
           
private  int jj_gc
           
private  int jj_gen
           
private  int jj_kind
           
private  int jj_la
           
private  int[] jj_la1
           
private  int[] jj_la1_0
           
private  int[] jj_la1_1
           
private  int[] jj_la1_2
           
private  Token jj_lastpos
           
private  int[] jj_lasttokens
           
 Token jj_nt
           
private  int jj_ntk
           
private  boolean jj_rescan
           
private  Token jj_scanpos
           
private  boolean jj_semLA
           
 boolean lookingAhead
           
private  java.lang.String pseudoElt
           
protected  org.w3c.css.sac.SelectorFactory selectorFactory
           
protected  org.w3c.css.sac.InputSource source
           
(package private) static java.lang.StringBuffer SPACE
           
 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()
           
(package private)  java.lang.String convertIdent(java.lang.String s)
           
(package private)  java.lang.String convertString(java.lang.String s)
           
(package private)  java.lang.String convertStringIndex(java.lang.String s, int start, int len)
           
 void declaration()
           
 void disable_tracing()
           
 org.w3c.css.sac.SimpleSelector element_name()
           
 void enable_tracing()
           
 org.w3c.css.sac.LexicalUnit expr()
           
 void fontFace()
           
 LexicalUnitImpl function(char operator, LexicalUnitImpl prev)
          Handle all CSS2 functions.
 ParseException generateParseException()
           
private  CharStream getCharStreamWithLurk(org.w3c.css.sac.InputSource source)
          Convert the source into a CharStream with encoding informations.
private  org.w3c.css.sac.Locator getLocator()
           
private  LocatorImpl getLocator(Token save)
           
 Token getNextToken()
           
 java.lang.String getParserVersion()
          This methods returns "http://www.w3.org/TR/REC-CSS2".
private  java.io.Reader getReader(org.w3c.css.sac.InputSource source)
          Convert the source into a Reader.
 Token getToken(int index)
           
 org.w3c.css.sac.Condition hash(org.w3c.css.sac.Condition pred)
           
 LexicalUnitImpl hexcolor(LexicalUnitImpl prev)
           
 void ignoreStatement()
           
 void importDeclaration()
          The import statement
private  boolean jj_2_1(int xla)
           
private  boolean jj_3_1()
           
private  boolean jj_3R_69()
           
private  boolean jj_3R_70()
           
private  boolean jj_3R_71()
           
private  boolean jj_3R_72()
           
private  boolean jj_3R_73()
           
private  boolean jj_3R_74()
           
private  boolean jj_3R_75()
           
private  boolean jj_3R_76()
           
private  boolean jj_3R_77()
           
private  boolean jj_3R_78()
           
private  boolean jj_3R_79()
           
private  boolean jj_3R_80()
           
private  boolean jj_3R_81()
           
private  boolean jj_3R_82()
           
private  boolean jj_3R_83()
           
private  boolean jj_3R_84()
           
private  boolean jj_3R_85()
           
private  boolean jj_3R_86()
           
private  boolean jj_3R_87()
           
private  boolean jj_3R_88()
           
private  boolean jj_3R_89()
           
private  boolean jj_3R_90()
           
private  void jj_add_error_token(int kind, int pos)
           
private  Token jj_consume_token(int kind)
           
private  int jj_ntk()
           
private  void jj_rescan_token()
           
private  void jj_save(int index, int xla)
           
private  boolean jj_scan_token(int kind)
           
 void media()
           
 void mediaStatement(MediaListImpl ml)
           
 java.lang.String medium()
           
(package private)  float number(char operator, Token n, int lengthUnit)
           
 LexicalUnitImpl operator(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)
          Parse a CSS priority value (e.g.
 org.w3c.css.sac.LexicalUnit parsePropertyValue(org.w3c.css.sac.InputSource source)
          Parse a CSS property value.
 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)
          Parse a comma separated list of selectors.
 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)
           
(package private)  void rejectToken(Token t)
           
private  void reportError(org.w3c.css.sac.Locator l, java.lang.Exception e)
           
private  void reportWarningSkipText(org.w3c.css.sac.Locator l, java.lang.String text)
           
 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)
          Allow an application to request a locale for errors and warnings.
 void setSelectorFactory(org.w3c.css.sac.SelectorFactory selectorFactory)
           
 org.w3c.css.sac.Selector simple_selector(org.w3c.css.sac.Selector selector, char comb)
           
(package private)  java.lang.String skip_to_matching_brace()
           
(package private)  java.lang.String skipAfterExpression()
           
(package private)  java.lang.String skipStatement()
           
 void skipUnknownRule()
           
 void styleRule()
           
 LexicalUnitImpl term(LexicalUnitImpl prev)
           
 char unaryOperator()
           
 LexicalUnitImpl unicode(LexicalUnitImpl prev)
           
 LexicalUnitImpl url(LexicalUnitImpl prev)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

private java.lang.String pseudoElt

currentLocator

private LocatorImpl currentLocator

token_source

public ParserTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

jj_ntk

private int jj_ntk

jj_scanpos

private Token jj_scanpos

jj_lastpos

private Token jj_lastpos

jj_la

private int jj_la

lookingAhead

public boolean lookingAhead

jj_semLA

private boolean jj_semLA

jj_gen

private int jj_gen

jj_la1

private final int[] jj_la1

jj_la1_0

private final int[] jj_la1_0

jj_la1_1

private final int[] jj_la1_1

jj_la1_2

private final int[] jj_la1_2

jj_2_rtns

private final Parser.JJCalls[] jj_2_rtns

jj_rescan

private boolean jj_rescan

jj_gc

private int jj_gc

jj_expentries

private java.util.Vector jj_expentries

jj_expentry

private int[] jj_expentry

jj_kind

private int jj_kind

jj_lasttokens

private int[] jj_lasttokens

jj_endpos

private int jj_endpos
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
Description copied from interface: org.w3c.css.sac.Parser
Allow an application to request a locale for errors and warnings.

CSS parsers are not required to provide localisation for errors and warnings; if they cannot support the requested locale, however, they must throw a CSS exception. Applications may not request a locale change in the middle of a parse.

Specified by:
setLocale 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

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,
                            java.io.IOException
Main parse methods

Specified by:
parseStyleSheet in interface org.w3c.css.sac.Parser

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

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

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

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

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

parseSelectors

public org.w3c.css.sac.SelectorList parseSelectors(org.w3c.css.sac.InputSource source)
                                            throws org.w3c.css.sac.CSSException,
                                                   java.io.IOException
Description copied from interface: org.w3c.css.sac.Parser
Parse a comma separated list of selectors.

Specified by:
parseSelectors 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
Description copied from interface: org.w3c.css.sac.Parser
Parse a CSS property value.

Specified by:
parsePropertyValue in interface org.w3c.css.sac.Parser

parsePriority

public boolean parsePriority(org.w3c.css.sac.InputSource source)
                      throws org.w3c.css.sac.CSSException,
                             java.io.IOException
Description copied from interface: org.w3c.css.sac.Parser
Parse a CSS priority value (e.g. "!important").

Specified by:
parsePriority in interface org.w3c.css.sac.Parser

getReader

private java.io.Reader getReader(org.w3c.css.sac.InputSource source)
                          throws java.io.IOException
Convert the source into a Reader. Used only by DOM Level 2 parser methods.


getCharStreamWithLurk

private CharStream getCharStreamWithLurk(org.w3c.css.sac.InputSource source)
                                  throws org.w3c.css.sac.CSSException,
                                         java.io.IOException
Convert the source into a CharStream with encoding informations. The encoding can be found in the InputSource or in the CSS document. Since this method marks the reader and make a reset after looking for the charset declaration, you'll find the charset declaration into the stream.


getLocator

private org.w3c.css.sac.Locator getLocator()

getLocator

private LocatorImpl getLocator(Token save)

reportError

private void reportError(org.w3c.css.sac.Locator l,
                         java.lang.Exception e)

reportWarningSkipText

private void reportWarningSkipText(org.w3c.css.sac.Locator l,
                                   java.lang.String text)

parserUnit

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


charset

public final void charset()
                   throws ParseException

afterImportDeclaration

public final void afterImportDeclaration()
                                  throws ParseException

ignoreStatement

public final void ignoreStatement()
                           throws ParseException

importDeclaration

public final void importDeclaration()
                             throws ParseException
The import statement


media

public final void media()
                 throws ParseException

mediaStatement

public final void mediaStatement(MediaListImpl ml)
                          throws ParseException

medium

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

page

public final void page()
                throws ParseException

pseudo_page

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

fontFace

public final void fontFace()
                    throws ParseException

atRuleDeclaration

public final void atRuleDeclaration()
                             throws ParseException

skipUnknownRule

public final void skipUnknownRule()
                           throws ParseException

combinator

public final char combinator()
                      throws ParseException

property

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

styleRule

public final void styleRule()
                     throws ParseException

selectorList

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

selector

public final org.w3c.css.sac.Selector selector()
                                        throws ParseException

simple_selector

public final org.w3c.css.sac.Selector simple_selector(org.w3c.css.sac.Selector selector,
                                                      char comb)
                                               throws ParseException

_class

public final org.w3c.css.sac.Condition _class(org.w3c.css.sac.Condition pred)
                                       throws ParseException

element_name

public final org.w3c.css.sac.SimpleSelector element_name()
                                                  throws ParseException

attrib

public final org.w3c.css.sac.Condition attrib(org.w3c.css.sac.Condition pred)
                                       throws ParseException

pseudo

public final org.w3c.css.sac.Condition pseudo(org.w3c.css.sac.Condition pred)
                                       throws ParseException

hash

public final org.w3c.css.sac.Condition hash(org.w3c.css.sac.Condition pred)
                                     throws ParseException

declaration

public final void declaration()
                       throws ParseException

prio

public final boolean prio()
                   throws ParseException

operator

public final LexicalUnitImpl operator(LexicalUnitImpl prev)
                               throws ParseException

expr

public final org.w3c.css.sac.LexicalUnit expr()
                                       throws ParseException

unaryOperator

public final char unaryOperator()
                         throws ParseException

term

public final LexicalUnitImpl term(LexicalUnitImpl prev)
                           throws ParseException

function

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


unicode

public final LexicalUnitImpl unicode(LexicalUnitImpl prev)
                              throws ParseException

url

public final LexicalUnitImpl url(LexicalUnitImpl prev)
                          throws ParseException

hexcolor

public final LexicalUnitImpl hexcolor(LexicalUnitImpl prev)
                               throws ParseException

number

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

skipStatement

java.lang.String skipStatement()
                         throws ParseException

skip_to_matching_brace

java.lang.String skip_to_matching_brace()
                                  throws ParseException

convertStringIndex

java.lang.String convertStringIndex(java.lang.String s,
                                    int start,
                                    int len)
                              throws ParseException

convertIdent

java.lang.String convertIdent(java.lang.String s)
                        throws ParseException

convertString

java.lang.String convertString(java.lang.String s)
                         throws ParseException

rejectToken

void rejectToken(Token t)
           throws ParseException

skipAfterExpression

java.lang.String skipAfterExpression()
                               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.


_parseImportRule

public final void _parseImportRule()
                            throws ParseException

_parseMediaRule

public final void _parseMediaRule()
                           throws ParseException

_parseDeclarationBlock

public final void _parseDeclarationBlock()
                                  throws ParseException

_parseSelectors

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

jj_2_1

private final boolean jj_2_1(int xla)

jj_3R_70

private final boolean jj_3R_70()

jj_3R_88

private final boolean jj_3R_88()

jj_3R_87

private final boolean jj_3R_87()

jj_3R_86

private final boolean jj_3R_86()

jj_3R_80

private final boolean jj_3R_80()

jj_3R_81

private final boolean jj_3R_81()

jj_3R_79

private final boolean jj_3R_79()

jj_3R_83

private final boolean jj_3R_83()

jj_3R_72

private final boolean jj_3R_72()

jj_3R_90

private final boolean jj_3R_90()

jj_3R_73

private final boolean jj_3R_73()

jj_3R_71

private final boolean jj_3R_71()

jj_3R_69

private final boolean jj_3R_69()

jj_3R_89

private final boolean jj_3R_89()

jj_3R_82

private final boolean jj_3R_82()

jj_3_1

private final boolean jj_3_1()

jj_3R_84

private final boolean jj_3R_84()

jj_3R_85

private final boolean jj_3R_85()

jj_3R_78

private final boolean jj_3R_78()

jj_3R_77

private final boolean jj_3R_77()

jj_3R_76

private final boolean jj_3R_76()

jj_3R_75

private final boolean jj_3R_75()

jj_3R_74

private final boolean jj_3R_74()

ReInit

public void ReInit(CharStream stream)

ReInit

public void ReInit(ParserTokenManager tm)

jj_consume_token

private final Token jj_consume_token(int kind)
                              throws ParseException

jj_scan_token

private final boolean jj_scan_token(int kind)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

jj_ntk

private final int jj_ntk()

jj_add_error_token

private void jj_add_error_token(int kind,
                                int pos)

generateParseException

public final ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()

jj_rescan_token

private final void jj_rescan_token()

jj_save

private final void jj_save(int index,
                           int xla)