|
@@ -898,6 +898,13 @@ bool ShaderLanguage::_lookup_next(Token &r_tk) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ShaderLanguage::Token ShaderLanguage::_peek() {
|
|
|
|
+ TkPos pre_pos = _get_tkpos();
|
|
|
|
+ Token tk = _get_token();
|
|
|
|
+ _set_tkpos(pre_pos);
|
|
|
|
+ return tk;
|
|
|
|
+}
|
|
|
|
+
|
|
String ShaderLanguage::token_debug(const String &p_code) {
|
|
String ShaderLanguage::token_debug(const String &p_code) {
|
|
clear();
|
|
clear();
|
|
|
|
|
|
@@ -8080,6 +8087,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
|
|
_set_error(RTR("The middle expression is expected to be a boolean operator."));
|
|
_set_error(RTR("The middle expression is expected to be a boolean operator."));
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
|
|
+ tk = _peek();
|
|
|
|
+ if (tk.type == TK_SEMICOLON) {
|
|
|
|
+ _set_error(vformat(RTR("Expected expression, found: '%s'."), get_token_text(tk)));
|
|
|
|
+ return ERR_PARSE_ERROR;
|
|
|
|
+ }
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
if (tk.type != TK_SEMICOLON) {
|
|
if (tk.type != TK_SEMICOLON) {
|
|
@@ -8088,6 +8100,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun
|
|
}
|
|
}
|
|
} else if (p_block->block_type == BlockNode::BLOCK_TYPE_FOR_EXPRESSION) {
|
|
} else if (p_block->block_type == BlockNode::BLOCK_TYPE_FOR_EXPRESSION) {
|
|
if (tk.type == TK_COMMA) {
|
|
if (tk.type == TK_COMMA) {
|
|
|
|
+ tk = _peek();
|
|
|
|
+ if (tk.type == TK_PARENTHESIS_CLOSE) {
|
|
|
|
+ _set_error(vformat(RTR("Expected expression, found: '%s'."), get_token_text(tk)));
|
|
|
|
+ return ERR_PARSE_ERROR;
|
|
|
|
+ }
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
if (tk.type != TK_PARENTHESIS_CLOSE) {
|
|
if (tk.type != TK_PARENTHESIS_CLOSE) {
|