diff libinterp/parse-tree/lex.h @ 32930:ab4b7e516ff3 stable

allow help for ordinary functions to work again (bug #65220) * comment-list.h (comment_elt::doc_string): Delete enum element. The lexer and parser no longer attempt to tag comments as doc strings when they are initially recognized so this tag is unused now. (comment_elt::is_doc_string): Delete function. (comment_list::find_doc_comment, comment_list::find_doc_string): New functions. * lex.h, lex.ll (lexical_feedback::m_classdef_doc_string, lexical_feedback::m_doc_string): Delete data members and all uses. (base_parser::finish_comment): Don't try to recognize doc string here. * parse.h, oct-parse.yy (classdef_beg): Don't try to recognize doc string here. (classdef): Use stash_comment to grab comment before END instead of calling lexer.get_comment inside rule. Don't try to recognize doc string here. * (base_parser::make_script): Examine comment lists attached to commands to find doc string. * (base_parser::make_function): Examine leading and body comment lists to find doc string. For classdef methods, attempt Matlab compatible behavior by looking at whether comments only use '%' characters. * (base_parser::start_function): New argument, doc_string. Use it instead of asking the lexer for the doc string. * (base_parser::make_classdef): New argument, bc. Delete it on error. Extract doc string from leading or body comment. * help.cc (help_system::raw_help_from_symbol_table): When searching using the full name and a class is found, only search for a constructor if the full name contains a '.' and there is no doc string for the class itself. If a class is found and there is no doc string for the class itself or a constructor, generate a simple doc string indicating that the class exists but is undocumented.
author John W. Eaton <jwe@octave.org>
date Sun, 04 Feb 2024 23:21:11 -0500
parents f41297ca3e1a
children d8c716290873
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.h	Sat Feb 03 19:29:53 2024 +0100
+++ b/libinterp/parse-tree/lex.h	Sun Feb 04 23:21:11 2024 -0500
@@ -301,8 +301,6 @@
       m_filepos (1, 1),
       m_tok_beg (),
       m_tok_end (),
-      m_classdef_doc_string (),
-      m_doc_string (),
       m_string_text (),
       m_current_input_line (),
       m_comment_text (),
@@ -476,12 +474,6 @@
   filepos m_tok_beg;
   filepos m_tok_end;
 
-  // Pending doc string for classdef object.
-  comment_elt m_classdef_doc_string;
-
-  // Pending doc string for functions.
-  comment_elt m_doc_string;
-
   // The current character string text.
   std::string m_string_text;