RegExp

class RegExp

Regular Expression extension to Automaton.

Regular expressions are built from the following abstract syntax:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
description of regular expression grammar
*regexp* ::= *unionexp*
|
*unionexp* ::= *interexp* `**|**` *unionexp* (union)
| *interexp*
*interexp* ::= *concatexp* `**&**` *interexp* (intersection) [OPTIONAL]
| *concatexp*
*concatexp* ::= *repeatexp* *concatexp* (concatenation)
| *repeatexp*
*repeatexp* ::= *repeatexp* `**?**` (zero or one occurrence)
| *repeatexp* `*****` (zero or more occurrences)
| *repeatexp* `**+**` (one or more occurrences)
| *repeatexp* `**{***n***}**` (`*n*` occurrences)
| *repeatexp* `**{***n***,}**` (`*n*` or more occurrences)
| *repeatexp* `**{***n***,***m***}**` (`*n*` to `*m*` occurrences, including both)
| *complexp*
*charclassexp* ::= `**[**` *charclasses* `**]**` (character class)
| `**[^**` *charclasses* `**]**` (negated character class)
| *simpleexp*
*charclasses* ::= *charclass* *charclasses*
| *charclass*
*charclass* ::= *charexp* `**-**` *charexp* (character range, including end-points)
| *charexp*
*simpleexp* ::= *charexp*
| `**.**` (any single character)
| `**#**` (the empty language) [OPTIONAL]
| `**@**` (any string) [OPTIONAL]
| `**"**` <Unicode string without double-quotes>  `**"**` (a string)
| `**(**` `**)**` (the empty string)
| `**(**` *unionexp* `**)**` (precedence override)
| `**<**` <identifier> `**>**` (named automaton) [OPTIONAL]
| `**<***n*-*m***>**` (numerical interval) [OPTIONAL]
*charexp* ::= <Unicode character> (a single non-reserved character)
| `**\d**` (a digit [0-9])
| `**\D**` (a non-digit [^0-9])
| `**\s**` (whitespace [ \t\n\r])
| `**\S**` (non whitespace [^\s])
| `**\w**` (a word character [a-zA-Z_0-9])
| `**\W**` (a non word character [^\w])
| `**\**` <Unicode character>  (a single character)
*

The productions marked OPTIONAL are only allowed if specified by the syntax flags passed to the RegExp constructor. The reserved characters used in the (enabled) syntax must be escaped with backslash (**\**) or double-quotes (**"..."**). (In contrast to other regexp syntaxes, this is required also in character classes.) Be aware that dash (**-**) has a special meaning in charclass expressions. An identifier is a string not containing right angle bracket (**&gt;** * ) or dash (**-**). Numerical intervals are specified by non-negative decimal integers and include both end points, and if *n* and *m* * have the same number of digits, then the conforming strings must have that length (i.e. prefixed by 0's).

Constructors

Link copied to clipboard
constructor(s: String, syntax_flags: Int = ALL, match_flags: Int = 0)

Constructs new RegExp from a string. Same as RegExp(s, ALL).

Types

Link copied to clipboard
object Companion
Link copied to clipboard

The type of expression represented by a RegExp node.

Properties

Link copied to clipboard
val c: Int

Character expression

Link copied to clipboard
val digits: Int
Link copied to clipboard

Child expressions held by a container type expression

Link copied to clipboard
Link copied to clipboard
val flags: Int
Link copied to clipboard

Extents for range type expressions

Link copied to clipboard
Link copied to clipboard

The type of expression

Link copied to clipboard
val max: Int
Link copied to clipboard
val min: Int

Limits for repeatable type expressions

Link copied to clipboard

The string that was used to construct the regex. Compare to toString.

Link copied to clipboard
var pos: Int
Link copied to clipboard
val sVal: String?

String expression

Link copied to clipboard
val to: IntArray?

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun iterativeParseExp(gather: () -> RegExp, stop: () -> Boolean, associativeReduce: (Int, RegExp, RegExp) -> RegExp): RegExp
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Constructs new Automaton from this RegExp. Same as toAutomaton(null) (empty automaton map).

fun toAutomaton(automaton_provider: AutomatonProvider?): Automaton?

Constructs new Automaton from this RegExp.

Link copied to clipboard
open override fun toString(): String

Constructs string from parsed regular expression.

Link copied to clipboard
Link copied to clipboard

Like to string, but more verbose (shows the hierarchy more clearly).