EdFind.dcl 1.52 KB
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1
2
definition module EdFind

3
4
5
import	StdMaybe
from	StrictList	import :: StrictList
import	EdSelection
Diederik van Arkel's avatar
Diederik van Arkel committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

simpleLineSearch ::
	// plain search
	!Selection			// initial position	
	!Bool				// backwards
	!Bool				// wraparound
	!Bool				// ignore_case
	!Bool				// match_words
	!String				// search string
	!Text				// text
	-> Maybe Selection	// maybe found selection

simpleLineSearch` ::	// Alternative version for Replace All
	!Selection !Bool !Bool !Bool !Bool !String !*{String} -> !(!Maybe Selection,!*{String})

regexpLineSearch ::
	// regexp search
	!Selection			// initial position	
	!Bool				// backwards
	!Bool				// wraparound
	!Bool				// ignore_case						[unused]
	!Bool				// match_words						[unused]
	!String				// search expression
	!Text				// text
	-> Maybe Selection	// maybe found selection

regexpLineSearch` ::	// Alternative version for Replace All
	!Selection !Bool !Bool !Bool !Bool !String !*{String} -> !(!Maybe Selection,!*{String})

regexpLineReplace ::
	// regexp replace
	// Assumption is that the initial selection is a text fragment matching the
	// search expression. Checks that it indeed matches (mainly to find the sub-
	// strings. Returns the appropriate replacement string.
	!Selection			// initial selection
	!Bool				// search backwards					[unused]
	!Bool				// wraparound search				[unused]
	!Bool				// ignore case in search string		[unused]
	!Bool				// match_words						[unused]
	!String				// search expression
	!String				// replace expression
	!String				// original string
	-> Maybe String		// replacement string