MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / parse_doc_comment

Method parse_doc_comment

modules/gdscript/gdscript_parser.cpp:3954–4007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3952}
3953
3954GDScriptParser::MemberDocData GDScriptParser::parse_doc_comment(int p_line, bool p_single_line) {
3955 ERR_FAIL_COND_V(!has_comment(p_line, true), MemberDocData());
3956
3957 const HashMap<int, GDScriptTokenizer::CommentData> &comments = tokenizer->get_comments();
3958 int line = p_line;
3959
3960 if (!p_single_line) {
3961 while (comments.has(line - 1) && comments[line - 1].new_line && comments[line - 1].comment.begins_with("##")) {
3962 line--;
3963 }
3964 }
3965
3966 max_script_doc_line = MIN(max_script_doc_line, line - 1);
3967
3968 String space_prefix;
3969 {
3970 int i = 2;
3971 for (; i < comments[line].comment.length(); i++) {
3972 if (comments[line].comment[i] != ' ') {
3973 break;
3974 }
3975 }
3976 space_prefix = String(" ").repeat(i - 2);
3977 }
3978
3979 DocLineState state = DOC_LINE_NORMAL;
3980 MemberDocData result;
3981
3982 while (line <= p_line) {
3983 String doc_line = comments[line].comment.trim_prefix("##");
3984 line++;
3985
3986 if (state == DOC_LINE_NORMAL) {
3987 String stripped_line = doc_line.strip_edges();
3988 if (stripped_line == "@deprecated" || stripped_line.begins_with("@deprecated:")) {
3989 result.is_deprecated = true;
3990 if (stripped_line.begins_with("@deprecated:")) {
3991 result.deprecated_message = stripped_line.trim_prefix("@deprecated:").strip_edges();
3992 }
3993 continue;
3994 } else if (stripped_line == "@experimental" || stripped_line.begins_with("@experimental:")) {
3995 result.is_experimental = true;
3996 if (stripped_line.begins_with("@experimental:")) {
3997 result.experimental_message = stripped_line.trim_prefix("@experimental:").strip_edges();
3998 }
3999 continue;
4000 }
4001 }
4002
4003 result.description += _process_doc_line(doc_line, result.description, space_prefix, state);
4004 }
4005
4006 return result;
4007}
4008
4009GDScriptParser::ClassDocData GDScriptParser::parse_class_doc_comment(int p_line, bool p_single_line) {
4010 ERR_FAIL_COND_V(!has_comment(p_line, true), ClassDocData());

Callers

nothing calls this directly

Calls 10

MemberDocDataClass · 0.85
MINFunction · 0.85
_process_doc_lineFunction · 0.85
begins_withMethod · 0.80
repeatMethod · 0.80
trim_prefixMethod · 0.80
strip_edgesMethod · 0.80
StringClass · 0.50
hasMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected