Documentation generation for GDScript

- ClassDoc added to GDScript and property reflection data were extracted
from parse tree

- GDScript comments are collected from tokenizer for documentation and
applied to the ClassDoc by the GDScript compiler

- private docs were excluded (name with underscore prefix and doesn't
have any doc comments)

- default values (of non exported vars), arguments are extraced from the
parser

- Integrated with GDScript 2.0 and new enums were added.

- merge conflicts fixed
This commit is contained in:
Thakee Nathees 2020-11-29 08:07:57 +05:30
parent ef2d1f6d19
commit d0e7d9b62f
21 changed files with 1036 additions and 76 deletions

View file

@ -1014,9 +1014,17 @@ void GDScriptTokenizer::check_indent() {
}
if (_peek() == '#') {
// Comment. Advance to the next line.
#ifdef TOOLS_ENABLED
String comment;
while (_peek() != '\n' && !_is_at_end()) {
comment += _advance();
}
comments[line] = CommentData(comment, true);
#else
while (_peek() != '\n' && !_is_at_end()) {
_advance();
}
#endif // TOOLS_ENABLED
if (_is_at_end()) {
// Reached the end with an empty line, so just dedent as much as needed.
pending_indents -= indent_level();
@ -1125,18 +1133,26 @@ void GDScriptTokenizer::_skip_whitespace() {
newline(!is_bol); // Don't create new line token if line is empty.
check_indent();
break;
case '#':
case '#': {
// Comment.
#ifdef TOOLS_ENABLED
String comment;
while (_peek() != '\n' && !_is_at_end()) {
comment += _advance();
}
comments[line] = CommentData(comment, is_bol);
#else
while (_peek() != '\n' && !_is_at_end()) {
_advance();
}
#endif // TOOLS_ENABLED
if (_is_at_end()) {
return;
}
_advance(); // Consume '\n'
newline(!is_bol);
check_indent();
break;
} break;
default:
return;
}