public interface RegexFlavorProcessor
After either RegexFlavorProcessor.validate() or RegexFlavorProcessor.toECMAScriptRegex() was called,
RegexFlavorProcessor.getNamedCaptureGroups(), RegexFlavorProcessor.getFlags() and RegexFlavorProcessor.isUnicodePattern() can be called to
extract extra information obtained during the parse.
| Modifier and Type | Method and Description |
|---|---|
com.oracle.truffle.api.interop.TruffleObject |
getFlags()
Returns a
TruffleObject representing the compilation flags which were set for the
regular expression. |
Map<String,Integer> |
getNamedCaptureGroups()
Returns a map from the names of capture groups to their indices.
|
int |
getNumberOfCaptureGroups()
Returns the number of capture groups contained in the expression, including capture group 0.
|
boolean |
isUnicodePattern()
Returns
true if the generated ECMAScript pattern is a Unicode pattern (matches
Unicode code points instead of UTF-16 code units). |
RegexSource |
toECMAScriptRegex()
Runs the parser and emits an equivalent ECMAScript regex.
|
void |
validate()
Runs the parser without trying to find an equivalent ECMAScript regex.
|
void validate()
throws RegexSyntaxException
RegexSyntaxException - when the pattern or the flags are not well-formedRegexSource toECMAScriptRegex() throws RegexSyntaxException, UnsupportedRegexException
RegexSource compatible to the input oneRegexSyntaxException - when the pattern or the flags are not well-formedUnsupportedRegexException - when the pattern cannot be translated to an equivalent
ECMAScript patternint getNumberOfCaptureGroups()
Map<String,Integer> getNamedCaptureGroups()
com.oracle.truffle.api.interop.TruffleObject getFlags()
TruffleObject representing the compilation flags which were set for the
regular expression. The returned object responds to 'READ' messages on names which correspond
to the names of the flags as used in the language from which the flavor originates.boolean isUnicodePattern()
true if the generated ECMAScript pattern is a Unicode pattern (matches
Unicode code points instead of UTF-16 code units).