Bill Spight bspight at pacbell.net
Wed Feb 5 18:21:53 UTC 2003

Progris Riport:

Well, I fiddled with Scanner to get it to accept <|, |>, ||, and others
as selectors. It's not as general a solution as suggested, but it seems
to work. So far, so good. :-)

Here are the changes:

 "Changed the lookup tokenType for $| to #xVerticalBar to activate
method of that name."
 * * *
    newTable at: $| asciiValue put: #xVerticalBar.
    TypeTable _ newTable


    tokenType _ #binary.
    token _ self step asSymbol.
"Added hereChar = $| to condition"
    [((typeTable at: hereChar asciiValue) = #xBinary 
        and: [hereChar ~= $-]) 
        or: [hereChar = $|]]
        whileTrue: [token _ (token , (String with: self step)) asSymbol]

    "If the vertical bar is followed by a binary type (except $-) or
itself, treat it as a binary type. (New method.)"	

    (((typeTable at: aheadChar asciiValue) = #xBinary 
        and: [aheadChar ~= $-]) 
        or: [aheadChar = $|]) 
        ifTrue: [self xBinary]
        ifFalse: [tokenType _ #verticalBar.
            ^ token _ self step asSymbol]

Much grass,


More information about the Squeak-dev mailing list