Attached is a patch that changes the "find word" test in string_cs.t
to use the find_cclass and find_not_cclass opcodes to locate word
boundaries.  

This test doesn't work exactly the way Leo has envisioned it (creating 
a special .CCLASS_* value for word boundaries), but it demonstrates 
how I think PIR programmers will typically locate word boundaries.

Sent as a patch rather than applied directly to give others an 
opportunity to review and comment.

Pm
Index: t/op/string_cs.t
===================================================================
--- t/op/string_cs.t    (revision 10026)
+++ t/op/string_cs.t    (working copy)
@@ -244,25 +244,26 @@
 0 2 5 7 ok
 OUTPUT
 
-SKIP: {
-  skip('TODO wordboundary has no cclass', 1);
 output_is( <<'CODE', <<OUTPUT, "find a word_boundary");
+.include "cclass.pasm"
     set S0, "_ab 09z"
     set I0, 0
+    length I1, S0
 lp:
-    find_cclass I0, .CCLASS_???, S0, I0, I1
+    find_cclass I0, .CCLASS_WORD, S0, I0, I1
     print I0
     print " "
-    eq I0, -1, done
-    inc I0
-    branch lp
+    eq I0, I1, done
+    find_not_cclass I0, .CCLASS_WORD, S0, I0, I1
+    print I0
+    print " "
+    ne I0, I1, lp
 done:
     print "ok\n"
     end
 CODE
-0 2 3 6 7 ok
+0 3 4 7 ok
 OUTPUT
-}
 
 output_is( <<'CODE', <<OUTPUT, "trans_charset_s_s_i");
     set S0, "abc"

Reply via email to