adjust disasm lexer to account for compiler-autogenerated symbol names

This commit is contained in:
Ryan Fleury
2024-10-24 11:41:59 -07:00
parent 8f932bdbf7
commit e9666e2edd
2 changed files with 30 additions and 5 deletions
+6 -2
View File
@@ -279,8 +279,8 @@ few_params1(Pair *pairs, int count, Function_No_Params_Type *no_params_type){
} }
static void static void
type_coverage_eval_tests(void){ type_coverage_eval_tests(void)
{
Basics basics = {-1, 1, -2, 2, -4, 4, -8, 8, 1.5f, 1.50000000000001}; Basics basics = {-1, 1, -2, 2, -4, 4, -8, 8, 1.5f, 1.50000000000001};
Basics_Stdint basics_stdint = {-1, 1, -2, 2, -4, 4, -8, 8, 1.5f, 1.50000000000001}; Basics_Stdint basics_stdint = {-1, 1, -2, 2, -4, 4, -8, 8, 1.5f, 1.50000000000001};
@@ -432,6 +432,10 @@ type_coverage_eval_tests(void){
OutputDebugStringA("\n"); OutputDebugStringA("\n");
} }
const int32_t x1 = 3;
const int32_t y1 = -10;
const int32_t z1 = x1 + y1;
int x = (int)(Anonymous_D); int x = (int)(Anonymous_D);
} }
+22 -1
View File
@@ -1377,6 +1377,7 @@ txt_token_array_from_string__disasm_x64_intel(Arena *arena, U64 *bytes_processed
B32 string_is_char = 0; B32 string_is_char = 0;
S32 brace_nest = 0; S32 brace_nest = 0;
S32 paren_nest = 0; S32 paren_nest = 0;
S32 string_tick_nest = 0;
for(U64 advance = 0; off <= string.size; off += advance) for(U64 advance = 0; off <= string.size; off += advance)
{ {
U8 byte = (off+0 < string.size) ? string.str[off+0] : 0; U8 byte = (off+0 < string.size) ? string.str[off+0] : 0;
@@ -1425,6 +1426,13 @@ txt_token_array_from_string__disasm_x64_intel(Arena *arena, U64 *bytes_processed
advance = 1; advance = 1;
string_is_char = 0; string_is_char = 0;
} }
else if(byte == '`')
{
active_token_start_off = off;
active_token_kind = TXT_TokenKind_String;
advance = 1;
string_tick_nest += 1;
}
else if(('0' <= byte && byte <= '9') || (byte == '.' && '0' <= next_byte && next_byte <= '9')) else if(('0' <= byte && byte <= '9') || (byte == '.' && '0' <= next_byte && next_byte <= '9'))
{ {
active_token_start_off = off; active_token_start_off = off;
@@ -1479,12 +1487,21 @@ txt_token_array_from_string__disasm_x64_intel(Arena *arena, U64 *bytes_processed
}break; }break;
case TXT_TokenKind_String: case TXT_TokenKind_String:
{ {
U8 ender_byte = string_is_char ? '\'' : '"'; U8 ender_byte = (string_tick_nest > 0 ? '\'' :
string_is_char ? '\''
: '"');
if(!escaped && byte == ender_byte) if(!escaped && byte == ender_byte)
{
if(string_tick_nest > 0)
{
string_tick_nest -= 1;
}
if(string_tick_nest == 0)
{ {
ender_found = 1; ender_found = 1;
advance = 1; advance = 1;
} }
}
else if(escaped) else if(escaped)
{ {
escaped = 0; escaped = 0;
@@ -1495,6 +1512,10 @@ txt_token_array_from_string__disasm_x64_intel(Arena *arena, U64 *bytes_processed
escaped = 1; escaped = 1;
advance = 1; advance = 1;
} }
else if(string_tick_nest > 0 && byte == '`')
{
string_tick_nest += 1;
}
else else
{ {
U8 byte_class = utf8_class[byte>>3]; U8 byte_class = utf8_class[byte>>3];