[squeak-dev] Separator character in class names

Eliot Miranda eliot.miranda at gmail.com
Thu Nov 20 19:11:31 UTC 2014


Hi Trygve,

On Thu, Nov 20, 2014 at 9:32 AM, Trygve Reenskaug <trygver at ifi.uio.no>
wrote:

>  Hi,
> I'm relying on decomposing composite class names.
> An example class name is  *BB5aBank*
> I decompose it into *#(BB5a Bank)* but am using ugly and error-prone
> hacks to achieve it.
> It would be very helpful if I could use some kind of separator in the
> class name, e.g., *BB5a:Bank*
>
> I've tried brute force by renaming class *BB5aBank *to *BB5a:Bank*
> This is permitted and Smalltalk points to the renamed class.
> Compiling a method that is using the new class name fails:
>     *bank :=  *Expression expected ->*BB5a:Bank new*
>
> I've looked into the Parser code, but got lost.
>

You probably need to dive down into the Scanner.  For example if you used
period and modified Scanner>>xLetter to not terminate the scan if it sees a
period followed by a capital letter you'll likely be able to parse e.g.
BB5a.Bank as a single token.  If you look at the xLetter method you'll see
it already tests self allowUnderscoreSelectors to accept underscores.

Ah, so an alternative would be to make sure the allowUnderscoreSelecctors
preference is set and use underscore as your separator.

HTH



> Anybody have any ideas?
>
> --Trygve
>
>
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20141120/782dc6a0/attachment.htm


More information about the Squeak-dev mailing list