leque / Gauche-pxeger

regexp->string-generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gauche-pxeger Build Status

This module provides a generator that yields strings which match a given regexp. (string-reverse "regexp") ; => "pxeger".

Requirement

APIs

[Function] regexp->string-generator re :key (*-max-repeat 8) (char-set-universe char-set:full)

Creates a generator that yields strings which match a given regular expression RE.

For regular expressions . and pat*, you would rarely mean truely aribitrary characters or repetion count. This function read . as characters in CHAR-SET-UNIVERSE, and [^...] as characters in (char-set-difference CHAR-SET-UNIVERSE #[...]). Also, pat*, pat+, and pat{n} are read as pat{0,*-MAX-REPEAT}, pat{1,*-MAX-REPEAT+1}, and pat{n,*-MAX-REPEAT+n}, respectively.

This function supports subset of Gauche's regular expression. Unsupported syntaxes are:

  • non-greedy patterns -- *?, +?, ??, {n,m}?
  • beginning / end of string -- ^, $
  • word boundary -- \b, \B
  • look ahead -- (?=pat), (?!pat)
  • look behind -- (?<=pat), (?<!pat)
  • atomic patterns -- (?>pattern), *+, ++, ?+
  • conditional matching -- (?assertion then-pattern|else-pattern)
    • (?(integer)then-pattern|else-pattern) is supported

About

regexp->string-generator

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Scheme 78.5%Language:Makefile 18.8%Language:Shell 2.7%