--- a/TextView.st Sat May 18 09:54:16 1996 +0200
+++ b/TextView.st Sat May 18 11:39:53 1996 +0200
@@ -1514,9 +1514,9 @@
!
searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:foundBlock
- ifNotFound:notFoundBlock
- onError:failBlock
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
+ onError:failBlock
"search for a matching parenthesis, parChar is one of '$( $[ ${ $) $] $}'.
Search for the corresponding character is done forward if its an opening,
@@ -1525,13 +1525,13 @@
If there is a nesting error, performs failBlock."
^ self
- searchForMatchingParenthesisFromLine:startLine col:startCol
- ifFound:foundBlock
- ifNotFound:notFoundBlock
- onError:failBlock
- ignoring:#( $' $" )
+ searchForMatchingParenthesisFromLine:startLine col:startCol
+ ifFound:foundBlock
+ ifNotFound:notFoundBlock
+ onError:failBlock
+ ignoring:#( $' $" '$[' '$]' '${' '$)' )
- "Modified: 18.11.1995 / 16:28:23 / cg"
+ "Modified: 18.5.1996 / 11:05:57 / cg"
!
searchForMatchingParenthesisFromLine:startLine col:startCol
@@ -1546,7 +1546,7 @@
If there is a nesting error, performs failBlock."
|i direction lineString line col parChar charSet closingChar
- ignoring delta endCol cc incSet decSet nesting maxLine|
+ ignoring delta endCol cc incSet decSet nesting maxLine ign skip|
charSet := #( $( $) $[ $] ${ $} " $< $> " ).
@@ -1583,28 +1583,60 @@
] ifFalse:[
endCol := 1
].
+
col to:endCol by:delta do:[:runCol |
cc := lineString at:runCol.
- (ignoreSet includes:cc) ifTrue:[
- ignoring := ignoring not
- ].
- ignoring ifFalse:[
- (incSet includes:cc) ifTrue:[
- nesting := nesting + 1
+ ign := skip := false.
+ ignoreSet do:[:ignore |
+ ignore == cc ifTrue:[
+ ign := true
] ifFalse:[
- (decSet includes:cc) ifTrue:[
- nesting := nesting - 1
+ ignore isString ifTrue:[
+ cc == (ignore at:2) ifTrue:[
+ runCol > 1 ifTrue:[
+ (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
+ skip := true
+ ]
+ ]
+ ] ifFalse:[
+ cc == (ignore at:1) ifTrue:[
+ runCol < lineString size ifTrue:[
+ (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
+ skip := true
+ ]
+ ]
+ ]
+ ]
]
]
].
+
+ ign ifTrue:[
+ ignoring := ignoring not
+ ].
+
+ ignoring ifFalse:[
+ skip ifFalse:[
+ (incSet includes:cc) ifTrue:[
+ nesting := nesting + 1
+ ] ifFalse:[
+ (decSet includes:cc) ifTrue:[
+ nesting := nesting - 1
+ ]
+ ]
+ ]
+ ].
+
nesting == 0 ifTrue:[
"check if legal"
- cc == closingChar ifFalse:[
- ^ failBlock value
- ].
- ^ foundBlock value:line value:runCol.
+ skip ifFalse:[
+ cc == closingChar ifFalse:[
+ ^ failBlock value
+ ].
+ ^ foundBlock value:line value:runCol.
+ ]
]
].
].
@@ -1619,10 +1651,9 @@
col := lineString size
]
].
-
^ notFoundBlock value
- "Modified: 6.3.1996 / 14:58:29 / cg"
+ "Modified: 18.5.1996 / 11:38:35 / cg"
!
searchFwd
@@ -2154,5 +2185,5 @@
!TextView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.51 1996-05-17 06:58:30 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.52 1996-05-18 09:39:53 cg Exp $'
! !