[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #9023] Tell user about misaligned if/end p
From: |
Lachlan Andrew |
Subject: |
[Octave-patch-tracker] [patch #9023] Tell user about misaligned if/end pairs when an end-related error occurs |
Date: |
Fri, 10 Jun 2016 09:18:21 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 |
URL:
<http://savannah.gnu.org/patch/?9023>
Summary: Tell user about misaligned if/end pairs when an
end-related error occurs
Project: GNU Octave
Submitted by: lachlan
Submitted on: Fri 10 Jun 2016 09:18:19 AM GMT
Category: None
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: lachlan
Originator Email:
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
This patch gives users a hint about where a missing or spurious "end" (or
"endif" or "endfor" etc.) might be.
It uses the heuristic that the "end" should start at the same level of
indentation as the "if" or whatever, or perhaps be on the same line as the
"if". It records if/end pairs for which that doesn't occur. If an error
occurs that is likely to be due to mismatched ends, it augments the error
message with a note telling the user the innermost pair that start in
different columns.
This is most useful for those of us who have to write Matlab-compatible code,
since the dedicated forms of endXYZ provide some help with this, but in deeply
nested "if" or "for" statements, it still reduces the ambiguity.
If users have a coding style in which the "end" is supposed to have a
different indent, this will not create excess diagnostics, since it only
prints anything when an error occurs. Also, the output is only of the form
Note: The if on line W column X matches the end on line Y column Z.
which doesn't say that that is the cause of the error.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Fri 10 Jun 2016 09:18:19 AM GMT Name: patch_warn_misaligned_ends.cset
Size: 10kB By: lachlan
<http://savannah.gnu.org/patch/download.php?file_id=37445>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/patch/?9023>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-patch-tracker] [patch #9023] Tell user about misaligned if/end pairs when an end-related error occurs,
Lachlan Andrew <=