On 12/30/2009 11:15 PM, Gwenael Casaccio wrote:
+    parseVersion: aString [
+       <category: 'version parsing'>
+
+       | tokens |
+       (tokens := aString tokenize: '\.') size = 3 ifFalse: [ self error: 'Bad 
version string : ', aString, ' should be xx.yy.zz' ].
+       self version: (Version major: tokens first asInteger minor: tokens 
second asInteger patch: tokens third asInteger)
+    ]

This should:

1) use #subStrings: or alternatively a single regex match

    ^(\d+)\.(\d+)(?:\.(\d+))$

instead of tokenize.

2) be in Version class>>#fromString:

3) accept a version like 1.0 and change it to 1.0.0 (see regex above).

Otherwise looks fine, filtering of prerequisites based on their version can be done later.

Paolo


_______________________________________________
help-smalltalk mailing list
help-smalltalk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to