String processing

Author(s): Daniel Cabeza.

This module provides some string-related predicates, specially for including in grammars defining strings.

Usage and interface

Documentation on exports

PREDICATEwhitespace/2
whitespace(String,Rest)

In a grammar rule, as whitespace/0, represents whitespace (a positive number of space (32), tab (9), newline (10) or return (13) characters). Thus, Rest is a proper suffix of String with one or more whitespace characters removed. An example of use would be:

   attrs([]) --> ""
   attrs([N|Ns]) -->
       whitespace,
       attr(N),
       attrs(Ns).

Usage:whitespace(S1,S2)

  • The following properties should hold at call time:
    (basic_props:string/1)S1 is a string (a list of character codes).
  • The following properties should hold upon exit:
    (basic_props:string/1)S2 is a string (a list of character codes).

PREDICATEwhitespace0/2
whitespace0(String,Rest)

In a grammar rule, as whitespace0/0, represents possible whitespace (any number of space (32), tab (9), newline (10) or return (13) characters). Thus, Rest is String or a proper suffix of String with one or more whitespace characters removed. An example of use would be:

   assignment(N,V) -->
       variable_name(N), whitespace0, "=", whitespace0, value(V).

Usage:whitespace0(S1,S2)

  • The following properties should hold at call time:
    (basic_props:string/1)S1 is a string (a list of character codes).
  • The following properties should hold upon exit:
    (basic_props:string/1)S2 is a string (a list of character codes).

PREDICATEstring/3
string(String,Head,Tail)

In a grammar rule, as string/1, represents literally String. An example of use would be:

double(A) -->
    string(A),
    string(A).

Usage 1:

Usage 2:string(A,B,C)

Documentation on imports

This module has the following direct dependencies: