summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--eval.c2
-rw-r--r--lib.c6
-rw-r--r--txr.14
-rw-r--r--txr.vim1
5 files changed, 24 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a1e0a386..67c086e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2012-03-24 Kaz Kylheku <kaz@kylheku.com>
+ * eval.c (eval_init): Register match-str and match-str-tree
+ intrinsics.
+
+ * lib.c (match_str, match_str_tree): Default position to zero.
+
+ * txr.1: Doc stubs created.
+
+ * txr.vim: Highlighting for match-str and match-str-tree.
+
+2012-03-24 Kaz Kylheku <kaz@kylheku.com>
+
Bugfix: code like @(skip)@{var /partial/} where
the regular expression does not match all the way to
the end of the line was getting by the check for
diff --git a/eval.c b/eval.c
index fbe63d3a..644998f0 100644
--- a/eval.c
+++ b/eval.c
@@ -2290,6 +2290,8 @@ void eval_init(void)
reg_fun(intern(lit("length-str"), user_package), func_n1(length_str));
reg_fun(intern(lit("search-str"), user_package), func_n4o(search_str, 2));
reg_fun(intern(lit("search-str-tree"), user_package), func_n4o(search_str_tree, 2));
+ reg_fun(intern(lit("match-str"), user_package), func_n3o(match_str, 2));
+ reg_fun(intern(lit("match-str-tree"), user_package), func_n3o(match_str_tree, 2));
reg_fun(intern(lit("sub-str"), user_package), func_n3o(sub_str, 1));
reg_fun(intern(lit("replace-str"), user_package), func_n4o(replace_str, 2));
reg_fun(intern(lit("cat-str"), user_package), func_n2o(cat_str, 1));
diff --git a/lib.c b/lib.c
index 6cbff8ba..2449cf4b 100644
--- a/lib.c
+++ b/lib.c
@@ -1560,6 +1560,9 @@ val match_str(val bigstr, val str, val pos)
{
val i, p;
+ if (pos == nil)
+ pos = zero;
+
for (i = zero;
length_str_gt(bigstr, p = plus(pos, i)) && length_str_gt(str, i);
i = plus(i, one))
@@ -1573,6 +1576,9 @@ val match_str(val bigstr, val str, val pos)
val match_str_tree(val bigstr, val tree, val pos)
{
+ if (pos == nil)
+ pos = zero;
+
if (stringp(tree)) {
if (match_str(bigstr, tree, pos))
return length_str(tree);
diff --git a/txr.1 b/txr.1
index 6bf7fcbf..5e606874 100644
--- a/txr.1
+++ b/txr.1
@@ -6807,6 +6807,10 @@ Certain object types have a custom equal function.
.SS Function search-str-tree
+.SS Function match-str
+
+.SS Function match-str-tree
+
.SS Function sub-str
.SS Function replace-str
diff --git a/txr.vim b/txr.vim
index 88313eb8..e6ef2b3f 100644
--- a/txr.vim
+++ b/txr.vim
@@ -65,6 +65,7 @@ syn keyword txl_keyword contained make-sym gensym *gensym-counter* make-package
syn keyword txl_keyword contained intern symbolp symbol-name symbol-package keywordp
syn keyword txl_keyword contained mkstring copy-str upcase-str downcase-str string-extend
syn keyword txl_keyword contained stringp lazy-stringp length-str search-str search-str-tree
+syn keyword txl_keyword contained match-str match-str-tree
syn keyword txl_keyword contained sub-str cat-str split-str replace-str
syn keyword txl_keyword contained split-str-set list-str trim-str
syn keyword txl_keyword contained string-lt int-str flo-str int-flo flo-int