caseless.icn: Procedures to perform caseless scanning

procedure anycl:           Caseless version of any()
procedure balcl:           Caseless version of bal()
procedure findcl:          Caseless version of find()
procedure manycl:          Caseless version of many()
procedure matchcl:         Caseless version of match()
procedure uptocl:          Caseless version of upto()

link caseless
August 19, 1996; Nevin J. Liber
This file is in the public domain.

These procedures are analogous to the standard string-analysis
functions except that uppercase letters are considered equivalent to
lowercase letters.

anycl(c, s, i1, i2)     succeeds and produces i1 + 1, provided
                        map(s[i1]) is in cset(map(c)) and i2 is
                        greater than i1.  It fails otherwise.

balcl(c1, c2, c3, s, i1, i2)    generates the sequence of integer
                                positions in s preceding a
                                character of cset(map(c1)) in
                                map(s[i1:i2]) that is balanced with
                                respect to characters in cset(map(c2))
                                and cset(map(c3)), but fails if there
                                is no such position.

findcl(s1, s2, i1, i2)  generates the sequence of integer positions in
                        s2 at which map(s1) occurs as a substring
                        in map(s2[i1:i2]), but fails if there is no
                        such position.

manycl(c, s, i1, i2)    succeeds and produces the position in s
                        after the longest initial sequence of
                        characters in cset(map(c)) within
                        map(s[i1:i2]).  It fails if map(s[i1]) is not
                        in cset(map(c)).

matchcl(s1, s2, i1, i2) produces i1 + *s1 if
                        map(s1) == map(s2[i1+:=*s1]) but fails
                        otherwise.

uptocl(c, s, i1, i2)    generates the sequence of integer positions in
                        s preceding a character of cset(map(c)) in
                        map(s[i1:i2]).  It fails if there is no such
                        position.

Defaults:       s, s2   &subject
                i1      &pos if s or s2 is defaulted; otherwise 1
                i2      0
                c1      &cset
                c2      '('
                c3      ')'

Errors: 101     i1 or i2 not integer
        103     s or s1 or s2 not string
        104     c or c1 or c2 or c3 not cset

Source code | Program Library Page | Icon Home Page