|
@@ -121,6 +121,7 @@ bool GDParser::_parse_arguments(Node* p_parent,Vector<Node*>& p_args,bool p_stat
|
|
tokenizer->advance();
|
|
tokenizer->advance();
|
|
} else {
|
|
} else {
|
|
|
|
|
|
|
|
+ parenthesis ++;
|
|
int argidx=0;
|
|
int argidx=0;
|
|
|
|
|
|
while(true) {
|
|
while(true) {
|
|
@@ -165,6 +166,7 @@ bool GDParser::_parse_arguments(Node* p_parent,Vector<Node*>& p_args,bool p_stat
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ parenthesis --;
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
return true;
|
|
@@ -360,18 +362,23 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
|
|
OperatorNode *yield = alloc_node<OperatorNode>();
|
|
OperatorNode *yield = alloc_node<OperatorNode>();
|
|
yield->op=OperatorNode::OP_YIELD;
|
|
yield->op=OperatorNode::OP_YIELD;
|
|
|
|
|
|
|
|
+ while (tokenizer->get_token()==GDTokenizer::TK_NEWLINE) {
|
|
|
|
+ tokenizer->advance();
|
|
|
|
+ }
|
|
|
|
+
|
|
if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) {
|
|
if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) {
|
|
expr=yield;
|
|
expr=yield;
|
|
tokenizer->advance();
|
|
tokenizer->advance();
|
|
} else {
|
|
} else {
|
|
|
|
|
|
|
|
+ parenthesis ++;
|
|
|
|
+
|
|
Node *object = _parse_and_reduce_expression(p_parent,p_static);
|
|
Node *object = _parse_and_reduce_expression(p_parent,p_static);
|
|
if (!object)
|
|
if (!object)
|
|
return NULL;
|
|
return NULL;
|
|
yield->arguments.push_back(object);
|
|
yield->arguments.push_back(object);
|
|
|
|
|
|
if (tokenizer->get_token()!=GDTokenizer::TK_COMMA) {
|
|
if (tokenizer->get_token()!=GDTokenizer::TK_COMMA) {
|
|
-
|
|
|
|
_set_error("Expected ',' after first argument of 'yield'");
|
|
_set_error("Expected ',' after first argument of 'yield'");
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
@@ -384,11 +391,12 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
|
|
yield->arguments.push_back(signal);
|
|
yield->arguments.push_back(signal);
|
|
|
|
|
|
if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) {
|
|
if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) {
|
|
-
|
|
|
|
_set_error("Expected ')' after second argument of 'yield'");
|
|
_set_error("Expected ')' after second argument of 'yield'");
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ parenthesis --;
|
|
|
|
+
|
|
tokenizer->advance();
|
|
tokenizer->advance();
|
|
|
|
|
|
expr=yield;
|
|
expr=yield;
|
|
@@ -1618,6 +1626,7 @@ void GDParser::_parse_block(BlockNode *p_block,bool p_static) {
|
|
case GDTokenizer::TK_CF_IF: {
|
|
case GDTokenizer::TK_CF_IF: {
|
|
|
|
|
|
tokenizer->advance();
|
|
tokenizer->advance();
|
|
|
|
+
|
|
Node *condition = _parse_and_reduce_expression(p_block,p_static);
|
|
Node *condition = _parse_and_reduce_expression(p_block,p_static);
|
|
if (!condition) {
|
|
if (!condition) {
|
|
if (_recover_from_completion()) {
|
|
if (_recover_from_completion()) {
|
|
@@ -2217,6 +2226,11 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|
bool defaulting=false;
|
|
bool defaulting=false;
|
|
while(true) {
|
|
while(true) {
|
|
|
|
|
|
|
|
+ if (tokenizer->get_token()==GDTokenizer::TK_NEWLINE) {
|
|
|
|
+ tokenizer->advance();
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (tokenizer->get_token()==GDTokenizer::TK_PR_VAR) {
|
|
if (tokenizer->get_token()==GDTokenizer::TK_PR_VAR) {
|
|
|
|
|
|
tokenizer->advance(); //var before the identifier is allowed
|
|
tokenizer->advance(); //var before the identifier is allowed
|
|
@@ -2269,6 +2283,10 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|
default_values.push_back(on);
|
|
default_values.push_back(on);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ while (tokenizer->get_token()==GDTokenizer::TK_NEWLINE) {
|
|
|
|
+ tokenizer->advance();
|
|
|
|
+ }
|
|
|
|
+
|
|
if (tokenizer->get_token()==GDTokenizer::TK_COMMA) {
|
|
if (tokenizer->get_token()==GDTokenizer::TK_COMMA) {
|
|
tokenizer->advance();
|
|
tokenizer->advance();
|
|
continue;
|
|
continue;
|
|
@@ -2310,6 +2328,7 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|
|
|
|
|
if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) {
|
|
if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) {
|
|
//has arguments
|
|
//has arguments
|
|
|
|
+ parenthesis ++;
|
|
while(true) {
|
|
while(true) {
|
|
|
|
|
|
Node *arg = _parse_and_reduce_expression(p_class,_static);
|
|
Node *arg = _parse_and_reduce_expression(p_class,_static);
|
|
@@ -2327,6 +2346,7 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|
break;
|
|
break;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ parenthesis --;
|
|
}
|
|
}
|
|
|
|
|
|
tokenizer->advance();
|
|
tokenizer->advance();
|
|
@@ -2387,6 +2407,10 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|
if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_OPEN) {
|
|
if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_OPEN) {
|
|
tokenizer->advance();
|
|
tokenizer->advance();
|
|
while(true) {
|
|
while(true) {
|
|
|
|
+ if (tokenizer->get_token()==GDTokenizer::TK_NEWLINE) {
|
|
|
|
+ tokenizer->advance();
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) {
|
|
if (tokenizer->get_token()==GDTokenizer::TK_PARENTHESIS_CLOSE) {
|
|
@@ -2402,6 +2426,10 @@ void GDParser::_parse_class(ClassNode *p_class) {
|
|
sig.arguments.push_back(tokenizer->get_token_identifier());
|
|
sig.arguments.push_back(tokenizer->get_token_identifier());
|
|
tokenizer->advance();
|
|
tokenizer->advance();
|
|
|
|
|
|
|
|
+ while (tokenizer->get_token()==GDTokenizer::TK_NEWLINE) {
|
|
|
|
+ tokenizer->advance();
|
|
|
|
+ }
|
|
|
|
+
|
|
if (tokenizer->get_token()==GDTokenizer::TK_COMMA) {
|
|
if (tokenizer->get_token()==GDTokenizer::TK_COMMA) {
|
|
tokenizer->advance();
|
|
tokenizer->advance();
|
|
} else if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) {
|
|
} else if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) {
|