浏览代码

Fix custom types having a string_len of 0(always)

mundusnine 4 年之前
父节点
当前提交
84fa046c7c
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      stb_c_lexer.h

+ 1 - 1
stb_c_lexer.h

@@ -588,7 +588,6 @@ int stb_c_lexer_get_token(stb_lexer *lexer)
          {
             int n = 0;
             lexer->string = lexer->string_storage;
-            lexer->string_len = n;
             do {
                if (n+1 >= lexer->string_storage_len)
                   return stb__clex_token(lexer, CLEX_parse_error, p, p+n);
@@ -602,6 +601,7 @@ int stb_c_lexer_get_token(stb_lexer *lexer)
                 STB_C_LEX_DOLLAR_IDENTIFIER( || p[n] == '$' )
             );
             lexer->string[n] = 0;
+            lexer->string_len = n;
             return stb__clex_token(lexer, CLEX_id, p, p+n-1);
          }