[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #64065] help text in m-file incorrectly identi
From: |
Ali Zahraee |
Subject: |
[Octave-bug-tracker] [bug #64065] help text in m-file incorrectly identified |
Date: |
Wed, 24 May 2023 07:49:46 -0400 (EDT) |
Follow-up Comment #1, bug #64065 (project octave):
Hi,
I spent some time debugging octave to find the root-cause of this bug. This
was my first foray into octave code, and was certainly a lot of fun.
The problem comes from the fact that the lexical parser distinguishes full
line comments from end of line comments, but in the end puts both of them in
the same category of LINE_COMMENT.
In the patch attached, if a comment line is an end of line comment, it is
marked as such, as is not used as help_text for the function.
With this fcn_help.m provided by Rik
function r = fcn_help (x)
r = x; # Single-line comment, not documentation for function
endfunction
calling print_usage() correctly detects that usage is not provided.
octave:> print_usage('fcn_help')
error: print_usage: 'fcn_help' is not documented
Now, if a line or two, of comments are added in the beginning of the function,
that is correctly identified as the correct usage.
function r = fcn_help (x)
# how to use this function
# this is how
r = x; # Single-line comment, not documentation for function
endfunction
octave:1> print_usage('fcn_help')
error: Invalid call to fcn_help. Correct usage is:
how to use this function
this is how
(file #54781)
_______________________________________________________
Additional Item Attachment:
File name: print_usage.fix.patch Size:1 KB
<https://file.savannah.gnu.org/file/print_usage.fix.patch?file_id=54781>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?64065>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #64065] help text in m-file incorrectly identified,
Ali Zahraee <=