2014-12-10 13:32 GMT+01:00 Erik Itter <[email protected]>:

>  Thanks, tried
>
> scanSpecialCharacter
>     | character |
>     currentCharacter = $:
>         ifTrue: [
>             self step.
>             ^ currentCharacter = $=
>                 ifTrue: [
>                     self step.
>                     RBAssignmentToken start: tokenStart]
>                 ifFalse: [ RBSpecialCharacterToken value: $: start:
> tokenStart ]].
>
>     currentCharacter = $:
>         ifTrue: [
>             self step.
>             ^ currentCharacter = $>
>                 ifTrue: [
>                     self step.
>                     RBAssignmentToken start: tokenStart]
>                 ifFalse: [ RBSpecialCharacterToken value: $: start:
> tokenStart ]].
>
>     currentCharacter = $_ ifTrue: [
>         self step.
>         ^ RBShortAssignmentToken start: tokenStart ].
>
>     character := currentCharacter.
>     self step.
>     ^ RBSpecialCharacterToken value: character start: tokenStart
>
> but while it does not seem to shred my image to pieces it also seems to
> have no effect at all. I guess the UI components still check differently
> and neither workplace nor SystemBrowser allow me to write code using the :>
> operator
>
> Am 10.12.2014 um 13:11 schrieb Thierry Goubier:
>
>   Hi,
>
>  If you are using the OpalCompiler (Pharo4, sure, Pharo3, I'm not so
> sure), have a look at:
>
>  RBScanner>>scanSpecialCharacter
>
>  Thierry
>
> 2014-12-10 12:57 GMT+01:00 Erik Itter <[email protected]>:
>
>> Hi,
>>
>> I need to modify the compiler adding ":>" as an alias for ":=" for
>> assignment. I have been reading all over the Compiler package but do not
>> find where a tokenizer parses for the assignement operator or where it is
>> defined.
>>
>> Any hint where to start or do it is appreciated.
>>
>> best regards
>> Erik
>>
>>
>
>
Hi Erik

with Opal resp. RBScanner (in pharo3 and pharo4)
There is a special handling for
k:=1
and
k := 1
because "k" can be an identifier, or the start of a selector (keyword
message) therefore you
have to change this too:

RBScanner>>#scanIdentifierOrKeyword

    (currentCharacter = $: and: [stream peek ~= $=])    "<---- add a test
for $>"
        ifTrue: [^self scanKeyword].


and the browsers/editor source code panel uses SHParserST80 for the syntax
highlighting:

SHParserST80>>#isAssignment
    ^ currentToken = ':='
        or: [currentToken = '_']   "<---- add atest for $> "



nicolai

Reply via email to