Class CSS3Parser
java.lang.Object
org.htmlunit.cssparser.parser.AbstractCSSParser
org.htmlunit.cssparser.parser.javacc.CSS3Parser
- All Implemented Interfaces:
CSS3ParserConstants
- Author:
- David Schweinsberg, waldbaer, Ahmed Ashour, Ronald Brill
-
Field Summary
Modifier and TypeFieldDescriptionNext token.Current token.Generated Token Manager.Fields inherited from interface org.htmlunit.cssparser.parser.javacc.CSS3ParserConstants
A_LETTER, AND, ANGLE_DEG, ANGLE_GRAD, ANGLE_RAD, ANGLE_TURN, ASTERISK, ATKEYWORD, C_LETTER, CDC, CDO, CH, CHARSET_SYM, COLON, COMMA, COMMENT, COMMENT_, CUSTOM_PROPERTY_NAME, D_LETTER, DASHMATCH, DEFAULT, DIMENSION, DOT, E_LETTER, EMS, EOF, EQUALS, ESCAPE, EXS, F_LETTER, FONT_FACE_SYM, FREQ_HZ, FREQ_KHZ, FUNCTION, FUNCTION_CALC, FUNCTION_HSL, FUNCTION_HWB, FUNCTION_LAB, FUNCTION_LANG, FUNCTION_LCH, FUNCTION_NOT, FUNCTION_RGB, FUNCTION_VAR, G_LETTER, GREATER, H, H_LETTER, H_PLACEHOLDER, HASH, HNUM, I_LETTER, IDENT, IMPORT_SYM, IMPORTANT_SYM, INCLUDES, INHERIT, K_LETTER, L_LETTER, LBRACE, LENGTH_CM, LENGTH_IN, LENGTH_MM, LENGTH_PC, LENGTH_PT, LENGTH_PX, LENGTH_Q, LROUND, LSQUARE, M_LETTER, MEDIA_SYM, MINUS, N_LETTER, NAME, NL, NMCHAR, NMSTART, NONASCII, NONE, NOT, NUM, NUMBER, O_LETTER, ONLY, P_LETTER, PAGE_SYM, PERCENTAGE, PLUS, PREFIXMATCH, R_LETTER, RBRACE, REM, RESOLUTION_DPCM, RESOLUTION_DPI, RROUND, RSQUARE, S, S_LETTER, SEMICOLON, SLASH, STRING, STRING1, STRING2, SUBSTRINGMATCH, SUFFIXMATCH, T_LETTER, TILDE, TIME_MS, TIME_S, tokenImage, U_LETTER, UNICODE, UNICODE_RANGE, UNKNOWN, URI, URL, VH, VMAX, VMIN, VW, X_LETTER, Z_LETTER
-
Constructor Summary
ConstructorDescriptionCSS3Parser
(CharStream stream) Constructor with user supplied CharStream.Constructor with generated Token Manager. -
Method Summary
Modifier and TypeMethodDescriptionfinal Condition
_class
(boolean pseudoElementFound) final Condition
attrib
(boolean pseudoElementFound) final LexicalUnit
calc
(LexicalUnit prev) final LexicalUnit
calcNumberProduct
(LexicalUnit prev) final LexicalUnit
calcNumberSum
(LexicalUnit prev) final LexicalUnit
calcNumberValue
(LexicalUnit prev) final LexicalUnit
calcProduct
(LexicalUnit prev) final LexicalUnit
calcSum
(LexicalUnit prev) final LexicalUnit
calcValue
(LexicalUnit prev) final void
final char
final void
final LexicalUnit
dimension
(LexicalUnit prev, char op) final void
Disable tracing.final ElementSelector
final void
Enable tracing.final LexicalUnit
expr()
Process an expression.final void
final LexicalUnit
function
(LexicalUnit prev) Generate ParseException.protected String
final Token
final Token
getToken
(int index) final Condition
hash
(boolean pseudoElementFound) final LexicalUnit
hexcolor
(LexicalUnit prev) final LexicalUnit
hslColor
(LexicalUnit prev) final LexicalUnit
hwbColor
(LexicalUnit prev) final Token
ident()
final void
importRule
(boolean nonImportRuleFoundBefore) final LexicalUnit
labColor
(LexicalUnit prev) final LexicalUnit
lchColor
(LexicalUnit prev) final Property
final void
Process a media list.final MediaQuery
final void
final void
final String
medium()
final LexicalUnit
number
(LexicalUnit prev, char op) final LexicalUnit
operator
(LexicalUnit prev) final void
pageRule()
final String
final String
final SelectorList
Process a selector list.final LexicalUnit
percentage
(LexicalUnit prev, char op) final boolean
prio()
Process a prio.final Object
pseudo
(boolean pseudoElementFound) final String
void
ReInit
(CharStream stream) Reinitialise.void
Reinitialisefinal LexicalUnit
rgbColor
(LexicalUnit prev) final Selector
selector()
final SelectorList
final Selector
simpleSelector
(Selector sel, char comb) final void
Process a style sheet declaration.final void
final void
Process a style sheet.final void
final void
Process a style sheet rule.final LexicalUnit
term
(LexicalUnit prev) final boolean
final char
final LexicalUnit
unicodeRange
(LexicalUnit prev) final void
final LexicalUnit
var
(LexicalUnit prev) Methods inherited from class org.htmlunit.cssparser.parser.AbstractCSSParser
addEscapes, createLocator, createSkipWarning, doubleValue, functionInternal, getDocumentHandler, getErrorHandler, getInputSource, getLastNumPos, getParserMessage, handleCharset, handleEndDocument, handleEndFontFace, handleEndMedia, handleEndPage, handleEndSelector, handleIgnorableAtRule, handleImportStyle, handleProperty, handleStartDocument, handleStartFontFace, handleStartMedia, handleStartPage, handleStartSelector, hexColorInternal, hslColorInternal, hwbColorInternal, intValue, labColorInternal, lchColorInternal, normalizeAndValidatePagePseudoClass, parseMedia, parsePriority, parsePropertyValue, parseRule, parseSelectors, parseStyleDeclaration, parseStyleSheet, rgbColorInternal, setDocumentHandler, setErrorHandler, toCSSParseException, toCSSParseException, toCSSParseException, toCSSParseException, unescape
-
Field Details
-
token_source
Generated Token Manager. -
token
Current token. -
jj_nt
Next token.
-
-
Constructor Details
-
CSS3Parser
public CSS3Parser() -
CSS3Parser
Constructor with user supplied CharStream.- Parameters:
stream
- stream to init with
-
CSS3Parser
Constructor with generated Token Manager.- Parameters:
tm
- Token manager to use
-
-
Method Details
-
getParserVersion
- Specified by:
getParserVersion
in classAbstractCSSParser
- Returns:
- a string about which CSS language is supported by this parser. For CSS Level 1, it returns "http://www.w3.org/TR/REC-CSS1", for CSS Level 2, it returns "http://www.w3.org/TR/REC-CSS2". Note that a "CSSx" parser can return lexical unit other than those allowed by CSS Level x but this usage is not recommended.
-
getGrammarUri
-
styleSheet
Description copied from class:AbstractCSSParser
Process a style sheet.- Specified by:
styleSheet
in classAbstractCSSParser
- Throws:
ParseException
- in case of error
-
styleSheetRuleList
- Throws:
ParseException
-
styleSheetRuleSingle
Description copied from class:AbstractCSSParser
Process a style sheet rule.- Specified by:
styleSheetRuleSingle
in classAbstractCSSParser
- Throws:
ParseException
- in case of error
-
charsetRule
- Throws:
ParseException
-
unknownAtRule
- Throws:
ParseException
-
importRule
- Throws:
ParseException
-
mediaRule
- Throws:
ParseException
-
mediaList
Description copied from class:AbstractCSSParser
Process a media list.- Specified by:
mediaList
in classAbstractCSSParser
- Parameters:
ml
- the media list- Throws:
ParseException
- in case of error
-
mediaQuery
- Throws:
ParseException
-
mediaExpression
- Throws:
ParseException
-
mediaRuleList
- Throws:
ParseException
-
medium
- Throws:
ParseException
-
pageRule
- Throws:
ParseException
-
pageSelectorList
- Throws:
ParseException
-
pageSelector
- Throws:
ParseException
-
pseudoPage
- Throws:
ParseException
-
fontFaceRule
- Throws:
ParseException
-
operator
- Throws:
ParseException
-
combinator
- Throws:
ParseException
-
unaryOperator
- Throws:
ParseException
-
styleRule
- Throws:
ParseException
-
parseSelectorsInternal
Description copied from class:AbstractCSSParser
Process a selector list.- Specified by:
parseSelectorsInternal
in classAbstractCSSParser
- Returns:
- the selector list
- Throws:
ParseException
- in case of error
-
selectorList
- Throws:
ParseException
-
selector
- Throws:
ParseException
-
simpleSelector
- Throws:
ParseException
-
_class
- Throws:
ParseException
-
elementName
- Throws:
ParseException
-
attrib
- Throws:
ParseException
-
pseudo
- Throws:
ParseException
-
hash
- Throws:
ParseException
-
styleDeclaration
Description copied from class:AbstractCSSParser
Process a style sheet declaration.- Specified by:
styleDeclaration
in classAbstractCSSParser
- Throws:
ParseException
- in case of error
-
declaration
- Throws:
ParseException
-
prio
Description copied from class:AbstractCSSParser
Process a prio.- Specified by:
prio
in classAbstractCSSParser
- Returns:
- true or false
- Throws:
ParseException
- in case of error
-
expr
Description copied from class:AbstractCSSParser
Process an expression.- Specified by:
expr
in classAbstractCSSParser
- Returns:
- the lexical unit
- Throws:
ParseException
- in case of error
-
term
- Throws:
ParseException
-
function
- Throws:
ParseException
-
calc
- Throws:
ParseException
-
calcSum
- Throws:
ParseException
-
calcProduct
- Throws:
ParseException
-
calcValue
- Throws:
ParseException
-
calcNumberSum
- Throws:
ParseException
-
calcNumberProduct
- Throws:
ParseException
-
calcNumberValue
- Throws:
ParseException
-
var
- Throws:
ParseException
-
rgbColor
- Throws:
ParseException
-
hslColor
- Throws:
ParseException
-
hwbColor
- Throws:
ParseException
-
labColor
- Throws:
ParseException
-
lchColor
- Throws:
ParseException
-
ident
- Throws:
ParseException
-
number
- Throws:
ParseException
-
percentage
- Throws:
ParseException
-
dimension
- Throws:
ParseException
-
unicodeRange
- Throws:
ParseException
-
hexcolor
- Throws:
ParseException
-
ReInit
Reinitialise.- Specified by:
ReInit
in classAbstractCSSParser
- Parameters:
stream
- stream to init with
-
ReInit
Reinitialise- Parameters:
tm
- Token manager to use
-
getNextToken
- Returns:
- the next Token.
-
getToken
- Parameters:
index
- index to be retrieved- Returns:
- the specific Token.
-
generateParseException
Generate ParseException.- Returns:
- new Exception object. Never
null
-
trace_enabled
public final boolean trace_enabled()- Returns:
- Always
false
.
-
enable_tracing
public final void enable_tracing()Enable tracing. -
disable_tracing
public final void disable_tracing()Disable tracing.
-