diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-04-05 18:50:09 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-04-05 18:50:09 -0300 |
commit | b4969373b3475799d6b24cdffeda4659c37f0b8a (patch) | |
tree | 5cafdea68a5fe1f79c343c7cdf8def821e7f0b05 /modules/gdscript | |
parent | 9f33134c93ecbadda70e8eefc50563e29b2eb7f2 (diff) |
-HttpClient: ’Content-Length’ is added to httprequest if not provided in the headers and a body exists
-expressions in GDScript can take multiple lines if inside parenthesis (python-like)
-Added \ to force linebreaks to GDscript (python-like)
-added exclude objects from raycast
-fixed crashes
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gd_parser.cpp | 16 | ||||
-rw-r--r-- | modules/gdscript/gd_parser.h | 1 | ||||
-rw-r--r-- | modules/gdscript/gd_tokenizer.cpp | 18 |
3 files changed, 35 insertions, 0 deletions
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index f962f8c5fb..f540660cd3 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -174,10 +174,19 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ /* Parse Operand */ /*****************/ + if (parenthesis>0) { + //remove empty space (only allowed if inside parenthesis + while(tokenizer->get_token()==GDTokenizer::TK_NEWLINE) { + tokenizer->advance(); + } + } + if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_OPEN) { //subexpression () tokenizer->advance(); + parenthesis++; Node* subexpr = _parse_expression(p_parent,p_static); + parenthesis--; if (!subexpr) return NULL; @@ -629,6 +638,12 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ /* Parse Operator */ /******************/ + if (parenthesis>0) { + //remove empty space (only allowed if inside parenthesis + while(tokenizer->get_token()==GDTokenizer::TK_NEWLINE) { + tokenizer->advance(); + } + } Expression e; e.is_op=false; @@ -2475,6 +2490,7 @@ void GDParser::clear() { tab_level.push_back(0); error_line=0; error_column=0; + parenthesis=0; current_export.type=Variant::NIL; error=""; diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h index 1925808cac..278e5f543d 100644 --- a/modules/gdscript/gd_parser.h +++ b/modules/gdscript/gd_parser.h @@ -356,6 +356,7 @@ private: template<class T> T* alloc_node(); + int parenthesis; bool error_set; String error; int error_line; diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index ff9be7926b..aeee1f6667 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -242,6 +242,24 @@ void GDTokenizerText::_advance() { case 0: _make_token(TK_EOF); break; + case '\\': + INCPOS(1); + if (GETCHAR(0)=='\r') { + INCPOS(1); + } + + if (GETCHAR(0)!='\n') { + _make_error("Expected newline after '\\'."); + return; + } + + INCPOS(1); + + while(GETCHAR(0)==' ' || GETCHAR(0)=='\t') { + INCPOS(1); + } + + continue; case '\t': case '\r': case ' ': |