jp.cssj.sakae.sac.parser
クラス Parser

java.lang.Object
  拡張jp.cssj.sakae.sac.parser.Parser
すべての実装インタフェース:
ExtendedParser, Localizable, Parser

public class Parser
extends Object
implements ExtendedParser, Localizable

This class implements the Parserinterface.

バージョン:
$Id: Parser.java,v 1.4 2005/06/28 01:57:44 harumanx Exp $
作成者:
Stephane Hillion

フィールドの概要
static String BUNDLE_CLASSNAME
          The default resource bundle base name.
protected  ConditionFactory conditionFactory
          The condition factory.
protected  int current
          The current lexical unit.
protected  DocumentHandler documentHandler
          The document handler.
protected  String documentURI
          The document URI.
protected  ErrorHandler errorHandler
          The error handler.
protected  boolean legacy
           
protected  LocalizableSupport localizableSupport
          The localizable support.
protected  Map prefixToURI
          Mapping from prefix to URI.
protected  String pseudoElement
          To store the current pseudo element.
protected  Scanner scanner
          The scanner used to scan the input source.
protected  SelectorFactory selectorFactory
          The selector factory.
 
コンストラクタの概要
Parser()
           
 
メソッドの概要
protected  CSSParseException createCSSParseException(String key)
          Creates a parse exception.
protected  CSSParseException createCSSParseException(String key, Object[] params)
          Creates a parse exception.
protected  Scanner createScanner(InputSource source)
          Creates a scanner, given an InputSource.
protected  LexicalUnit dimension(boolean positive, LexicalUnit prev)
          Converts the current lexical unit to a dimension.
 String formatMessage(String key, Object[] args)
          Implements Localizable.formatMessage(String,Object[]) .
 Locale getLocale()
          Implements Localizable.getLocale().
 String getParserVersion()
          SAC : Implements Parser.getParserVersion() .
protected  LexicalUnit hexcolor(LexicalUnit prev)
          Converts a hash unit to a RGB color.
 boolean isLegacy()
           
protected  boolean isPseudoElement(String s)
          Tells whether or not the given string represents a pseudo-element.
protected  int next()
          Advances to the next token, ignoring comments.
protected  int nextIgnoreSpaces()
          Advances to the next token and skip the spaces, ignoring comments.
protected  float number(boolean positive)
          Converts the current lexical unit to a float.
protected  void parseAtRule()
          Parses an unknown rule.
protected  LexicalUnit parseExpression(boolean param)
          Parses a CSS2 expression.
protected  void parseFontFaceRule()
          Parses a font-face rule.
protected  LexicalUnit parseFunction(LexicalUnit prev)
          Parses a CSS2 function.
protected  void parseImportRule()
          Parses an import rule.
 SACMediaList parseMedia(String mediaText)
          Implements ExtendedParser.parseMedia(String).
protected  CSSSACMediaList parseMediaList()
          Parses a media list.
protected  void parseMediaRule()
          Parses a media rule.
protected  void parseNamespaceRule()
          Parses an namespace rule.
protected  void parsePageRule()
          Parses a page rule.
 boolean parsePriority(InputSource source)
          SAC : Implements Parser.parsePriority(InputSource).
 boolean parsePriority(String source)
          Implements ExtendedParser.parsePriority(String).
protected  boolean parsePriorityInternal()
          Parses the priority using the current scanner.
 LexicalUnit parsePropertyValue(InputSource source)
          SAC : Implements Parser.parsePropertyValue(InputSource).
 LexicalUnit parsePropertyValue(String source)
          Implements ExtendedParser.parsePropertyValue(String).
protected  LexicalUnit parsePropertyValueInternal()
          Parses property value using the current scanner.
protected  void parseRule()
          Parses a rule.
 void parseRule(InputSource source)
          SAC : Implements Parser.parseRule(InputSource).
 void parseRule(String source)
          Implements ExtendedParser.parseRule(String).
protected  void parseRuleInternal()
          Parses a rule using the current scanner.
protected  void parseRuleSet()
          Parses a ruleset.
protected  Selector parseSelector()
          Parses a selector.
protected  SelectorList parseSelectorList()
          Parses a selector list
 SelectorList parseSelectors(InputSource source)
          SAC : Implements Parser.parseSelectors(InputSource).
 SelectorList parseSelectors(String source)
          Implements ExtendedParser.parseSelectors(String).
protected  SelectorList parseSelectorsInternal()
          Parses selectors using the current scanner.
protected  SimpleSelector parseSimpleSelector()
          Parses a simple selector.
protected  void parseStyleDeclaration(boolean inSheet)
          Parses the given reader.
 void parseStyleDeclaration(InputSource source)
          SAC : Implements Parser.parseStyleDeclaration(InputSource).
 void parseStyleDeclaration(String source)
          Implements ExtendedParser.parseStyleDeclaration(String).
protected  void parseStyleDeclarationInternal()
          Parses a style declaration using the current scanner.
 void parseStyleSheet(InputSource source)
          SAC : Implements Parser.parseStyleSheet(InputSource).
protected  void parseStyleSheet(InputSource source, boolean rescan, boolean checkCharset)
           
 void parseStyleSheet(String uri)
          SAC : Implements Parser.parseStyleSheet(String).
protected  LexicalUnit parseTerm(LexicalUnit prev)
          Parses a CSS2 term.
protected  void reportError(CSSParseException e)
          Reports a parsing error.
protected  void reportError(String key)
          Reports a parsing error.
protected  void reportError(String key, Object[] params)
          Reports a parsing error.
 void setConditionFactory(ConditionFactory factory)
          SAC : Implements Parser.setConditionFactory(ConditionFactory).
 void setDocumentHandler(DocumentHandler handler)
          SAC : Implements Parser.setDocumentHandler(DocumentHandler).
 void setErrorHandler(ErrorHandler handler)
          SAC : Implements Parser.setErrorHandler(ErrorHandler).
 void setLegacy(boolean legacy)
           
 void setLocale(Locale locale)
          SAC : Implements Parser.setLocale(Locale).
 void setSelectorFactory(SelectorFactory factory)
          SAC : Implements Parser.setSelectorFactory(SelectorFactory).
protected  int skipSpaces()
          Skips the white spaces.
protected  int skipSpacesAndCDOCDC()
          Skips the white spaces and CDO/CDC units.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

BUNDLE_CLASSNAME

public static final String BUNDLE_CLASSNAME
The default resource bundle base name.


localizableSupport

protected LocalizableSupport localizableSupport
The localizable support.


scanner

protected Scanner scanner
The scanner used to scan the input source.


current

protected int current
The current lexical unit.


documentHandler

protected DocumentHandler documentHandler
The document handler.


selectorFactory

protected SelectorFactory selectorFactory
The selector factory.


conditionFactory

protected ConditionFactory conditionFactory
The condition factory.


errorHandler

protected ErrorHandler errorHandler
The error handler.


pseudoElement

protected String pseudoElement
To store the current pseudo element.


documentURI

protected String documentURI
The document URI.


prefixToURI

protected Map prefixToURI
Mapping from prefix to URI.


legacy

protected boolean legacy
コンストラクタの詳細

Parser

public Parser()
メソッドの詳細

isLegacy

public boolean isLegacy()

setLegacy

public void setLegacy(boolean legacy)

getParserVersion

public String getParserVersion()
SAC : Implements Parser.getParserVersion() .

定義:
インタフェース Parser 内の getParserVersion
戻り値:
"http://www.w3.org/TR/REC-CSS2".

setLocale

public void setLocale(Locale locale)
               throws CSSException
SAC : Implements Parser.setLocale(Locale).

定義:
インタフェース Parser 内の setLocale
例外:
CSSException

getLocale

public Locale getLocale()
Implements Localizable.getLocale().

定義:
インタフェース Localizable 内の getLocale

formatMessage

public String formatMessage(String key,
                            Object[] args)
                     throws MissingResourceException
Implements Localizable.formatMessage(String,Object[]) .

定義:
インタフェース Localizable 内の formatMessage
パラメータ:
key - The key used to retreive the message from the resource bundle.
args - The objects that compose the message.
例外:
MissingResourceException - if the key is not in the bundle.

setDocumentHandler

public void setDocumentHandler(DocumentHandler handler)
SAC : Implements Parser.setDocumentHandler(DocumentHandler).

定義:
インタフェース Parser 内の setDocumentHandler

setSelectorFactory

public void setSelectorFactory(SelectorFactory factory)
SAC : Implements Parser.setSelectorFactory(SelectorFactory).

定義:
インタフェース Parser 内の setSelectorFactory

setConditionFactory

public void setConditionFactory(ConditionFactory factory)
SAC : Implements Parser.setConditionFactory(ConditionFactory).

定義:
インタフェース Parser 内の setConditionFactory

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
SAC : Implements Parser.setErrorHandler(ErrorHandler).

定義:
インタフェース Parser 内の setErrorHandler

parseStyleSheet

public void parseStyleSheet(InputSource source)
                     throws CSSException,
                            IOException
SAC : Implements Parser.parseStyleSheet(InputSource).

定義:
インタフェース Parser 内の parseStyleSheet
例外:
CSSException
IOException

parseStyleSheet

protected void parseStyleSheet(InputSource source,
                               boolean rescan,
                               boolean checkCharset)
                        throws CSSException,
                               IOException,
                               ChangeCharacterEncodingException
例外:
CSSException
IOException
ChangeCharacterEncodingException

parseStyleSheet

public void parseStyleSheet(String uri)
                     throws CSSException,
                            IOException
SAC : Implements Parser.parseStyleSheet(String).

定義:
インタフェース Parser 内の parseStyleSheet
例外:
CSSException
IOException

parseStyleDeclaration

public void parseStyleDeclaration(InputSource source)
                           throws CSSException,
                                  IOException
SAC : Implements Parser.parseStyleDeclaration(InputSource).

定義:
インタフェース Parser 内の parseStyleDeclaration
例外:
CSSException
IOException

parseStyleDeclarationInternal

protected void parseStyleDeclarationInternal()
                                      throws CSSException,
                                             IOException
Parses a style declaration using the current scanner.

例外:
CSSException
IOException

parseRule

public void parseRule(InputSource source)
               throws CSSException,
                      IOException
SAC : Implements Parser.parseRule(InputSource).

定義:
インタフェース Parser 内の parseRule
例外:
CSSException
IOException

parseRuleInternal

protected void parseRuleInternal()
                          throws CSSException,
                                 IOException
Parses a rule using the current scanner.

例外:
CSSException
IOException

parseSelectors

public SelectorList parseSelectors(InputSource source)
                            throws CSSException,
                                   IOException
SAC : Implements Parser.parseSelectors(InputSource).

定義:
インタフェース Parser 内の parseSelectors
例外:
CSSException
IOException

parseSelectorsInternal

protected SelectorList parseSelectorsInternal()
                                       throws CSSException,
                                              IOException
Parses selectors using the current scanner.

例外:
CSSException
IOException

parsePropertyValue

public LexicalUnit parsePropertyValue(InputSource source)
                               throws CSSException,
                                      IOException
SAC : Implements Parser.parsePropertyValue(InputSource).

定義:
インタフェース Parser 内の parsePropertyValue
例外:
CSSException
IOException

parsePropertyValueInternal

protected LexicalUnit parsePropertyValueInternal()
                                          throws CSSException,
                                                 IOException
Parses property value using the current scanner.

例外:
CSSException
IOException

parsePriority

public boolean parsePriority(InputSource source)
                      throws CSSException,
                             IOException
SAC : Implements Parser.parsePriority(InputSource).

定義:
インタフェース Parser 内の parsePriority
例外:
CSSException
IOException

parsePriorityInternal

protected boolean parsePriorityInternal()
                                 throws CSSException,
                                        IOException
Parses the priority using the current scanner.

例外:
CSSException
IOException

parseRule

protected void parseRule()
                  throws IOException
Parses a rule.

例外:
IOException

parseAtRule

protected void parseAtRule()
                    throws IOException
Parses an unknown rule.

例外:
IOException

parseImportRule

protected void parseImportRule()
                        throws IOException
Parses an import rule. Assumes the current token is '@import'.

例外:
IOException

parseNamespaceRule

protected void parseNamespaceRule()
                           throws IOException
Parses an namespace rule.

例外:
IOException

parseMediaList

protected CSSSACMediaList parseMediaList()
                                  throws IOException
Parses a media list.

例外:
IOException

parseFontFaceRule

protected void parseFontFaceRule()
                          throws IOException
Parses a font-face rule.

例外:
IOException

parsePageRule

protected void parsePageRule()
                      throws IOException
Parses a page rule.

例外:
IOException

parseMediaRule

protected void parseMediaRule()
                       throws IOException
Parses a media rule.

例外:
IOException

parseRuleSet

protected void parseRuleSet()
                     throws IOException
Parses a ruleset.

例外:
IOException

parseSelectorList

protected SelectorList parseSelectorList()
                                  throws IOException
Parses a selector list

例外:
IOException

parseSelector

protected Selector parseSelector()
                          throws IOException
Parses a selector.

例外:
IOException

parseSimpleSelector

protected SimpleSelector parseSimpleSelector()
                                      throws IOException
Parses a simple selector.

例外:
IOException

isPseudoElement

protected boolean isPseudoElement(String s)
Tells whether or not the given string represents a pseudo-element.


parseStyleDeclaration

protected void parseStyleDeclaration(boolean inSheet)
                              throws IOException
Parses the given reader.

例外:
IOException

parseExpression

protected LexicalUnit parseExpression(boolean param)
                               throws IOException
Parses a CSS2 expression.

例外:
IOException

parseTerm

protected LexicalUnit parseTerm(LexicalUnit prev)
                         throws IOException
Parses a CSS2 term.

例外:
IOException

parseFunction

protected LexicalUnit parseFunction(LexicalUnit prev)
                             throws IOException
Parses a CSS2 function.

例外:
IOException

hexcolor

protected LexicalUnit hexcolor(LexicalUnit prev)
                        throws IOException
Converts a hash unit to a RGB color.

例外:
IOException

createScanner

protected Scanner createScanner(InputSource source)
                         throws IOException
Creates a scanner, given an InputSource.

例外:
IOException

skipSpaces

protected int skipSpaces()
                  throws IOException
Skips the white spaces.

例外:
IOException

skipSpacesAndCDOCDC

protected int skipSpacesAndCDOCDC()
                           throws IOException
Skips the white spaces and CDO/CDC units.

例外:
IOException

number

protected float number(boolean positive)
                throws IOException
Converts the current lexical unit to a float.

例外:
IOException

dimension

protected LexicalUnit dimension(boolean positive,
                                LexicalUnit prev)
                         throws IOException
Converts the current lexical unit to a dimension.

例外:
IOException

next

protected int next()
            throws IOException
Advances to the next token, ignoring comments.

例外:
IOException

nextIgnoreSpaces

protected int nextIgnoreSpaces()
                        throws IOException
Advances to the next token and skip the spaces, ignoring comments.

例外:
IOException

reportError

protected void reportError(String key)
                    throws IOException
Reports a parsing error.

例外:
IOException

reportError

protected void reportError(String key,
                           Object[] params)
                    throws IOException
Reports a parsing error.

例外:
IOException

reportError

protected void reportError(CSSParseException e)
                    throws IOException
Reports a parsing error.

例外:
IOException

createCSSParseException

protected CSSParseException createCSSParseException(String key)
Creates a parse exception.


createCSSParseException

protected CSSParseException createCSSParseException(String key,
                                                    Object[] params)
Creates a parse exception.


parseStyleDeclaration

public void parseStyleDeclaration(String source)
                           throws CSSException,
                                  IOException
Implements ExtendedParser.parseStyleDeclaration(String).

定義:
インタフェース ExtendedParser 内の parseStyleDeclaration
例外:
IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
CSSException - Any CSS exception, possibly wrapping another exception.

parseRule

public void parseRule(String source)
               throws CSSException,
                      IOException
Implements ExtendedParser.parseRule(String).

定義:
インタフェース ExtendedParser 内の parseRule
例外:
IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
CSSException - Any CSS exception, possibly wrapping another exception.

parseSelectors

public SelectorList parseSelectors(String source)
                            throws CSSException,
                                   IOException
Implements ExtendedParser.parseSelectors(String).

定義:
インタフェース ExtendedParser 内の parseSelectors
例外:
CSSException - Any CSS exception, possibly wrapping another exception.
IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.

parsePropertyValue

public LexicalUnit parsePropertyValue(String source)
                               throws CSSException,
                                      IOException
Implements ExtendedParser.parsePropertyValue(String).

定義:
インタフェース ExtendedParser 内の parsePropertyValue
例外:
CSSException - Any CSS exception, possibly wrapping another exception.
IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.

parsePriority

public boolean parsePriority(String source)
                      throws CSSException,
                             IOException
Implements ExtendedParser.parsePriority(String).

定義:
インタフェース ExtendedParser 内の parsePriority
例外:
IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.
CSSException - Any CSS exception, possibly wrapping another exception.

parseMedia

public SACMediaList parseMedia(String mediaText)
                        throws CSSException,
                               IOException
Implements ExtendedParser.parseMedia(String).

定義:
インタフェース ExtendedParser 内の parseMedia
例外:
CSSException - Any CSS exception, possibly wrapping another exception.
IOException - An IO exception from the parser, possibly from a byte stream or character stream supplied by the application.


(c)2009 GNN & Co.,Ltd.