public final class RubyFlavorProcessor extends Object implements RegexFlavorProcessor
RegexFlavorProcessor| Modifier and Type | Field and Description |
|---|---|
static String |
WORD_BOUNDARY |
static Pattern |
WORD_CHARS_PATTERN |
static String |
WORD_NON_BOUNDARY |
| Constructor and Description |
|---|
RubyFlavorProcessor(RegexSource source) |
| Modifier and Type | Method and Description |
|---|---|
AbstractRegexObject |
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 |
isProperEscapeNext()
Indicates whether the following is a proper escape sequence, which cannot be a part of a
string.
|
boolean |
isQuantifierNext()
Indicates whether a quantifier is coming up next.
|
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.
|
public static final Pattern WORD_CHARS_PATTERN
public static final String WORD_BOUNDARY
public static final String WORD_NON_BOUNDARY
public RubyFlavorProcessor(RegexSource source)
public int getNumberOfCaptureGroups()
RegexFlavorProcessorgetNumberOfCaptureGroups in interface RegexFlavorProcessorpublic Map<String,Integer> getNamedCaptureGroups()
RegexFlavorProcessorgetNamedCaptureGroups in interface RegexFlavorProcessorpublic AbstractRegexObject getFlags()
RegexFlavorProcessorTruffleObject 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.getFlags in interface RegexFlavorProcessorpublic boolean isUnicodePattern()
RegexFlavorProcessortrue if the generated ECMAScript pattern is a Unicode pattern (matches
Unicode code points instead of UTF-16 code units).isUnicodePattern in interface RegexFlavorProcessorpublic void validate()
throws RegexSyntaxException
RegexFlavorProcessorvalidate in interface RegexFlavorProcessorRegexSyntaxException - when the pattern or the flags are not well-formedpublic RegexSource toECMAScriptRegex() throws RegexSyntaxException, UnsupportedRegexException
RegexFlavorProcessortoECMAScriptRegex in interface RegexFlavorProcessorRegexSource 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 patternpublic boolean isProperEscapeNext()
RubyFlavorProcessor.fetchEscapedChar().public boolean isQuantifierNext()