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, If you are using the OpalCompiler (Pharo4, sure, Pharo3, I'm not so sure), have a look at:2014-12-10 12:57 GMT+01:00 Erik Itter <[hidden email]>: Hi, |
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 Erik, You need to make sure you are using the right compiler. In a Pharo3 image, you'll find two compilers: Opal and the old one.2014-12-10 13:32 GMT+01:00 Erik Itter <[hidden email]>:
|
In reply to this post by Erik Itter
2014-12-10 13:32 GMT+01:00 Erik Itter <[hidden email]>:
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 |
THX, Nicolai and Thierry, that got me a few steps further and will try
to get the rest by myself (at least for a few hours...). |
Free forum by Nabble | Edit this page |