diff options
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/SCsub | 2 | ||||
-rw-r--r-- | modules/gdscript/gd_compiler.cpp | 42 | ||||
-rw-r--r-- | modules/gdscript/gd_compiler.h | 4 | ||||
-rw-r--r-- | modules/gdscript/gd_editor.cpp | 75 | ||||
-rw-r--r-- | modules/gdscript/gd_functions.cpp | 129 | ||||
-rw-r--r-- | modules/gdscript/gd_functions.h | 5 | ||||
-rw-r--r-- | modules/gdscript/gd_parser.cpp | 211 | ||||
-rw-r--r-- | modules/gdscript/gd_parser.h | 9 | ||||
-rw-r--r-- | modules/gdscript/gd_pretty_print.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gd_pretty_print.h | 2 | ||||
-rw-r--r-- | modules/gdscript/gd_script.cpp | 105 | ||||
-rw-r--r-- | modules/gdscript/gd_script.h | 10 | ||||
-rw-r--r-- | modules/gdscript/gd_tokenizer.cpp | 16 | ||||
-rw-r--r-- | modules/gdscript/gd_tokenizer.h | 5 | ||||
-rw-r--r-- | modules/gdscript/register_types.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/register_types.h | 2 |
16 files changed, 543 insertions, 78 deletions
diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub index d20da72b72..403fe68f66 100644 --- a/modules/gdscript/SCsub +++ b/modules/gdscript/SCsub @@ -3,5 +3,3 @@ Import('env') env.add_source_files(env.modules_sources,"*.cpp") Export('env') - - diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index a62225f663..53519030fc 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -1156,6 +1156,10 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo codegen.opcodes.push_back(GDFunction::OPCODE_ASSERT); codegen.opcodes.push_back(ret); } break; + case GDParser::Node::TYPE_BREAKPOINT: { + // try subblocks + codegen.opcodes.push_back(GDFunction::OPCODE_BREAKPOINT); + } break; case GDParser::Node::TYPE_LOCAL_VAR: { @@ -1181,7 +1185,7 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo } -Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *p_class,const GDParser::FunctionNode *p_func) { +Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *p_class,const GDParser::FunctionNode *p_func,bool p_for_ready) { Vector<int> bytecode; CodeGen codegen; @@ -1212,9 +1216,9 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode * /* Parse initializer -if applies- */ - bool is_initializer=false || !p_func; + bool is_initializer=!p_for_ready && !p_func; - if (!p_func || String(p_func->name)=="_init") { + if (is_initializer || (p_func && String(p_func->name)=="_init")) { //parse initializer for class members if (!p_func && p_class->extends_used && p_script->native.is_null()){ @@ -1232,12 +1236,24 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode * } + if (p_for_ready || (p_func && String(p_func->name)=="_ready")) { + //parse initializer for class members + if (p_class->ready->statements.size()) { + Error err = _parse_block(codegen,p_class->ready,stack_level); + if (err) + return err; + } + + } + + /* Parse default argument code -if applies- */ Vector<int> defarg_addr; StringName func_name; if (p_func) { + if (p_func->default_values.size()) { codegen.opcodes.push_back(GDFunction::OPCODE_JUMP_TO_DEF_ARGUMENT); @@ -1260,7 +1276,10 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode * func_name=p_func->name; } else { - func_name="_init"; + if (p_for_ready) + func_name="_ready"; + else + func_name="_init"; } codegen.opcodes.push_back(GDFunction::OPCODE_END); @@ -1328,7 +1347,7 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode * if (defarg_addr.size()) { gdfunc->default_arguments=defarg_addr; - gdfunc->_default_arg_count=defarg_addr.size(); + gdfunc->_default_arg_count=defarg_addr.size()-1; gdfunc->_default_arg_ptr=&gdfunc->default_arguments[0]; } else { gdfunc->_default_arg_count=0; @@ -1614,10 +1633,14 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars //parse methods bool has_initializer=false; + bool has_ready=false; + for(int i=0;i<p_class->functions.size();i++) { if (!has_initializer && p_class->functions[i]->name=="_init") has_initializer=true; + if (!has_ready && p_class->functions[i]->name=="_ready") + has_ready=true; Error err = _parse_function(p_script,p_class,p_class->functions[i]); if (err) return err; @@ -1640,6 +1663,13 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars return err; } + if (!has_ready && p_class->ready->statements.size()) { + //create a constructor + Error err = _parse_function(p_script,p_class,NULL,true); + if (err) + return err; + } + #ifdef DEBUG_ENABLED //validate setters/getters if debug is enabled for(int i=0;i<p_class->variables.size();i++) { diff --git a/modules/gdscript/gd_compiler.h b/modules/gdscript/gd_compiler.h index bdf4e9816a..5bf7ec980d 100644 --- a/modules/gdscript/gd_compiler.h +++ b/modules/gdscript/gd_compiler.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -143,7 +143,7 @@ class GDCompiler { int _parse_assign_right_expression(CodeGen& codegen,const GDParser::OperatorNode *p_expression, int p_stack_level); int _parse_expression(CodeGen& codegen,const GDParser::Node *p_expression, int p_stack_level,bool p_root=false,bool p_initializer=false); Error _parse_block(CodeGen& codegen,const GDParser::BlockNode *p_block,int p_stack_level=0,int p_break_addr=-1,int p_continue_addr=-1); - Error _parse_function(GDScript *p_script,const GDParser::ClassNode *p_class,const GDParser::FunctionNode *p_func); + Error _parse_function(GDScript *p_script,const GDParser::ClassNode *p_class,const GDParser::FunctionNode *p_func,bool p_for_ready=false); Error _parse_class(GDScript *p_script,GDScript *p_owner,const GDParser::ClassNode *p_class); int err_line; int err_column; diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 0d986e92a2..126a8cd1eb 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -1147,8 +1147,54 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const } } + //autoloads as singletons + List<PropertyInfo> props; + Globals::get_singleton()->get_property_list(&props); + for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) { + String s = E->get().name; + if (!s.begins_with("autoload/")) + continue; + String name = s.get_slice("/",1); + if (name==String(p_identifier)) { + + String path = Globals::get_singleton()->get(s); + if (path.begins_with("*")) { + String script =path.substr(1,path.length()); + + if (!script.ends_with(".gd")) { + //not a script, try find the script anyway, + //may have some success + script=script.basename()+".gd"; + } + + if (FileAccess::exists(script)) { + + //print_line("is a script"); + + + Ref<Script> scr; + if (ScriptCodeCompletionCache::get_sigleton()) + scr = ScriptCodeCompletionCache::get_sigleton()->get_cached_resource(script); + else + scr = ResourceLoader::load(script); + + + r_type.obj_type="Node"; + r_type.type=Variant::OBJECT; + r_type.script=scr; + r_type.value=Variant(); + + return true; + + } + } + } + + } + + //global for(Map<StringName,int>::Element *E=GDScriptLanguage::get_singleton()->get_global_map().front();E;E=E->next()) { if (E->key()==p_identifier) { @@ -1291,6 +1337,15 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl const GDParser::BlockNode *block=context.block; + if (context.function) { + + const GDParser::FunctionNode* f = context.function; + + for (int i=0;i<f->arguments.size();i++) { + result.insert(f->arguments[i].operator String()); + } + } + while(block) { GDCompletionContext c = context; @@ -1327,6 +1382,24 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl result.insert(_type_names[i]); } + //autoload singletons + List<PropertyInfo> props; + Globals::get_singleton()->get_property_list(&props); + + for(List<PropertyInfo>::Element *E=props.front();E;E=E->next()) { + + String s = E->get().name; + if (!s.begins_with("autoload/")) + continue; + String name = s.get_slice("/",1); + String path = Globals::get_singleton()->get(s); + if (path.begins_with("*")) { + result.insert(name); + } + + } + + for(const Map<StringName,int>::Element *E=GDScriptLanguage::get_singleton()->get_global_map().front();E;E=E->next()) { result.insert(E->key().operator String()); } diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index 6f51ac5312..e015ddb65e 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -33,6 +33,8 @@ #include "gd_script.h" #include "func_ref.h" #include "os/os.h" +#include "variant_parser.h" +#include "io/marshalls.h" const char *GDFunctions::get_func_name(Function p_func) { @@ -93,11 +95,14 @@ const char *GDFunctions::get_func_name(Function p_func) { "printraw", "var2str", "str2var", + "var2bytes", + "bytes2var", "range", "load", "inst2dict", "dict2inst", "hash", + "Color8", "print_stack", "instance_from_id", }; @@ -524,6 +529,7 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va for(int i=0;i<p_arg_count;i++) { String os = p_args[i]->operator String();; + if (i==0) str=os; else @@ -607,7 +613,9 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va } break; case VAR_TO_STR: { VALIDATE_ARG_COUNT(1); - r_ret=p_args[0]->get_construct_string(); + String vars; + VariantWriter::write_to_string(*p_args[0],vars); + r_ret=vars; } break; case STR_TO_VAR: { VALIDATE_ARG_COUNT(1); @@ -618,7 +626,72 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va r_ret=Variant(); return; } - Variant::construct_from_string(*p_args[0],r_ret); + + VariantParser::StreamString ss; + ss.s=*p_args[0]; + + String errs; + int line; + Error err = VariantParser::parse(&ss,r_ret,errs,line); + + if (err!=OK) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::STRING; + r_ret=Variant(); + } + + } break; + case VAR_TO_BYTES: { + VALIDATE_ARG_COUNT(1); + + ByteArray barr; + int len; + Error err = encode_variant(*p_args[0],NULL,len); + if (err) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::NIL; + r_ret=Variant(); + return; + } + + barr.resize(len); + { + ByteArray::Write w = barr.write(); + encode_variant(*p_args[0],w.ptr(),len); + + } + r_ret=barr; + } break; + case BYTES_TO_VAR: { + VALIDATE_ARG_COUNT(1); + if (p_args[0]->get_type()!=Variant::RAW_ARRAY) { + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::RAW_ARRAY; + r_ret=Variant(); + return; + } + + ByteArray varr=*p_args[0]; + Variant ret; + { + ByteArray::Read r=varr.read(); + Error err = decode_variant(ret,r.ptr(),varr.size(),NULL); + if (err!=OK) { + ERR_PRINT("Not enough bytes for decoding.."); + r_error.error=Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.argument=0; + r_error.expected=Variant::RAW_ARRAY; + r_ret=Variant(); + return; + } + + } + + r_ret=ret; + } break; case GEN_RANGE: { @@ -920,6 +993,33 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va r_ret=p_args[0]->hash(); } break; + case COLOR8: { + + if (p_arg_count<3) { + r_error.error=Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.argument=3; + return; + } + if (p_arg_count>4) { + r_error.error=Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; + r_error.argument=4; + return; + } + + VALIDATE_ARG_NUM(0); + VALIDATE_ARG_NUM(1); + VALIDATE_ARG_NUM(2); + + Color color(*p_args[0],*p_args[1],*p_args[2]); + + if (p_arg_count==4) { + VALIDATE_ARG_NUM(3); + color.a=*p_args[3]; + } + + r_ret=color; + + } break; case PRINT_STACK: { @@ -999,6 +1099,7 @@ bool GDFunctions::is_deterministic(Function p_func) { case TYPE_CONVERT: case TYPE_OF: case TEXT_STR: + case COLOR8: // enable for debug only, otherwise not desirable - case GEN_RANGE: return true; default: @@ -1307,7 +1408,19 @@ MethodInfo GDFunctions::get_info(Function p_func) { } break; case STR_TO_VAR: { - MethodInfo mi("str2var:var",PropertyInfo(Variant::STRING,"string")); + MethodInfo mi("str2var:Variant",PropertyInfo(Variant::STRING,"string")); + mi.return_val.type=Variant::NIL; + return mi; + } break; + case VAR_TO_BYTES: { + MethodInfo mi("var2bytes",PropertyInfo(Variant::NIL,"var")); + mi.return_val.type=Variant::RAW_ARRAY; + return mi; + + } break; + case BYTES_TO_VAR: { + + MethodInfo mi("bytes2var:Variant",PropertyInfo(Variant::RAW_ARRAY,"bytes")); mi.return_val.type=Variant::NIL; return mi; } break; @@ -1338,10 +1451,16 @@ MethodInfo GDFunctions::get_info(Function p_func) { } break; case HASH: { - MethodInfo mi("hash",PropertyInfo(Variant::NIL,"var:var")); + MethodInfo mi("hash",PropertyInfo(Variant::NIL,"var:Variant")); mi.return_val.type=Variant::INT; return mi; } break; + case COLOR8: { + + MethodInfo mi("Color8",PropertyInfo(Variant::INT,"r8"),PropertyInfo(Variant::INT,"g8"),PropertyInfo(Variant::INT,"b8"),PropertyInfo(Variant::INT,"a8")); + mi.return_val.type=Variant::COLOR; + return mi; + } break; case PRINT_STACK: { MethodInfo mi("print_stack"); diff --git a/modules/gdscript/gd_functions.h b/modules/gdscript/gd_functions.h index ad35a628d5..8c88472567 100644 --- a/modules/gdscript/gd_functions.h +++ b/modules/gdscript/gd_functions.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -89,11 +89,14 @@ public: TEXT_PRINTRAW, VAR_TO_STR, STR_TO_VAR, + VAR_TO_BYTES, + BYTES_TO_VAR, GEN_RANGE, RESOURCE_LOAD, INST2DICT, DICT2INST, HASH, + COLOR8, PRINT_STACK, INSTANCE_FROM_ID, FUNC_MAX diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 313fb57d0e..c4175e048d 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -65,28 +65,38 @@ bool GDParser::_enter_indent_block(BlockNode* p_block) { if (tokenizer->get_token()!=GDTokenizer::TK_COLON) { - - _set_error("':' expected at end of line."); + // report location at the previous token (on the previous line) + int error_line = tokenizer->get_token_line(-1); + int error_column = tokenizer->get_token_column(-1); + _set_error("':' expected at end of line.",error_line,error_column); return false; } tokenizer->advance(); if (tokenizer->get_token()!=GDTokenizer::TK_NEWLINE) { - _set_error("newline expected after ':'."); - return false; + // be more python-like + int current = tab_level.back()->get(); + tab_level.push_back(current+1); + return true; + //_set_error("newline expected after ':'."); + //return false; } while(true) { if (tokenizer->get_token()!=GDTokenizer::TK_NEWLINE) { + print_line("no newline"); return false; //wtf } else if (tokenizer->get_token(1)!=GDTokenizer::TK_NEWLINE) { int indent = tokenizer->get_token_line_indent(); int current = tab_level.back()->get(); - if (indent<=current) + if (indent<=current) { + print_line("current: "+itos(current)+" indent: "+itos(indent)); + print_line("less than current"); return false; + } tab_level.push_back(indent); tokenizer->advance(); @@ -257,6 +267,13 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ constant->value=tokenizer->get_token_constant(); tokenizer->advance(); expr=constant; + } else if (tokenizer->get_token()==GDTokenizer::TK_CONST_PI) { + + //constant defined by tokenizer + ConstantNode *constant = alloc_node<ConstantNode>(); + constant->value=Math_PI; + tokenizer->advance(); + expr=constant; } else if (tokenizer->get_token()==GDTokenizer::TK_PR_PRELOAD) { //constant defined by tokenizer @@ -1586,6 +1603,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { p_block->sub_blocks.push_back(cf_if->body); if (!_enter_indent_block(cf_if->body)) { + _set_error("Expected intended block after 'if'"); p_block->end_line=tokenizer->get_token_line(); return; } @@ -1645,6 +1663,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { if (!_enter_indent_block(cf_if->body)) { + _set_error("Expected indented block after 'elif'"); p_block->end_line=tokenizer->get_token_line(); return; } @@ -1659,7 +1678,6 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { } else if (tokenizer->get_token()==GDTokenizer::TK_CF_ELSE) { if (tab_level.back()->get() > indent_level) { - _set_error("Invalid indent"); return; } @@ -1671,6 +1689,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { p_block->sub_blocks.push_back(cf_if->body_else); if (!_enter_indent_block(cf_if->body_else)) { + _set_error("Expected indented block after 'else'"); p_block->end_line=tokenizer->get_token_line(); return; } @@ -1711,6 +1730,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { p_block->sub_blocks.push_back(cf_while->body); if (!_enter_indent_block(cf_while->body)) { + _set_error("Expected indented block after 'while'"); p_block->end_line=tokenizer->get_token_line(); return; } @@ -1762,6 +1782,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { p_block->sub_blocks.push_back(cf_for->body); if (!_enter_indent_block(cf_for->body)) { + _set_error("Expected indented block after 'while'"); p_block->end_line=tokenizer->get_token_line(); return; } @@ -1848,6 +1869,17 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) { return; } } break; + case GDTokenizer::TK_PR_BREAKPOINT: { + + tokenizer->advance(); + BreakpointNode *bn = alloc_node<BreakpointNode>(); + p_block->statements.push_back(bn); + + if (!_end_statement()) { + _set_error("Expected end of statement after breakpoint."); + return; + } + } break; default: { Node *expression = _parse_and_reduce_expression(p_block,p_static,false,true); @@ -1940,9 +1972,15 @@ void GDParser::_parse_extends(ClassNode *p_class) { p_class->extends_used=true; - //see if inheritance happens from a file tokenizer->advance(); + if (tokenizer->get_token()==GDTokenizer::TK_BUILT_IN_TYPE && tokenizer->get_token_type()==Variant::OBJECT) { + p_class->extends_class.push_back(Variant::get_type_name(Variant::OBJECT)); + tokenizer->advance(); + return; + } + + // see if inheritance happens from a file if (tokenizer->get_token()==GDTokenizer::TK_CONSTANT) { Variant constant = tokenizer->get_token_constant(); @@ -2050,6 +2088,8 @@ void GDParser::_parse_class(ClassNode *p_class) { ClassNode *newclass = alloc_node<ClassNode>(); newclass->initializer = alloc_node<BlockNode>(); newclass->initializer->parent_class=newclass; + newclass->ready = alloc_node<BlockNode>(); + newclass->ready->parent_class=newclass; newclass->name=name; newclass->owner=p_class; @@ -2373,10 +2413,48 @@ void GDParser::_parse_class(ClassNode *p_class) { current_export.hint=PROPERTY_HINT_ALL_FLAGS; tokenizer->advance(); - if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) { - _set_error("Expected ')' in hint."); + + if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) { + break; + } + if (tokenizer->get_token()!=GDTokenizer::TK_COMMA) + { + _set_error("Expected ')' or ',' in bit flags hint."); return; } + + current_export.hint=PROPERTY_HINT_FLAGS; + tokenizer->advance(); + + bool first = true; + while(true) { + + if (tokenizer->get_token()!=GDTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type()!=Variant::STRING) { + current_export=PropertyInfo(); + _set_error("Expected a string constant in named bit flags hint."); + return; + } + + String c = tokenizer->get_token_constant(); + if (!first) + current_export.hint_string+=","; + else + first=false; + + current_export.hint_string+=c.xml_escape(); + + tokenizer->advance(); + if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) + break; + + if (tokenizer->get_token()!=GDTokenizer::TK_COMMA) { + current_export=PropertyInfo(); + _set_error("Expected ')' or ',' in named bit flags hint."); + return; + } + tokenizer->advance(); + } + break; } @@ -2431,6 +2509,23 @@ void GDParser::_parse_class(ClassNode *p_class) { break; } + // range + if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="EXP") { + + current_export.hint=PROPERTY_HINT_EXP_RANGE; + tokenizer->advance(); + + if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) + break; + else if (tokenizer->get_token()!=GDTokenizer::TK_COMMA) { + _set_error("Expected ')' or ',' in exponential range hint."); + return; + } + tokenizer->advance(); + } + else + current_export.hint=PROPERTY_HINT_RANGE; + float sign=1.0; if (tokenizer->get_token()==GDTokenizer::TK_OP_SUB) { @@ -2444,8 +2539,6 @@ void GDParser::_parse_class(ClassNode *p_class) { return; } - //enumeration - current_export.hint=PROPERTY_HINT_RANGE; current_export.hint_string=rtos(sign*double(tokenizer->get_token_constant())); tokenizer->advance(); @@ -2548,10 +2641,32 @@ void GDParser::_parse_class(ClassNode *p_class) { if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="DIR") { - current_export.hint=PROPERTY_HINT_DIR; tokenizer->advance(); - if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) { - _set_error("Expected ')' in hint."); + + if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) + current_export.hint=PROPERTY_HINT_DIR; + else if (tokenizer->get_token()==GDTokenizer::TK_COMMA ) { + + tokenizer->advance(); + + if (tokenizer->get_token()!=GDTokenizer::TK_IDENTIFIER || !(tokenizer->get_token_identifier()=="GLOBAL")) { + _set_error("Expected 'GLOBAL' after comma in directory hint."); + return; + } + if (!p_class->tool) { + _set_error("Global filesystem hints may only be used in tool scripts."); + return; + } + current_export.hint=PROPERTY_HINT_GLOBAL_DIR; + tokenizer->advance(); + + if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) { + _set_error("Expected ')' in hint."); + return; + } + } + else { + _set_error("Expected ')' or ',' in hint."); return; } break; @@ -2565,9 +2680,32 @@ void GDParser::_parse_class(ClassNode *p_class) { if (tokenizer->get_token()==GDTokenizer::TK_COMMA) { tokenizer->advance(); + + if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier()=="GLOBAL") { + + if (!p_class->tool) { + _set_error("Global filesystem hints may only be used in tool scripts."); + return; + } + current_export.hint=PROPERTY_HINT_GLOBAL_FILE; + tokenizer->advance(); + + if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) + break; + else if (tokenizer->get_token()==GDTokenizer::TK_COMMA) + tokenizer->advance(); + else { + _set_error("Expected ')' or ',' in hint."); + return; + } + } + if (tokenizer->get_token()!=GDTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type()!=Variant::STRING) { - _set_error("Expected string constant with filter"); + if (current_export.hint==PROPERTY_HINT_GLOBAL_FILE) + _set_error("Expected string constant with filter"); + else + _set_error("Expected 'GLOBAL' or string constant with filter"); return; } current_export.hint_string=tokenizer->get_token_constant(); @@ -2661,6 +2799,17 @@ void GDParser::_parse_class(ClassNode *p_class) { } }; //fallthrough to var + case GDTokenizer::TK_PR_ONREADY: { + + if (token==GDTokenizer::TK_PR_ONREADY) { + //may be fallthrough from export, ignore if so + tokenizer->advance(); + if (tokenizer->get_token()!=GDTokenizer::TK_PR_VAR) { + _set_error("Expected 'var'."); + return; + } + } + }; //fallthrough to var case GDTokenizer::TK_PR_VAR: { //variale declaration and (eventual) initialization @@ -2671,6 +2820,8 @@ void GDParser::_parse_class(ClassNode *p_class) { current_export=PropertyInfo(); } + bool onready = tokenizer->get_token(-1)==GDTokenizer::TK_PR_ONREADY; + tokenizer->advance(); if (tokenizer->get_token()!=GDTokenizer::TK_IDENTIFIER) { @@ -2701,6 +2852,21 @@ void GDParser::_parse_class(ClassNode *p_class) { return; } + //discourage common error + if (!onready && subexpr->type==Node::TYPE_OPERATOR) { + + OperatorNode *op=static_cast<OperatorNode*>(subexpr); + if (op->op==OperatorNode::OP_CALL && op->arguments[0]->type==Node::TYPE_SELF && op->arguments[1]->type==Node::TYPE_IDENTIFIER) { + IdentifierNode *id=static_cast<IdentifierNode*>(op->arguments[1]); + if (id->name=="get_node") { + + _set_error("Use 'onready var "+String(member.identifier)+" = get_node(..)' instead"); + return; + + } + } + } + member.expression=subexpr; if (autoexport) { @@ -2747,12 +2913,19 @@ void GDParser::_parse_class(ClassNode *p_class) { op->arguments.push_back(id); op->arguments.push_back(subexpr); + #ifdef DEBUG_ENABLED NewLineNode *nl = alloc_node<NewLineNode>(); nl->line=line; - p_class->initializer->statements.push_back(nl); + if (onready) + p_class->ready->statements.push_back(nl); + else + p_class->initializer->statements.push_back(nl); #endif - p_class->initializer->statements.push_back(op); + if (onready) + p_class->ready->statements.push_back(op); + else + p_class->initializer->statements.push_back(op); @@ -2903,6 +3076,8 @@ Error GDParser::_parse(const String& p_base_path) { ClassNode *main_class = alloc_node<ClassNode>(); main_class->initializer = alloc_node<BlockNode>(); main_class->initializer->parent_class=main_class; + main_class->ready = alloc_node<BlockNode>(); + main_class->ready->parent_class=main_class; current_class=main_class; _parse_class(main_class); diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h index 134279b6d8..9ad8633968 100644 --- a/modules/gdscript/gd_parser.h +++ b/modules/gdscript/gd_parser.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -54,6 +54,7 @@ public: TYPE_CONTROL_FLOW, TYPE_LOCAL_VAR, TYPE_ASSERT, + TYPE_BREAKPOINT, TYPE_NEWLINE, }; @@ -105,6 +106,7 @@ public: Vector<FunctionNode*> static_functions; Vector<Signal> _signals; BlockNode *initializer; + BlockNode *ready; ClassNode *owner; //Vector<Node*> initializers; int end_line; @@ -275,8 +277,11 @@ public: AssertNode() { type=TYPE_ASSERT; } }; + struct BreakpointNode : public Node { + BreakpointNode() { type=TYPE_BREAKPOINT; } + }; + struct NewLineNode : public Node { - int line; NewLineNode() { type=TYPE_NEWLINE; } }; diff --git a/modules/gdscript/gd_pretty_print.cpp b/modules/gdscript/gd_pretty_print.cpp index 9c290eac4a..cca3cd3984 100644 --- a/modules/gdscript/gd_pretty_print.cpp +++ b/modules/gdscript/gd_pretty_print.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_pretty_print.h b/modules/gdscript/gd_pretty_print.h index 998fdc53ab..0106d873d9 100644 --- a/modules/gdscript/gd_pretty_print.h +++ b/modules/gdscript/gd_pretty_print.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 99ddc74bb4..d753a9f167 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -33,17 +33,6 @@ #include "os/file_access.h" #include "io/file_access_encrypted.h" -/* TODO: - - *populate globals - *do checks as close to debugger as possible (but don't do debugger) - *const check plz - *check arguments and default arguments in GDFunction - -get property list in instance? - *missing opcodes - -const checks - -make thread safe - */ @@ -232,6 +221,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a r_err.error=Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS; r_err.argument=_argument_count; + return Variant(); } else if (p_argcount < _argument_count - _default_arg_count) { @@ -1077,6 +1067,14 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a ip+=2; } continue; + case OPCODE_BREAKPOINT: { +#ifdef DEBUG_ENABLED + if (ScriptDebugger::get_singleton()) { + GDScriptLanguage::get_singleton()->debug_break("Breakpoint Statement",true); + } +#endif + ip+=1; + } continue; case OPCODE_LINE: { CHECK_SPACE(2); @@ -1370,7 +1368,7 @@ Variant GDFunctionState::resume(const Variant& p_arg) { void GDFunctionState::_bind_methods() { - ObjectTypeDB::bind_method(_MD("resume:var","arg"),&GDFunctionState::resume,DEFVAL(Variant())); + ObjectTypeDB::bind_method(_MD("resume:Variant","arg"),&GDFunctionState::resume,DEFVAL(Variant())); ObjectTypeDB::bind_method(_MD("is_valid"),&GDFunctionState::is_valid); ObjectTypeDB::bind_native_method(METHOD_FLAGS_DEFAULT,"_signal_callback",&GDFunctionState::_signal_callback,MethodInfo("_signal_callback")); @@ -1449,7 +1447,7 @@ Object *GDNativeClass::instance() { -GDInstance* GDScript::_create_instance(const Variant** p_args,int p_argcount,Object *p_owner,bool p_isref) { +GDInstance* GDScript::_create_instance(const Variant** p_args,int p_argcount,Object *p_owner,bool p_isref,Variant::CallError& r_error) { /* STEP 1, CREATE */ @@ -1465,14 +1463,13 @@ GDInstance* GDScript::_create_instance(const Variant** p_args,int p_argcount,Obj instances.insert(instance->owner); - Variant::CallError err; - initializer->call(instance,p_args,p_argcount,err); + initializer->call(instance,p_args,p_argcount,r_error); - if (err.error!=Variant::CallError::CALL_OK) { + if (r_error.error!=Variant::CallError::CALL_OK) { instance->script=Ref<GDScript>(); instance->owner->set_script_instance(NULL); instances.erase(p_owner); - ERR_FAIL_COND_V(err.error!=Variant::CallError::CALL_OK, NULL); //error consrtucting + ERR_FAIL_COND_V(r_error.error!=Variant::CallError::CALL_OK, NULL); //error constructing } //@TODO make thread safe @@ -1505,7 +1502,7 @@ Variant GDScript::_new(const Variant** p_args,int p_argcount,Variant::CallError& } - GDInstance* instance = _create_instance(p_args,p_argcount,owner,r!=NULL); + GDInstance* instance = _create_instance(p_args,p_argcount,owner,r!=NULL,r_error); if (!instance) { if (ref.is_null()) { memdelete(owner); //no owner, sorry @@ -1596,6 +1593,28 @@ void GDScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) { }*/ #endif + +bool GDScript::get_property_default_value(const StringName& p_property, Variant &r_value) const { + +#ifdef TOOLS_ENABLED + + //for (const Map<StringName,Variant>::Element *I=member_default_values.front();I;I=I->next()) { + // print_line("\t"+String(String(I->key())+":"+String(I->get()))); + //} + const Map<StringName,Variant>::Element *E=member_default_values_cache.find(p_property); + if (E) { + r_value=E->get(); + return true; + } + + if (base_cache.is_valid()) { + return base_cache->get_property_default_value(p_property,r_value); + } +#endif + return false; + +} + ScriptInstance* GDScript::instance_create(Object *p_this) { @@ -1637,7 +1656,8 @@ ScriptInstance* GDScript::instance_create(Object *p_this) { } } - return _create_instance(NULL,0,p_this,p_this->cast_to<Reference>()); + Variant::CallError unchecked_error; + return _create_instance(NULL,0,p_this,p_this->cast_to<Reference>(),unchecked_error); } bool GDScript::instance_has(const Object *p_this) const { @@ -1732,16 +1752,21 @@ bool GDScript::_update_exports() { } } - Ref<GDScript> bf = ResourceLoader::load(path); + if (path!=get_path()) { + + Ref<GDScript> bf = ResourceLoader::load(path); - if (bf.is_valid()) { + if (bf.is_valid()) { - //print_line("parent is: "+bf->get_path()); - base_cache=bf; - bf->inheriters_cache.insert(get_instance_ID()); + //print_line("parent is: "+bf->get_path()); + base_cache=bf; + bf->inheriters_cache.insert(get_instance_ID()); - //bf->_update_exports(p_instances,true,false); + //bf->_update_exports(p_instances,true,false); + } + } else { + ERR_PRINT(("Path extending itself in "+path).utf8().get_data()); } } @@ -2274,6 +2299,26 @@ bool GDInstance::get(const StringName& p_name, Variant &r_ret) const { return false; } + +Variant::Type GDInstance::get_property_type(const StringName& p_name,bool *r_is_valid) const { + + + const GDScript *sptr=script.ptr(); + while(sptr) { + + if (sptr->member_info.has(p_name)) { + if (r_is_valid) + *r_is_valid=true; + return sptr->member_info[p_name].type; + } + sptr = sptr->_base; + } + + if (r_is_valid) + *r_is_valid=false; + return Variant::NIL; +} + void GDInstance::get_property_list(List<PropertyInfo> *p_properties) const { // exported members, not doen yet! @@ -2550,6 +2595,12 @@ void GDScriptLanguage::_add_global(const StringName& p_name,const Variant& p_val _global_array=global_array.ptr(); } +void GDScriptLanguage::add_global_constant(const StringName& p_variable,const Variant& p_value) { + + _add_global(p_variable,p_value); +} + + void GDScriptLanguage::init() { @@ -2626,6 +2677,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const { "elif", "enum", "extends" , + "onready", "for" , "func" , "if" , @@ -2645,6 +2697,7 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const { "or", "export", "assert", + "breakpoint", "yield", "static", "float", diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 37ef47af6c..cf8f762a86 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -71,6 +71,7 @@ public: OPCODE_ITERATE_BEGIN, OPCODE_ITERATE, OPCODE_ASSERT, + OPCODE_BREAKPOINT, OPCODE_LINE, OPCODE_END }; @@ -286,7 +287,7 @@ friend class GDScriptLanguage; String name; - GDInstance* _create_instance(const Variant** p_args,int p_argcount,Object *p_owner,bool p_isref); + GDInstance* _create_instance(const Variant** p_args,int p_argcount,Object *p_owner,bool p_isref,Variant::CallError &r_error); void _set_subclass_path(Ref<GDScript>& p_sc,const String& p_path); @@ -351,6 +352,8 @@ public: Vector<uint8_t> get_as_byte_code() const; + bool get_property_default_value(const StringName& p_property,Variant& r_value) const; + virtual ScriptLanguage *get_language() const; GDScript(); @@ -373,6 +376,8 @@ public: virtual bool set(const StringName& p_name, const Variant& p_value); virtual bool get(const StringName& p_name, Variant &r_ret) const; virtual void get_property_list(List<PropertyInfo> *p_properties) const; + virtual Variant::Type get_property_type(const StringName& p_name,bool *r_is_valid=NULL) const; + virtual void get_method_list(List<MethodInfo> *p_list) const; virtual bool has_method(const StringName& p_method) const; @@ -527,6 +532,7 @@ public: virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const; virtual Error complete_code(const String& p_code, const String& p_base_path, Object*p_owner,List<String>* r_options,String& r_call_hint); virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const; + virtual void add_global_constant(const StringName& p_variable,const Variant& p_value); /* DEBUGGER FUNCTIONS */ diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index b591ed3b4b..377ef06694 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -98,6 +98,7 @@ const char* GDTokenizer::token_names[TK_MAX]={ "assert", "yield", "signal", +"breakpoint", "'['", "']'", "'{'", @@ -110,6 +111,7 @@ const char* GDTokenizer::token_names[TK_MAX]={ "'?'", "':'", "'\\n'", +"PI", "Error", "EOF", "Cursor"}; @@ -259,6 +261,7 @@ void GDTokenizerText::_advance() { } INCPOS(1); + line++; while(GETCHAR(0)==' ' || GETCHAR(0)=='\t') { INCPOS(1); @@ -774,20 +777,15 @@ void GDTokenizerText::_advance() { {Variant::INT,"int"}, {Variant::REAL,"float"}, {Variant::STRING,"String"}, - {Variant::VECTOR2,"vec2"}, {Variant::VECTOR2,"Vector2"}, {Variant::RECT2,"Rect2"}, {Variant::MATRIX32,"Matrix32"}, - {Variant::MATRIX32,"mat32"}, - {Variant::VECTOR3,"vec3"}, {Variant::VECTOR3,"Vector3"}, {Variant::_AABB,"AABB"}, {Variant::_AABB,"Rect3"}, {Variant::PLANE,"Plane"}, {Variant::QUAT,"Quat"}, - {Variant::MATRIX3,"mat3"}, {Variant::MATRIX3,"Matrix3"}, - {Variant::TRANSFORM,"trn"}, {Variant::TRANSFORM,"Transform"}, {Variant::COLOR,"Color"}, {Variant::IMAGE,"Image"}, @@ -795,7 +793,6 @@ void GDTokenizerText::_advance() { {Variant::OBJECT,"Object"}, {Variant::INPUT_EVENT,"InputEvent"}, {Variant::NODE_PATH,"NodePath"}, - {Variant::DICTIONARY,"dict"}, {Variant::DICTIONARY,"Dictionary"}, {Variant::ARRAY,"Array"}, {Variant::RAW_ARRAY,"RawArray"}, @@ -857,6 +854,7 @@ void GDTokenizerText::_advance() { {TK_PR_FUNCTION,"function"}, {TK_PR_CLASS,"class"}, {TK_PR_EXTENDS,"extends"}, + {TK_PR_ONREADY,"onready"}, {TK_PR_TOOL,"tool"}, {TK_PR_STATIC,"static"}, {TK_PR_EXPORT,"export"}, @@ -866,6 +864,7 @@ void GDTokenizerText::_advance() { {TK_PR_ASSERT,"assert"}, {TK_PR_YIELD,"yield"}, {TK_PR_SIGNAL,"signal"}, + {TK_PR_BREAKPOINT,"breakpoint"}, {TK_PR_CONST,"const"}, //controlflow {TK_CF_IF,"if"}, @@ -880,6 +879,7 @@ void GDTokenizerText::_advance() { {TK_CF_RETURN,"return"}, {TK_CF_PASS,"pass"}, {TK_SELF,"self"}, + {TK_CONST_PI,"PI"}, {TK_ERROR,NULL} }; @@ -1046,7 +1046,7 @@ void GDTokenizerText::advance(int p_amount) { ////////////////////////////////////////////////////////////////////////////////////////////////////// -#define BYTECODE_VERSION 5 +#define BYTECODE_VERSION 10 Error GDTokenizerBuffer::set_code_buffer(const Vector<uint8_t> & p_buffer) { diff --git a/modules/gdscript/gd_tokenizer.h b/modules/gdscript/gd_tokenizer.h index d6bd63c5b8..aaff573090 100644 --- a/modules/gdscript/gd_tokenizer.h +++ b/modules/gdscript/gd_tokenizer.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -95,6 +95,7 @@ public: TK_PR_FUNCTION, TK_PR_CLASS, TK_PR_EXTENDS, + TK_PR_ONREADY, TK_PR_TOOL, TK_PR_STATIC, TK_PR_EXPORT, @@ -105,6 +106,7 @@ public: TK_PR_ASSERT, TK_PR_YIELD, TK_PR_SIGNAL, + TK_PR_BREAKPOINT, TK_BRACKET_OPEN, TK_BRACKET_CLOSE, TK_CURLY_BRACKET_OPEN, @@ -117,6 +119,7 @@ public: TK_QUESTION_MARK, TK_COLON, TK_NEWLINE, + TK_CONST_PI, TK_ERROR, TK_EOF, TK_CURSOR, //used for code completion diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 4470b7ca0c..2aea494f39 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /*************************************************/ /* Source code within this file is: */ -/* (c) 2007-2010 Juan Linietsky, Ariel Manzur */ +/* (c) 2007-2016 Juan Linietsky, Ariel Manzur */ /* All Rights Reserved. */ /*************************************************/ diff --git a/modules/gdscript/register_types.h b/modules/gdscript/register_types.h index 9eb5d1846b..aed11cd1d4 100644 --- a/modules/gdscript/register_types.h +++ b/modules/gdscript/register_types.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ |