public final class RubyRegexParser extends Object implements RegexValidator, RegexParser
| Modifier and Type | Method and Description |
|---|---|
static RegexParser |
createParser(RegexLanguage language,
RegexSource source,
CompilationBuffer compilationBuffer) |
static RegexValidator |
createValidator(RegexSource source) |
AbstractRegexObject |
getFlags()
Returns a
TruffleObject representing the compilation flags which were set for the
regular expression. |
AbstractRegexObject |
getNamedCaptureGroups()
Returns a map from the names of capture groups to their indices.
|
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.
|
RegexAST |
parse()
Runs the parser and produces an AST.
|
void |
validate()
Checks the regular expression for syntax errors without building an AST.
|
public static RegexValidator createValidator(RegexSource source) throws RegexSyntaxException
RegexSyntaxExceptionpublic static RegexParser createParser(RegexLanguage language, RegexSource source, CompilationBuffer compilationBuffer) throws RegexSyntaxException
RegexSyntaxExceptionpublic AbstractRegexObject getNamedCaptureGroups()
RegexParserRegexParser.parse().getNamedCaptureGroups in interface RegexParserpublic AbstractRegexObject getFlags()
RegexParserTruffleObject 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. This
method has to be called after calling RegexParser.parse().getFlags in interface RegexParserpublic void validate()
throws RegexSyntaxException
RegexValidatorvalidate in interface RegexValidatorRegexSyntaxException - when the pattern or the flags are not well-formedpublic RegexAST parse() throws RegexSyntaxException, UnsupportedRegexException
RegexParserparse in interface RegexParserRegexSyntaxException - when the pattern or the flags are not well-formedUnsupportedRegexException - when the pattern cannot be translated to an equivalent
ECMAScript patternpublic boolean isProperEscapeNext()
RubyRegexParser.fetchEscapedChar().public boolean isQuantifierNext()