|
This post was updated on .
Excuse me for my poor english.
I have a problem in Amber Smalltalk. When the next code is executed all method variables have nil value on debugger:
pvtGetWordFragments: aString regex: aStringRegex
| wordFragmentRegex fragments formattedWord execResult |
wordFragmentRegex := RegularExpression fromString: aStringRegex flag: 'g'.
fragments := OrderedCollection new.
formattedWord := aString trimBoth asLowercase.
execResult := wordFragmentRegex exec: formattedWord.
self halt.
"Don't execute the next code. You need more classes..."
(execResult notNil) whileTrue:[
fragments add: (VRSWordFragment newFrom: formattedWord inPosition: (execResult index)).
execResult := wordFragmentRegex exec: formattedWord.
].
^fragments.
aString have value 'terratremol'
aStringRegex have value 'que|què|qui|quí|gue|guè|gué|gui|guí'
That method returns a collection of matches from aString instance, but my problem, when run that on a Workspace, appears when I eval "formattedWord" and "fragments" than values is nil.
Regards
|