Package org.htmlunit.javascript.regexp
Class HtmlUnitRegExpProxy
java.lang.Object
org.htmlunit.corejs.javascript.regexp.RegExpImpl
org.htmlunit.javascript.regexp.HtmlUnitRegExpProxy
- All Implemented Interfaces:
org.htmlunit.corejs.javascript.RegExpProxy
public class HtmlUnitRegExpProxy
extends org.htmlunit.corejs.javascript.regexp.RegExpImpl
Begins customization of JavaScript RegExp base on JDK regular expression support.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
private static final class
Simple helper. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.apache.commons.logging.Log
Pattern cacheprivate final org.htmlunit.corejs.javascript.RegExpProxy
Fields inherited from class org.htmlunit.corejs.javascript.regexp.RegExpImpl
input, lastMatch, lastParen, leftContext, multiline, parens, rightContext
Fields inherited from interface org.htmlunit.corejs.javascript.RegExpProxy
RA_MATCH, RA_REPLACE, RA_REPLACE_ALL, RA_SEARCH
-
Constructor Summary
ConstructorsConstructorDescriptionHtmlUnitRegExpProxy
(org.htmlunit.corejs.javascript.RegExpProxy wrapped) Wraps a proxy to enhance it. -
Method Summary
Modifier and TypeMethodDescriptionaction
(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, int actionType) Use the wrapped proxy except for replacement with string arg where it uses Java regular expression.compileRegExp
(org.htmlunit.corejs.javascript.Context cx, String source, String flags) (package private) String
computeReplacementValue
(String replacement, String originalString, MatchResult matcher, boolean group0ReturnsWholeMatch) private Object
doAction
(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, int actionType) private String
doReplacement
(String originalString, String replacement, Matcher matcher, boolean replaceAll) private String
doStringReplacement
(String originalString, String searchString, String replacement, boolean replaceAll) int
find_split
(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, String target, String separator, org.htmlunit.corejs.javascript.Scriptable re, int[] ip, int[] matchlen, boolean[] matched, String[][] parensp) boolean
isRegExp
(org.htmlunit.corejs.javascript.Scriptable obj) (package private) static String
Transform a JavaScript regular expression to a Java regular expressionprivate void
setProperties
(Matcher matcher, String thisString, int startPos, int endPos) private Object
wrappedAction
(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, int actionType) Calls action on the wrapped RegExp proxy.org.htmlunit.corejs.javascript.Scriptable
wrapRegExp
(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, Object compiled) Methods inherited from class org.htmlunit.corejs.javascript.regexp.RegExpImpl
js_split
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
PATTENS
Pattern cache -
wrapped_
private final org.htmlunit.corejs.javascript.RegExpProxy wrapped_
-
-
Constructor Details
-
HtmlUnitRegExpProxy
public HtmlUnitRegExpProxy(org.htmlunit.corejs.javascript.RegExpProxy wrapped) Wraps a proxy to enhance it.- Parameters:
wrapped
- the original proxy
-
-
Method Details
-
action
public Object action(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, int actionType) Use the wrapped proxy except for replacement with string arg where it uses Java regular expression.- Specified by:
action
in interfaceorg.htmlunit.corejs.javascript.RegExpProxy
- Overrides:
action
in classorg.htmlunit.corejs.javascript.regexp.RegExpImpl
-
doAction
-
doStringReplacement
-
doReplacement
-
computeReplacementValue
String computeReplacementValue(String replacement, String originalString, MatchResult matcher, boolean group0ReturnsWholeMatch) -
wrappedAction
private Object wrappedAction(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, int actionType) Calls action on the wrapped RegExp proxy. -
setProperties
-
compileRegExp
- Specified by:
compileRegExp
in interfaceorg.htmlunit.corejs.javascript.RegExpProxy
- Overrides:
compileRegExp
in classorg.htmlunit.corejs.javascript.regexp.RegExpImpl
-
find_split
public int find_split(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, String target, String separator, org.htmlunit.corejs.javascript.Scriptable re, int[] ip, int[] matchlen, boolean[] matched, String[][] parensp) - Specified by:
find_split
in interfaceorg.htmlunit.corejs.javascript.RegExpProxy
- Overrides:
find_split
in classorg.htmlunit.corejs.javascript.regexp.RegExpImpl
-
isRegExp
public boolean isRegExp(org.htmlunit.corejs.javascript.Scriptable obj) - Specified by:
isRegExp
in interfaceorg.htmlunit.corejs.javascript.RegExpProxy
- Overrides:
isRegExp
in classorg.htmlunit.corejs.javascript.regexp.RegExpImpl
-
wrapRegExp
public org.htmlunit.corejs.javascript.Scriptable wrapRegExp(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, Object compiled) - Specified by:
wrapRegExp
in interfaceorg.htmlunit.corejs.javascript.RegExpProxy
- Overrides:
wrapRegExp
in classorg.htmlunit.corejs.javascript.regexp.RegExpImpl
-
jsRegExpToJavaRegExp
Transform a JavaScript regular expression to a Java regular expression- Parameters:
re
- the JavaScript regular expression to transform- Returns:
- the transformed expression
-