You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
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:
@@ -32,6 +32,7 @@
|
||||
#define GDSCRIPT_TOKENIZER_H
|
||||
|
||||
#include "core/templates/list.h"
|
||||
#include "core/templates/map.h"
|
||||
#include "core/templates/set.h"
|
||||
#include "core/templates/vector.h"
|
||||
#include "core/variant/variant.h"
|
||||
@@ -181,6 +182,21 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
struct CommentData {
|
||||
String comment;
|
||||
bool new_line = false;
|
||||
CommentData() {}
|
||||
CommentData(const String &p_comment, bool p_new_line) {
|
||||
comment = p_comment;
|
||||
new_line = p_new_line;
|
||||
}
|
||||
};
|
||||
const Map<int, CommentData> &get_comments() const {
|
||||
return comments;
|
||||
}
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
private:
|
||||
String source;
|
||||
const char32_t *_source = nullptr;
|
||||
@@ -207,6 +223,10 @@ private:
|
||||
int position = 0;
|
||||
int length = 0;
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
Map<int, CommentData> comments;
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
_FORCE_INLINE_ bool _is_at_end() { return position >= length; }
|
||||
_FORCE_INLINE_ char32_t _peek(int p_offset = 0) { return position + p_offset >= 0 && position + p_offset < length ? _current[p_offset] : '\0'; }
|
||||
int indent_level() const { return indent_stack.size(); }
|
||||
|
||||
Reference in New Issue
Block a user