Browse Source

Fix parse error using Vector{2,3,4}.INF

Adam Scott 2 years ago
parent
commit
c45b9245ae

+ 1 - 0
modules/gdscript/gdscript_tokenizer.cpp

@@ -164,6 +164,7 @@ bool GDScriptTokenizer::Token::is_identifier() const {
 	switch (type) {
 		case IDENTIFIER:
 		case MATCH: // Used in String.match().
+		case CONST_INF: // Used in Vector{2,3,4}.INF
 			return true;
 		default:
 			return false;

+ 6 - 0
modules/gdscript/tests/scripts/parser/features/vector_inf.gd

@@ -0,0 +1,6 @@
+func test():
+	var vec2: = Vector2.INF
+	var vec3: = Vector3.INF
+
+	print(vec2.x == INF)
+	print(vec3.z == INF)

+ 3 - 0
modules/gdscript/tests/scripts/parser/features/vector_inf.out

@@ -0,0 +1,3 @@
+GDTEST_OK
+true
+true