comparison 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
comparison
equal deleted inserted replaced
32925:ac3121944bb7 32930:ab4b7e516ff3
299 m_command_arg_paren_count (0), 299 m_command_arg_paren_count (0),
300 m_token_count (0), 300 m_token_count (0),
301 m_filepos (1, 1), 301 m_filepos (1, 1),
302 m_tok_beg (), 302 m_tok_beg (),
303 m_tok_end (), 303 m_tok_end (),
304 m_classdef_doc_string (),
305 m_doc_string (),
306 m_string_text (), 304 m_string_text (),
307 m_current_input_line (), 305 m_current_input_line (),
308 m_comment_text (), 306 m_comment_text (),
309 m_function_text (), 307 m_function_text (),
310 m_fcn_file_name (), 308 m_fcn_file_name (),
474 // update_token_positions to handle the beginning and end of 472 // update_token_positions to handle the beginning and end of
475 // character strings. 473 // character strings.
476 filepos m_tok_beg; 474 filepos m_tok_beg;
477 filepos m_tok_end; 475 filepos m_tok_end;
478 476
479 // Pending doc string for classdef object.
480 comment_elt m_classdef_doc_string;
481
482 // Pending doc string for functions.
483 comment_elt m_doc_string;
484
485 // The current character string text. 477 // The current character string text.
486 std::string m_string_text; 478 std::string m_string_text;
487 479
488 // The current line of input. 480 // The current line of input.
489 std::string m_current_input_line; 481 std::string m_current_input_line;