Menu

#333 clarify DO/LOOP reserved keywords in expressions

5.1.0
pending
Erich
None
1
2024-09-04
2024-09-02
No

Rexxref 2.4 DO, note 9, says:

[...] Similarly, TO, BY, and FOR cannot be used in expri, exprt, exprb, or exprf. [...] However, parentheses around or within an expression can prevent these keywords from terminating an expression.

This does not work when TO, BY or FOR are used as variable reference terms. For example, in

to = 3
Do i = >to to 4
  Say i
End

line 2 should produce an error, because the first "to" token should be taken to be a reserved sub-keyword, and then expri would be ">", which is an invalid expression.

My impression is that the interpreter should be fixed to honor note 9. Otherwise, this special behaviour should be documented.

Discussion

  • Rick McGuire

    Rick McGuire - 2024-09-02

    I think I have to agree with Josep in this case. Consider the following:

    do i = a~to to 6; say hi; end
    Oooops ! ... try again. String or symbol expected.
    String or symbol expected after tilde (~).

    The TO is recognized as being a reserved word and thus an expression
    terminator even though it is part of a message term just like >to would be.
    I actually prefer the way ">to" is working currently, but both cases should
    be working the same way.

    On Mon, Sep 2, 2024 at 12:42 PM Josep Maria Blasco jmblasc2@users.sourceforge.net wrote:


    [bugs:#1974] Reserved subkeywords not working when used as variable
    reference terms

    Status: open
    Group: 5.1.0
    Created: Mon Sep 02, 2024 04:42 PM UTC by Josep Maria Blasco
    Last Updated: Mon Sep 02, 2024 04:42 PM UTC
    Owner: nobody

    Rexxref 2.4 DO, note 9, says:

    [...] Similarly, TO, BY, and FOR cannot be used in expri, exprt, exprb,
    or exprf. [...] However, parentheses around or within an expression can
    prevent these keywords from terminating an expression.

    This does not work when TO, BY or FOR are used as variable reference
    terms. For example, in

    ~~~
    to = 3
    Do i = >to to 4
    Say i
    End
    ~~~

    line 2 should produce an error, because the first "to" token should be
    taken to be a reserved sub-keyword, and then expri would be ">", which is
    an invalid expression.

    My impression is that the interpreter should be fixed to honor note 9.
    Otherwise, this special behaviour should be documented.


    Sent from sourceforge.net because you indicated interest in <
    https://sourceforge.net/p/oorexx/bugs/1974/>

    To unsubscribe from further messages, please visit <
    https://sourceforge.net/auth/subscriptions/>

     
  • Erich

    Erich - 2024-09-04

    Ticket moved from /p/oorexx/bugs/1974/

    Can't be converted:

    • _pending_work_items: none
     
  • Erich

    Erich - 2024-09-04
    • summary: Reserved subkeywords not working when used as variable reference terms --> clarify DO/LOOP reserved keywords in expressions
    • status: open --> pending
    • assigned_to: Erich
     
  • Erich

    Erich - 2024-09-04

    updated rexxref with [r12892] to clarify reserved DO/LOOP keywords can be used in certain terms even without parens.
    also opened [feature-requests:#844] Allow reserved keywords in DO/LOOP expression message terms

     

    Related

    Commit: [r12892]
    Feature Requests: #844

Anonymous
Anonymous

Add attachments
Cancel