Q: Periods in {} expression

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Sat Jun 3 10:23:52 UTC 2000


Brent Pinkney wrote:

> { 5 factorial. 4 factorial. 3 factorial.} gives the error: "Variable or
> expression expected -> }

Brent,

I reported this a while ago since it caused a great deal of trouble for a
code generator of mine. I got a fix for it very quickly, but I thought this
had already gone into the regular update stream:

Parser>>braceExpression
    " { elements } => BraceNode."

    | elements locations loc more |
    elements _ OrderedCollection new.
    locations _ OrderedCollection new.
    self advance.
    more _ hereType ~~ #rightBrace.
    [more]
        whileTrue: 
            [loc _ hereMark + requestorOffset.
            self expression
                ifTrue:
                    [elements addLast: parseNode.
                    locations addLast: loc]
                ifFalse:
                    [^self expected: 'Variable or expression'].
            (self match: #period)
                ifTrue: [more _ hereType ~~ #rightBrace]
                ifFalse: [more _ false]].
    parseNode _ BraceNode new elements: elements sourceLocations: locations.
    (self match: #rightBrace)
        ifFalse: [^self expected: 'Period or right brace'].
    ^true

Let me know if this makes any difference for you; I'm not convinved that
this is the solution to your problem, as it ought to have been fixed
already.

Henrik






More information about the Squeak-dev mailing list