Parser

weaponregex.parser.Parser
See theParser companion object
abstract class Parser(val pattern: String)

The based abstract parser

Attributes

pattern

The regex pattern to be parsed

Note:

The parsing rules methods inside this class is created based on the defined grammar

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ParserJS
class ParserJVM

Members list

Concise view

Value members

Abstract methods

def charOct[A : ParsingRun]: ParsingRun[MetaChar]

Parse a character with octal value

Parse a character with octal value

Attributes

Returns:

weaponregex.model.regextree.MetaChar tree node

Example:

"\012"

Concrete methods

def Indexed[A : ParsingRun, T](p: => ParsingRun[T]): ParsingRun[(Location, T)]

A higher order parser that add weaponregex.model.Location index information of the parse of the given parser

A higher order parser that add weaponregex.model.Location index information of the parse of the given parser

Attributes

p

the parser to be indexed

Returns:

A tuple of the weaponregex.model.Location of the parse, and the return of the given parser p

def RE[A : ParsingRun]: ParsingRun[RegexTree]

The top-level parsing rule which can parse either or or simpleRE

The top-level parsing rule which can parse either or or simpleRE

Attributes

Returns:

weaponregex.model.regextree.RegexTree tree

Example:

any supported regex

def anyDot[A : ParsingRun]: ParsingRun[AnyDot]

Parse an any(dot) (.) predefined character class

Parse an any(dot) (.) predefined character class

Attributes

Returns:

weaponregex.model.regextree.AnyDot tree node

Example:

"."

def atomicGroup[A : ParsingRun]: ParsingRun[AtomicGroup]

Parse an independent non-capturing group

Parse an independent non-capturing group

Attributes

Returns:

weaponregex.model.regextree.AtomicGroup

Note:

This is a Scala/Java-only regex syntax

Example:

"(?>abc)"

def basicRE[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule which can parse either quantifier or elementaryRE

Intermediate parsing rule which can parse either quantifier or elementaryRE

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

def bol[A : ParsingRun]: ParsingRun[BOL]

Parse a beginning of line character (^)

Parse a beginning of line character (^)

Attributes

Returns:

weaponregex.model.regextree.BOL tree node

Example:

"^"

def boundary[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule for boundary tokens which can parse either bol, eol or boundaryMetaChar

Intermediate parsing rule for boundary tokens which can parse either bol, eol or boundaryMetaChar

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

def boundaryMetaChar[A : ParsingRun]: ParsingRun[Boundary]

Parse a boundary meta-character character

Parse a boundary meta-character character

Attributes

Returns:

weaponregex.model.regextree.BOL tree node

See also:
Example:

"\z"

def capturing[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule for capturing-related tokens which can parse either group or specialConstruct

Intermediate parsing rule for capturing-related tokens which can parse either group or specialConstruct

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

def charClass[A : ParsingRun]: ParsingRun[CharacterClass]

Parse a character class

Parse a character class

Attributes

Returns:

weaponregex.model.regextree.CharacterClass tree node

Example:

"[abc]"

def charClassCharLiteral[A : ParsingRun]: ParsingRun[Character]

Parse a single literal character that is allowed to be in a character class

Parse a single literal character that is allowed to be in a character class

Attributes

Returns:

weaponregex.model.regextree.Character tree node

See also:
Example:

"{"

def charClassCharLiteralSpecialCases[A : ParsingRun]: ParsingRun[String]

Parse special cases of a character literal in a character class

Parse special cases of a character literal in a character class

Attributes

Returns:

The captured character as a string

def charCodePoint[A : ParsingRun]: ParsingRun[MetaChar]

Parse a character with a code point \x{h...h}, where Character.MIN_CODE_POINT <= 0xh...h <= Character.MAX_CODE_POINT and x is weaponregex.parser.Parser#codePointEscChar

Parse a character with a code point \x{h...h}, where Character.MIN_CODE_POINT <= 0xh...h <= Character.MAX_CODE_POINT and x is weaponregex.parser.Parser#codePointEscChar

Attributes

Returns:

weaponregex.model.regextree.MetaChar tree node

See also:
Example:

"\ x{0123}" or "\ u{0123}"

def charHex[A : ParsingRun]: ParsingRun[MetaChar]

Parse a character with hexadecimal value \xhh

Parse a character with hexadecimal value \xhh

Attributes

Returns:

weaponregex.model.regextree.MetaChar tree node

Example:

"\x01"

def charLiteral[A : ParsingRun]: ParsingRun[Character]

Parse a single literal character that is not a regex special character

Parse a single literal character that is not a regex special character

Attributes

Returns:

weaponregex.model.regextree.Character tree node

See also:
Example:

"a"

def charLiteralSpecialCases[A : ParsingRun]: ParsingRun[String]

Parse special cases of a character literal

Parse special cases of a character literal

Attributes

Returns:

The captured character as a string

def charUnicode[A : ParsingRun]: ParsingRun[MetaChar]

Parse a unicode character \ uhhhh

Parse a unicode character \ uhhhh

Attributes

Returns:

weaponregex.model.regextree.MetaChar tree node

Example:

"\ u0020"

def character[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule for character-related tokens which can parse either metaCharacter or charLiteral

Intermediate parsing rule for character-related tokens which can parse either metaCharacter or charLiteral

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

def classItem[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule for character class item tokens which can parse either charClass, preDefinedCharClass, metaCharacter, range, quoteChar, or charClassCharLiteral

Intermediate parsing rule for character class item tokens which can parse either charClass, preDefinedCharClass, metaCharacter, range, quoteChar, or charClassCharLiteral

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

def concat[A : ParsingRun]: ParsingRun[Concat]

Parse a concatenation of basicREs

Parse a concatenation of basicREs

Attributes

Returns:

weaponregex.model.regextree.Concat tree node

Example:

"abc"

def controlChar[A : ParsingRun]: ParsingRun[ControlChar]

Parse an control meta-character based on caret notation

Parse an control meta-character based on caret notation

Attributes

Returns:

weaponregex.model.regextree.ControlChar tree node

See also:
Example:

"\cA"

def elementaryRE[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule which can parse either capturing, anyDot, preDefinedCharClass, boundary, charClass, reference, character or quote

Intermediate parsing rule which can parse either capturing, anyDot, preDefinedCharClass, boundary, charClass, reference, character or quote

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

def empty[A : ParsingRun]: ParsingRun[Empty]

Parse an empty string

Parse an empty string

Attributes

Returns:

weaponregex.model.regextree.Empty tree node

Example:

""

def entry[A : ParsingRun]: ParsingRun[RegexTree]

The entry point of the parser that should parse from the start to the end of the regex string

The entry point of the parser that should parse from the start to the end of the regex string

Attributes

Returns:

weaponregex.model.regextree.RegexTree tree

def eol[A : ParsingRun]: ParsingRun[EOL]

Parse a beginning of line character ($)

Parse a beginning of line character ($)

Attributes

Returns:

weaponregex.model.regextree.EOL tree node

Example:

"$"

def escapeChar[A : ParsingRun]: ParsingRun[MetaChar]

Parse an escape meta-character

Parse an escape meta-character

Attributes

Returns:

weaponregex.model.regextree.MetaChar tree node

See also:
Example:

"\n"

def flagNCGroup[A : ParsingRun]: ParsingRun[FlagNCGroup]

Parse a non-capturing group with flags

Parse a non-capturing group with flags

Attributes

Returns:

weaponregex.model.regextree.FlagNCGroup

Note:

This is a Scala/Java-only regex syntax

Example:

"(?id-mu:abc)"

def flagToggle[A : ParsingRun](fs: String): ParsingRun[FlagToggle]

Parse a flag toggle (idmsuxU-idmsuxU)

Parse a flag toggle (idmsuxU-idmsuxU)

Attributes

Returns:

weaponregex.model.regextree.FlagToggle tree node

Note:

This is a Scala/Java-only regex syntax

Example:

"idmsuxU-idmsuxU"

def flagToggleGroup[A : ParsingRun]: ParsingRun[FlagToggleGroup]

Parse a flag toggle group

Parse a flag toggle group

Attributes

Returns:

weaponregex.model.regextree.FlagToggleGroup

Note:

This is a Scala/Java-only regex syntax

Example:

"(?id-mu)"

def flags[A : ParsingRun](fs: String): ParsingRun[Flags]

Parse flag literal characters given a string contains all allowed flags

Parse flag literal characters given a string contains all allowed flags

Attributes

fs

The string contains all allowed flags

Returns:

weaponregex.model.regextree.Flags tree node

Note:

This is a Scala/Java-only regex syntax

Example:

"idmsuxU"

def group[A : ParsingRun]: ParsingRun[Group]

Parse a capturing group

Parse a capturing group

Attributes

Returns:

weaponregex.model.regextree.Group tree node

Example:

"(a)"

def groupName[A : ParsingRun]: ParsingRun[String]

Parse a group name that starts with a letter and followed by zero or more alphanumeric characters

Parse a group name that starts with a letter and followed by zero or more alphanumeric characters

Attributes

Returns:

the parsed name string

Example:

"name1"

def hexDigit[A : ParsingRun]: ParsingRun[String]

Parse a single hexadecimal digit

Parse a single hexadecimal digit

Attributes

Returns:

the parsed hexadecimal digit as a String

Example:

"F"

def hexEscCharConsumer[A : ParsingRun]: ParsingRun[RegexTree]

Used to consume a hexadecimal escape character \ x or \ u when all other hex related cases are checked and failed to prevent back tracking.

Used to consume a hexadecimal escape character \ x or \ u when all other hex related cases are checked and failed to prevent back tracking.

Attributes

Returns:

a null dummy

def lookaround[A : ParsingRun]: ParsingRun[Lookaround]

Parse a positive or negative lookahead or lookbehind

Parse a positive or negative lookahead or lookbehind

Attributes

Returns:

weaponregex.model.regextree.Lookaround

Example:

"(?=abc)" (positive lookahead)

def metaCharacter[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule for meta-character tokens which can parse either charOct, charHex, charUnicode, charHexBrace or escapeChar

Intermediate parsing rule for meta-character tokens which can parse either charOct, charHex, charUnicode, charHexBrace or escapeChar

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

def nameReference[A : ParsingRun]: ParsingRun[NameReference]

Parse a reference to a named capturing group

Parse a reference to a named capturing group

Attributes

Returns:

weaponregex.model.regextree.NameReference

Example:

"\k<name1>"

def namedGroup[A : ParsingRun]: ParsingRun[NamedGroup]

Parse a named-capturing group

Parse a named-capturing group

Attributes

Returns:

weaponregex.model.regextree.NamedGroup tree node

Example:

"(?<name1>hello)"

def nonCapturingGroup[A : ParsingRun]: ParsingRun[Group]

Parse a non-capturing group

Parse a non-capturing group

Attributes

Returns:

weaponregex.model.regextree.Group tree node

Example:

"(?:hello)"

def numReference[A : ParsingRun]: ParsingRun[NumberReference]

Parse a numbered reference to a capture group

Parse a numbered reference to a capture group

Attributes

Returns:

weaponregex.model.regextree.NumberReference

Example:

"\13"

def number[A : ParsingRun]: ParsingRun[Int]

Parse an integer with any number of digits between 0 and 9

Parse an integer with any number of digits between 0 and 9

Attributes

Returns:

the parsed integer

Example:

"123"

def or[A : ParsingRun]: ParsingRun[Or]

Parse an 'or' (|) of simpleRE

Parse an 'or' (|) of simpleRE

Attributes

Returns:

weaponregex.model.regextree.Or tree node

Example:

"a|b|c"

def parse: Either[String, RegexTree]

Parse the given regex pattern

Parse the given regex pattern

Attributes

Returns:

A Right of parsed weaponregex.model.regextree.RegexTree if can be parsed, a Left with the error message otherwise

def posixCharClass[A : ParsingRun]: ParsingRun[POSIXCharClass]

Parse a posix character class

Parse a posix character class

Attributes

Returns:

weaponregex.model.regextree.POSIXCharClass tree node

Note:

This does not check for the validity of the property inside \p{}

Example:

"\p{Alpha}"

def preDefinedCharClass[A : ParsingRun]: ParsingRun[PredefinedCharClass]

Parse a predefined character class

Parse a predefined character class

Attributes

Returns:

weaponregex.model.regextree.PredefinedCharClass tree node

See also:
Example:

"\d"

def quantifier[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule for quantifier tokens which can parse either quantifierShort or quantifierLong

Intermediate parsing rule for quantifier tokens which can parse either quantifierShort or quantifierLong

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

def quantifierLong[A : ParsingRun]: ParsingRun[Quantifier]

Parse a (full) quantifier ({n}, {n,}, {n,m})

Parse a (full) quantifier ({n}, {n,}, {n,m})

Attributes

Returns:

weaponregex.model.regextree.Quantifier tree node

Example:

"a{1}"

def quantifierLongTail[A : ParsingRun]: ParsingRun[(Int, Option[Option[Int]])]

Parse the tail part of a long quantifier

Parse the tail part of a long quantifier

Attributes

Returns:

A tuple of the quantifier minimum and optional maximum part

def quantifierShort[A : ParsingRun]: ParsingRun[RegexTree]

Parse a shorthand notation for quantifier (?, *, +)

Parse a shorthand notation for quantifier (?, *, +)

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

Example:

"a*"

def quantifierType[A : ParsingRun, T](p: => ParsingRun[T]): ParsingRun[(T, QuantifierType)]

A higher order parser that add weaponregex.model.regextree.QuantifierType information of the parse of the given (quantifier) parser

A higher order parser that add weaponregex.model.regextree.QuantifierType information of the parse of the given (quantifier) parser

Attributes

p

the quantifier parser

Returns:

A tuple of the return of the given (quantifier) parser p, and its weaponregex.model.regextree.QuantifierType

def quote[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule for quoting tokens which can parse either quoteLong or quoteChar

Intermediate parsing rule for quoting tokens which can parse either quoteLong or quoteChar

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

def quoteChar[A : ParsingRun]: ParsingRun[QuoteChar]

Parse a quoted character (any character)

Parse a quoted character (any character)

Attributes

Returns:

weaponregex.model.regextree.QuoteChar

Example:

"$"

def quoteLong[A : ParsingRun]: ParsingRun[Quote]

Parse a 'long' quote, using \Q and \E

Parse a 'long' quote, using \Q and \E

Attributes

Returns:

weaponregex.model.regextree.Quote tree node

Example:

"\Qquoted\E"

def range[A : ParsingRun]: ParsingRun[Range]

Parse a character range inside a character class

Parse a character range inside a character class

Attributes

Returns:

weaponregex.model.regextree.Range tree node

Example:

"a-z"

def reference[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule for reference tokens which can parse either nameReference or numReference

Intermediate parsing rule for reference tokens which can parse either nameReference or numReference

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

def simpleRE[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule which can parse either concat, basicRE or empty

Intermediate parsing rule which can parse either concat, basicRE or empty

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

def specialConstruct[A : ParsingRun]: ParsingRun[RegexTree]

Intermediate parsing rule for special construct tokens which can parse either namedGroup, nonCapturingGroup or lookaround

Intermediate parsing rule for special construct tokens which can parse either namedGroup, nonCapturingGroup or lookaround

Attributes

Returns:

weaponregex.model.regextree.RegexTree (sub)tree

Abstract fields

val boundaryMetaChars: String

Allowed boundary meta-characters

Allowed boundary meta-characters

Attributes

Special characters within a character class

Special characters within a character class

Attributes

val codePointEscChar: String

The escape character used with a code point

The escape character used with a code point

Attributes

Example:

\ x{h..h} or \ u{h..h}

val escapeChars: String

Allowed escape characters

Allowed escape characters

Attributes

Minimum number of character class items of a valid character class

Minimum number of character class items of a valid character class

Attributes

Allowed predefined character class characters

Allowed predefined character class characters

Attributes

val specialChars: String

Regex special characters

Regex special characters

Attributes

Concrete fields

val pattern: String