Hi Alistair,
I have found the cause of the problem, and it's easy to work the issue around. Just evaluate the following in a workspace:
Scanner allowUnderscoreAsAssignment: false. RBScanner initializeClassificationTable
The cause of the error is that RBScanner considers _ to be #special instead of #alphabetic when Scanner class >> #allowUnderscoreAsAssignment returns true. In Pharo this is not an issue, because underscore assignments have been abandoned and underscores in selectors are allowed permanently. But in Squeak everything can happen (so underscore can either be #special or #alphabetic depending on its context) and RBScanner would need some rewrite to support those cases.
I suggest the line
Scanner allowUnderscoreAsAssignment: false
be added to BuildSqueakSpurTrunkVMMakerImage.st before RB is loaded to avoid this issue in future images (because VMMaker code shouldn't rely on underscore assignments being supported).
Levente
On Mon, 5 Nov 2018, Alistair Grant wrote:
Hi Levente,
On Mon, 5 Nov 2018 at 00:35, Levente Uzonyi leves@caesar.elte.hu wrote:
On Sun, 4 Nov 2018, Alistair Grant wrote:
Hi All,
If I attempt to execute the following:
| rules |
rules := RBParseTreeRewriter new.
rules replace: 'state at: `@index put: `@expr' with: 'state at: `@index put: `@expr asC_unsigned_int'.
I presume the version you use doesn't support underscores in selectors. Does it work if you use a selector with no underscores in it?
That's it, thanks! (it works without the underscores)
I hate it when I forget to include version information, sorry:
Squeak5.3alpha latest update: #18261 Image format 68021 (64 bit)
AST-Core-eem.97 Refactoring-Changes-eem.22 Refactoring-Core-ul.162 Refactoring-Environment-eem.11 Refactoring-Squeak-Platform-cwp.2 Refactoring-Tests-Changes-lr.16 Refactoring-Tests-Core-lr.56 Refactoring-Tests-Environment-eem.5
How did you load RB? Did you use the Metacello configuration? (it may not be up-to-date)
All the above appear to be the latest versions on http://www.squeaksource.com/rb.
This is a vmmaker image, they were all loaded through:
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/image/BuildSqueak...
It sounds like there may be an updated version of RB that already addresses this?
Thanks again, Alistair
Levente
(rules executeTree: (MD5Plugin parseTreeFor: #md5ProcessBuffer:withState:)) ifTrue: [rules tree newSource inspect]. self error: 'parse tree rewrite failed'
I get "Error: End of statement list encountered" (stack trace below). The same works and produces the expected output in Pharo 7.
It looks like the Refactoring Browser has diverged quite a bit between Squeak and Pharo.
Who looks after RB in Squeak, and is there a plan to keep in sync with Pharo, or the other way around, or should this be fixed independently?
Thanks, Alistair