Class GssParserCC
- java.lang.Object
-
- com.google.common.css.compiler.ast.GssParserCCConstants
-
- com.google.common.css.compiler.ast.GssParserCC
-
public class GssParserCC extends GssParserCCConstants
A parser that recognizes GSS files and builds the new AST.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCRAZY_CONTENT-
Fields inherited from class com.google.common.css.compiler.ast.GssParserCCConstants
ALPHA, AMPERSAND, AND, ASTERISK, ASTERISK_EQUALS, AT, ATKEYWORD, ATLIST, ATRULESWITHDECLBLOCK, BAD_TOKEN, CALC, CARET, CARET_EQUALS, CDC, CDO, COLON, COMMA, CUSTOM_PROPERTY_NAME, DEFAULT, DIGIT, DOLLAR, DOLLAR_EQUALS, DOT, DOUBLE_QUOTE, DOUBLE_QUOTED_STRING, EOF, EQUALS, ESCAPE, EXCL_MARK, FOR_VARIABLE, FUNCTION, GREATER, HASH, HASH_NAME, HEX, HEXNUM, IDENTIFIER, IMPORTANT_SYM, LANGFUNCTION, LEFTBRACE, LEFTROUND, LEFTSQUARE, MINUS, NAME, NAMECHAR, NAMESTART, NL, NL1, NONASCII, NOTFUNCTION, NUMBER, OR, PERCENT, PIPE, PIPE_EQUALS, PLUS, RIGHTBRACE, RIGHTROUND, RIGHTSQUARE, S, SEMICOLON, SINGLE_QUOTE, SINGLE_QUOTED_STRING, SLASH, TILDE, TILDE_EQUALS, tokenImage, UNDERSCORE, UNICODE, UNICODE_RANGE, UNICODE_RANGE_TEXT, URI, URL, VARFUNCTION, W, WDEEP, WEBKITKEYFRAMES, WGREATER, WMINUSW, WPLUS, WTILDE
-
-
Constructor Summary
Constructors Constructor Description GssParserCC(CharStream stream)Constructor with user supplied CharStream.
-
Method Summary
-
-
-
Field Detail
-
CRAZY_CONTENT
public static final java.lang.String CRAZY_CONTENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GssParserCC
public GssParserCC(CharStream stream)
Constructor with user supplied CharStream.
-
-
Method Detail
-
parse
public void parse() throws GssParserException- Throws:
GssParserException
-
parse
public void parse(CssBlockNode globalBlock, SourceCode sourceCode, boolean errorHandling, com.google.common.collect.ImmutableList.Builder<GssParserException> parsingErrors) throws GssParserException
Wrapper aroundparse()that (re-)initializes the parser and clears its state afterwards.- Parameters:
globalBlock- the place to store parsing resultsourceCode- the source code to parseerrorHandling- whether error handling is enabledparsingErrors- the place to store errors occured during parsing- Throws:
GssParserException
-
string
public final CssStringNode string() throws ParseException
- Throws:
ParseException
-
ruleSet
public final CssRulesetNode ruleSet() throws ParseException
- Throws:
ParseException
-
selectorList
public final CssSelectorListNode selectorList() throws ParseException
- Throws:
ParseException
-
selector
public final CssSelectorNode selector() throws ParseException
- Throws:
ParseException
-
className
public final CssClassSelectorNode className() throws ParseException
- Throws:
ParseException
-
id
public final CssRefinerNode id() throws ParseException
- Throws:
ParseException
-
pseudo
public final CssRefinerNode pseudo() throws ParseException
- Throws:
ParseException
-
nth
public final java.lang.String nth() throws ParseException- Throws:
ParseException
-
attribute
public final CssAttributeSelectorNode attribute() throws ParseException
- Throws:
ParseException
-
simpleSelector
public final CssSelectorNode simpleSelector() throws ParseException
- Throws:
ParseException
-
elementName
public final Token elementName() throws ParseException
- Throws:
ParseException
-
combinator
public final CssCombinatorNode combinator() throws ParseException
- Throws:
ParseException
-
styleDeclaration
public final CssDeclarationBlockNode styleDeclaration() throws ParseException
- Throws:
ParseException
-
declaration
public final CssNode declaration() throws ParseException
- Throws:
ParseException
-
customDeclaration
public final CssDeclarationNode customDeclaration() throws ParseException
- Throws:
ParseException
-
customDeclarationValue
public final CssPropertyValueNode customDeclarationValue() throws ParseException
- Throws:
ParseException
-
standardDeclaration
public final CssDeclarationNode standardDeclaration() throws ParseException
- Throws:
ParseException
-
expr
public final CssPropertyValueNode expr() throws ParseException
- Throws:
ParseException
-
compositeTerm
public final CssValueNode compositeTerm() throws ParseException
- Throws:
ParseException
-
assignTerm
public final CssValueNode assignTerm() throws ParseException
- Throws:
ParseException
-
slashTerm
public final CssValueNode slashTerm() throws ParseException
- Throws:
ParseException
-
term
public final CssValueNode term() throws ParseException
- Throws:
ParseException
-
extendedTerm
public final CssBooleanExpressionNode extendedTerm() throws ParseException
- Throws:
ParseException
-
booleanAndTerm
public final CssBooleanExpressionNode booleanAndTerm() throws ParseException
- Throws:
ParseException
-
booleanNegatedTerm
public final CssBooleanExpressionNode booleanNegatedTerm() throws ParseException
- Throws:
ParseException
-
basicTerm
public final CssBooleanExpressionNode basicTerm() throws ParseException
- Throws:
ParseException
-
parenthesizedTerm
public final CssBooleanExpressionNode parenthesizedTerm() throws ParseException
- Throws:
ParseException
-
unaryOperator
public final Token unaryOperator() throws ParseException
- Throws:
ParseException
-
hexcolor
public final Token hexcolor() throws ParseException
- Throws:
ParseException
-
varNode
public final CssFunctionNode varNode() throws ParseException
- Throws:
ParseException
-
uri
public final CssFunctionNode uri() throws ParseException
- Throws:
ParseException
-
function
public final CssFunctionNode function() throws ParseException
Note: We allow the function name to have : and . to support non-standard IE functions- Returns:
- function node
- Throws:
ParseException
-
calc
public final CssFunctionNode calc() throws ParseException
- Throws:
ParseException
-
sum
public final CssValueNode sum(boolean hasParenthesis) throws ParseException
- Throws:
ParseException
-
product
public final CssValueNode product(boolean hasParenthesis) throws ParseException
- Throws:
ParseException
-
unit
public final CssValueNode unit() throws ParseException
- Throws:
ParseException
-
atFunction
public final CssFunctionNode atFunction() throws ParseException
- Throws:
ParseException
-
important
public final CssPriorityNode important() throws ParseException
- Throws:
ParseException
-
atRule
public final CssAtRuleNode atRule() throws ParseException
- Throws:
ParseException
-
atRuleWithDeclBlock
public final CssAtRuleNode atRuleWithDeclBlock() throws ParseException
- Throws:
ParseException
-
innerAtRule
public final CssAtRuleNode innerAtRule() throws ParseException
- Throws:
ParseException
-
webkitKeyframesRule
public final CssAtRuleNode webkitKeyframesRule() throws ParseException
- Throws:
ParseException
-
webkitKeyframesBlock
public final CssBlockNode webkitKeyframesBlock() throws ParseException
- Throws:
ParseException
-
webkitKeyframeRuleSet
public final CssKeyframeRulesetNode webkitKeyframeRuleSet() throws ParseException
- Throws:
ParseException
-
keyList
public final CssKeyListNode keyList() throws ParseException
- Throws:
ParseException
-
key
public final CssKeyNode key() throws ParseException
- Throws:
ParseException
-
block
public final CssBlockNode block(boolean isEnclosedWithBraces) throws ParseException
- Throws:
ParseException
-
start
public final void start() throws ParseException- Throws:
ParseException
-
atRuleWithCrazySyntax
public final CssAtRuleNode atRuleWithCrazySyntax() throws ParseException
- Throws:
ParseException
-
crazyBlockBrace
public final CssLiteralNode crazyBlockBrace() throws ParseException
A last-resort, minimally-restrictive brace-delimited production.- Returns:
- literal node
- Throws:
ParseException
-
crazyBlockBracket
public final CssLiteralNode crazyBlockBracket() throws ParseException
Inside blocks, brackets, parens, and braces must be balanced.- Returns:
- literal node
- Throws:
ParseException
-
crazyBlockParen
public final CssLiteralNode crazyBlockParen() throws ParseException
Inside blocks, brackets, parens, and braces must be balanced.- Returns:
- literal node
- Throws:
ParseException
-
reInit
public void reInit(CharStream stream)
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.
-
-