summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_tokenizer.h
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-12-02 14:15:38 +0100
committerGitHub <noreply@github.com>2020-12-02 14:15:38 +0100
commitd1231be1c8f8f2c16fd1047adcd3c7f997a07c1f (patch)
treef7ceec96ce5251a3f7ed7ed33abcb163f29f0ad3 /modules/gdscript/gdscript_tokenizer.h
parent0019aa940e661fcc5e6b8f333ca291ba8726e6e4 (diff)
parent42bfa169960b59c5d9337e9f63862f5feae92d58 (diff)
Merge pull request #41095 from ThakeeNathees/GDScript-Documentation
GDScript(2.0) Documentation generation system
Diffstat (limited to 'modules/gdscript/gdscript_tokenizer.h')
-rw-r--r--modules/gdscript/gdscript_tokenizer.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_tokenizer.h b/modules/gdscript/gdscript_tokenizer.h
index d51f1f250f..f236c86f9f 100644
--- a/modules/gdscript/gdscript_tokenizer.h
+++ b/modules/gdscript/gdscript_tokenizer.h
@@ -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(); }