]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Merge branch 'cooking' of git://github.com/graphitemaster/gmqcc into cooking
authorWolfgang Bumiller <wry.git@bumiller.com>
Fri, 11 Oct 2013 12:10:57 +0000 (14:10 +0200)
committerWolfgang Bumiller <wry.git@bumiller.com>
Fri, 11 Oct 2013 12:10:57 +0000 (14:10 +0200)
1  2 
parser.c

diff --combined parser.c
index eeec52e01ea9ce0cd345135b73f25cedf2bdc469,2585f69576a4c76eab79eaba6953096ba8dde68b..30a9d7866ef691f06768f2cb496228d4439077d5
+++ b/parser.c
@@@ -23,6 -23,7 +23,7 @@@
   */
  #include <string.h>
  #include <math.h>
  #include "parser.h"
  
  #define PARSER_HT_LOCALS  2
@@@ -3334,7 -3335,7 +3335,7 @@@ static bool parse_statement(parser_t *p
      if (parser->tok == TOKEN_IDENT)
          typevar = parser_find_typedef(parser, parser_tokval(parser), 0);
  
 -    if (typevar || parser->tok == TOKEN_TYPENAME || parser->tok == '.')
 +    if (typevar || parser->tok == TOKEN_TYPENAME || parser->tok == '.' || parser->tok == TOKEN_DOTS)
      {
          /* local variable */
          if (!block) {
@@@ -4708,10 -4709,8 +4709,10 @@@ static ast_value *parse_typename(parser
      ctx = parser_ctx(parser);
  
      /* types may start with a dot */
 -    if (parser->tok == '.') {
 +    if (parser->tok == '.' || parser->tok == TOKEN_DOTS) {
          isfield = true;
 +        if (parser->tok == TOKEN_DOTS)
 +            morefields += 2;
          /* if we parsed a dot we need a typename now */
          if (!parser_next(parser)) {
              parseerror(parser, "expected typename for field definition");
          /* Further dots are handled seperately because they won't be part of the
           * basetype
           */
 -        while (parser->tok == '.') {
 -            ++morefields;
 +        while (true) {
 +            if (parser->tok == '.')
 +                ++morefields;
 +            else if (parser->tok == TOKEN_DOTS)
 +                morefields += 3;
 +            else
 +                break;
              if (!parser_next(parser)) {
                  parseerror(parser, "expected typename for field definition");
                  return NULL;
@@@ -5773,7 -5767,7 +5774,7 @@@ static bool parser_global_statement(par
      if (parser->tok == TOKEN_IDENT)
          istype = parser_find_typedef(parser, parser_tokval(parser), 0);
  
 -    if (istype || parser->tok == TOKEN_TYPENAME || parser->tok == '.')
 +    if (istype || parser->tok == TOKEN_TYPENAME || parser->tok == '.' || parser->tok == TOKEN_DOTS)
      {
          return parse_variable(parser, NULL, false, CV_NONE, istype, false, false, 0, NULL);
      }
@@@ -5912,7 -5906,7 +5913,7 @@@ parser_t *parser_create(
          }
      }
      if (!parser->assign_op) {
-         printf("internal error: initializing parser: failed to find assign operator\n");
+         con_err("internal error: initializing parser: failed to find assign operator\n");
          mem_d(parser);
          return NULL;
      }