Class REGULAR-EXPRESSION-TEMPLATE
Package:
COMMON-LISP.EXTENSIONS.DATA-AND-CONTROL-FLOW.UNIFICATION
Class Precedence List:
REGULAR-EXPRESSION-TEMPLATE, STRING-TEMPLATE, VECTOR-TEMPLATE, SEQUENCE-TEMPLATE, ARRAY-TEMPLATE, TYPE-TEMPLATE, TEMPLATE, STANDARD-OBJECT, T.
Known Subclasses:
None.
Slots:
None documented.
Description:
The REGULAR-EXPRESSION-TEMPLATE class denotes regular expressions (the CL-PPCRE regular expressions) that are used to unify against a STRING.
Template Syntax:
The spec syntax for a REGULAR-EXPRESSION-TEMPLATE is the following:
#T(regular-expression REGEXP &optional unification-vars &rest keys) #T(regexp REGEXP &optional unification-vars &rest keys)where
REGEXP ::= <a CL-PPCRE regexp string or tree> unification-vars ::= '(' variable* ')' keys ::= <CL-PPCRE (constant) keys to be passed to CL-PPCRE:CREATE-SCANNER>
regular-expression
and
regexp
are
interchangeable. The unification-vars
, if
present, are unified (i.e., associated) with each group returned
by the scanner created by CL-PPCRE:CREATE-SCANNER. The scanner is
called by the appropriate UNIFY method.
Examples:
cl-prompt> (unify "abcbca" #T(regexp "a(bc)*a")) #<ENVIRONMENT xxx> cl-prompt> (unify #T(regexp "a(cb)*a" (?foo)) "acbcba") #<ENVIRONMENT xyz> cl-prompt> (find-variable-value '?foo *) "cb" T
Affected By:
None.
Exceptional Situations:
Unifying an REGULAR-EXPRESSION-TEMPLATE against a non-STRING object results in an UNIFICATION-FAILURE error being signaled.
See Also:
Notes:
The underlying implementation uses CL-PPCRE. If CL-PPCRE is not available in the system, CL-UNIFICATION will not have REGULAR-EXPRESSION-TEMPLATE working.