[squeak-dev] positionalMesssge breaks literal array parsing
Igor Stasenko
siguctua at gmail.com
Thu Mar 24 23:37:31 UTC 2011
On 24 March 2011 22:12, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> Hi All,
> the following won't parse because of support for positional messages
> (whatever they are; I'll come to that later).
> #(word()) should be equal to { #word. #() }
> but because of the type == #leftParenthesis clause in the below it causes a
> syntax error:
> Scanner methods for multi-character scans
> xLetter
> "Form a word or keyword."
> | type |
> buffer reset.
> [(type := self typeTableAt: hereChar) == #xLetter
> or: [type == #xDigit
> or: [type == #xUnderscore and:[self allowUnderscoreSelectors]]]] whileTrue:
> ["open code step for speed"
> buffer nextPut: hereChar.
> hereChar := aheadChar.
> aheadChar := source atEnd
> ifTrue: [30 asCharacter "doit"]
> ifFalse: [source next]].
> tokenType := (type == #colon or: [type == #xColon and: [aheadChar ~~ $=]])
> ifTrue:
> [buffer nextPut: self step.
> "Allow any number of embedded colons in literal symbols"
> [(self typeTableAt: hereChar) == #xColon] whileTrue:
> [buffer nextPut: self step].
> #keyword]
> ifFalse:
> [type == #leftParenthesis
> ifTrue:
> [buffer nextPut: self step; nextPut: $).
> #positionalMessage]
> ifFalse:[#word]].
> token := buffer contents
> e.g. evaluate any of the following:
> #(word())
> Compiler evaluate: '#(word())'
> Scanner new scanTokens: '#(word())'
> What is this support for? Is it for those funky ffi calls in the OpenGL
> code? Can it not be hoisted out of the scanner and into the parser proper?
My IMO: just wipe it out.
It is broken anyways, because expressions like:
self foo(4).
are not parsed correctly and producing syntax error instead of
recognizing it as a message with positional arguments .
> [and optimistically anyone have a fix already?]
> best,
> Eliot
>
>
>
--
Best regards,
Igor Stasenko AKA sig.
More information about the Squeak-dev
mailing list
|