diff options
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gd_parser.cpp | 36 | ||||
-rw-r--r-- | modules/gdscript/gd_script.h | 13 | ||||
-rw-r--r-- | modules/gdscript/gd_tokenizer.cpp | 6 |
3 files changed, 46 insertions, 9 deletions
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index afe8c9aa71..f7aaaf7ee5 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2315,6 +2315,17 @@ void GDParser::_parse_class(ClassNode *p_class) { case Variant::INT: { + if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="FLAGS") { + + current_export.hint=PROPERTY_HINT_ALL_FLAGS; + tokenizer->advance(); + if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) { + _set_error("Expected ')' in hint."); + return; + } + break; + } + if (tokenizer->get_token()==GDTokenizer::TK_CONSTANT && tokenizer->get_token_constant().get_type()==Variant::STRING) { //enumeration current_export.hint=PROPERTY_HINT_ENUM; @@ -2542,16 +2553,23 @@ void GDParser::_parse_class(ClassNode *p_class) { } else if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) { String identifier = tokenizer->get_token_identifier(); - if (!ObjectTypeDB::is_type(identifier,"Resource")) { - - current_export=PropertyInfo(); - _set_error("Export hint not a type or resource."); + if (identifier == "flag") { + current_export.type=Variant::INT; + current_export.hint=PROPERTY_HINT_ALL_FLAGS; + }else if (identifier == "multiline"){ + current_export.type=Variant::STRING; + current_export.hint=PROPERTY_HINT_MULTILINE_TEXT; + } else { + if (!ObjectTypeDB::is_type(identifier,"Resource")) { + + current_export=PropertyInfo(); + _set_error("Export hint not a type or resource."); + } + + current_export.type=Variant::OBJECT; + current_export.hint=PROPERTY_HINT_RESOURCE_TYPE; + current_export.hint_string=identifier; } - - current_export.type=Variant::OBJECT; - current_export.hint=PROPERTY_HINT_RESOURCE_TYPE; - current_export.hint_string=identifier; - tokenizer->advance(); } diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 1e1279d5f5..fe325ff71e 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -475,6 +475,19 @@ public: } + virtual Vector<StackInfo> debug_get_current_stack_info() { + if (Thread::get_main_ID()!=Thread::get_caller_ID()) + return Vector<StackInfo>(); + + Vector<StackInfo> csi; + csi.resize(_debug_call_stack_pos); + for(int i=0;i<_debug_call_stack_pos;i++) { + csi[_debug_call_stack_pos-i-1].line=_call_stack[i].line?*_call_stack[i].line:0; + csi[_debug_call_stack_pos-i-1].script=Ref<GDScript>(_call_stack[i].function->get_script()); + } + return csi; + } + struct { StringName _init; diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 8b25b38bd3..b591ed3b4b 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -97,6 +97,7 @@ const char* GDTokenizer::token_names[TK_MAX]={ "preload", "assert", "yield", +"signal", "'['", "']'", "'{'", @@ -642,6 +643,11 @@ void GDTokenizerText::_advance() { str+=res; } else { + if (CharType(GETCHAR(i))=='\n') { + line++; + column=0; + } + str+=CharType(GETCHAR(i)); } i++; |