~/bend-docscommunity

re.bend checks

raw source on the hub · import yaml-for-bend@0.1.1.0/re.bend as Re

A small regular-expression matcher, for the scalar forms schemas name as regexes. A pattern is data: a list of items, each a character class, an optional or repeated item, or a choice of sequences. Matching is anchored at both ends and backtracks. Each step eats a character or moves along the pattern, so fuel of the text's length times a constant bounds the work.

1 import
import Base

Types

type Cls source · line 9 · raw

Data

type Pat source · line 20 · raw

Data

Definitions

def code source · line 27 · raw

@c:Char -> U32

def between source · line 32 · raw

@+x:U32 -> @lo:U32 -> @hi:U32 -> Bool

def in source · line 35 · raw

@c:Char -> @s:String -> Bool

def is_alpha source · line 39 · raw

@+x:U32 -> Bool

[[:alpha:]] as Onigmo reads it: ASCII letters, and letters past ASCII.

def test source · line 44 · raw

@cls:Cls -> @+c:Char -> Bool

def or.else source · line 65 · raw

@hit:Bool -> @rest:(@_:Unit -> Bool) -> Bool

def and.then source · line 72 · raw

@hit:Bool -> @rest:(@_:Unit -> Bool) -> Bool

def run source · line 79 · raw

@fuel:Nat -> @ps:List<&2, Pat> -> @+s:String -> Bool

def matches source · line 109 · raw

@ps:List<&2, Pat> -> @+s:String -> Bool

Whether all of +s+ matches +ps+.

def starts source · line 113 · raw

@ps:List<&2, Pat> -> @+s:String -> Bool

Whether +s+ starts with a match of +ps+.

def c source · line 117 · raw

@x:Char -> Pat

Builders, so a pattern reads close to the regex it comes from.

def digit source · line 120 · raw

Pat

def digits source · line 123 · raw

Pat

def sign source · line 126 · raw

Pat

def of source · line 129 · raw

@chars:String -> Pat

def seq source · line 132 · raw

@ps:List<&2, Pat> -> Pat

def word source · line 135 · raw

@s:String -> List<&2, Pat>