From ebe77805eb38e16b43cef6cdec13fa1bf7548f7a Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Sat, 14 Apr 2012 03:08:15 -0400 Subject: [PATCH] Vector test --- parse.c | 3 +-- test/vector.qc | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 test/vector.qc diff --git a/parse.c b/parse.c index 3555035..d2c9063 100644 --- 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 index 0000000..d74e481 --- /dev/null +++ b/test/vector.qc @@ -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. }; -- 2.39.2