[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #58945] Octave parser allows keyword 'end' as
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #58945] Octave parser allows keyword 'end' as a function parameter |
Date: |
Thu, 13 Aug 2020 18:08:09 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko |
URL:
<https://savannah.gnu.org/bugs/?58945>
Summary: Octave parser allows keyword 'end' as a function
parameter
Project: GNU Octave
Submitted by: rik5
Submitted on: Thu 13 Aug 2020 03:08:07 PM PDT
Category: Interpreter
Severity: 2 - Minor
Priority: 5 - Normal
Item Group: Incorrect Result
Status: Confirmed
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Release: dev
Discussion Lock: Any
Operating System: Any
_______________________________________________________
Details:
Keywords are reserved, and shouldn't be available for use as variable names.
This is the case for the keyword 'end' when used on the command line. For
example,
end = 1
error: parse error:
syntax error
>>> end = 1
^
It might be nicer to have a more specific message then just "syntax error" in
this case, but it still does prevent user's from re-assigning a keyword.
On the other hand, this function allows assigning to a keyword via the
parameter name of a function.
function y = fend (end)
disp (end(1:end));
end
For certain values of the input parameter, such as 1, this works. In Matlab,
there is an error on line 1, column 20 which is the start of the keyword
"end".
This is a small priority so I've made the severity minor.
Also, 'end' was just an example. One can alias any keyword such as 'for',
'while', etc.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58945>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #58945] Octave parser allows keyword 'end' as a function parameter,
Rik <=