Adding missing nwb support.

This commit is contained in:
Alex Shinn 2014-07-11 06:53:10 +09:00
parent 53c7dfd71e
commit bca1281acb
2 changed files with 7 additions and 0 deletions

View file

@ -532,6 +532,9 @@
(string-cursor>? i start)
(char-word-constituent?
(string-cursor-ref str (string-cursor-prev str i)))))
(define (match/nwb str i ch start end matches)
(and (not (match/bow str i ch start end matches))
(not (match/eow str i ch start end matches))))
(define (match/bog str i ch start end matches)
(and (string-cursor<? i end)
(or (string-cursor=? i start)
@ -718,6 +721,7 @@
((eol) (make-char-state match/eol flags next))
((bow) (make-char-state match/bow flags next))
((eow) (make-char-state match/eow flags next))
((nwb) (make-char-state match/nwb flags next))
((bog) (make-char-state match/bog flags next))
((eog) (make-char-state match/eog flags next))
((grapheme)

View file

@ -142,6 +142,9 @@
(test-re #f
'(: (* space) bow ($ (* alpha)) eow (* space))
" abc. ")
(test-re-search '("foo") '(: "foo") " foo ")
(test-re-search #f '(: nwb "foo" nwb) " foo ")
(test-re-search '("foo") '(: nwb "foo" nwb) "xfoox")
(test-re '("beef")
'(* (/"af"))