help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] RBScanner and compile time constants


From: Holger Hans Peter Freyther
Subject: [Help-smalltalk] RBScanner and compile time constants
Date: Fri, 20 Dec 2013 22:21:35 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

I finally understand the issue (I have already beeng debugging this
in autumn).

  STInST.RBParser parseExpression: '#(##(1/2))'   -> error

This is because of:

  (STInST.RBScanner on: '#(##(1/2))') next next   -> $)

and this is because of...


    scanLiteralArrayParts [
        <category: 'private-scanning'>
        currentCharacter == $# ifTrue: [^self scanLiteral].

... 

    scanLiteral [
        <category: 'private-scanning'> 
        self step.
        self stripSeparators.
...
        currentCharacter == $# ifTrue: [^self scanExtendedLiterals].



    scanExtendedLiterals [
        <category: 'private-scanning numbers'>
        | token |
        self step.
        currentCharacter == $( 
            ifTrue:
                [self step.
                ^RBOptimizedToken start: tokenStart].
        self scannerError: 'Expecting parentheses'
    ]


...


So scanExtendedLiterals will consume the $( of ##( but the $) of the literal 
will
not be consumed leaving the extra token.

Now my question is if the optimized token should recursively scan the
literals? Or should the RBScanner count $( and $) to know that it needs
to read one more item?


holger



reply via email to

[Prev in Thread] Current Thread [Next in Thread]