[squeak-dev] positionalMesssge breaks literal array parsing

Eliot Miranda eliot.miranda at gmail.com
Thu Mar 24 21:12:31 UTC 2011


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?
[and optimistically anyone have a fix already?]

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


More information about the Squeak-dev mailing list