<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;"><div>Hi Folks,<br></div><div><br></div><div>I am importing my grammar/xtreams parsing work into its own image so that I can change my system fonts without making my other projects look funky with the chages.<br></div><div><br></div><div>The base image is:<br></div><div><br></div><div><br></div><div>Image<br></div><div>-----<br></div><div>/home/wm/usr/src/smalltalk/squeak6.0alpha/shared/Squeak6.0alpha-19802-64bit.image<br></div><div>Squeak6.0alpha<br></div><div>latest update: #20147<br></div><div><br></div><div>to the latest:<br></div><div><br></div><div>/home/wm/Squeak/images/WikitextParser/WikitextParser.image<br></div><div>Squeak6.0alpha<br></div><div>latest update: #20188<br></div><div><br></div><div>During the import of my work, I ran into this issue regarding Store Into in a block:<br></div><div><br></div><div><br></div><div><a href="http://forum.world.st/Cuis-problem-with-blocks-td1047783.html#a1049556" target="_blank">http://forum.world.st/Cuis-problem-with-blocks-td1047783.html#a1049556</a><br></div><div><br></div><div><br></div><div>The parser is looking for patterns of  (10e2)e2....i.e.  exponential notation of unknown length, i.e. per the comment on Collection inject: into:  accumulate a running value...<br></div><div><br></div><div><br></div><div><br></div><div>Per the email chain referenced, the "Allow block argument assignment" is allowed in the former, and not allowed in the latest, which is cool with me, but...<br></div><div><br></div><div>My question is "what is the generic form" that I can use to duplicate the behaviour I want?<br>Here is the original method with the bad store into:<br><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>Float: first exponent: pairs<br></div><div>  <action: 'Float' arguments:#(1 2)><br></div><div><br></div><div>"Float                                             <- ( Number / Group / Function ) (''e'' ( Number / Group / Function ))+"<br></div><div><br></div><div>|result|<br></div><div>        result := pairs inject: first<br></div><div>                        into: [ :base  :pair |<br></div><div>                                    (pair first = 'e')<br></div><div>                                               ifTrue: [<br></div><div>                                                            (pair last abs > 1)<br></div><div>                                                                  ifTrue:[       base := Float readFrom: ((base asString) , 'e', (pair last asString))]<br></div><div>                                                                  ifFalse:[    base := (base * (10 raisedTo:(pair last) ))]]].<br></div><div><br></div><div>transcripton ifTrue:[Transcript show:'Float ' , (result asFloat); cr.  ].<br></div><div><br></div><div><br></div><div>^ result asFloat<br></div></blockquote><br></div><div><br></div><div><br></div><div>Here is my "hack" to fix it , (I create a tmp variable outside the block to use in place of the "base"):<br></div><div><br></div><div><br></div><div><blockquote style="border: 1px solid rgb(204, 204, 204); padding: 7px; background-color: rgb(245, 245, 245);"><div>Float: first exponent: pairs<br></div><div>  <action: 'Float' arguments:#(1 2)><br></div><div><br></div><div>"Float                                              <- ( Number / Group / Function ) (''e'' ( Number / Group / Function ))+"<br></div><div><br></div><div>|result tmp|<br></div><div>              result := pairs inject: first<br></div><div>                              into: [ :base  :pair |<br></div><div>                                          (pair first = 'e')<br></div><div>                                                ifTrue: [<br></div><div>                                                      (pair last abs > 1)<br></div><div>                                                            ifTrue:[tmp := base.<br></div><div>                                                                        tmp := Float readFrom: ((tmp asString) , 'e', (pair last asString))]<br></div><div>                                                                        tmp := Float readFrom: ((tmp asString) , 'e', (pair last asString)).<br></div><div>                                                                        tmp]<br></div><div>                                                            ifFalse:[tmp := base.<br></div><div>                                                                        tmp := (tmp * (10 raisedTo:(pair last) ))]]].<br></div><div>                                                                        tmp := (tmp * (10 raisedTo:(pair last) )).<br></div><div>                                                                        tmp]]].<br></div><div><br></div><div>transcripton ifTrue:[Transcript show:'Float ' , (result asFloat); cr.     ].<br></div><div><br></div><div><br></div><div>^ result asFloat<br></div></blockquote><br></div><div>I got a bad feeling about this one.<br></div><div><br></div><div><br></div><div>Is there a general form for this ?<br></div><div><br></div><div><br></div><div>My brain is a bit foggy from working the graveyard shift so what would be obvious while in normal conditions , is not obvious today.</div><div><br></div><div><br></div><div>Thanks for you time.</div><div><br></div><div><br></div></div><br></body></html>