mojoshader_assembler.c
changeset 478 af4bfa5d615c
parent 477 e8c74c310a11
child 479 f7beff48de5e
equal deleted inserted replaced
477:e8c74c310a11 478:af4bfa5d615c
   218             if (ctx->source[1] == '\n')
   218             if (ctx->source[1] == '\n')
   219                continue;  // ignore '\r' if this is "\r\n" ...
   219                continue;  // ignore '\r' if this is "\r\n" ...
   220             ch = '\n';
   220             ch = '\n';
   221         } // else if
   221         } // else if
   222 
   222 
   223         if ((ch > '0') && (ch < '9'))
   223         if ((ch >= '0') && (ch <= '9'))
   224         {
   224         {
   225             // starting a number, but rest of current token was not number.
   225             // starting a number, but rest of current token was not number.
   226             if ((idx > 0) && ((ctx->prevchar < '0') || (ctx->prevchar > '9')))
   226             if ((idx > 0) && ((ctx->prevchar < '0') || (ctx->prevchar > '9')))
   227             {
   227             {
   228                 ctx->token[idx++] = '\0';
   228                 ctx->token[idx++] = '\0';
   230             } // if
   230             } // if
   231         } // if
   231         } // if
   232         else
   232         else
   233         {
   233         {
   234             // starting a non-number, but rest of current token was numbers.
   234             // starting a non-number, but rest of current token was numbers.
   235             if ((idx > 0) && ((ctx->prevchar >= '0') || (ctx->prevchar <= '9')))
   235             if ((idx > 0) && ((ctx->prevchar >= '0') && (ctx->prevchar <= '9')))
   236             {
   236             {
   237                 ctx->token[idx++] = '\0';
   237                 ctx->token[idx++] = '\0';
   238                 return NOFAIL;
   238                 return NOFAIL;
   239             } // if
   239             } // if
   240         } // else
   240         } // else
   247                     ctx->token[idx] = '\0';
   247                     ctx->token[idx] = '\0';
   248                 else
   248                 else
   249                 {
   249                 {
   250                     ctx->token[idx++] = ch;
   250                     ctx->token[idx++] = ch;
   251                     ctx->source++;
   251                     ctx->source++;
   252                     if ((ch == '/') && (ctx->source[1] == '/'))
   252                     if ((ch == '/') && (*ctx->source == '/'))
   253                     {
   253                     {
   254                         ctx->token[idx++] = '/';
   254                         ctx->token[idx++] = '/';
   255                         ctx->source++;
   255                         ctx->source++;
   256                     } // if
   256                     } // if
   257                     ctx->token[idx++] = '\0';
   257                     ctx->token[idx++] = '\0';