positionalMesssge breaks literal array parsing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

positionalMesssge breaks literal array parsing

Eliot Miranda-2
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
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] positionalMesssge breaks literal array parsing

Igor Stasenko
On 24 March 2011 22:12, Eliot Miranda <[hidden email]> wrote:
> Hi All,
>     the following won't parse because of support for positional messages
> (whatever they are; I'll come to that later).

http://www.lazarevic.de/PositionalArgs.html

>         #(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
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] positionalMesssge breaks literal array parsing

Igor Stasenko
In reply to this post by Eliot Miranda-2
On 24 March 2011 22:12, Eliot Miranda <[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] positionalMesssge breaks literal array parsing

Tapple Gao
In reply to this post by Eliot Miranda-2
On Thu, Mar 24, 2011 at 02:12:31PM -0700, Eliot Miranda wrote:
> 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?]

I was under the impression those were never in the compiler. I
had to add the support to the Compiler myself (the code was in
the inbox, but now has been removed to the treated inbox).
OpenGL no longer has positional methods; they were removed

--
Matthew Fulmer (a.k.a. Tapple)

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] positionalMesssge breaks literal array parsing

Nicolas Cellier
Anyway, if we would keep an alternate syntax,I recommend using a
subclass of Parser and leave the SmalltalkParser alone.

Nicolas

2011/3/25 Matthew Fulmer <[hidden email]>:

> On Thu, Mar 24, 2011 at 02:12:31PM -0700, Eliot Miranda wrote:
>> 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?]
>
> I was under the impression those were never in the compiler. I
> had to add the support to the Compiler myself (the code was in
> the inbox, but now has been removed to the treated inbox).
> OpenGL no longer has positional methods; they were removed
>
> --
> Matthew Fulmer (a.k.a. Tapple)
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] positionalMesssge breaks literal array parsing

Igor Stasenko
On 25 March 2011 08:14, Nicolas Cellier
<[hidden email]> wrote:
> Anyway, if we would keep an alternate syntax,I recommend using a
> subclass of Parser and leave the SmalltalkParser alone.
>
+1

> Nicolas
>
> 2011/3/25 Matthew Fulmer <[hidden email]>:
>> On Thu, Mar 24, 2011 at 02:12:31PM -0700, Eliot Miranda wrote:
>>> 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?]
>>
>> I was under the impression those were never in the compiler. I
>> had to add the support to the Compiler myself (the code was in
>> the inbox, but now has been removed to the treated inbox).
>> OpenGL no longer has positional methods; they were removed
>>
>> --
>> Matthew Fulmer (a.k.a. Tapple)
>>
>>
>
>



--
Best regards,
Igor Stasenko AKA sig.