Portability: transform `[...] doWhile: [...]` to `[...] whileTrue`
ANSI smalltalk defines only `#whileTrue`, `#doWhile:` is stxism
(yet arguably useful and more readable).
--- a/GDBMIParser.st Mon Oct 29 13:02:14 2018 +0000
+++ b/GDBMIParser.st Tue Oct 30 14:36:08 2018 +0000
@@ -757,20 +757,21 @@
object := OrderedCollection new.
self peek ~~ terminator ifTrue:[
- [
+ [ "do..."
('"{[' includes: self peek) ifFalse:[
self parseVariable.
self expect: $=.
].
value := self parseValue.
object add: value.
- ] doWhile:[
+ "...while..."
(self peek == $,) ifTrue:[ self next. true ] ifFalse:[ false ]
- ].
+ ] whileTrue.
].
^ object asArray
"Created: / 06-07-2017 / 08:24:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-10-2018 / 14:29:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
parseTuple
@@ -839,6 +840,7 @@
| propertyName propertyValue propertyDescriptor |
[
+ "do..."
propertyName := self parseVariable.
propertyDescriptor := descriptor propertyDescriptorAt: propertyName.
self expect: $=.
@@ -847,13 +849,14 @@
] ifFalse:[
propertyValue := propertyDescriptor parseUsingGDBMIParser:self.
].
- object propertyAt: propertyName put: propertyValue
- ] doWhile: [
+ object propertyAt: propertyName put: propertyValue.
+ "...while..."
(self peek == $,) ifTrue:[ self next. true ] ifFalse:[ false ]
- ].
+ ] whileTrue.
^ object
"Created: / 19-03-2015 / 07:52:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-10-2018 / 14:30:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
parseValueAsBoolean
@@ -1028,18 +1031,20 @@
list := OrderedCollection new.
bracketsOmmited ifTrue:[
[
+ "do..."
list add: (self parseValueAsListElementDescribedBy: descriptor).
- ] doWhile:[
+ "...while..."
(self peek == $,) ifTrue:[ self next ].
self peek == ${
- ].
+ ] whileTrue.
] ifFalse:[
self peek ~~ $] ifTrue:[
[
+ "do..."
list add: (self parseValueAsListElementDescribedBy: descriptor).
- ] doWhile: [
+ "...while..."
(self peek == $,) ifTrue:[ self next. true ] ifFalse:[ false ]
- ].
+ ] whileTrue.
].
].
@@ -1049,8 +1054,7 @@
^ list asNilIfEmpty.
"Created: / 11-11-2017 / 12:14:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 12-11-2017 / 17:22:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 03-07-2018 / 15:51:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-10-2018 / 14:31:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
parseValueAsString