com.vaadin.sass.internal.parser
Class Parser

java.lang.Object
  extended by com.vaadin.sass.internal.parser.Parser
All Implemented Interfaces:
ParserConstants, org.w3c.css.sac.Parser

public class Parser
extends java.lang.Object
implements org.w3c.css.sac.Parser, ParserConstants

A CSS2 parser

Version:
$Revision: 1.15 $
Author:
Philippe Le H�garet

Field Summary
protected  org.w3c.css.sac.ConditionFactory conditionFactory
           
protected  SCSSDocumentHandlerImpl documentHandler
           
protected  org.w3c.css.sac.ErrorHandler errorHandler
           
 Token jj_nt
          Next token.
protected  org.w3c.css.sac.SelectorFactory selectorFactory
           
protected  org.w3c.css.sac.InputSource source
           
 Token token
          Current token.
 ParserTokenManager token_source
          Generated Token Manager.
 
Fields inherited from interface com.vaadin.sass.internal.parser.ParserConstants
_URL, AND, ANY, APPEND, ATKEYWORD, CARETMATCH, CDC, CDO, CHARSET_SYM, CM, COLON, COMMA, COMPARE, CONTAINS, CONTENT_SYM, D, DASHMATCH, DEBUG_SYM, DEFAULT, DEG, DIMEN, DIV, DOLLARMATCH, DOT, EACH_IN, EACH_SYM, ELSE_SYM, EMS, EOF, EQ, ESCAPE, EXS, EXTEND_SYM, FONT_FACE_SYM, FOR_SYM, FORMAL_COMMENT, FROM, FUNCTION, FUNCTION_SYM, GRAD, GUARDED_SYM, H, HASH, HZ, IDENT, IF, IF_SYM, IMPORT_SYM, IMPORTANT_SYM, IN, IN_FORMAL_COMMENT, IN_MULTI_LINE_COMMENT, IN_SINGLE_LINE_COMMENT, INCLUDE_SYM, INCLUDES, INTERPOLATION, KEY_FRAME_SYM, KHZ, LBRACE, LBRACKET, LEM, LPARAN, MEDIA_SYM, MICROSOFT_RULE, MINUS, MIXIN_SYM, MM, MOD, MOZ_DOCUMENT_SYM, MS, MULTI_LINE_COMMENT, NAME, NMCHAR, NMSTART, NONASCII, NOT_EQ, NUMBER, OR, PAGE_SYM, PARENT, PC, PERCENTAGE, PLUS, PRECEDES, PT, PX, RAD, RANGE, RANGE0, RANGE1, RANGE2, RANGE3, RANGE4, RANGE5, RANGE6, RBRACE, RBRACKET, REM, REMOVE, RETURN_SYM, RPARAN, S, SECOND, SEMICOLON, SIBLING, STARMATCH, STRING, STRINGCHAR, SUCCEEDS, SUPPORTS_SYM, THROUGH, TO, tokenImage, UNI, UNICODE, UNICODERANGE, UNKNOWN, URL, VARIABLE, WARN_SYM, WHILE_SYM
 
Constructor Summary
Parser()
          Creates a new Parser
Parser(CharStream stream)
          Constructor with user supplied CharStream.
Parser(ParserTokenManager tm)
          Constructor with generated Token Manager.
 
Method Summary
 java.lang.String _class(java.lang.String 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.
 java.util.ArrayList<java.lang.String> _parseSelectors()
           
 void afterImportDeclaration()
           
 void appendDirective()
           
 java.util.ArrayList<VariableNode> arglist()
           
 java.util.ArrayList<LexicalUnitImpl> argValuelist()
           
 void atRuleDeclaration()
           
 java.lang.String attrib(java.lang.String pred)
           
 java.lang.String booleanExpressionToken()
           
 void charset()
           
 char combinator()
           
 char combinatorChar()
          to refactor combinator and reuse in selector().
 java.lang.String containsDirective()
           
 void contentDirective()
           
 void controlDirective()
           
 void debugDirective()
           
 void debuggingDirective()
           
 void declaration()
           
 void declarationOrNestedProperties()
           
 void disable_tracing()
          Disable tracing.
 void eachDirective()
           
 java.lang.String element_name()
           
 void elseDirective()
           
 void enable_tracing()
          Enable tracing.
 LexicalUnitImpl expr()
           
 void extendDirective()
           
 void fontFace()
           
 Node forDirective()
           
 LexicalUnitImpl function(char operator, LexicalUnitImpl prev)
          Handle all CSS2 functions.
 java.lang.String functionName()
           
 ParseException generateParseException()
          Generate ParseException.
 org.w3c.css.sac.InputSource getInputSource()
           
 Token getNextToken()
          Get the next Token.
 java.lang.String getParserVersion()
          This methods returns "http://www.w3.org/TR/REC-CSS2".
 Token getToken(int index)
          Get the specific Token.
 boolean guarded()
           
 java.lang.String hash(java.lang.String pred)
           
 LexicalUnitImpl hexcolor(LexicalUnitImpl prev)
           
 void ifContentStatement()
           
 void ifDirective()
           
 void ignoreStatement()
           
 void importDeclaration()
          The import statement
 void includeDirective()
           
 java.lang.String interpolation()
           
 void keyframes()
           
 void keyframeSelector()
           
 void listModifyDirective()
           
 void media()
           
 void mediaStatement(MediaListImpl ml)
           
 java.lang.String medium()
           
 void microsoftExtension()
           
 VariableNode mixinArg()
           
 void mixinDirective()
           
 void nestedProperties()
           
 LexicalUnitImpl nonVariableTerm(LexicalUnitImpl prev)
           
 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)
           
 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()
           
 java.lang.String pseudo(java.lang.String pred)
           
 void ReInit(CharStream stream)
          Reinitialise.
 void ReInit(ParserTokenManager tm)
          Reinitialise.
 void removeDirective()
           
 Node returnDirective()
           
 java.lang.String selector()
           
 java.util.ArrayList<java.lang.String> 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)
           
 java.lang.String simple_selector(java.lang.String selector, char comb)
           
 void skipUnknownRule()
           
 java.util.ArrayList<java.lang.String> stringList()
           
 void styleRule()
           
 void styleRuleOrDeclarationOrNestedProperties()
           
 LexicalUnitImpl term(LexicalUnitImpl prev)
           
 char unaryOperator()
           
 LexicalUnitImpl unicode(LexicalUnitImpl prev)
           
 LexicalUnitImpl url(LexicalUnitImpl prev)
           
 void variable()
           
 java.lang.String variableName()
           
 LexicalUnitImpl variableTerm(LexicalUnitImpl prev)
           
 void warnDirective()
           
 Node whileDirective()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

documentHandler

protected SCSSDocumentHandlerImpl 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

token_source

public ParserTokenManager token_source
Generated Token Manager.


token

public Token token
Current token.


jj_nt

public Token jj_nt
Next token.

Constructor Detail

Parser

public Parser()
Creates a new Parser


Parser

public Parser(CharStream stream)
Constructor with user supplied CharStream.


Parser

public Parser(ParserTokenManager tm)
Constructor with generated Token Manager.

Method Detail

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

getInputSource

public org.w3c.css.sac.InputSource getInputSource()

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

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.

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.

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

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.

Throws:
org.w3c.css.sac.CSSException
java.io.IOException

parseMediaRule

public void parseMediaRule(org.w3c.css.sac.InputSource source)
                    throws org.w3c.css.sac.CSSException,
                           java.io.IOException
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
Specified by:
parseSelectors in interface org.w3c.css.sac.Parser
Throws:
org.w3c.css.sac.CSSException
java.io.IOException

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
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
Throws:
org.w3c.css.sac.CSSException
java.io.IOException

parserUnit

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

Throws:
ParseException - exception during the parse

charset

public final void charset()
                   throws ParseException
Throws:
ParseException

afterImportDeclaration

public final void afterImportDeclaration()
                                  throws ParseException
Throws:
ParseException

ignoreStatement

public final void ignoreStatement()
                           throws ParseException
Throws:
ParseException

importDeclaration

public final void importDeclaration()
                             throws ParseException
The import statement

Throws:
ParseException - exception during the parse

keyframes

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

keyframeSelector

public final void keyframeSelector()
                            throws ParseException
Throws:
ParseException

media

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

mediaStatement

public final void mediaStatement(MediaListImpl ml)
                          throws ParseException
Throws:
ParseException

medium

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

page

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

pseudo_page

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

fontFace

public final void fontFace()
                    throws ParseException
Throws:
ParseException

atRuleDeclaration

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

skipUnknownRule

public final void skipUnknownRule()
                           throws ParseException
Throws:
ParseException

combinator

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

combinatorChar

public final char combinatorChar()
                          throws ParseException
to refactor combinator and reuse in selector().

Throws:
ParseException

microsoftExtension

public final void microsoftExtension()
                              throws ParseException
Throws:
ParseException

property

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

variableName

public final java.lang.String variableName()
                                    throws ParseException
Throws:
ParseException

functionName

public final java.lang.String functionName()
                                    throws ParseException
Throws:
ParseException

styleRule

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

selectorList

public final java.util.ArrayList<java.lang.String> selectorList()
                                                         throws ParseException
Throws:
ParseException

selector

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

simple_selector

public final java.lang.String simple_selector(java.lang.String selector,
                                              char comb)
                                       throws ParseException
Throws:
ParseException - exception during the parse

_class

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

element_name

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

attrib

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

pseudo

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

hash

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

variable

public final void variable()
                    throws ParseException
Throws:
ParseException

controlDirective

public final void controlDirective()
                            throws ParseException
Throws:
ParseException

ifContentStatement

public final void ifContentStatement()
                              throws ParseException
Throws:
ParseException

ifDirective

public final void ifDirective()
                       throws ParseException
Throws:
ParseException

elseDirective

public final void elseDirective()
                         throws ParseException
Throws:
ParseException

booleanExpressionToken

public final java.lang.String booleanExpressionToken()
                                              throws ParseException
Throws:
ParseException

eachDirective

public final void eachDirective()
                         throws ParseException
Throws:
ParseException

stringList

public final java.util.ArrayList<java.lang.String> stringList()
                                                       throws ParseException
Throws:
ParseException

mixinDirective

public final void mixinDirective()
                          throws ParseException
Throws:
ParseException

arglist

public final java.util.ArrayList<VariableNode> arglist()
                                                throws ParseException
Throws:
ParseException

mixinArg

public final VariableNode mixinArg()
                            throws ParseException
Throws:
ParseException

argValuelist

public final java.util.ArrayList<LexicalUnitImpl> argValuelist()
                                                        throws ParseException
Throws:
ParseException

includeDirective

public final void includeDirective()
                            throws ParseException
Throws:
ParseException

interpolation

public final java.lang.String interpolation()
                                     throws ParseException
Throws:
ParseException

listModifyDirective

public final void listModifyDirective()
                               throws ParseException
Throws:
ParseException

appendDirective

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

removeDirective

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

containsDirective

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

returnDirective

public final Node returnDirective()
                           throws ParseException
Throws:
ParseException

debuggingDirective

public final void debuggingDirective()
                              throws ParseException
Throws:
ParseException

debugDirective

public final void debugDirective()
                          throws ParseException
Throws:
ParseException

warnDirective

public final void warnDirective()
                         throws ParseException
Throws:
ParseException

forDirective

public final Node forDirective()
                        throws ParseException
Throws:
ParseException

whileDirective

public final Node whileDirective()
                          throws ParseException
Throws:
ParseException

extendDirective

public final void extendDirective()
                           throws ParseException
Throws:
ParseException

contentDirective

public final void contentDirective()
                            throws ParseException
Throws:
ParseException

nestedProperties

public final void nestedProperties()
                            throws ParseException
Throws:
ParseException

styleRuleOrDeclarationOrNestedProperties

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

declarationOrNestedProperties

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

declaration

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

prio

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

guarded

public final boolean guarded()
                      throws ParseException
Throws:
ParseException

operator

public final LexicalUnitImpl operator(LexicalUnitImpl prev)
                               throws ParseException
Throws:
ParseException - exception during the parse

expr

public final LexicalUnitImpl expr()
                           throws ParseException
Throws:
ParseException - exception during the parse

unaryOperator

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

term

public final LexicalUnitImpl term(LexicalUnitImpl prev)
                           throws ParseException
Throws:
ParseException - exception during the parse

variableTerm

public final LexicalUnitImpl variableTerm(LexicalUnitImpl prev)
                                   throws ParseException
Throws:
ParseException

nonVariableTerm

public final LexicalUnitImpl nonVariableTerm(LexicalUnitImpl prev)
                                      throws ParseException
Throws:
ParseException

function

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

Throws:
ParseException - exception during the parse

unicode

public final LexicalUnitImpl unicode(LexicalUnitImpl prev)
                              throws ParseException
Throws:
ParseException

url

public final LexicalUnitImpl url(LexicalUnitImpl prev)
                          throws ParseException
Throws:
ParseException

hexcolor

public final LexicalUnitImpl hexcolor(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

_parseImportRule

public final void _parseImportRule()
                            throws ParseException
Throws:
ParseException

_parseMediaRule

public final void _parseMediaRule()
                           throws ParseException
Throws:
ParseException

_parseDeclarationBlock

public final void _parseDeclarationBlock()
                                  throws ParseException
Throws:
ParseException

_parseSelectors

public final java.util.ArrayList<java.lang.String> _parseSelectors()
                                                            throws ParseException
Throws:
ParseException

ReInit

public void ReInit(CharStream stream)
Reinitialise.


ReInit

public void ReInit(ParserTokenManager tm)
Reinitialise.


getNextToken

public final Token getNextToken()
Get the next Token.


getToken

public final Token getToken(int index)
Get the specific Token.


generateParseException

public ParseException generateParseException()
Generate ParseException.


enable_tracing

public final void enable_tracing()
Enable tracing.


disable_tracing

public final void disable_tracing()
Disable tracing.



Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.