summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/register_types.cpp
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2020-05-01 19:14:56 -0300
committerGeorge Marques <george@gmarqu.es>2020-07-20 11:38:39 -0300
commit5d6e8538065050d5f5579ec03cfa9e241811e062 (patch)
treec36cdc8d6b4353243dab6afb457db87c84c053e9 /modules/gdscript/register_types.cpp
parent818bfbc5b53cc7df4f33493d3ca0a9b74e2cb34a (diff)
downloadredot-engine-5d6e8538065050d5f5579ec03cfa9e241811e062.tar.gz
New GDScript tokenizer and parser
Sometimes to fix something you have to break it first. This get GDScript mostly working with the new tokenizer and parser but a lot of things isn't working yet. It compiles and it's usable, and that should be enough for now. Don't worry: other huge commits will come after this.
Diffstat (limited to 'modules/gdscript/register_types.cpp')
-rw-r--r--modules/gdscript/register_types.cpp66
1 files changed, 8 insertions, 58 deletions
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 6c4e529922..06367e3a31 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -50,10 +50,13 @@ Ref<ResourceFormatSaverGDScript> resource_saver_gd;
#include "editor/gdscript_highlighter.h"
#include "editor/gdscript_translation_parser_plugin.h"
+// FIXME: Reenable LSP.
+#if 0
#ifndef GDSCRIPT_NO_LSP
#include "core/engine.h"
#include "language_server/gdscript_language_server.h"
#endif // !GDSCRIPT_NO_LSP
+#endif
Ref<GDScriptEditorTranslationParserPlugin> gdscript_translation_parser_plugin;
@@ -76,64 +79,8 @@ public:
return;
}
- Vector<uint8_t> file = FileAccess::get_file_as_array(p_path);
- if (file.empty()) {
- return;
- }
-
- String txt;
- txt.parse_utf8((const char *)file.ptr(), file.size());
- file = GDScriptTokenizerBuffer::parse_code_string(txt);
-
- if (!file.empty()) {
- if (script_mode == EditorExportPreset::MODE_SCRIPT_ENCRYPTED) {
- String tmp_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("script.gde");
- FileAccess *fa = FileAccess::open(tmp_path, FileAccess::WRITE);
-
- Vector<uint8_t> key;
- key.resize(32);
- for (int i = 0; i < 32; i++) {
- int v = 0;
- if (i * 2 < script_key.length()) {
- CharType ct = script_key[i * 2];
- if (ct >= '0' && ct <= '9') {
- ct = ct - '0';
- } else if (ct >= 'a' && ct <= 'f') {
- ct = 10 + ct - 'a';
- }
- v |= ct << 4;
- }
-
- if (i * 2 + 1 < script_key.length()) {
- CharType ct = script_key[i * 2 + 1];
- if (ct >= '0' && ct <= '9') {
- ct = ct - '0';
- } else if (ct >= 'a' && ct <= 'f') {
- ct = 10 + ct - 'a';
- }
- v |= ct;
- }
- key.write[i] = v;
- }
- FileAccessEncrypted *fae = memnew(FileAccessEncrypted);
- Error err = fae->open_and_parse(fa, key, FileAccessEncrypted::MODE_WRITE_AES256);
-
- if (err == OK) {
- fae->store_buffer(file.ptr(), file.size());
- }
-
- memdelete(fae);
-
- file = FileAccess::get_file_as_array(tmp_path);
- add_file(p_path.get_basename() + ".gde", file, true);
-
- // Clean up temporary file.
- DirAccess::remove_file_or_error(tmp_path);
-
- } else {
- add_file(p_path.get_basename() + ".gdc", file, true);
- }
- }
+ // TODO: Readd compiled/encrypted GDScript on export.
+ return;
}
};
@@ -148,12 +95,15 @@ static void _editor_init() {
ScriptEditor::get_singleton()->register_syntax_highlighter(gdscript_syntax_highlighter);
#endif
+// FIXME: Reenable LSP.
+#if 0
#ifndef GDSCRIPT_NO_LSP
register_lsp_types();
GDScriptLanguageServer *lsp_plugin = memnew(GDScriptLanguageServer);
EditorNode::get_singleton()->add_editor_plugin(lsp_plugin);
Engine::get_singleton()->add_singleton(Engine::Singleton("GDScriptLanguageProtocol", GDScriptLanguageProtocol::get_singleton()));
#endif // !GDSCRIPT_NO_LSP
+#endif
}
#endif // TOOLS_ENABLED