diff --git a/custom/4coder_async_tasks.cpp b/custom/4coder_async_tasks.cpp index 3a0e9adf..aa38dd2d 100644 --- a/custom/4coder_async_tasks.cpp +++ b/custom/4coder_async_tasks.cpp @@ -138,6 +138,7 @@ async_task_handler_init(Application_Links *app, Async_System *async_system){ async_system->cv = system_condition_variable_make(); async_system->join_cv = system_condition_variable_make(); dll_init_sentinel(&async_system->task_sent); + async_system->thread.async_system = async_system; async_system->thread.thread = system_thread_launch(async_task_thread, &async_system->thread); } diff --git a/custom/4coder_async_tasks.h b/custom/4coder_async_tasks.h index dd3b5efb..2e1af6e4 100644 --- a/custom/4coder_async_tasks.h +++ b/custom/4coder_async_tasks.h @@ -11,8 +11,8 @@ typedef void Async_Task_Function_Type(struct Async_Context *actx, Data data); typedef u64 Async_Task; struct Async_Thread{ - System_Thread thread; struct Async_System *async_system; + System_Thread thread; struct Async_Node *node; Async_Task task; b32 cancel_signal; diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index b5a1dc70..62729570 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -541,6 +541,7 @@ BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){ function void do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ Application_Links *app = actx->app; + ProfileScope(app, "async lex"); Thread_Context *tctx = get_thread_context(app); Scratch_Block scratch(tctx); @@ -548,20 +549,36 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ String_Const_u8 contents = push_whole_buffer(app, scratch, buffer_id); system_release_global_frame_mutex(tctx); - Token_List list = lex_full_input_cpp(scratch, contents); + Lex_State_Cpp state = {}; + lex_full_input_cpp_init(&state, contents); - system_acquire_global_frame_mutex(tctx); - Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); - Base_Allocator *allocator = managed_scope_allocator(app, scope); - Token_Array tokens = {}; - tokens.tokens = base_array(allocator, Token, list.total_count); - tokens.count = list.total_count; - tokens.max = list.total_count; - token_fill_memory_from_list(tokens.tokens, &list); + Token_List list = {}; + b32 canceled = false; + for (;;){ + ProfileScope(app, "async lex block"); + if (lex_full_input_cpp_breaks(scratch, &list, &state, 10000)){ + break; + } + if (async_check_canceled(actx)){ + canceled = true; + break; + } + } - Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); - block_copy_struct(tokens_ptr, &tokens); - system_release_global_frame_mutex(tctx); + if (!canceled){ + system_acquire_global_frame_mutex(tctx); + Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); + Base_Allocator *allocator = managed_scope_allocator(app, scope); + Token_Array tokens = {}; + tokens.tokens = base_array(allocator, Token, list.total_count); + tokens.count = list.total_count; + tokens.max = list.total_count; + token_fill_memory_from_list(tokens.tokens, &list); + + Token_Array *tokens_ptr = scope_attachment(app, scope, attachment_tokens, Token_Array); + block_copy_struct(tokens_ptr, &tokens); + system_release_global_frame_mutex(tctx); + } } function void diff --git a/custom/generated/lexer_cpp.cpp b/custom/generated/lexer_cpp.cpp index 90c95275..33c479c2 100644 --- a/custom/generated/lexer_cpp.cpp +++ b/custom/generated/lexer_cpp.cpp @@ -43,860 +43,951 @@ lexeme_table_lookup(u64 *hash_array, String_Const_u8 *key_array, } #endif -u64 main_keys_hash_array[115] = { -0xbf6bcf77f466dd27,0x0000000000000000,0x0000000000000000,0xddafeacf66f79855, -0x0000000000000000,0xdc1a48df5108b771,0x42538c18e51eaa09,0x0000000000000000, -0x0000000000000000,0x0000000000000000,0x22537917f8a8a3eb,0xddafeacf66260e41, -0xbf6bcf7919c5cd77,0x0000000000000000,0x0000000000000000,0x7d6693cbac2bdd35, -0x0000000000000000,0x5b9fb6e2e69394f5,0xbf6bcf7968ce0a97,0x0000000000000000, -0xf3e523d06624f633,0xf3e523d067e7e921,0x0000000000000000,0xe174e4ef910e16f5, -0x0000000000000000,0xbf6bcf7679ec9457,0x8bf3b33d8d78a995,0x0000000000000000, -0x0000000000000000,0x42538c18e51ea93b,0xbf6bcf89bfdadcaf,0x0000000000000000, -0x0000000000000000,0x6513238162438c87,0x0000000000000000,0x0000000000000000, -0xdc1a48e959a6b7cb,0x0000000000000000,0x0000000000000000,0x8bf3bea4cea76929, -0x8bf3b047b147be3f,0x0000000000000000,0x0000000000000000,0x0000000000000000, -0x22537917f8a89707,0xf3e523d1bafd48b7,0xdc19ecdc1f3f3911,0xddafeacf666fc121, -0xf3e523d198883577,0x0000000000000000,0x0000000000000000,0x0000000000000000, -0xddafeacf6608a25d,0xf3e523d1b32acf23,0x0000000000000000,0x0000000000000000, -0x0ca578ca97852d1d,0x0000000000000000,0x0000000000000000,0xddafeacf66f75937, -0x22537917f8a817f5,0x0000000000000000,0x8bf3b4d379e3209b,0x0000000000000000, -0xdc1f2554d985408f,0x22537917f8a92833,0x0000000000000000,0x0000000000000000, -0xdc19eafe1d4c1d47,0xbf6bcf79d5fc73bd,0x0000000000000000,0xdc19e7390520f3bd, -0x0000000000000000,0xdc205ac0aff5457d,0xddafeacf66236661,0x0000000000000000, -0xddafeacf66cdd9b5,0xbf6bcf766259902f,0x0000000000000000,0xbf6bcf79660fe8ef, -0xbf6bcf79f6fb461b,0xdc19f20d6e2f3f0f,0xddafeacf66d373a1,0xdc1a45e31224453f, -0x0000000000000000,0xf3e523d067cb75c1,0x8bf3b4ed96a9dee7,0x0cd7d5c6c06bf5bd, -0x0000000000000000,0xbf6bcf7919d76689,0xe7c91e3f330f2359,0xc31899a1114df135, -0xbf6bcf7679be41ad,0xbf6bcf7691c57781,0x0000000000000000,0x0000000000000000, -0xf3e523d06c30d251,0x0000000000000000,0x22537917f8a8218b,0x8bf3b4a94dbb5eef, -0xf3e523d06c41aad5,0x0000000000000000,0x0000000000000000,0x8bf3b047b147bfd7, -0x0000000000000000,0xbf6bcf79d4a6eb89,0xf3e523d1b5c80ee1,0xddafeacf662637f5, -0x0000000000000000,0xdc1a4095f2b2cc07,0xddafeacf660b2247,0x0000000000000000, -0xbf6bcf765be19f55,0x0000000000000000,0xf3e523d181b6f48f, +u64 main_keys_hash_array[125] = { +0x0000000000000000,0x0000000000000000,0xae0dc40193b178f9,0xb96986ad74366239, +0xae0dc4007d2799c3,0x0000000000000000,0x6b890ab6607df9f5,0xfe4cf8e09552fd7d, +0xb96986abf449ab87,0x0ce3b6f3f2ae6d8b,0xb96986b1e4d5012d,0x0000000000000000, +0xae0dc4006a46609d,0xbae13981c29d9e93,0xb96986ac8864fc5b,0x0000000000000000, +0xfe4cdd7782bcdf87,0x0000000000000000,0x27dc518216dc92b9,0x0000000000000000, +0x0000000000000000,0x0ce3a6b2ed33a3f3,0xb6c16efd6d7f8691,0x0000000000000000, +0x5f1d5c76d1541da9,0x0000000000000000,0x0000000000000000,0xae0dc4006ef1e009, +0xb96986ad76870c01,0xb96986aba21ca901,0xb96986ae1e791a09,0xfe4cda48543d15eb, +0x0000000000000000,0xfe4c21260e153663,0xbae13981c29e1649,0xae0dc4007c306d83, +0x0000000000000000,0x0000000000000000,0x0000000000000000,0xfe53a22c8fba72db, +0x0000000000000000,0x0000000000000000,0xfe4c3c0e0a6459c3,0x0000000000000000, +0x0000000000000000,0x482db76ef4a7c2b9,0x0000000000000000,0x0000000000000000, +0xb96986adef80de03,0xbae13981c29e443f,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0xfe4c3b126f24e73b,0x0000000000000000,0x0000000000000000, +0xb6c16efd6d5e9039,0x0ce3a73cf2370b75,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0x0ce3a6cd0e243afd,0xae0dc4006d60a3dd,0xb6c16efd6d33baeb, +0x0000000000000000,0x0000000000000000,0xae0dc4007c1e53d9,0xfe50f7d974bbaa05, +0xb96986acb1e73223,0xb96986ad72de7ddd,0xb96986ae0d38e84b,0x0000000000000000, +0x0000000000000000,0xfe4c3b65bbba43b3,0x320c5ad54842e269,0xb6c16efd6d7eb2db, +0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000, +0xb6c16efd6d41ec49,0xb6c16efd6d3ad8c3,0xb6c16efd6d79768d,0x0000000000000000, +0x0ce3a725764fbd37,0x0000000000000000,0xb6c16efd6d326823,0xae0dc4006a76982b, +0x0000000000000000,0x0000000000000000,0xae0dc40193bc7f19,0xa48abde904c1baf9, +0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0xb6c16efd6d379001,0x0000000000000000,0x0000000000000000, +0x0000000000000000,0x0000000000000000,0xb96986ae0d2c0de5,0x0000000000000000, +0xb96986ac4109bb39,0x0000000000000000,0x5ee5e1225dabbaf9,0x6b8a48a90953eeab, +0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000, +0xb6c16efd6d3a30eb,0xb96986ae1e53e287,0xfe4c6461b7a951e5,0x0000000000000000, +0xbae13981c29ded97,0xbae13981c29dde75,0x5f1d5c76d1541c8f,0x0000000000000000, +0x0ce3b6f5b502c4ff,0x0000000000000000,0xae0dc4006c0426b9,0x0ce3b6f3f2ae5611, +0xc8cfe7a5027aeab5, }; -u8 main_keys_key_array_0[] = {0x70,0x75,0x62,0x6c,0x69,0x63,}; -u8 main_keys_key_array_3[] = {0x63,0x61,0x73,0x65,}; -u8 main_keys_key_array_5[] = {0x65,0x78,0x70,0x6c,0x69,0x63,0x69,0x74,}; -u8 main_keys_key_array_6[] = {0x64,0x6f,}; -u8 main_keys_key_array_10[] = {0x6e,0x65,0x77,}; -u8 main_keys_key_array_11[] = {0x65,0x6c,0x73,0x65,}; -u8 main_keys_key_array_12[] = {0x65,0x78,0x70,0x6f,0x72,0x74,}; -u8 main_keys_key_array_15[] = {0x64,0x79,0x6e,0x61,0x6d,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; -u8 main_keys_key_array_17[] = {0x63,0x6f,0x6e,0x73,0x74,0x5f,0x63,0x61,0x73,0x74,}; -u8 main_keys_key_array_18[] = {0x69,0x6e,0x6c,0x69,0x6e,0x65,}; -u8 main_keys_key_array_20[] = {0x62,0x72,0x65,0x61,0x6b,}; -u8 main_keys_key_array_21[] = {0x66,0x61,0x6c,0x73,0x65,}; -u8 main_keys_key_array_23[] = {0x72,0x65,0x69,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,0x74,0x5f,0x63,0x61,0x73,0x74,}; -u8 main_keys_key_array_25[] = {0x73,0x74,0x61,0x74,0x69,0x63,}; -u8 main_keys_key_array_26[] = {0x6e,0x75,0x6c,0x6c,0x70,0x74,0x72,}; -u8 main_keys_key_array_29[] = {0x69,0x66,}; -u8 main_keys_key_array_30[] = {0x66,0x72,0x69,0x65,0x6e,0x64,}; -u8 main_keys_key_array_33[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x61,0x73,0x73,0x65,0x72,0x74,}; -u8 main_keys_key_array_36[] = {0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,}; -u8 main_keys_key_array_39[] = {0x76,0x69,0x72,0x74,0x75,0x61,0x6c,}; -u8 main_keys_key_array_40[] = {0x61,0x6c,0x69,0x67,0x6e,0x6f,0x66,}; -u8 main_keys_key_array_44[] = {0x69,0x6e,0x74,}; -u8 main_keys_key_array_45[] = {0x73,0x68,0x6f,0x72,0x74,}; -u8 main_keys_key_array_46[] = {0x74,0x79,0x70,0x65,0x6e,0x61,0x6d,0x65,}; -u8 main_keys_key_array_47[] = {0x76,0x6f,0x69,0x64,}; -u8 main_keys_key_array_48[] = {0x63,0x6c,0x61,0x73,0x73,}; -u8 main_keys_key_array_52[] = {0x74,0x72,0x75,0x65,}; -u8 main_keys_key_array_53[] = {0x75,0x6e,0x69,0x6f,0x6e,}; -u8 main_keys_key_array_56[] = {0x70,0x72,0x6f,0x74,0x65,0x63,0x74,0x65,0x64,}; -u8 main_keys_key_array_59[] = {0x63,0x68,0x61,0x72,}; -u8 main_keys_key_array_60[] = {0x61,0x73,0x6d,}; -u8 main_keys_key_array_62[] = {0x74,0x79,0x70,0x65,0x64,0x65,0x66,}; -u8 main_keys_key_array_64[] = {0x76,0x6f,0x6c,0x61,0x74,0x69,0x6c,0x65,}; -u8 main_keys_key_array_65[] = {0x74,0x72,0x79,}; -u8 main_keys_key_array_68[] = {0x64,0x65,0x63,0x6c,0x74,0x79,0x70,0x65,}; -u8 main_keys_key_array_69[] = {0x73,0x69,0x67,0x6e,0x65,0x64,}; -u8 main_keys_key_array_71[] = {0x75,0x6e,0x73,0x69,0x67,0x6e,0x65,0x64,}; -u8 main_keys_key_array_73[] = {0x63,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,}; -u8 main_keys_key_array_74[] = {0x67,0x6f,0x74,0x6f,}; -u8 main_keys_key_array_76[] = {0x62,0x6f,0x6f,0x6c,}; -u8 main_keys_key_array_77[] = {0x64,0x65,0x6c,0x65,0x74,0x65,}; -u8 main_keys_key_array_79[] = {0x64,0x6f,0x75,0x62,0x6c,0x65,}; -u8 main_keys_key_array_80[] = {0x73,0x69,0x7a,0x65,0x6f,0x66,}; -u8 main_keys_key_array_81[] = {0x74,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65,}; -u8 main_keys_key_array_82[] = {0x6c,0x6f,0x6e,0x67,}; -u8 main_keys_key_array_83[] = {0x6e,0x6f,0x65,0x78,0x63,0x65,0x70,0x74,}; -u8 main_keys_key_array_85[] = {0x66,0x6c,0x6f,0x61,0x74,}; -u8 main_keys_key_array_86[] = {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,}; -u8 main_keys_key_array_87[] = {0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,}; -u8 main_keys_key_array_89[] = {0x65,0x78,0x74,0x65,0x72,0x6e,}; -u8 main_keys_key_array_90[] = {0x74,0x68,0x72,0x65,0x61,0x64,0x5f,0x6c,0x6f,0x63,0x61,0x6c,}; -u8 main_keys_key_array_91[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; -u8 main_keys_key_array_92[] = {0x73,0x74,0x72,0x75,0x63,0x74,}; -u8 main_keys_key_array_93[] = {0x74,0x79,0x70,0x65,0x69,0x64,}; -u8 main_keys_key_array_96[] = {0x63,0x6f,0x6e,0x73,0x74,}; -u8 main_keys_key_array_98[] = {0x66,0x6f,0x72,}; -u8 main_keys_key_array_99[] = {0x70,0x72,0x69,0x76,0x61,0x74,0x65,}; -u8 main_keys_key_array_100[] = {0x63,0x61,0x74,0x63,0x68,}; -u8 main_keys_key_array_103[] = {0x61,0x6c,0x69,0x67,0x6e,0x61,0x73,}; -u8 main_keys_key_array_105[] = {0x72,0x65,0x74,0x75,0x72,0x6e,}; -u8 main_keys_key_array_106[] = {0x75,0x73,0x69,0x6e,0x67,}; -u8 main_keys_key_array_107[] = {0x65,0x6e,0x75,0x6d,}; -u8 main_keys_key_array_109[] = {0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,}; -u8 main_keys_key_array_110[] = {0x74,0x68,0x69,0x73,}; -u8 main_keys_key_array_112[] = {0x73,0x77,0x69,0x74,0x63,0x68,}; -u8 main_keys_key_array_114[] = {0x77,0x68,0x69,0x6c,0x65,}; -String_Const_u8 main_keys_key_array[115] = { -{main_keys_key_array_0, 6}, +u8 main_keys_key_array_2[] = {0x63,0x6f,0x6e,0x73,0x74,}; +u8 main_keys_key_array_3[] = {0x73,0x74,0x72,0x75,0x63,0x74,}; +u8 main_keys_key_array_4[] = {0x77,0x68,0x69,0x6c,0x65,}; +u8 main_keys_key_array_6[] = {0x70,0x72,0x6f,0x74,0x65,0x63,0x74,0x65,0x64,}; +u8 main_keys_key_array_7[] = {0x65,0x78,0x70,0x6c,0x69,0x63,0x69,0x74,}; +u8 main_keys_key_array_8[] = {0x72,0x65,0x74,0x75,0x72,0x6e,}; +u8 main_keys_key_array_9[] = {0x61,0x6c,0x69,0x67,0x6e,0x6f,0x66,}; +u8 main_keys_key_array_10[] = {0x74,0x79,0x70,0x65,0x69,0x64,}; +u8 main_keys_key_array_12[] = {0x66,0x6c,0x6f,0x61,0x74,}; +u8 main_keys_key_array_13[] = {0x61,0x73,0x6d,}; +u8 main_keys_key_array_14[] = {0x69,0x6e,0x6c,0x69,0x6e,0x65,}; +u8 main_keys_key_array_16[] = {0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,}; +u8 main_keys_key_array_18[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; +u8 main_keys_key_array_21[] = {0x70,0x72,0x69,0x76,0x61,0x74,0x65,}; +u8 main_keys_key_array_22[] = {0x74,0x68,0x69,0x73,}; +u8 main_keys_key_array_24[] = {0x64,0x6f,}; +u8 main_keys_key_array_27[] = {0x73,0x68,0x6f,0x72,0x74,}; +u8 main_keys_key_array_28[] = {0x73,0x74,0x61,0x74,0x69,0x63,}; +u8 main_keys_key_array_29[] = {0x70,0x75,0x62,0x6c,0x69,0x63,}; +u8 main_keys_key_array_30[] = {0x65,0x78,0x70,0x6f,0x72,0x74,}; +u8 main_keys_key_array_31[] = {0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,}; +u8 main_keys_key_array_33[] = {0x64,0x65,0x63,0x6c,0x74,0x79,0x70,0x65,}; +u8 main_keys_key_array_34[] = {0x69,0x6e,0x74,}; +u8 main_keys_key_array_35[] = {0x75,0x6e,0x69,0x6f,0x6e,}; +u8 main_keys_key_array_39[] = {0x63,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,}; +u8 main_keys_key_array_42[] = {0x76,0x6f,0x6c,0x61,0x74,0x69,0x6c,0x65,}; +u8 main_keys_key_array_45[] = {0x64,0x79,0x6e,0x61,0x6d,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,}; +u8 main_keys_key_array_48[] = {0x64,0x6f,0x75,0x62,0x6c,0x65,}; +u8 main_keys_key_array_49[] = {0x74,0x72,0x79,}; +u8 main_keys_key_array_53[] = {0x74,0x79,0x70,0x65,0x6e,0x61,0x6d,0x65,}; +u8 main_keys_key_array_56[] = {0x6c,0x6f,0x6e,0x67,}; +u8 main_keys_key_array_57[] = {0x76,0x69,0x72,0x74,0x75,0x61,0x6c,}; +u8 main_keys_key_array_61[] = {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,}; +u8 main_keys_key_array_62[] = {0x63,0x61,0x74,0x63,0x68,}; +u8 main_keys_key_array_63[] = {0x63,0x61,0x73,0x65,}; +u8 main_keys_key_array_66[] = {0x75,0x73,0x69,0x6e,0x67,}; +u8 main_keys_key_array_67[] = {0x6e,0x6f,0x65,0x78,0x63,0x65,0x70,0x74,}; +u8 main_keys_key_array_68[] = {0x64,0x65,0x6c,0x65,0x74,0x65,}; +u8 main_keys_key_array_69[] = {0x73,0x77,0x69,0x74,0x63,0x68,}; +u8 main_keys_key_array_70[] = {0x73,0x69,0x7a,0x65,0x6f,0x66,}; +u8 main_keys_key_array_73[] = {0x74,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65,}; +u8 main_keys_key_array_74[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x61,0x73,0x73,0x65,0x72,0x74,}; +u8 main_keys_key_array_75[] = {0x74,0x72,0x75,0x65,}; +u8 main_keys_key_array_80[] = {0x67,0x6f,0x74,0x6f,}; +u8 main_keys_key_array_81[] = {0x65,0x6e,0x75,0x6d,}; +u8 main_keys_key_array_82[] = {0x76,0x6f,0x69,0x64,}; +u8 main_keys_key_array_84[] = {0x74,0x79,0x70,0x65,0x64,0x65,0x66,}; +u8 main_keys_key_array_86[] = {0x63,0x68,0x61,0x72,}; +u8 main_keys_key_array_87[] = {0x66,0x61,0x6c,0x73,0x65,}; +u8 main_keys_key_array_90[] = {0x63,0x6c,0x61,0x73,0x73,}; +u8 main_keys_key_array_91[] = {0x72,0x65,0x69,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,0x74,0x5f,0x63,0x61,0x73,0x74,}; +u8 main_keys_key_array_97[] = {0x62,0x6f,0x6f,0x6c,}; +u8 main_keys_key_array_102[] = {0x73,0x69,0x67,0x6e,0x65,0x64,}; +u8 main_keys_key_array_104[] = {0x66,0x72,0x69,0x65,0x6e,0x64,}; +u8 main_keys_key_array_106[] = {0x63,0x6f,0x6e,0x73,0x74,0x5f,0x63,0x61,0x73,0x74,}; +u8 main_keys_key_array_107[] = {0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,}; +u8 main_keys_key_array_112[] = {0x65,0x6c,0x73,0x65,}; +u8 main_keys_key_array_113[] = {0x65,0x78,0x74,0x65,0x72,0x6e,}; +u8 main_keys_key_array_114[] = {0x75,0x6e,0x73,0x69,0x67,0x6e,0x65,0x64,}; +u8 main_keys_key_array_116[] = {0x66,0x6f,0x72,}; +u8 main_keys_key_array_117[] = {0x6e,0x65,0x77,}; +u8 main_keys_key_array_118[] = {0x69,0x66,}; +u8 main_keys_key_array_120[] = {0x6e,0x75,0x6c,0x6c,0x70,0x74,0x72,}; +u8 main_keys_key_array_122[] = {0x62,0x72,0x65,0x61,0x6b,}; +u8 main_keys_key_array_123[] = {0x61,0x6c,0x69,0x67,0x6e,0x61,0x73,}; +u8 main_keys_key_array_124[] = {0x74,0x68,0x72,0x65,0x61,0x64,0x5f,0x6c,0x6f,0x63,0x61,0x6c,}; +String_Const_u8 main_keys_key_array[125] = { {0, 0}, {0, 0}, -{main_keys_key_array_3, 4}, +{main_keys_key_array_2, 5}, +{main_keys_key_array_3, 6}, +{main_keys_key_array_4, 5}, {0, 0}, -{main_keys_key_array_5, 8}, -{main_keys_key_array_6, 2}, +{main_keys_key_array_6, 9}, +{main_keys_key_array_7, 8}, +{main_keys_key_array_8, 6}, +{main_keys_key_array_9, 7}, +{main_keys_key_array_10, 6}, +{0, 0}, +{main_keys_key_array_12, 5}, +{main_keys_key_array_13, 3}, +{main_keys_key_array_14, 6}, +{0, 0}, +{main_keys_key_array_16, 8}, +{0, 0}, +{main_keys_key_array_18, 11}, {0, 0}, {0, 0}, +{main_keys_key_array_21, 7}, +{main_keys_key_array_22, 4}, {0, 0}, -{main_keys_key_array_10, 3}, -{main_keys_key_array_11, 4}, -{main_keys_key_array_12, 6}, +{main_keys_key_array_24, 2}, {0, 0}, {0, 0}, -{main_keys_key_array_15, 12}, -{0, 0}, -{main_keys_key_array_17, 10}, -{main_keys_key_array_18, 6}, -{0, 0}, -{main_keys_key_array_20, 5}, -{main_keys_key_array_21, 5}, -{0, 0}, -{main_keys_key_array_23, 16}, -{0, 0}, -{main_keys_key_array_25, 6}, -{main_keys_key_array_26, 7}, -{0, 0}, -{0, 0}, -{main_keys_key_array_29, 2}, +{main_keys_key_array_27, 5}, +{main_keys_key_array_28, 6}, +{main_keys_key_array_29, 6}, {main_keys_key_array_30, 6}, +{main_keys_key_array_31, 8}, {0, 0}, -{0, 0}, -{main_keys_key_array_33, 13}, -{0, 0}, -{0, 0}, -{main_keys_key_array_36, 8}, -{0, 0}, -{0, 0}, -{main_keys_key_array_39, 7}, -{main_keys_key_array_40, 7}, +{main_keys_key_array_33, 8}, +{main_keys_key_array_34, 3}, +{main_keys_key_array_35, 5}, {0, 0}, {0, 0}, {0, 0}, -{main_keys_key_array_44, 3}, -{main_keys_key_array_45, 5}, -{main_keys_key_array_46, 8}, -{main_keys_key_array_47, 4}, -{main_keys_key_array_48, 5}, +{main_keys_key_array_39, 8}, +{0, 0}, +{0, 0}, +{main_keys_key_array_42, 8}, +{0, 0}, +{0, 0}, +{main_keys_key_array_45, 12}, +{0, 0}, +{0, 0}, +{main_keys_key_array_48, 6}, +{main_keys_key_array_49, 3}, {0, 0}, {0, 0}, {0, 0}, -{main_keys_key_array_52, 4}, -{main_keys_key_array_53, 5}, +{main_keys_key_array_53, 8}, {0, 0}, {0, 0}, -{main_keys_key_array_56, 9}, +{main_keys_key_array_56, 4}, +{main_keys_key_array_57, 7}, {0, 0}, {0, 0}, -{main_keys_key_array_59, 4}, -{main_keys_key_array_60, 3}, {0, 0}, -{main_keys_key_array_62, 7}, -{0, 0}, -{main_keys_key_array_64, 8}, -{main_keys_key_array_65, 3}, +{main_keys_key_array_61, 7}, +{main_keys_key_array_62, 5}, +{main_keys_key_array_63, 4}, {0, 0}, {0, 0}, -{main_keys_key_array_68, 8}, +{main_keys_key_array_66, 5}, +{main_keys_key_array_67, 8}, +{main_keys_key_array_68, 6}, {main_keys_key_array_69, 6}, +{main_keys_key_array_70, 6}, {0, 0}, -{main_keys_key_array_71, 8}, {0, 0}, {main_keys_key_array_73, 8}, -{main_keys_key_array_74, 4}, +{main_keys_key_array_74, 13}, +{main_keys_key_array_75, 4}, {0, 0}, -{main_keys_key_array_76, 4}, -{main_keys_key_array_77, 6}, {0, 0}, -{main_keys_key_array_79, 6}, -{main_keys_key_array_80, 6}, -{main_keys_key_array_81, 8}, +{0, 0}, +{0, 0}, +{main_keys_key_array_80, 4}, +{main_keys_key_array_81, 4}, {main_keys_key_array_82, 4}, -{main_keys_key_array_83, 8}, {0, 0}, -{main_keys_key_array_85, 5}, -{main_keys_key_array_86, 7}, -{main_keys_key_array_87, 9}, +{main_keys_key_array_84, 7}, {0, 0}, -{main_keys_key_array_89, 6}, -{main_keys_key_array_90, 12}, -{main_keys_key_array_91, 11}, -{main_keys_key_array_92, 6}, -{main_keys_key_array_93, 6}, +{main_keys_key_array_86, 4}, +{main_keys_key_array_87, 5}, {0, 0}, {0, 0}, -{main_keys_key_array_96, 5}, -{0, 0}, -{main_keys_key_array_98, 3}, -{main_keys_key_array_99, 7}, -{main_keys_key_array_100, 5}, +{main_keys_key_array_90, 5}, +{main_keys_key_array_91, 16}, {0, 0}, {0, 0}, -{main_keys_key_array_103, 7}, {0, 0}, -{main_keys_key_array_105, 6}, -{main_keys_key_array_106, 5}, -{main_keys_key_array_107, 4}, {0, 0}, -{main_keys_key_array_109, 8}, -{main_keys_key_array_110, 4}, {0, 0}, -{main_keys_key_array_112, 6}, +{main_keys_key_array_97, 4}, {0, 0}, -{main_keys_key_array_114, 5}, +{0, 0}, +{0, 0}, +{0, 0}, +{main_keys_key_array_102, 6}, +{0, 0}, +{main_keys_key_array_104, 6}, +{0, 0}, +{main_keys_key_array_106, 10}, +{main_keys_key_array_107, 9}, +{0, 0}, +{0, 0}, +{0, 0}, +{0, 0}, +{main_keys_key_array_112, 4}, +{main_keys_key_array_113, 6}, +{main_keys_key_array_114, 8}, +{0, 0}, +{main_keys_key_array_116, 3}, +{main_keys_key_array_117, 3}, +{main_keys_key_array_118, 2}, +{0, 0}, +{main_keys_key_array_120, 7}, +{0, 0}, +{main_keys_key_array_122, 5}, +{main_keys_key_array_123, 7}, +{main_keys_key_array_124, 12}, }; -Lexeme_Table_Value main_keys_value_array[115] = { -{4, TokenCppKind_Public}, +Lexeme_Table_Value main_keys_value_array[125] = { {0, 0}, {0, 0}, -{4, TokenCppKind_Case}, +{4, TokenCppKind_Const}, +{4, TokenCppKind_Struct}, +{4, TokenCppKind_While}, {0, 0}, +{4, TokenCppKind_Protected}, {4, TokenCppKind_Explicit}, +{4, TokenCppKind_Return}, +{4, TokenCppKind_AlignOf}, +{4, TokenCppKind_TypeID}, +{0, 0}, +{4, TokenCppKind_Float}, +{4, TokenCppKind_Asm}, +{4, TokenCppKind_Inline}, +{0, 0}, +{4, TokenCppKind_Operator}, +{0, 0}, +{4, TokenCppKind_StaticCast}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Private}, +{4, TokenCppKind_This}, +{0, 0}, {4, TokenCppKind_Do}, {0, 0}, {0, 0}, -{0, 0}, -{4, TokenCppKind_New}, -{4, TokenCppKind_Else}, +{4, TokenCppKind_Short}, +{4, TokenCppKind_Static}, +{4, TokenCppKind_Public}, {4, TokenCppKind_Export}, +{4, TokenCppKind_Register}, +{0, 0}, +{4, TokenCppKind_DeclType}, +{4, TokenCppKind_Int}, +{4, TokenCppKind_Union}, +{0, 0}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Continue}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Volatile}, {0, 0}, {0, 0}, {4, TokenCppKind_DynamicCast}, {0, 0}, -{4, TokenCppKind_ConstCast}, -{4, TokenCppKind_Inline}, {0, 0}, -{4, TokenCppKind_Break}, -{8, TokenCppKind_LiteralFalse}, -{0, 0}, -{4, TokenCppKind_ReinterpretCast}, -{0, 0}, -{4, TokenCppKind_Static}, -{4, TokenCppKind_NullPtr}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_If}, -{4, TokenCppKind_Friend}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_StaticAssert}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Operator}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Virtual}, -{4, TokenCppKind_AlignOf}, -{0, 0}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Int}, -{4, TokenCppKind_Short}, -{4, TokenCppKind_Typename}, -{4, TokenCppKind_Void}, -{4, TokenCppKind_Class}, -{0, 0}, -{0, 0}, -{0, 0}, -{8, TokenCppKind_LiteralTrue}, -{4, TokenCppKind_Union}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Protected}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Char}, -{4, TokenCppKind_Asm}, -{0, 0}, -{4, TokenCppKind_Typedef}, -{0, 0}, -{4, TokenCppKind_Volatile}, +{4, TokenCppKind_Double}, {4, TokenCppKind_Try}, {0, 0}, {0, 0}, -{4, TokenCppKind_DeclType}, -{4, TokenCppKind_Signed}, {0, 0}, -{4, TokenCppKind_Unsigned}, +{4, TokenCppKind_Typename}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Long}, +{4, TokenCppKind_Virtual}, +{0, 0}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Default}, +{4, TokenCppKind_Catch}, +{4, TokenCppKind_Case}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Using}, +{4, TokenCppKind_NoExcept}, +{4, TokenCppKind_Delete}, +{4, TokenCppKind_Switch}, +{4, TokenCppKind_SizeOf}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Template}, +{4, TokenCppKind_StaticAssert}, +{8, TokenCppKind_LiteralTrue}, +{0, 0}, +{0, 0}, +{0, 0}, {0, 0}, -{4, TokenCppKind_Continue}, {4, TokenCppKind_Goto}, +{4, TokenCppKind_Enum}, +{4, TokenCppKind_Void}, +{0, 0}, +{4, TokenCppKind_Typedef}, +{0, 0}, +{4, TokenCppKind_Char}, +{8, TokenCppKind_LiteralFalse}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Class}, +{4, TokenCppKind_ReinterpretCast}, +{0, 0}, +{0, 0}, +{0, 0}, +{0, 0}, {0, 0}, {4, TokenCppKind_Bool}, -{4, TokenCppKind_Delete}, {0, 0}, -{4, TokenCppKind_Double}, -{4, TokenCppKind_SizeOf}, -{4, TokenCppKind_Template}, -{4, TokenCppKind_Long}, -{4, TokenCppKind_NoExcept}, {0, 0}, -{4, TokenCppKind_Float}, -{4, TokenCppKind_Default}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Signed}, +{0, 0}, +{4, TokenCppKind_Friend}, +{0, 0}, +{4, TokenCppKind_ConstCast}, {4, TokenCppKind_Namespace}, {0, 0}, +{0, 0}, +{0, 0}, +{0, 0}, +{4, TokenCppKind_Else}, {4, TokenCppKind_Extern}, -{4, TokenCppKind_ThreadLocal}, -{4, TokenCppKind_StaticCast}, -{4, TokenCppKind_Struct}, -{4, TokenCppKind_TypeID}, -{0, 0}, -{0, 0}, -{4, TokenCppKind_Const}, +{4, TokenCppKind_Unsigned}, {0, 0}, {4, TokenCppKind_For}, -{4, TokenCppKind_Private}, -{4, TokenCppKind_Catch}, +{4, TokenCppKind_New}, +{4, TokenCppKind_If}, {0, 0}, +{4, TokenCppKind_NullPtr}, {0, 0}, +{4, TokenCppKind_Break}, {4, TokenCppKind_AlignAs}, -{0, 0}, -{4, TokenCppKind_Return}, -{4, TokenCppKind_Using}, -{4, TokenCppKind_Enum}, -{0, 0}, -{4, TokenCppKind_Register}, -{4, TokenCppKind_This}, -{0, 0}, -{4, TokenCppKind_Switch}, -{0, 0}, -{4, TokenCppKind_While}, +{4, TokenCppKind_ThreadLocal}, }; -i32 main_keys_slot_count = 115; -u64 main_keys_seed = 0x16bfab524fa54382; +i32 main_keys_slot_count = 125; +u64 main_keys_seed = 0xfa381694d5674125; u64 pp_directives_hash_array[25] = { -0xb609da307054bea3,0x0000000000000000,0x0000000000000000,0xa2e78356ab03f40f, -0x0000000000000000,0x0ee3d6653314ef87,0x0000000000000000,0xa2e7835774c1adef, -0x0ee3d660cdba6a31,0xa2e783568162a20f,0x8736de7657610e07,0x0000000000000000, -0x0ee3d660cf11c00f,0xb609da3070f19257,0xa2e7835772fe8f57,0x0000000000000000, -0xb609da3070f19323,0x0ee3d633c7a04603,0x0000000000000000,0x0000000000000000, -0x81c8a8b11ba92f2b,0xa2e78356842fa881,0x0000000000000000,0x81c8aed73449609b, -0x0000000000000000, +0x0000000000000000,0x34b86dc413bdc61d,0x0000000000000000,0xcc5e69206f9dddbd, +0x0000000000000000,0x65f024ddd53ade19,0x65f02489c656353d,0x0000000000000000, +0xcc5e69207d2543bd,0x35db8e7164ab1e55,0x6bb45a7c34b15b09,0x35db8e7164f625dd, +0x0000000000000000,0x0000000000000000,0x35db8e7164ab3649,0xcc5e692189cbad79, +0x0000000000000000,0xcc5e69207d6608a3,0x0000000000000000,0x0000000000000000, +0x65f02488282ecfbd,0x6bb4b5a2472171e5,0xcc5e6921a27c7d55,0x0000000000000000, +0x65f02489e6243cc7, }; -u8 pp_directives_key_array_0[] = {0x6c,0x69,0x6e,0x65,}; +u8 pp_directives_key_array_1[] = {0x69,0x66,}; u8 pp_directives_key_array_3[] = {0x69,0x66,0x64,0x65,0x66,}; u8 pp_directives_key_array_5[] = {0x70,0x72,0x61,0x67,0x6d,0x61,}; -u8 pp_directives_key_array_7[] = {0x65,0x72,0x72,0x6f,0x72,}; -u8 pp_directives_key_array_8[] = {0x69,0x6d,0x70,0x6f,0x72,0x74,}; -u8 pp_directives_key_array_9[] = {0x75,0x6e,0x64,0x65,0x66,}; -u8 pp_directives_key_array_10[] = {0x69,0x66,}; -u8 pp_directives_key_array_12[] = {0x69,0x66,0x6e,0x64,0x65,0x66,}; -u8 pp_directives_key_array_13[] = {0x65,0x6c,0x69,0x66,}; -u8 pp_directives_key_array_14[] = {0x65,0x6e,0x64,0x69,0x66,}; -u8 pp_directives_key_array_16[] = {0x65,0x6c,0x73,0x65,}; -u8 pp_directives_key_array_17[] = {0x64,0x65,0x66,0x69,0x6e,0x65,}; -u8 pp_directives_key_array_20[] = {0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,}; -u8 pp_directives_key_array_21[] = {0x75,0x73,0x69,0x6e,0x67,}; -u8 pp_directives_key_array_23[] = {0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,}; +u8 pp_directives_key_array_6[] = {0x64,0x65,0x66,0x69,0x6e,0x65,}; +u8 pp_directives_key_array_8[] = {0x75,0x6e,0x64,0x65,0x66,}; +u8 pp_directives_key_array_9[] = {0x65,0x6c,0x69,0x66,}; +u8 pp_directives_key_array_10[] = {0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,}; +u8 pp_directives_key_array_11[] = {0x6c,0x69,0x6e,0x65,}; +u8 pp_directives_key_array_14[] = {0x65,0x6c,0x73,0x65,}; +u8 pp_directives_key_array_15[] = {0x65,0x72,0x72,0x6f,0x72,}; +u8 pp_directives_key_array_17[] = {0x75,0x73,0x69,0x6e,0x67,}; +u8 pp_directives_key_array_20[] = {0x69,0x66,0x6e,0x64,0x65,0x66,}; +u8 pp_directives_key_array_21[] = {0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,}; +u8 pp_directives_key_array_22[] = {0x65,0x6e,0x64,0x69,0x66,}; +u8 pp_directives_key_array_24[] = {0x69,0x6d,0x70,0x6f,0x72,0x74,}; String_Const_u8 pp_directives_key_array[25] = { -{pp_directives_key_array_0, 4}, {0, 0}, +{pp_directives_key_array_1, 2}, {0, 0}, {pp_directives_key_array_3, 5}, {0, 0}, {pp_directives_key_array_5, 6}, +{pp_directives_key_array_6, 6}, {0, 0}, -{pp_directives_key_array_7, 5}, -{pp_directives_key_array_8, 6}, -{pp_directives_key_array_9, 5}, -{pp_directives_key_array_10, 2}, -{0, 0}, -{pp_directives_key_array_12, 6}, -{pp_directives_key_array_13, 4}, -{pp_directives_key_array_14, 5}, -{0, 0}, -{pp_directives_key_array_16, 4}, -{pp_directives_key_array_17, 6}, +{pp_directives_key_array_8, 5}, +{pp_directives_key_array_9, 4}, +{pp_directives_key_array_10, 7}, +{pp_directives_key_array_11, 4}, {0, 0}, {0, 0}, -{pp_directives_key_array_20, 7}, -{pp_directives_key_array_21, 5}, +{pp_directives_key_array_14, 4}, +{pp_directives_key_array_15, 5}, {0, 0}, -{pp_directives_key_array_23, 7}, +{pp_directives_key_array_17, 5}, {0, 0}, +{0, 0}, +{pp_directives_key_array_20, 6}, +{pp_directives_key_array_21, 7}, +{pp_directives_key_array_22, 5}, +{0, 0}, +{pp_directives_key_array_24, 6}, }; Lexeme_Table_Value pp_directives_value_array[25] = { -{5, TokenCppKind_PPLine}, {0, 0}, +{5, TokenCppKind_PPIf}, {0, 0}, {5, TokenCppKind_PPIfDef}, {0, 0}, {5, TokenCppKind_PPPragma}, -{0, 0}, -{5, TokenCppKind_PPError}, -{5, TokenCppKind_PPImport}, -{5, TokenCppKind_PPUndef}, -{5, TokenCppKind_PPIf}, -{0, 0}, -{5, TokenCppKind_PPIfNDef}, -{5, TokenCppKind_PPElIf}, -{5, TokenCppKind_PPEndIf}, -{0, 0}, -{5, TokenCppKind_PPElse}, {5, TokenCppKind_PPDefine}, {0, 0}, +{5, TokenCppKind_PPUndef}, +{5, TokenCppKind_PPElIf}, +{5, TokenCppKind_PPInclude}, +{5, TokenCppKind_PPLine}, +{0, 0}, +{0, 0}, +{5, TokenCppKind_PPElse}, +{5, TokenCppKind_PPError}, {0, 0}, -{5, TokenCppKind_PPVersion}, {5, TokenCppKind_PPUsing}, {0, 0}, -{5, TokenCppKind_PPInclude}, {0, 0}, +{5, TokenCppKind_PPIfNDef}, +{5, TokenCppKind_PPVersion}, +{5, TokenCppKind_PPEndIf}, +{0, 0}, +{5, TokenCppKind_PPImport}, }; i32 pp_directives_slot_count = 25; -u64 pp_directives_seed = 0x20a9103cfa5a977d; +u64 pp_directives_seed = 0x8fec132e93357a37; u64 pp_keys_hash_array[2] = { -0x0000000000000000,0xd488faf5597fb9a7, +0xaa00330834c0d751,0x0000000000000000, }; -u8 pp_keys_key_array_1[] = {0x64,0x65,0x66,0x69,0x6e,0x65,0x64,}; +u8 pp_keys_key_array_0[] = {0x64,0x65,0x66,0x69,0x6e,0x65,0x64,}; String_Const_u8 pp_keys_key_array[2] = { +{pp_keys_key_array_0, 7}, {0, 0}, -{pp_keys_key_array_1, 7}, }; Lexeme_Table_Value pp_keys_value_array[2] = { -{0, 0}, {4, TokenCppKind_PPDefined}, +{0, 0}, }; i32 pp_keys_slot_count = 2; -u64 pp_keys_seed = 0x69b39c166d6f6c83; -internal Token_List -lex_full_input_cpp(Arena *arena, String_Const_u8 input){ -Token_List list = {}; -u32 flags_ZF0 = 0; -u32 flags_KF0 = 0; -u16 flags_KB0 = 0; -u8 *delim_first = input.str; -u8 *delim_one_past_last = input.str; -u8 *emit_ptr = input.str; -u8 *ptr = input.str; -u8 *opl_ptr = ptr + input.size; +u64 pp_keys_seed = 0x444d48e552bc237e; +struct Lex_State_Cpp{ +u32 flags_ZF0; +u32 flags_KF0; +u16 flags_KB0; +u8 *base; +u8 *delim_first; +u8 *delim_one_past_last; +u8 *emit_ptr; +u8 *ptr; +u8 *opl_ptr; +}; +internal void +lex_full_input_cpp_init(Lex_State_Cpp *state_ptr, String_Const_u8 input){ +state_ptr->flags_ZF0 = 0; +state_ptr->flags_KF0 = 0; +state_ptr->flags_KB0 = 0; +state_ptr->base = input.str; +state_ptr->delim_first = input.str; +state_ptr->delim_one_past_last = input.str; +state_ptr->emit_ptr = input.str; +state_ptr->ptr = input.str; +state_ptr->opl_ptr = input.str + input.size; +} +internal b32 +lex_full_input_cpp_breaks(Arena *arena, Token_List *list, Lex_State_Cpp *state_ptr, u64 max){ +b32 result = false; +u64 emit_counter = 0; +Lex_State_Cpp state; +block_copy_struct(&state, state_ptr); { state_label_1: // root -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ case 0x00:case 0x01:case 0x02:case 0x03:case 0x04:case 0x05:case 0x06: case 0x07:case 0x08:case 0x0e:case 0x0f:case 0x10:case 0x11:case 0x12: case 0x13:case 0x14:case 0x15:case 0x16:case 0x17:case 0x18:case 0x19: case 0x1a:case 0x1b:case 0x1c:case 0x1d:case 0x1e:case 0x1f:case 0x40: case 0x60:case 0x7f: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x09:case 0x0b:case 0x0c:case 0x0d:case 0x20: { -if ((HasFlag(flags_KF0, 0x2))){ -ptr += 1; +if ((HasFlag(state.flags_KF0, 0x2))){ +state.ptr += 1; goto state_label_4; // error_body } -ptr += 1; +state.ptr += 1; goto state_label_3; // whitespace }break; case 0x0a: { -ptr += 1; -flags_KB0 &= ~(0x1); -flags_KF0 &= ~(0x1); -flags_KF0 &= ~(0x2); +state.ptr += 1; +state.flags_KB0 &= ~(0x1); +state.flags_KF0 &= ~(0x1); +state.flags_KF0 &= ~(0x2); goto state_label_3; // whitespace }break; case 0x21: { -ptr += 1; +state.ptr += 1; goto state_label_60; // op stage }break; case 0x22: { -if ((HasFlag(flags_KF0, 0x1))){ -ptr += 1; +if ((HasFlag(state.flags_KF0, 0x1))){ +state.ptr += 1; goto state_label_26; // include_quotes } -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x23: { -if ((!HasFlag(flags_KB0, 0x1))){ -ptr += 1; +if ((!HasFlag(state.flags_KB0, 0x1))){ +state.ptr += 1; goto state_label_23; // pp_directive_whitespace } -ptr += 1; +state.ptr += 1; goto state_label_67; // op stage }break; default: { -ptr += 1; +state.ptr += 1; goto state_label_2; // identifier }break; case 0x25: { -ptr += 1; +state.ptr += 1; goto state_label_64; // op stage }break; case 0x26: { -ptr += 1; +state.ptr += 1; goto state_label_61; // op stage }break; case 0x27: { -ptr += 1; -flags_ZF0 |= 0x40; +state.ptr += 1; +state.flags_ZF0 |= 0x40; goto state_label_32; // string }break; case 0x28: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_ParenOp; token.kind = 13; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x29: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_ParenCl; token.kind = 14; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2a: { -ptr += 1; +state.ptr += 1; goto state_label_63; // op stage }break; case 0x2b: { -ptr += 1; +state.ptr += 1; goto state_label_53; // op stage }break; case 0x2c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Comma; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2d: { -ptr += 1; +state.ptr += 1; goto state_label_54; // op stage }break; case 0x2e: { -ptr += 1; +state.ptr += 1; goto state_label_6; // operator_or_fnumber_dot }break; case 0x2f: { -ptr += 1; +state.ptr += 1; goto state_label_7; // operator_or_comment_slash }break; case 0x30: { -ptr += 1; +state.ptr += 1; goto state_label_9; // znumber }break; case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36:case 0x37: case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_8; // number }break; case 0x3a: { -ptr += 1; +state.ptr += 1; goto state_label_52; // op stage }break; case 0x3b: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Semicolon; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3c: { -if ((!HasFlag(flags_KF0, 0x1))){ -ptr += 1; +if ((!HasFlag(state.flags_KF0, 0x1))){ +state.ptr += 1; goto state_label_56; // op stage } -ptr += 1; +state.ptr += 1; goto state_label_25; // include_pointy }break; case 0x3d: { -ptr += 1; +state.ptr += 1; goto state_label_59; // op stage }break; case 0x3e: { -ptr += 1; +state.ptr += 1; goto state_label_57; // op stage }break; case 0x3f: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Ternary; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c: { -ptr += 1; -flags_ZF0 |= 0x4; +state.ptr += 1; +state.flags_ZF0 |= 0x4; goto state_label_27; // pre_L }break; case 0x52: { -ptr += 1; +state.ptr += 1; goto state_label_31; // pre_R }break; case 0x55: { -ptr += 1; -flags_ZF0 |= 0x20; +state.ptr += 1; +state.flags_ZF0 |= 0x20; goto state_label_29; // pre_U }break; case 0x5b: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BrackOp; token.kind = 13; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x5c: { -ptr += 1; +state.ptr += 1; goto state_label_5; // backslash }break; case 0x5d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BrackCl; token.kind = 14; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x5e: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Xor; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x75: { -ptr += 1; -flags_ZF0 |= 0x10; +state.ptr += 1; +state.flags_ZF0 |= 0x10; goto state_label_28; // pre_u }break; case 0x7b: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BraceOp; token.kind = 11; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x7c: { -ptr += 1; +state.ptr += 1; goto state_label_62; // op stage }break; case 0x7d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BraceCl; token.kind = 12; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x7e: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Tilde; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_2: // identifier -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_KB0, 0x1)){ -Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_keys_hash_array, pp_keys_key_array, pp_keys_value_array, pp_keys_slot_count, pp_keys_seed, emit_ptr, token.size); +if (HasFlag(state.flags_KB0, 0x1)){ +Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_keys_hash_array, pp_keys_key_array, pp_keys_value_array, pp_keys_slot_count, pp_keys_seed, state.emit_ptr, token.size); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; break; } } -Lexeme_Table_Lookup lookup = lexeme_table_lookup(main_keys_hash_array, main_keys_key_array, main_keys_value_array, main_keys_slot_count, main_keys_seed, emit_ptr, token.size); +Lexeme_Table_Lookup lookup = lexeme_table_lookup(main_keys_hash_array, main_keys_key_array, main_keys_value_array, main_keys_slot_count, main_keys_seed, state.emit_ptr, token.size); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; @@ -905,14 +996,15 @@ break; token.sub_kind = TokenCppKind_Identifier; token.kind = 6; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ case 0x00:case 0x01:case 0x02:case 0x03:case 0x04:case 0x05:case 0x06: case 0x07:case 0x08:case 0x09:case 0x0a:case 0x0b:case 0x0c:case 0x0d: case 0x0e:case 0x0f:case 0x10:case 0x11:case 0x12:case 0x13:case 0x14: @@ -926,19 +1018,19 @@ case 0x7f: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_KB0, 0x1)){ -Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_keys_hash_array, pp_keys_key_array, pp_keys_value_array, pp_keys_slot_count, pp_keys_seed, emit_ptr, token.size); +if (HasFlag(state.flags_KB0, 0x1)){ +Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_keys_hash_array, pp_keys_key_array, pp_keys_value_array, pp_keys_slot_count, pp_keys_seed, state.emit_ptr, token.size); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; break; } } -Lexeme_Table_Lookup lookup = lexeme_table_lookup(main_keys_hash_array, main_keys_key_array, main_keys_value_array, main_keys_slot_count, main_keys_seed, emit_ptr, token.size); +Lexeme_Table_Lookup lookup = lexeme_table_lookup(main_keys_hash_array, main_keys_key_array, main_keys_value_array, main_keys_slot_count, main_keys_seed, state.emit_ptr, token.size); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; @@ -947,835 +1039,943 @@ break; token.sub_kind = TokenCppKind_Identifier; token.kind = 6; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; default: { -ptr += 1; +state.ptr += 1; goto state_label_2; // identifier }break; } } { state_label_3: // whitespace -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Whitespace; token.kind = 1; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Whitespace; token.kind = 1; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x09:case 0x0b:case 0x0c:case 0x0d:case 0x20: { -ptr += 1; +state.ptr += 1; goto state_label_3; // whitespace }break; case 0x0a: { -ptr += 1; -flags_KB0 &= ~(0x1); -flags_KF0 &= ~(0x1); -flags_KF0 &= ~(0x2); +state.ptr += 1; +state.flags_KB0 &= ~(0x1); +state.flags_KF0 &= ~(0x1); +state.flags_KF0 &= ~(0x2); goto state_label_3; // whitespace }break; } } { state_label_4: // error_body -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPErrorMessage; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_4; // error_body }break; case 0x0a: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPErrorMessage; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_5: // backslash -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Backslash; token.kind = 1; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Backslash; token.kind = 1; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x0a: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Backslash; token.kind = 1; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_6: // operator_or_fnumber_dot -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Dot; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Dot; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2a: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_DotStar; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2e: { -ptr += 1; +state.ptr += 1; goto state_label_68; // op stage }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_10; // fnumber_decimal }break; } } { state_label_7: // operator_or_comment_slash -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Div; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Div; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2a: { -ptr += 1; +state.ptr += 1; goto state_label_49; // comment_block }break; case 0x2f: { -ptr += 1; +state.ptr += 1; goto state_label_51; // comment_line }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_DivEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_8: // number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralInteger; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralInteger; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2e: { -ptr += 1; +state.ptr += 1; goto state_label_10; // fnumber_decimal }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_8; // number }break; case 0x45:case 0x65: { -ptr += 1; +state.ptr += 1; goto state_label_11; // fnumber_exponent }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_18; // L_number }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; goto state_label_17; // U_number }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_20; // l_number }break; } } { state_label_9: // znumber -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralInteger; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralInteger; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2e: { -ptr += 1; +state.ptr += 1; goto state_label_10; // fnumber_decimal }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37: { -ptr += 1; -flags_ZF0 |= 0x2; +state.ptr += 1; +state.flags_ZF0 |= 0x2; goto state_label_16; // number_oct }break; case 0x45:case 0x65: { -ptr += 1; +state.ptr += 1; goto state_label_11; // fnumber_exponent }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_18; // L_number }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; goto state_label_17; // U_number }break; case 0x58:case 0x78: { -ptr += 1; -flags_ZF0 |= 0x1; +state.ptr += 1; +state.flags_ZF0 |= 0x1; goto state_label_14; // number_hex_first }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_20; // l_number }break; } } { state_label_10: // fnumber_decimal -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_10; // fnumber_decimal }break; case 0x45:case 0x65: { -ptr += 1; +state.ptr += 1; goto state_label_11; // fnumber_exponent }break; case 0x46:case 0x66: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat32; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c:case 0x6c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_11: // fnumber_exponent -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2b:case 0x2d: { -ptr += 1; +state.ptr += 1; goto state_label_12; // fnumber_exponent_sign }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_13; // fnumber_exponent_digits }break; case 0x46:case 0x66: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat32; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c:case 0x6c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_12: // fnumber_exponent_sign -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_13; // fnumber_exponent_digits }break; case 0x46:case 0x66: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat32; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c:case 0x6c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_13: // fnumber_exponent_digits -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37:case 0x38:case 0x39: { -ptr += 1; +state.ptr += 1; goto state_label_13; // fnumber_exponent_digits }break; case 0x46:case 0x66: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat32; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c:case 0x6c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralFloat64; token.kind = 9; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_14: // number_hex_first -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: @@ -1783,47 +1983,52 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_15; // number_hex }break; } } { state_label_15: // number_hex -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralIntegerHex; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralIntegerHex; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: @@ -1831,104 +2036,109 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_15; // number_hex }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_18; // L_number }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; goto state_label_17; // U_number }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_20; // l_number }break; } } { state_label_16: // number_oct -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralIntegerOct; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LiteralIntegerOct; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37: { -ptr += 1; -flags_ZF0 |= 0x2; +state.ptr += 1; +state.flags_ZF0 |= 0x2; goto state_label_16; // number_oct }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_18; // L_number }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; goto state_label_17; // U_number }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_20; // l_number }break; } } { state_label_17: // U_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexU; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctU; token.kind = 8; break; @@ -1936,28 +2146,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerU; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexU; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctU; token.kind = 8; break; @@ -1965,40 +2176,44 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerU; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_19; // UL_number }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_21; // Ul_number }break; } } { state_label_18: // L_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctL; token.kind = 8; break; @@ -2006,28 +2221,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctL; token.kind = 8; break; @@ -2035,32 +2251,36 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c: { -ptr += 1; +state.ptr += 1; goto state_label_22; // LL_number }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2068,30 +2288,34 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_19: // UL_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2099,28 +2323,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2128,27 +2353,31 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x4c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexULL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctULL; token.kind = 8; break; @@ -2156,30 +2385,34 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerULL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_20: // l_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctL; token.kind = 8; break; @@ -2187,28 +2420,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctL; token.kind = 8; break; @@ -2216,27 +2450,31 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2244,35 +2482,39 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x6c: { -ptr += 1; +state.ptr += 1; goto state_label_22; // LL_number }break; } } { state_label_21: // Ul_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2280,28 +2522,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexUL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctUL; token.kind = 8; break; @@ -2309,27 +2552,31 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerUL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x6c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexULL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctULL; token.kind = 8; break; @@ -2337,30 +2584,34 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerULL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_22: // LL_number -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexLL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctLL; token.kind = 8; break; @@ -2368,28 +2619,29 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerLL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexLL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctLL; token.kind = 8; break; @@ -2397,27 +2649,31 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerLL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x55:case 0x75: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x1)){ +if (HasFlag(state.flags_ZF0, 0x1)){ token.sub_kind = TokenCppKind_LiteralIntegerHexULL; token.kind = 8; break; } -if (HasFlag(flags_ZF0, 0x2)){ +if (HasFlag(state.flags_ZF0, 0x2)){ token.sub_kind = TokenCppKind_LiteralIntegerOctULL; token.kind = 8; break; @@ -2425,55 +2681,64 @@ break; token.sub_kind = TokenCppKind_LiteralIntegerULL; token.kind = 8; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_23: // pp_directive_whitespace -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x09:case 0x0b:case 0x0c:case 0x20: { -ptr += 1; +state.ptr += 1; goto state_label_23; // pp_directive_whitespace }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: @@ -2486,25 +2751,25 @@ case 0x66:case 0x67:case 0x68:case 0x69:case 0x6a:case 0x6b:case 0x6c: case 0x6d:case 0x6e:case 0x6f:case 0x70:case 0x71:case 0x72:case 0x73: case 0x74:case 0x75:case 0x76:case 0x77:case 0x78:case 0x79:case 0x7a: { -delim_first = ptr; -flags_KB0 |= 0x1; -ptr += 1; +state.delim_first = state.ptr; +state.flags_KB0 |= 0x1; +state.ptr += 1; goto state_label_24; // pp_directive }break; } } { state_label_24: // pp_directive -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ -delim_one_past_last = ptr; +state.delim_one_past_last = state.ptr; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_directives_hash_array, pp_directives_key_array, pp_directives_value_array, pp_directives_slot_count, pp_directives_seed, delim_first, (delim_one_past_last - delim_first)); +Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_directives_hash_array, pp_directives_key_array, pp_directives_value_array, pp_directives_slot_count, pp_directives_seed, state.delim_first, (state.delim_one_past_last - state.delim_first)); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; @@ -2516,31 +2781,32 @@ token.kind = 2; switch (token.sub_kind){ case TokenCppKind_PPInclude: { -flags_KF0 |= 0x1; +state.flags_KF0 |= 0x1; }break; case TokenCppKind_PPError: { -flags_KF0 |= 0x2; +state.flags_KF0 |= 0x2; }break; } -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { -delim_one_past_last = ptr; +state.delim_one_past_last = state.ptr; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_directives_hash_array, pp_directives_key_array, pp_directives_value_array, pp_directives_slot_count, pp_directives_seed, delim_first, (delim_one_past_last - delim_first)); +Lexeme_Table_Lookup lookup = lexeme_table_lookup(pp_directives_hash_array, pp_directives_key_array, pp_directives_value_array, pp_directives_slot_count, pp_directives_seed, state.delim_first, (state.delim_one_past_last - state.delim_first)); if (lookup.found_match){ token.kind = lookup.base_kind; token.sub_kind = lookup.sub_kind; @@ -2552,17 +2818,21 @@ token.kind = 2; switch (token.sub_kind){ case TokenCppKind_PPInclude: { -flags_KF0 |= 0x1; +state.flags_KF0 |= 0x1; }break; case TokenCppKind_PPError: { -flags_KF0 |= 0x2; +state.flags_KF0 |= 0x2; }break; } -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: @@ -2575,47 +2845,52 @@ case 0x66:case 0x67:case 0x68:case 0x69:case 0x6a:case 0x6b:case 0x6c: case 0x6d:case 0x6e:case 0x6f:case 0x70:case 0x71:case 0x72:case 0x73: case 0x74:case 0x75:case 0x76:case 0x77:case 0x78:case 0x79:case 0x7a: { -ptr += 1; +state.ptr += 1; goto state_label_24; // pp_directive }break; } } { state_label_25: // include_pointy -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x20:case 0x2e:case 0x2f:case 0x30:case 0x31:case 0x32:case 0x33: @@ -2629,65 +2904,74 @@ case 0x69:case 0x6a:case 0x6b:case 0x6c:case 0x6d:case 0x6e:case 0x6f: case 0x70:case 0x71:case 0x72:case 0x73:case 0x74:case 0x75:case 0x76: case 0x77:case 0x78:case 0x79:case 0x7a: { -ptr += 1; +state.ptr += 1; goto state_label_25; // include_pointy }break; case 0x3e: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPIncludeFile; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_26: // include_quotes -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x20:case 0x2e:case 0x2f:case 0x30:case 0x31:case 0x32:case 0x33: @@ -2701,220 +2985,229 @@ case 0x69:case 0x6a:case 0x6b:case 0x6c:case 0x6d:case 0x6e:case 0x6f: case 0x70:case 0x71:case 0x72:case 0x73:case 0x74:case 0x75:case 0x76: case 0x77:case 0x78:case 0x79:case 0x7a: { -ptr += 1; +state.ptr += 1; goto state_label_26; // include_quotes }break; case 0x22: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPIncludeFile; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_27: // pre_L -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_2; // identifier } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_2; // identifier }break; case 0x22: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x52: { -ptr += 1; +state.ptr += 1; goto state_label_31; // pre_R }break; } } { state_label_28: // pre_u -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_2; // identifier } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_2; // identifier }break; case 0x22: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x38: { -ptr += 1; -flags_ZF0 |= 0x8; +state.ptr += 1; +state.flags_ZF0 |= 0x8; goto state_label_30; // pre_u8 }break; case 0x52: { -ptr += 1; +state.ptr += 1; goto state_label_31; // pre_R }break; } } { state_label_29: // pre_U -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_2; // identifier } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_2; // identifier }break; case 0x22: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x52: { -ptr += 1; +state.ptr += 1; goto state_label_31; // pre_R }break; } } { state_label_30: // pre_u8 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_2; // identifier } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_2; // identifier }break; case 0x22: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x52: { -ptr += 1; +state.ptr += 1; goto state_label_31; // pre_R }break; } } { state_label_31: // pre_R -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_2; // identifier } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_2; // identifier }break; case 0x22: { -ptr += 1; -delim_first = ptr; +state.ptr += 1; +state.delim_first = state.ptr; goto state_label_45; // raw_string_get_delim }break; } } { state_label_32: // string -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x0a: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x22: { -if ((!HasFlag(flags_ZF0, 0x40))){ -ptr += 1; +if ((!HasFlag(state.flags_ZF0, 0x40))){ +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x4)){ +if (HasFlag(state.flags_ZF0, 0x4)){ token.sub_kind = TokenCppKind_LiteralStringWide; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x8)){ +if (HasFlag(state.flags_ZF0, 0x8)){ token.sub_kind = TokenCppKind_LiteralStringUTF8; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x10)){ +if (HasFlag(state.flags_ZF0, 0x10)){ token.sub_kind = TokenCppKind_LiteralStringUTF16; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x20)){ +if (HasFlag(state.flags_ZF0, 0x20)){ token.sub_kind = TokenCppKind_LiteralStringUTF32; token.kind = 10; break; @@ -2922,41 +3215,45 @@ break; token.sub_kind = TokenCppKind_LiteralString; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root } -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x27: { -if ((HasFlag(flags_ZF0, 0x40))){ -ptr += 1; +if ((HasFlag(state.flags_ZF0, 0x40))){ +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x4)){ +if (HasFlag(state.flags_ZF0, 0x4)){ token.sub_kind = TokenCppKind_LiteralCharacterWide; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x8)){ +if (HasFlag(state.flags_ZF0, 0x8)){ token.sub_kind = TokenCppKind_LiteralCharacterUTF8; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x10)){ +if (HasFlag(state.flags_ZF0, 0x10)){ token.sub_kind = TokenCppKind_LiteralCharacterUTF16; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x20)){ +if (HasFlag(state.flags_ZF0, 0x20)){ token.sub_kind = TokenCppKind_LiteralCharacterUTF32; token.kind = 10; break; @@ -2964,92 +3261,99 @@ break; token.sub_kind = TokenCppKind_LiteralCharacter; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root } -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x5c: { -ptr += 1; +state.ptr += 1; goto state_label_33; // string_esc }break; } } { state_label_33: // string_esc -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37: { -ptr += 1; +state.ptr += 1; goto state_label_34; // string_esc_oct2 }break; case 0x55: { -ptr += 1; +state.ptr += 1; goto state_label_37; // string_esc_universal_8 }break; case 0x75: { -ptr += 1; +state.ptr += 1; goto state_label_41; // string_esc_universal_4 }break; case 0x78: { -ptr += 1; +state.ptr += 1; goto state_label_36; // string_esc_hex }break; } } { state_label_34: // string_esc_oct2 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3057,19 +3361,19 @@ goto state_label_32; // string case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37: { -ptr += 1; +state.ptr += 1; goto state_label_35; // string_esc_oct1 }break; } } { state_label_35: // string_esc_oct1 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3077,19 +3381,19 @@ goto state_label_32; // string case 0x30:case 0x31:case 0x32:case 0x33:case 0x34:case 0x35:case 0x36: case 0x37: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; } } { state_label_36: // string_esc_hex -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3099,19 +3403,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_36; // string_esc_hex }break; } } { state_label_37: // string_esc_universal_8 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3121,19 +3425,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_38; // string_esc_universal_7 }break; } } { state_label_38: // string_esc_universal_7 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3143,19 +3447,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_39; // string_esc_universal_6 }break; } } { state_label_39: // string_esc_universal_6 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3165,19 +3469,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_40; // string_esc_universal_5 }break; } } { state_label_40: // string_esc_universal_5 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3187,19 +3491,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_41; // string_esc_universal_4 }break; } } { state_label_41: // string_esc_universal_4 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3209,19 +3513,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_42; // string_esc_universal_3 }break; } } { state_label_42: // string_esc_universal_3 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3231,19 +3535,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_43; // string_esc_universal_2 }break; } } { state_label_43: // string_esc_universal_2 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3253,19 +3557,19 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_44; // string_esc_universal_1 }break; } } { state_label_44: // string_esc_universal_1 -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_32; // string } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_32; // string @@ -3275,135 +3579,145 @@ case 0x37:case 0x38:case 0x39:case 0x41:case 0x42:case 0x43:case 0x44: case 0x45:case 0x46:case 0x61:case 0x62:case 0x63:case 0x64:case 0x65: case 0x66: { -ptr += 1; +state.ptr += 1; goto state_label_32; // string }break; } } { state_label_45: // raw_string_get_delim -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_45; // raw_string_get_delim }break; case 0x20:case 0x29:case 0x5c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x28: { -delim_one_past_last = ptr; -ptr += 1; +state.delim_one_past_last = state.ptr; +state.ptr += 1; goto state_label_46; // raw_string_find_close }break; } } { state_label_46: // raw_string_find_close -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_46; // raw_string_find_close }break; case 0x29: { -ptr += 1; +state.ptr += 1; goto state_label_47; // raw_string_try_delim }break; } } { state_label_47: // raw_string_try_delim -umem delim_length = delim_one_past_last - delim_first; +umem delim_length = state.delim_one_past_last - state.delim_first; umem parse_length = 0; for (;;){ if (parse_length == delim_length){ goto state_label_48; // raw_string_try_quote } -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ goto state_label_48; // raw_string_try_quote } -if (*ptr == delim_first[parse_length]){ -ptr += 1; +if (*state.ptr == state.delim_first[parse_length]){ +state.ptr += 1; parse_length += 1; } else{ @@ -3413,41 +3727,41 @@ goto state_label_46; // raw_string_find_close } { state_label_48: // raw_string_try_quote -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ goto state_label_46; // raw_string_find_close } } -switch (*ptr){ +switch (*state.ptr){ default: { goto state_label_46; // raw_string_find_close }break; case 0x22: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ -if (HasFlag(flags_ZF0, 0x4)){ +if (HasFlag(state.flags_ZF0, 0x4)){ token.sub_kind = TokenCppKind_LiteralStringWideRaw; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x8)){ +if (HasFlag(state.flags_ZF0, 0x8)){ token.sub_kind = TokenCppKind_LiteralStringUTF8Raw; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x10)){ +if (HasFlag(state.flags_ZF0, 0x10)){ token.sub_kind = TokenCppKind_LiteralStringUTF16Raw; token.kind = 10; break; } -if (HasFlag(flags_ZF0, 0x20)){ +if (HasFlag(state.flags_ZF0, 0x20)){ token.sub_kind = TokenCppKind_LiteralStringUTF32Raw; token.kind = 10; break; @@ -3455,1200 +3769,1385 @@ break; token.sub_kind = TokenCppKind_LiteralStringRaw; token.kind = 10; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_49: // comment_block -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BlockComment; token.kind = 3; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_49; // comment_block }break; case 0x0a: { -ptr += 1; -flags_KB0 &= ~(0x1); -flags_KF0 &= ~(0x1); +state.ptr += 1; +state.flags_KB0 &= ~(0x1); +state.flags_KF0 &= ~(0x1); goto state_label_49; // comment_block }break; case 0x2a: { -ptr += 1; +state.ptr += 1; goto state_label_50; // comment_block_try_close }break; } } { state_label_50: // comment_block_try_close -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BlockComment; token.kind = 3; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EOF; token.kind = 0; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; +result = true; goto end; } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_49; // comment_block }break; case 0x2a: { -ptr += 1; +state.ptr += 1; goto state_label_50; // comment_block_try_close }break; case 0x2f: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_BlockComment; token.kind = 3; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_51: // comment_line -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LineComment; token.kind = 3; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { -ptr += 1; +state.ptr += 1; goto state_label_51; // comment_line }break; case 0x0a: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LineComment; token.kind = 3; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_52: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Colon; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Colon; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3a: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_ColonColon; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_53: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Plus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Plus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2b: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PlusPlus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PlusEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_54: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Minus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Minus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_MinusMinus; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_MinusEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3e: { -ptr += 1; +state.ptr += 1; goto state_label_55; // op stage }break; } } { state_label_55: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Arrow; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Arrow; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2a: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_ArrowStar; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_56: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Less; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Less; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3c: { -ptr += 1; +state.ptr += 1; goto state_label_65; // op stage }break; case 0x3d: { -ptr += 1; +state.ptr += 1; goto state_label_58; // op stage }break; } } { state_label_57: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Grtr; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Grtr; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_GrtrEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3e: { -ptr += 1; +state.ptr += 1; goto state_label_66; // op stage }break; } } { state_label_58: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LessEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LessEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3e: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Compare; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_59: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Eq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Eq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_EqEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_60: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Not; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Not; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_NotEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_61: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_And; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_And; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x26: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_AndAnd; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_62: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Or; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Or; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x7c: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_OrOr; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_63: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Star; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Star; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_StarEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_64: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Mod; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_Mod; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_ModEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_65: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LeftLeft; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LeftLeft; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LeftLeftEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_66: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_RightRight; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_RightRight; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x3d: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_RightRightEq; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_67: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPStringify; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPStringify; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x23: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_PPConcat; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } { state_label_68: // op stage -if (ptr == opl_ptr){ +if (state.ptr == state.opl_ptr){ if ((true)){ { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +state.emit_ptr = state.ptr; } -flags_ZF0 = 0; +state.flags_ZF0 = 0; goto state_label_1; // root } } -switch (*ptr){ +switch (*state.ptr){ default: { { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_LexError; token.kind = 2; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; case 0x2e: { -ptr += 1; +state.ptr += 1; { Token token = {}; -token.pos = (i64)(emit_ptr - input.str); -token.size = (i64)(ptr - emit_ptr); -token.flags = flags_KB0; +token.pos = (i64)(state.emit_ptr - state.base); +token.size = (i64)(state.ptr - state.emit_ptr); +token.flags = state.flags_KB0; do{ token.sub_kind = TokenCppKind_DotDotDot; token.kind = 7; }while(0); -token_list_push(arena, &list, &token); -emit_ptr = ptr; +token_list_push(arena, list, &token); +emit_counter += 1; +if (emit_counter == max){ +goto end; } -flags_ZF0 = 0; +state.emit_ptr = state.ptr; +} +state.flags_ZF0 = 0; goto state_label_1; // root }break; } } end:; +block_copy_struct(state_ptr, &state); +return(result); +} +internal Token_List +lex_full_input_cpp(Arena *arena, String_Const_u8 input){ +Lex_State_Cpp state = {}; +lex_full_input_cpp_init(&state, input); +Token_List list = {}; +lex_full_input_cpp_breaks(arena, &list, &state, max_u64); return(list); } diff --git a/custom/lexer_generator/4coder_lex_gen_main.cpp b/custom/lexer_generator/4coder_lex_gen_main.cpp index e0be4e06..1284f434 100644 --- a/custom/lexer_generator/4coder_lex_gen_main.cpp +++ b/custom/lexer_generator/4coder_lex_gen_main.cpp @@ -3258,7 +3258,7 @@ gen_flag_check__cont_flow(Flag *flag, b32 value, FILE *out){ if (value == 0){ fprintf(out, "!"); } - fprintf(out, "HasFlag(%.*s%d, 0x%x)", string_expand(flag->base_name), flag->index, flag->value); + fprintf(out, "HasFlag(state.%.*s%d, 0x%x)", string_expand(flag->base_name), flag->index, flag->value); } internal void @@ -3298,6 +3298,7 @@ gen_goto_state__cont_flow(State *state, Action_Context context, FILE *out){ }break; case ActionContext_EndOfFile: { + fprintf(out, "result = true;\n"); fprintf(out, "goto end;\n"); }break; } @@ -3312,11 +3313,11 @@ internal void gen_action__set_flag(Flag *flag, b32 value, FILE *out){ if (flag != 0){ if (value == 0){ - fprintf(out, "%.*s%d &= ~(0x%x);\n", + fprintf(out, "state.%.*s%d &= ~(0x%x);\n", string_expand(flag->base_name), flag->index, flag->value); } else{ - fprintf(out, "%.*s%d |= 0x%x;\n", + fprintf(out, "state.%.*s%d |= 0x%x;\n", string_expand(flag->base_name), flag->index, flag->value); } } @@ -3326,15 +3327,15 @@ internal void gen_emit__fill_token_flags(Flag_Set flags, Flag_Bucket_Set bucket_set, FILE *out){ if (bucket_set.buckets[FlagBindProperty_Bound][FlagResetRule_AutoZero].count > 0){ if (bucket_set.buckets[FlagBindProperty_Bound][FlagResetRule_KeepState].count > 0){ - fprintf(out, "token.flags = flag_ZB0 | flags_KB0;\n"); + fprintf(out, "token.flags = state.flag_ZB0 | state.flags_KB0;\n"); } else{ - fprintf(out, "token.flags = flags_ZB0;\n"); + fprintf(out, "token.flags = state.flags_ZB0;\n"); } } else{ if (bucket_set.buckets[FlagBindProperty_Bound][FlagResetRule_KeepState].count > 0){ - fprintf(out, "token.flags = flags_KB0;\n"); + fprintf(out, "token.flags = state.flags_KB0;\n"); } } for (Flag *flag = flags.first; @@ -3390,25 +3391,25 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set for (i32 i = 0; i < FlagBindProperty_COUNT; i += 1){ Flag_Bucket *bucket = &bucket_set.buckets[i][FlagResetRule_AutoZero]; for (i32 j = 0; j < bucket->number_of_variables; j += 1){ - fprintf(out, "%.*s%d = 0;\n", string_expand(bucket->pretty_name), j); + fprintf(out, "state.%.*s%d = 0;\n", string_expand(bucket->pretty_name), j); } } }break; case ActionKind_DelimMarkFirst: { - fprintf(out, "delim_first = ptr;\n"); + fprintf(out, "state.delim_first = state.ptr;\n"); }break; case ActionKind_DelimMarkOnePastLast: { - fprintf(out, "delim_one_past_last = ptr;\n"); + fprintf(out, "state.delim_one_past_last = state.ptr;\n"); }break; case ActionKind_Consume: { if (context != ActionContext_EndOfFile){ - fprintf(out, "ptr += 1;\n"); + fprintf(out, "state.ptr += 1;\n"); } else{ result_context = ActionContext_EndOfFile; @@ -3422,8 +3423,8 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set fprintf(out, "{\n"); fprintf(out, "Token token = {};\n"); - fprintf(out, "token.pos = (i64)(emit_ptr - input.str);\n"); - fprintf(out, "token.size = (i64)(ptr - emit_ptr);\n"); + fprintf(out, "token.pos = (i64)(state.emit_ptr - state.base);\n"); + fprintf(out, "token.size = (i64)(state.ptr - state.emit_ptr);\n"); gen_emit__fill_token_flags(flags, bucket_set, out); @@ -3454,7 +3455,7 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set fprintf(out, "Lexeme_Table_Lookup lookup = " "lexeme_table_lookup(%.*s_hash_array, %.*s_key_array, " "%.*s_value_array, %.*s_slot_count, %.*s_seed, " - "emit_ptr, token.size);\n", + "state.emit_ptr, token.size);\n", string_expand(keywords->pretty_name), string_expand(keywords->pretty_name), string_expand(keywords->pretty_name), @@ -3478,7 +3479,7 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set fprintf(out, "Lexeme_Table_Lookup lookup = " "lexeme_table_lookup(%.*s_hash_array, %.*s_key_array, " "%.*s_value_array, %.*s_slot_count, %.*s_seed, " - "delim_first, (delim_one_past_last - delim_first));\n", + "state.delim_first, (state.delim_one_past_last - state.delim_first));\n", string_expand(keywords->pretty_name), string_expand(keywords->pretty_name), string_expand(keywords->pretty_name), @@ -3520,8 +3521,14 @@ gen_SLOW_action_list__cont_flow(Arena *scratch, Token_Kind_Set tokens, Flag_Set fprintf(out, "}\n"); } - fprintf(out, "token_list_push(arena, &list, &token);\n"); - fprintf(out, "emit_ptr = ptr;\n"); + fprintf(out, "token_list_push(arena, list, &token);\n"); + fprintf(out, "emit_counter += 1;\n"); + if (context != ActionContext_EndOfFile){ + fprintf(out, "if (emit_counter == max){\n"); + fprintf(out, "goto end;\n"); + fprintf(out, "}\n"); + } + fprintf(out, "state.emit_ptr = state.ptr;\n"); fprintf(out, "}\n"); }break; } @@ -3535,7 +3542,18 @@ gen_flag_declarations__cont_flow(Flag_Bucket *bucket, FILE *out){ i32 number_of_flag_variables = (bucket->count + max_bits - 1)/max_bits; String_Const_u8 pretty_name = bucket->pretty_name; for (i32 i = 0; i < number_of_flag_variables; i += 1){ - fprintf(out, "u%d %.*s%d = 0;\n", max_bits, string_expand(pretty_name), i); + fprintf(out, "u%d %.*s%d;\n", max_bits, string_expand(pretty_name), i); + } + bucket->number_of_variables = number_of_flag_variables; +} + +internal void +gen_flag_init__cont_flow(Flag_Bucket *bucket, FILE *out){ + i32 max_bits = bucket->max_bits; + i32 number_of_flag_variables = (bucket->count + max_bits - 1)/max_bits; + String_Const_u8 pretty_name = bucket->pretty_name; + for (i32 i = 0; i < number_of_flag_variables; i += 1){ + fprintf(out, "state_ptr->%.*s%d = 0;\n", string_expand(pretty_name), i); } bucket->number_of_variables = number_of_flag_variables; } @@ -3664,23 +3682,43 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M } } - fprintf(out, "internal Token_List\n"); - fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "(Arena *arena, String_Const_u8 input){\n"); - fprintf(out, "Token_List list = {};\n"); - + fprintf(out, "struct Lex_State_" LANG_NAME_CAMEL_STR "{\n"); for (i32 i = 0; i < FlagBindProperty_COUNT; i += 1){ for (i32 j = 0; j < FlagResetRule_COUNT; j += 1){ gen_flag_declarations__cont_flow(&bucket_set.buckets[i][j], out); } } + fprintf(out, "u8 *base;\n"); + fprintf(out, "u8 *delim_first;\n"); + fprintf(out, "u8 *delim_one_past_last;\n"); + fprintf(out, "u8 *emit_ptr;\n"); + fprintf(out, "u8 *ptr;\n"); + fprintf(out, "u8 *opl_ptr;\n"); + fprintf(out, "};\n"); - fprintf(out, "u8 *delim_first = input.str;\n"); - fprintf(out, "u8 *delim_one_past_last = input.str;\n"); + fprintf(out, "internal void\n"); + fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "_init(Lex_State_" + LANG_NAME_CAMEL_STR " *state_ptr, String_Const_u8 input){\n"); + for (i32 i = 0; i < FlagBindProperty_COUNT; i += 1){ + for (i32 j = 0; j < FlagResetRule_COUNT; j += 1){ + gen_flag_init__cont_flow(&bucket_set.buckets[i][j], out); + } + } + fprintf(out, "state_ptr->base = input.str;\n"); + fprintf(out, "state_ptr->delim_first = input.str;\n"); + fprintf(out, "state_ptr->delim_one_past_last = input.str;\n"); + fprintf(out, "state_ptr->emit_ptr = input.str;\n"); + fprintf(out, "state_ptr->ptr = input.str;\n"); + fprintf(out, "state_ptr->opl_ptr = input.str + input.size;\n"); + fprintf(out, "}\n"); - fprintf(out, "u8 *emit_ptr = input.str;\n"); - - fprintf(out, "u8 *ptr = input.str;\n"); - fprintf(out, "u8 *opl_ptr = ptr + input.size;\n"); + fprintf(out, "internal b32\n"); + fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "_breaks(" + "Arena *arena, Token_List *list, Lex_State_" LANG_NAME_CAMEL_STR " *state_ptr, u64 max){\n"); + fprintf(out, "b32 result = false;\n"); + fprintf(out, "u64 emit_counter = 0;\n"); + fprintf(out, "Lex_State_" LANG_NAME_CAMEL_STR " state;\n"); + fprintf(out, "block_copy_struct(&state, state_ptr);\n"); for (State *state = model.states.first; state != 0; @@ -3706,7 +3744,7 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M Transition *failure_trans = trans->next; Assert(failure_trans->condition.kind == TransitionCaseKind_DelimMatchFail); - fprintf(out, "umem delim_length = delim_one_past_last - delim_first;\n"); + fprintf(out, "umem delim_length = state.delim_one_past_last - state.delim_first;\n"); fprintf(out, "umem parse_length = 0;\n"); fprintf(out, "for (;;){\n"); { @@ -3718,7 +3756,7 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M gen_goto_dst_state__cont_flow(success_trans, ActionContext_Normal, out); } fprintf(out, "}\n"); - fprintf(out, "if (ptr == opl_ptr){\n"); + fprintf(out, "if (state.ptr == state.opl_ptr){\n"); { gen_SLOW_action_list__cont_flow(scratch, tokens, model.flags, bucket_set, failure_trans->activation_actions, @@ -3727,8 +3765,8 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M } fprintf(out, "}\n"); - fprintf(out, "if (*ptr == delim_first[parse_length]){\n"); - fprintf(out, "ptr += 1;\n"); + fprintf(out, "if (*state.ptr == state.delim_first[parse_length]){\n"); + fprintf(out, "state.ptr += 1;\n"); fprintf(out, "parse_length += 1;\n"); fprintf(out, "}\n"); fprintf(out, "else{\n"); @@ -3746,7 +3784,7 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M case TransitionCaseKind_ConditionSet: { { - fprintf(out, "if (ptr == opl_ptr){\n"); + fprintf(out, "if (state.ptr == state.opl_ptr){\n"); for (; trans != 0; trans = trans->next){ @@ -3773,7 +3811,7 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M Grouped_Input_Handler_List group_list = opt_grouped_input_handlers(scratch, trans); - fprintf(out, "switch (*ptr){\n"); + fprintf(out, "switch (*state.ptr){\n"); for (Grouped_Input_Handler *group = group_list.first; group != 0; group = group->next){ @@ -3823,6 +3861,16 @@ gen_contiguous_control_flow_lexer(Arena *scratch, Token_Kind_Set tokens, Lexer_M } fprintf(out, "end:;\n"); + fprintf(out, "block_copy_struct(state_ptr, &state);\n"); + fprintf(out, "return(result);\n"); + fprintf(out, "}\n"); + + fprintf(out, "internal Token_List\n"); + fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "(Arena *arena, String_Const_u8 input){\n"); + fprintf(out, "Lex_State_" LANG_NAME_CAMEL_STR " state = {};\n"); + fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "_init(&state, input);\n"); + fprintf(out, "Token_List list = {};\n"); + fprintf(out, "lex_full_input_" LANG_NAME_LOWER_STR "_breaks(arena, &list, &state, max_u64);\n"); fprintf(out, "return(list);\n"); fprintf(out, "}\n");