summaryrefslogtreecommitdiff
path: root/libguile/regex-posix.c
diff options
context:
space:
mode:
authorGreg J. Badros <gjb@cs.washington.edu>1999-12-13 03:40:23 +0000
committerGreg J. Badros <gjb@cs.washington.edu>1999-12-13 03:40:23 +0000
commit4079f87ed21341a8654ecaa29ac3e6a2344d9252 (patch)
treed9381ae0256c3daae81acde78bf40d1d12cd12e5 /libguile/regex-posix.c
parent75948d1b314685312f8d62315c4bec6bd003fca4 (diff)
downloadguile-4079f87ed21341a8654ecaa29ac3e6a2344d9252.tar.gz
* Makefile.am: Fix ETAGS_ARGS to recognize GUILE_PROC,
GUILE_PROC1. Build guile-procedures.txt, and add that file to pkgdata_DATA. * load.c: Added `pkgdata-dir', `site-dir', `library-dir' primitives. * guile-doc-snarf.awk: Drop trailing space when no arguments: e.g., "(foo )" is now "(foo)". * *.c: moved all the documentation for primitives from guile-doc/ref/{appendices,posix,scheme}.texi into the source code. This leaves about half of the primitives undocumented. Also, all the markup is currently still texinfo. I don't have a problem with texinfo per se, but the markup is not very descriptive or accurate.
Diffstat (limited to 'libguile/regex-posix.c')
-rw-r--r--libguile/regex-posix.c47
1 files changed, 44 insertions, 3 deletions
diff --git a/libguile/regex-posix.c b/libguile/regex-posix.c
index f52c72335..ea4d6bad5 100644
--- a/libguile/regex-posix.c
+++ b/libguile/regex-posix.c
@@ -135,7 +135,8 @@ scm_regexp_error_msg (int regerrno, regex_t *rx)
GUILE_PROC (scm_regexp_p, "regexp?", 1, 0, 0,
(SCM x),
-"")
+"Return @code{#t} if @var{obj} is a compiled regular expression, or
+@code{#f} otherwise.")
#define FUNC_NAME s_scm_regexp_p
{
return SCM_BOOL(SCM_NIMP (x) && SCM_RGXP (x));
@@ -144,7 +145,44 @@ GUILE_PROC (scm_regexp_p, "regexp?", 1, 0, 0,
GUILE_PROC (scm_make_regexp, "make-regexp", 1, 0, 1,
(SCM pat, SCM flags),
-"")
+"Compile the regular expression described by @var{str}, and return the
+compiled regexp structure. If @var{str} does not describe a legal
+regular expression, @code{make-regexp} throws a
+@code{regular-expression-syntax} error.
+
+The @var{flag} arguments change the behavior of the compiled regexp.
+The following flags may be supplied:
+
+@table @code
+@item regexp/icase
+Consider uppercase and lowercase letters to be the same when matching.
+
+@item regexp/newline
+If a newline appears in the target string, then permit the @samp{^} and
+@samp{$} operators to match immediately after or immediately before the
+newline, respectively. Also, the @samp{.} and @samp{[^...]} operators
+will never match a newline character. The intent of this flag is to
+treat the target string as a buffer containing many lines of text, and
+the regular expression as a pattern that may match a single one of those
+lines.
+
+@item regexp/basic
+Compile a basic (``obsolete'') regexp instead of the extended
+(``modern'') regexps that are the default. Basic regexps do not
+consider @samp{|}, @samp{+} or @samp{?} to be special characters, and
+require the @samp{@{...@}} and @samp{(...)} metacharacters to be
+backslash-escaped (@pxref{Backslash Escapes}). There are several other
+differences between basic and extended regular expressions, but these
+are the most significant.
+
+@item regexp/extended
+Compile an extended regular expression rather than a basic regexp. This
+is the default behavior; this flag will not usually be needed. If a
+call to @code{make-regexp} includes both @code{regexp/basic} and
+@code{regexp/extended} flags, the one which comes last will override
+the earlier one.
+@end table
+")
#define FUNC_NAME s_scm_make_regexp
{
SCM flag;
@@ -187,7 +225,10 @@ GUILE_PROC (scm_make_regexp, "make-regexp", 1, 0, 1,
GUILE_PROC (scm_regexp_exec, "regexp-exec", 2, 2, 0,
(SCM rx, SCM str, SCM start, SCM flags),
-"")
+"Match the compiled regular expression @var{regexp} against @code{str}.
+If the optional integer @var{start} argument is provided, begin matching
+from that position in the string. Return a match structure describing
+the results of the match, or @code{#f} if no match could be found.")
#define FUNC_NAME s_scm_regexp_exec
{
int status, nmatches, offset;