java.lang.Object
org.htmlunit.cssparser.parser.AbstractCSSParser
org.htmlunit.cssparser.parser.javacc.CSS3Parser
org.htmlunit.WebClient.PooledCSS3Parser
- All Implemented Interfaces:
AutoCloseable,org.htmlunit.cssparser.parser.javacc.CSS3ParserConstants
- Enclosing class:
- WebClient
public static class WebClient.PooledCSS3Parser
extends org.htmlunit.cssparser.parser.javacc.CSS3Parser
implements AutoCloseable
This is a poolable CSS3Parser which can be reused automatically when closed.
A regular CSS3Parser is not thread-safe, hence also our pooled parser
is not thread-safe.
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
-
Field Summary
Fields inherited from class org.htmlunit.cssparser.parser.javacc.CSS3Parser
jj_nt, token, token_sourceFields inherited from interface org.htmlunit.cssparser.parser.javacc.CSS3ParserConstants
AND, ANGLE_DEG, ANGLE_GRAD, ANGLE_RAD, ANGLE_TURN, ASTERISK, ATKEYWORD, CDC, CDO, CH, CHARSET_SYM, COLON, COMMA, COMMENT, COMMENT_, CUSTOM_PROPERTY_NAME, DASHMATCH, DEFAULT, DIMENSION, DOT, DVH, DVMAX, DVMIN, DVW, EMS, EOF, EQUALS, ESCAPE, EXS, FONT_FACE_SYM, FREQ_HZ, FREQ_KHZ, FROM, FUNCTION, FUNCTION_CALC, FUNCTION_HAS, FUNCTION_HSL, FUNCTION_HWB, FUNCTION_IS, FUNCTION_LAB, FUNCTION_LANG, FUNCTION_LCH, FUNCTION_NOT, FUNCTION_RGB, FUNCTION_VAR, FUNCTION_WHERE, GREATER, H, H_PLACEHOLDER, HASH, HNUM, IDENT, IMPORT_SYM, IMPORTANT_SYM, INCLUDES, INHERIT, LBRACE, LENGTH_CM, LENGTH_IN, LENGTH_MM, LENGTH_PC, LENGTH_PT, LENGTH_PX, LENGTH_Q, LROUND, LSQUARE, LVH, LVMAX, LVMIN, LVW, MEDIA_SYM, MINUS, NAME, NL, NMCHAR, NMSTART, NONASCII, NONE, NOT, NUM, NUMBER, ONLY, PAGE_SYM, PERCENTAGE, PLUS, PREFIXMATCH, RBRACE, REM, RESOLUTION_DPCM, RESOLUTION_DPI, RROUND, RSQUARE, S, SEMICOLON, SLASH, STRING, STRING1, STRING2, SUBSTRINGMATCH, SUFFIXMATCH, SVH, SVMAX, SVMIN, SVW, TILDE, TIME_MS, TIME_S, tokenImage, UNICODE, UNICODE_RANGE, UNKNOWN, URI, URL, VH, VMAX, VMIN, VW -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate a new poolable parser. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Implements the AutoClosable interface.protected WebClient.PooledCSS3ParserResets the parser's pool state so it can be safely returned again.Methods inherited from class org.htmlunit.cssparser.parser.javacc.CSS3Parser
_class, angle, attrib, calc, calcNumberProduct, calcNumberSum, calcNumberValue, calcProduct, calcSum, calcValue, charsetRule, combinator, declaration, dimension, disable_tracing, elementName, enable_tracing, expr, fontFaceRule, function, generateParseException, getGrammarUri, getNextToken, getParserVersion, getToken, hash, hexcolor, hslColor, hwbColor, ident, identExcludingInherit, identExcludingOnly, importRule, labColor, lchColor, mediaExpression, mediaList, mediaQuery, mediaRule, mediaRuleList, medium, number, operator, pageRule, pageSelector, pageSelectorList, parseSelectorsInternal, percentage, prio, pseudo, pseudoPage, ReInit, ReInit, relativeCombinator, relativeSelectorList, rgbColor, selector, selectorList, simpleSelector, styleDeclaration, styleRule, styleSheet, styleSheetRuleList, styleSheetRuleSingle, term, trace_enabled, unaryOperator, unicodeRange, unknownAtRule, varMethods 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
-
Constructor Details
-
PooledCSS3Parser
Create a new poolable parser.- Parameters:
pool- the pool the parser should return to when it is closed
-
-
Method Details
-
markInUse
Resets the parser's pool state so it can be safely returned again.- Parameters:
pool- the pool the parser should return to when it is closed- Returns:
- this parser for fluid programming
-
close
public void close()Implements the AutoClosable interface. The return method ensures that we are notified when we incorrectly close it twice which indicates a programming flow defect.- Specified by:
closein interfaceAutoCloseable- Throws:
IllegalStateException- in case the parser is closed several times
-