[Pharo-project] positionalMesssge breaks literal array parsing
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
On 24 March 2011 22:12, Eliot Miranda <eliot.miranda@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).
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.
On 24 March 2011 22:12, Eliot Miranda <eliot.miranda@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.
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)
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 <tapplek@gmail.com>:
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)
On 25 March 2011 08:14, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> 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 <tapplek@gmail.com>:
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.
participants (4)
-
Eliot Miranda -
Igor Stasenko -
Matthew Fulmer -
Nicolas Cellier