Class RegexOptions
java.lang.Object
com.oracle.truffle.regex.RegexOptions
These options define how TRegex should interpret a given parsing request.
Available options:
- Flavor: specifies the regex dialect to use. Possible values:
- ECMAScript: ECMAScript/JavaScript syntax (default).
- Python: Python 3 syntax
- Ruby: Ruby syntax.
- Encoding: specifies the string encoding to match against. Possible values:
- UTF-8
- UTF-16
- UTF-32
- LATIN-1
- BYTES (equivalent to LATIN-1)
- MatchingMode: specifies implicit anchoring modes. See
MatchingModefor details. Possible values:- search
- match
- fullmatch
- PythonLocale: specifies which locale is to be used by this locale-sensitive Python regexp
- Validate: don't generate a regex matcher object, just check the regex for syntax errors.
- U180EWhitespace: treat 0x180E MONGOLIAN VOWEL SEPARATOR as part of
\s. This is a legacy feature for languages using a Unicode standard older than 6.3, such as ECMAScript 6 and older. - UTF16ExplodeAstralSymbols: generate one DFA states per (16 bit)
charinstead of per-codepoint. This may improve performance in certain scenarios, but increases the likelihood of DFA state explosion. - AlwaysEager: do not generate any lazy regex matchers (lazy in the sense that they may
lazily compute properties of a
RegexResult). - RegressionTestMode: exercise all supported regex matcher variants, and check if they produce the same results.
- DumpAutomata: dump all generated parser trees, NFA, and DFA to disk. This will generate debugging dumps of most relevant data structures in JSON, GraphViz and LaTex format.
- StepExecution: dump tracing information about all DFA matcher runs.
- IgnoreAtomicGroups: treat atomic groups as ordinary groups (experimental).
- MustAdvance: force the matcher to advance by at least one character, either by finding a non-zero-width match or by skipping at least one character before matching.
Flavor, Encoding and PythonMethod are boolean and
false by default.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final RegexOptionsstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic final Stringstatic final String[]static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic RegexOptions.BuilderbooleanintJDK compatibility version forJavaFlavor.shortMaximum number of NFA transitions to allow for runtime compilation.shortMaximum number of DFA transitions.inthashCode()booleanAlways match capture groups eagerly.booleanDon't track capture groups, just return a boolean match result instead.booleanProduce ASTs and automata in JSON, DOT (GraphViz) and LaTeX formats.booleanbooleanGenerate DFA matchers immediately after parsing the expression.booleanTry to generate a string that matches the given regex and return it instead of the compiled regex.booleanIgnore atomic groups (found e.g.booleanDo not return zero-width matches at the beginning of the search string.booleanbooleanTrace the execution of automata in JSON files.booleanbooleanExplode astral symbols (0x10000 - 0x10FFFF) into sub-automata where every state matches onecharas opposed to one code point.booleanDo not generate an actual regular expression matcher, just check the given regular expression for syntax errors.toString()
-
Field Details
-
U180E_WHITESPACE_NAME
- See Also:
-
REGRESSION_TEST_MODE_NAME
- See Also:
-
DUMP_AUTOMATA_NAME
- See Also:
-
STEP_EXECUTION_NAME
- See Also:
-
ALWAYS_EAGER_NAME
- See Also:
-
UTF_16_EXPLODE_ASTRAL_SYMBOLS_NAME
- See Also:
-
VALIDATE_NAME
- See Also:
-
IGNORE_ATOMIC_GROUPS_NAME
- See Also:
-
BOOLEAN_MATCH_NAME
- See Also:
-
MUST_ADVANCE_NAME
- See Also:
-
GENERATE_INPUT_NAME
- See Also:
-
FLAVOR_NAME
- See Also:
-
FLAVOR_PYTHON
- See Also:
-
FLAVOR_RUBY
- See Also:
-
FLAVOR_ORACLE_DB
- See Also:
-
FLAVOR_ECMASCRIPT
- See Also:
-
FLAVOR_JAVA
- See Also:
-
ENCODING_NAME
- See Also:
-
PYTHON_METHOD_NAME
- See Also:
-
MATCHING_MODE_NAME
- See Also:
-
MATCHING_MODE_SEARCH
- See Also:
-
MATCHING_MODE_MATCH
- See Also:
-
MATCHING_MODE_FULLMATCH
- See Also:
-
PYTHON_LOCALE_NAME
- See Also:
-
JAVA_JDK_VERSION_NAME
- See Also:
-
JAVA_JDK_VERSION_OPTIONS
-
JAVA_JDK_VERSION_MIN
public static final int JAVA_JDK_VERSION_MIN- See Also:
-
JAVA_JDK_VERSION_MAX
public static final int JAVA_JDK_VERSION_MAX- See Also:
-
MAX_DFA_SIZE_NAME
- See Also:
-
MAX_BACK_TRACKER_SIZE_NAME
- See Also:
-
DEFAULT
-
-
Method Details
-
builder
public static RegexOptions.Builder builder(com.oracle.truffle.api.source.Source source, String sourceString) -
getMaxDFASize
public short getMaxDFASize()Maximum number of DFA transitions. Must be less thanShort.MAX_VALUE. Defaults toTRegexOptions.TRegexMaxDFATransitions. -
getMaxBackTrackerCompileSize
public short getMaxBackTrackerCompileSize()Maximum number of NFA transitions to allow for runtime compilation. Must be less thanShort.MAX_VALUE. Defaults toTRegexOptions.TRegexMaxBackTrackerMergeExplodeSize. -
isU180EWhitespace
public boolean isU180EWhitespace() -
isRegressionTestMode
public boolean isRegressionTestMode() -
isDumpAutomata
public boolean isDumpAutomata()Produce ASTs and automata in JSON, DOT (GraphViz) and LaTeX formats. -
isDumpAutomataWithSourceSections
public boolean isDumpAutomataWithSourceSections() -
isStepExecution
public boolean isStepExecution()Trace the execution of automata in JSON files. -
isGenerateDFAImmediately
public boolean isGenerateDFAImmediately()Generate DFA matchers immediately after parsing the expression. -
isBooleanMatch
public boolean isBooleanMatch()Don't track capture groups, just return a boolean match result instead. -
isAlwaysEager
public boolean isAlwaysEager()Always match capture groups eagerly. -
isUTF16ExplodeAstralSymbols
public boolean isUTF16ExplodeAstralSymbols()Explode astral symbols (0x10000 - 0x10FFFF) into sub-automata where every state matches onecharas opposed to one code point. -
isValidate
public boolean isValidate()Do not generate an actual regular expression matcher, just check the given regular expression for syntax errors. -
isIgnoreAtomicGroups
public boolean isIgnoreAtomicGroups()Ignore atomic groups (found e.g. in Ruby regular expressions), treat them as regular groups. -
isMustAdvance
public boolean isMustAdvance()Do not return zero-width matches at the beginning of the search string. The matcher must advance by at least one character by either finding a match of non-zero width or finding a match after advancing skipping several characters. -
isGenerateInput
public boolean isGenerateInput()Try to generate a string that matches the given regex and return it instead of the compiled regex. -
getFlavor
-
getEncoding
-
getMatchingMode
-
getPythonLocale
-
getJavaJDKVersion
public int getJavaJDKVersion()JDK compatibility version forJavaFlavor. -
withBooleanMatch
-
withoutBooleanMatch
-
hashCode
-
equals
-
toString
-