public interface RegexCompiler
RegexCompilers are very similar to RegexEngines. RegexEngines produce
RegexObjects, which contain metadata about the compiled regular expression and lazy
access to a CompiledRegexObjects. When the CompiledRegexObject of a
RegexObject is needed, the RegexEngine delegates to a RegexCompiler to do
the actual work. A RegexCompiler then (eagerly) compiles its input and returns a
CompiledRegexObject. RegexCompilers exist because they are easier to compose
RegexCompilers using combinators such as RegexCompilerWithFallback and because
they are easier to provide by third-party RegExp engines. RegexEngines exist because they
provide features that are desired by users of RegexLanguage (e.g. lazy compilation).| Modifier and Type | Method and Description |
|---|---|
Object |
compile(RegexSource source)
Uses the compiler to try and compile the regular expression described in
source. |
Object compile(RegexSource source) throws RegexSyntaxException, UnsupportedRegexException
source.CompiledRegexObject or a TruffleObject compatible to
RegexObjectRegexSyntaxException - if the engine discovers a syntax error in the regular expressionUnsupportedRegexException - if the regular expression is not supported by the engine