From c4cde994f8bbd6795c87359bdaa7ffc1759d3128 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 14 Apr 2024 15:52:10 +0800 Subject: [PATCH] fix a bug --- src/compiler.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compiler.cpp b/src/compiler.cpp index c4d42997..3b085e05 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -1236,14 +1236,18 @@ __EAT_DOTS_END: if(is_raw_string_used(token.type)){ auto it = token_indices.find(token.sv()); if(it == token_indices.end()){ - token_indices[token.sv()] = token_indices.size(); + token_indices[token.sv()] = 0; // assert no '\n' in token.sv() for(char c: token.sv()) if(c=='\n') PK_FATAL_ERROR(); } } } ss << "=" << (int)token_indices.size() << '\n'; // L3: raw string count - for(auto& kv: token_indices) ss << kv.first << '\n'; // L4: raw strings + int index = 0; + for(auto& kv: token_indices){ + ss << kv.first << '\n'; // L4: raw strings + kv.second = index++; + } ss << "=" << (int)tokens.size() << '\n'; // L5: token count for(int i=0; i