--- a/Parser.st Wed Mar 05 23:14:41 2014 +0100
+++ b/Parser.st Fri Mar 07 23:06:16 2014 +0100
@@ -3624,116 +3624,116 @@
"/ in case not the position of the var-decl bars, but of the varName is passed in
(source at:defStartPos) == $| ifFalse:[
- defStartPos := source lastIndexOf:$| startingAt:defStartPos+1.
+ defStartPos := source lastIndexOf:$| startingAt:defStartPos+1.
].
(source at:defEndPos) == $| ifFalse:[
- defEndPos := source indexOf:$| startingAt:defEndPos+1.
+ defEndPos := source indexOf:$| startingAt:defEndPos+1.
].
startSearch := defStartPos+1.
- [true] whileTrue:[
- |prevChar isFirstVar didPassEndOfLine|
-
- "/ search this name's position in the declaration part ...
- pos := source indexOfSubCollection:varName startingAt:startSearch ifAbsent:0.
- (pos == 0 or:[pos >= defEndPos]) ifTrue:[
- self error:'should not happen' mayProceed:true.
- ^ self.
- ].
-
- pos2 := pos + varName size - 1.
- pos > 1 ifTrue:[
- prevChar := source at:pos-1.
- ].
- (prevChar isNil or:[prevChar isLetterOrDigit not]) ifTrue:[
- nextChar := source at:pos2+1.
- nextChar isLetterOrDigit ifFalse:[
- "/ halfway intuitive space-removal behavior;
- "/ if there was a space after/before the |-char,
- "/ leave it; otherwise remove it.
- isFirstVar := pos == (defStartPos+1).
- (source at:pos-1) isSeparator ifTrue:[
- pos := pos - 1.
- [ (source at:pos-1) isSeparator] whileTrue:[
- pos := pos - 1.
- ].
- (source at:pos-1) == $| ifTrue:[
- "/ there was a space before - leave it
- pos := pos + 1.
- isFirstVar := true.
- ]
- ].
-
- (source at:pos2+1) isSeparator ifTrue:[
- didPassEndOfLine := (source at:pos2+1) == Character cr.
- pos2 := pos2 + 1.
- [ (source at:pos2+1) isSeparator] whileTrue:[
- (source at:pos2+1) == Character cr ifTrue:[ didPassEndOfLine := true ].
- pos2 := pos2 + 1.
- ].
-
- didPassEndOfLine ifFalse:[
- (source at:pos2+1) == $" ifTrue:[
- "/ comment follows - assume it belongs to the removed variable
- pos2 := pos2 + 1.
- (source at:pos2+1) == $/ ifTrue:[
- "/ EOL comment
- [ (source at:pos2+1) == Character cr ] whileFalse:[
- pos2 := pos2 + 1.
- ].
- pos2 := pos2 + 1.
- ] ifFalse:[
- "/ regular comment
- [ (source at:pos2+1) == $" ] whileFalse:[
- pos2 := pos2 + 1.
- ].
- pos2 := pos2 + 1.
- ].
- [ (source at:pos2+1) isSeparator] whileTrue:[
- (source at:pos2+1) == Character cr ifTrue:[ didPassEndOfLine := true ].
- pos2 := pos2 + 1.
- ].
- ]
- ].
-
- (source at:pos2+1) == $| ifTrue:[
- "/ there was a space after - leave it
- pos2 := pos2 - 1.
- ] ifFalse:[
- isFirstVar ifFalse:[
- pos2 := pos2 - 1.
- ]
- ].
- ].
-
- "/ if this was the last, remove empty var-declaration completely
- ((source at:pos-1) == $|
- and:[ (source at:pos2+1) == $| ]) ifTrue:[
- pos := pos - 1.
- pos2 := pos2 + 1.
- "/ see if that gives us an empty line
- p := pos.
- p2 := pos2.
-
- [(source at:p-1) == Character space] whileTrue:[ p := p - 1 ].
- [(source at:p2+1) == Character space] whileTrue:[ p2 := p2 + 1 ].
- ((source at:p-1) == Character cr and:[ (source at:p2+1) == Character cr]) ifTrue:[
- pos := p-1.
- pos2 := p2.
- (((source at:pos-1) == Character cr) and:[((source at:pos-2) == Character cr)])
- ifTrue:[ pos := pos - 1 ]
- ifFalse:[
- (((source at:pos2+1) == Character cr) and:[((source at:pos2+2) == Character cr)]) ifTrue:[
- pos2 := pos2 + 1 ]].
- ].
- ].
-
- self correctSourceByDeletingFrom:pos to:pos2.
- ^ self.
- ].
- ].
- startSearch := pos2 + 1.
- ]
+ [
+ |prevChar isFirstVar didPassEndOfLine|
+
+ "/ search this name's position in the declaration part ...
+ pos := source indexOfSubCollection:varName startingAt:startSearch ifAbsent:0.
+ (pos == 0 or:[pos >= defEndPos]) ifTrue:[
+ self error:'should not happen' mayProceed:true.
+ ^ self.
+ ].
+
+ pos2 := pos + varName size - 1.
+ pos > 1 ifTrue:[
+ prevChar := source at:pos-1.
+ ].
+ (prevChar isNil or:[prevChar isLetterOrDigit not]) ifTrue:[
+ nextChar := source at:pos2+1.
+ nextChar isLetterOrDigit ifFalse:[
+ "/ halfway intuitive space-removal behavior;
+ "/ if there was a space after/before the |-char,
+ "/ leave it; otherwise remove it.
+ isFirstVar := pos == (defStartPos+1).
+ (source at:pos-1) isSeparator ifTrue:[
+ pos := pos - 1.
+ [ (source at:pos-1) isSeparator] whileTrue:[
+ pos := pos - 1.
+ ].
+ (source at:pos-1) == $| ifTrue:[
+ "/ there was a space before - leave it
+ pos := pos + 1.
+ isFirstVar := true.
+ ]
+ ].
+
+ (source at:pos2+1) isSeparator ifTrue:[
+ didPassEndOfLine := (source at:pos2+1) == Character cr.
+ pos2 := pos2 + 1.
+ [ (source at:pos2+1) isSeparator] whileTrue:[
+ (source at:pos2+1) == Character cr ifTrue:[ didPassEndOfLine := true ].
+ pos2 := pos2 + 1.
+ ].
+
+ didPassEndOfLine ifFalse:[
+ (source at:pos2+1) == $" ifTrue:[
+ "/ comment follows - assume it belongs to the removed variable
+ pos2 := pos2 + 1.
+ (source at:pos2+1) == $/ ifTrue:[
+ "/ EOL comment
+ [ (source at:pos2+1) == Character cr ] whileFalse:[
+ pos2 := pos2 + 1.
+ ].
+ pos2 := pos2 + 1.
+ ] ifFalse:[
+ "/ regular comment
+ [ (source at:pos2+1) == $" ] whileFalse:[
+ pos2 := pos2 + 1.
+ ].
+ pos2 := pos2 + 1.
+ ].
+ [ (source at:pos2+1) isSeparator] whileTrue:[
+ (source at:pos2+1) == Character cr ifTrue:[ didPassEndOfLine := true ].
+ pos2 := pos2 + 1.
+ ].
+ ]
+ ].
+
+ (source at:pos2+1) == $| ifTrue:[
+ "/ there was a space after - leave it
+ pos2 := pos2 - 1.
+ ] ifFalse:[
+ isFirstVar ifFalse:[
+ pos2 := pos2 - 1.
+ ]
+ ].
+ ].
+
+ "/ if this was the last, remove empty var-declaration completely
+ ((source at:pos-1) == $|
+ and:[ (source at:pos2+1) == $| ]) ifTrue:[
+ pos := pos - 1.
+ pos2 := pos2 + 1.
+ "/ see if that gives us an empty line
+ p := pos.
+ p2 := pos2.
+
+ [(source at:p-1) == Character space] whileTrue:[ p := p - 1 ].
+ [(source at:p2+1) == Character space] whileTrue:[ p2 := p2 + 1 ].
+ ((source at:p-1) == Character cr and:[ (source at:p2+1) == Character cr]) ifTrue:[
+ pos := p-1.
+ pos2 := p2.
+ (((source at:pos-1) == Character cr) and:[((source at:pos-2) == Character cr)])
+ ifTrue:[ pos := pos - 1 ]
+ ifFalse:[
+ (((source at:pos2+1) == Character cr) and:[((source at:pos2+2) == Character cr)]) ifTrue:[
+ pos2 := pos2 + 1 ]].
+ ].
+ ].
+
+ self correctSourceByDeletingFrom:pos to:pos2.
+ ^ self.
+ ].
+ ].
+ startSearch := pos2 + 1.
+ ] loop.
"Modified: / 18-07-2006 / 08:56:25 / cg"
!
@@ -6727,26 +6727,26 @@
tokenType == $) ifTrue:[ self nextToken. ^ #() ].
argList := OrderedCollection new.
- [ true ] whileTrue:[
- prevInFunctionCallArgument := inFunctionCallArgument.
- inFunctionCallArgument := true.
-
- arg := self expression.
- arg == #Error ifTrue:[^ #Error].
- argList add:arg.
-
- inFunctionCallArgument := prevInFunctionCallArgument.
-
- tokenType == $) ifTrue:[
- self nextToken.
- ^ argList
- ].
- ((tokenType == #BinaryOperator) and:[tokenName = ',']) ifFalse:[
- self parseError:'"," or ")" expected'.
- ^ argList
- ].
- self nextToken.
- ].
+ [
+ prevInFunctionCallArgument := inFunctionCallArgument.
+ inFunctionCallArgument := true.
+
+ arg := self expression.
+ arg == #Error ifTrue:[^ #Error].
+ argList add:arg.
+
+ inFunctionCallArgument := prevInFunctionCallArgument.
+
+ tokenType == $) ifTrue:[
+ self nextToken.
+ ^ argList
+ ].
+ ((tokenType == #BinaryOperator) and:[tokenName = ',']) ifFalse:[
+ self parseError:'"," or ")" expected'.
+ ^ argList
+ ].
+ self nextToken.
+ ] loop.
!
functionCallExpression
@@ -8150,29 +8150,29 @@
|expressions elem pos1|
tokenType == $} ifTrue:[
- ^ #()
+ ^ #()
].
pos1 := tokenPosition.
expressions := OrderedCollection new:20.
- [true] whileTrue:[
- elem := self expression.
- (elem == #Error) ifTrue:[
- (tokenType == #EOF) ifTrue:[
- self syntaxError:'unterminated computed-array-element; ''}'' expected'
- position:pos1 to:tokenPosition
- ].
- ^ #Error
- ].
- expressions add:elem.
- tokenType == $. ifFalse:[
- ^ expressions
- ].
- self nextToken.
- tokenType == $} ifTrue:[
- ^ expressions
- ].
- ].
+ [
+ elem := self expression.
+ (elem == #Error) ifTrue:[
+ (tokenType == #EOF) ifTrue:[
+ self syntaxError:'unterminated computed-array-element; ''}'' expected'
+ position:pos1 to:tokenPosition
+ ].
+ ^ #Error
+ ].
+ expressions add:elem.
+ tokenType == $. ifFalse:[
+ ^ expressions
+ ].
+ self nextToken.
+ tokenType == $} ifTrue:[
+ ^ expressions
+ ].
+ ] loop.
"/ not reached
!
@@ -11827,11 +11827,11 @@
!Parser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.814 2014-03-05 22:12:46 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.815 2014-03-07 22:06:16 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.814 2014-03-05 22:12:46 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.815 2014-03-07 22:06:16 stefan Exp $'
!
version_SVN