X-Git-Url: https://jxself.org/git/?p=inform.git;a=blobdiff_plain;f=src%2Farrays.c;h=82caa7cb11ba187142d4ebf87ad480b57603dbc1;hp=c48cc65dfbf85fc7ed2f57a29b59ba8a23e78094;hb=HEAD;hpb=20cbfff96015938809d0e3da6cd0d83b76d27f14 diff --git a/src/arrays.c b/src/arrays.c index c48cc65..82caa7c 100644 --- a/src/arrays.c +++ b/src/arrays.c @@ -3,8 +3,8 @@ /* likewise global variables, which are in some ways a */ /* simpler form of the same thing. */ /* */ -/* Part of Inform 6.41 */ -/* copyright (c) Graham Nelson 1993 - 2022 */ +/* Part of Inform 6.42 */ +/* copyright (c) Graham Nelson 1993 - 2024 */ /* */ /* Inform is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ @@ -292,7 +292,7 @@ extern void make_global() int name_length; assembly_operand AO; - int32 globalnum; + uint32 globalnum; int32 global_symbol; debug_location_beginning beginning_debug_location = get_token_location_beginning(); @@ -322,7 +322,7 @@ extern void make_global() if (token_type != SYMBOL_TT) { discard_token_location(beginning_debug_location); - ebf_error("new global variable name", token_text); + ebf_curtoken_error("new global variable name"); panic_mode_error_recovery(); return; } @@ -413,7 +413,7 @@ extern void make_global() 4*globalnum); } - if (globalnum < 0 || globalnum >= global_initial_value_memlist.count) + if (globalnum >= global_initial_value_memlist.count) compiler_error("Globalnum out of range"); global_initial_value[globalnum] = AO.value; @@ -456,7 +456,7 @@ extern void make_array() if (token_type != SYMBOL_TT) { discard_token_location(beginning_debug_location); - ebf_error("new array name", token_text); + ebf_curtoken_error("new array name"); panic_mode_error_recovery(); return; } @@ -492,7 +492,7 @@ extern void make_array() if ((token_type == SEP_TT) && (token_value == SEMICOLON_SEP)) { discard_token_location(beginning_debug_location); - ebf_error("array definition", token_text); + ebf_curtoken_error("array definition"); put_token_back(); return; } @@ -516,8 +516,7 @@ extern void make_array() array_type = BUFFER_ARRAY; else { discard_token_location(beginning_debug_location); - ebf_error - ("'->', '-->', 'string', 'table' or 'buffer'", token_text); + ebf_curtoken_error("'->', '-->', 'string', 'table' or 'buffer'"); panic_mode_error_recovery(); return; } @@ -632,6 +631,8 @@ extern void make_array() put_token_back(); AO = parse_expression(ARRAY_CONTEXT); + if (AO.marker == ERROR_MV) + break; if (i == 0) { get_next_token(); @@ -656,7 +657,7 @@ extern void make_array() get_next_token(); if (token_type != DQ_TT) - { ebf_error("literal text in double-quotes", token_text); + { ebf_curtoken_error("literal text in double-quotes"); token_text = "error"; } @@ -705,6 +706,7 @@ advance as part of 'Zcharacter table':", unicode); i = 0; while (TRUE) { + assembly_operand AO; /* This isn't the start of a statement, but it's safe to release token texts anyway. Expressions in an array list are independent of each other. */ @@ -719,11 +721,14 @@ advance as part of 'Zcharacter table':", unicode); been missed, and the programmer is now starting a new routine */ - ebf_error("']'", token_text); + ebf_curtoken_error("']'"); put_token_back(); break; } put_token_back(); - array_entry(i, is_static, parse_expression(ARRAY_CONTEXT)); + AO = parse_expression(ARRAY_CONTEXT); + if (AO.marker == ERROR_MV) + break; + array_entry(i, is_static, AO); i++; } } @@ -864,7 +869,7 @@ extern void arrays_allocate_arrays(void) "global variable values"); initialise_memory_list(¤t_array_name, - sizeof(char), MAX_IDENTIFIER_LENGTH+1, NULL, + sizeof(char), 32, NULL, "array name currently being defined"); }