diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-03-24 01:13:55 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-03-24 01:13:55 -0700 |
commit | 52715b72cd4959569ad021b69bf9cf1b26ec55fb (patch) | |
tree | bd1d08d9afbb9ecd5f1e88bcab2abc98122be1df | |
parent | dc1ae5cd093466d815c52167a21db78ade601763 (diff) | |
download | txr-52715b72cd4959569ad021b69bf9cf1b26ec55fb.tar.gz txr-52715b72cd4959569ad021b69bf9cf1b26ec55fb.tar.bz2 txr-52715b72cd4959569ad021b69bf9cf1b26ec55fb.zip |
* 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.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | lib.c | 6 | ||||
-rw-r--r-- | txr.1 | 4 | ||||
-rw-r--r-- | txr.vim | 1 |
5 files changed, 24 insertions, 0 deletions
@@ -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 @@ -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)); @@ -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); @@ -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 @@ -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 |