]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Vector test
authorDale Weiler <killfieldengine@gmail.com>
Sat, 14 Apr 2012 07:08:15 +0000 (03:08 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Sat, 14 Apr 2012 07:08:15 +0000 (03:08 -0400)
parse.c
test/vector.qc [new file with mode: 0644]

diff --git a/parse.c b/parse.c
index 3555035848a11bdb8c597de1d162accb2c652385..d2c90630b098ab34aac042bbf503394ecda550d8 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -355,7 +355,7 @@ int parse_tree(struct lex_file *file) {
                                                            }                                                                                                                                                                  \
                                                            if (NAME != 'z') {                                                                                                                                                 \
                                                                if (token != ',' && token != ' ')  {                                                                                                                           \
-                                                                   error(ERROR_PARSE, "%s:%d invalid constant initializer element %c for vector (missing spaces, or comma delimited list?)\n", NAME, file->name, file->line); \
+                                                                   error(ERROR_PARSE, "%s:%d invalid constant initializer element %c for vector (missing spaces, or comma delimited list?)\n", file->name, file->line, NAME); \
                                                                }                                                                                                                                                              \
                                                            } else if (token != '}') {                                                                                                                                         \
                                                                error(ERROR_PARSE, "%s:%d Expected `}` on end of constant initialization for vector\n", file->name, file->line);                                               \
@@ -393,7 +393,6 @@ int parse_tree(struct lex_file *file) {
                                                        
                                                case TOKEN_ENTITY:
                                                case TOKEN_FLOAT:
-                                                       
                                                        if (!isdigit(token))
                                                                error(ERROR_PARSE, "%s:%d Expected numeric constant for float constant\n");
                                                        break;
diff --git a/test/vector.qc b/test/vector.qc
new file mode 100644 (file)
index 0000000..d74e481
--- /dev/null
@@ -0,0 +1,6 @@
+vector vec1 = {  -0,  +0,  0   };
+vector vec2 = {  .0,  .0, .0   };
+vector vec3 = { -.0, +.0, +0.1 };
+vector vec4 = { 1.1, 2.2, 3.3  };
+vector vec5 = { 2., 3., 4.     };
+vector vec6 = { -2., +3., -4.  };