aboutsummaryrefslogtreecommitdiff
path: root/modules/gdscript/gd_parser.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2017-02-28 23:00:30 +0100
committerGitHub2017-02-28 23:00:30 +0100
commitc5df3d4d8d3d6ee74b0dad5eeb45f318c8b205a9 (patch)
treea8e79b3f4a557ce4097791f5622728c69d22764f /modules/gdscript/gd_parser.cpp
parent0f8c6dd3822c38b8145f08265abb9eba479f4d15 (diff)
parent5e938f000136c076f9f35b8332dc7c022687a983 (diff)
downloadgodot-c5df3d4d8d3d6ee74b0dad5eeb45f318c8b205a9.tar.gz
godot-c5df3d4d8d3d6ee74b0dad5eeb45f318c8b205a9.tar.zst
godot-c5df3d4d8d3d6ee74b0dad5eeb45f318c8b205a9.zip
Merge pull request #7787 from SaracenOne/nan_and_inf
Inf and NaN support added to GDScript
Diffstat (limited to 'modules/gdscript/gd_parser.cpp')
-rw-r--r--modules/gdscript/gd_parser.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 350f596f7..5147ccd63 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -375,6 +375,22 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
constant->value=Math_PI;
tokenizer->advance();
expr=constant;
+ }
+ else if (tokenizer->get_token() == GDTokenizer::TK_CONST_INF) {
+
+ //constant defined by tokenizer
+ ConstantNode *constant = alloc_node<ConstantNode>();
+ constant->value = Math_INF;
+ tokenizer->advance();
+ expr = constant;
+ }
+ else if (tokenizer->get_token() == GDTokenizer::TK_CONST_NAN) {
+
+ //constant defined by tokenizer
+ ConstantNode *constant = alloc_node<ConstantNode>();
+ constant->value = Math_NAN;
+ tokenizer->advance();
+ expr = constant;
} else if (tokenizer->get_token()==GDTokenizer::TK_PR_PRELOAD) {
//constant defined by tokenizer