Rust error arrow thing '-->'

This commit is contained in:
Allen Webster 2017-11-27 17:16:23 -05:00
parent efc595cbaa
commit c27248dcf0
5 changed files with 44 additions and 45 deletions

View File

@ -274,14 +274,14 @@ static Command_Metadata fcoder_metacmd_table[185] = {
{ PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "C:\\work\\4ed\\code\\power\\4coder_experiments.cpp", 50, 31 },
{ PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 151 },
{ PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "C:\\work\\4ed\\code\\4coder_function_list.cpp", 45, 348 },
{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 654 },
{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 672 },
{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 724 },
{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 730 },
{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 772 },
{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 778 },
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 663 },
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 681 },
{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 640 },
{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 658 },
{ PROC_LINKS(list_all_locations_of_identifier, 0), "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 710 },
{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 716 },
{ PROC_LINKS(list_all_locations_of_selection, 0), "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 758 },
{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 764 },
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 649 },
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 667 },
{ PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "C:\\work\\4ed\\code\\4coder_project_commands.cpp", 48, 400 },
{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1129 },
{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "C:\\work\\4ed\\code\\power\\4coder_miblo_numbers.cpp", 52, 119 },
@ -380,7 +380,7 @@ static Command_Metadata fcoder_metacmd_table[185] = {
{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 638 },
{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 627 },
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 1164 },
{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 800 },
{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "C:\\work\\4ed\\code\\4coder_search.cpp", 38, 786 },
{ PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "C:\\work\\4ed\\code\\4coder_auto_indent.cpp", 43, 641 },
{ PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "C:\\work\\4ed\\code\\4coder_default_include.cpp", 47, 534 },
{ PROC_LINKS(write_character, 0), "write_character", 15, "Inserts whatever character was used to trigger this command.", 60, "C:\\work\\4ed\\code\\4coder_base_commands.cpp", 45, 47 },

View File

@ -18,8 +18,8 @@ bind(context, 'c', MDFR_ALT, open_color_tweaker);
bind(context, 'd', MDFR_ALT, open_debug);
bind(context, '.', MDFR_ALT, change_to_build_panel);
bind(context, ',', MDFR_ALT, close_build_panel);
bind(context, 'n', MDFR_ALT, goto_next_jump_sticky);
bind(context, 'N', MDFR_ALT, goto_prev_jump_sticky);
bind(context, 'n', MDFR_ALT, goto_next_jump_no_skips_sticky);
bind(context, 'N', MDFR_ALT, goto_prev_jump_no_skips_sticky);
bind(context, 'M', MDFR_ALT, goto_first_jump_sticky);
bind(context, 'm', MDFR_ALT, build_in_build_panel);
bind(context, 'z', MDFR_ALT, execute_any_cli);
@ -352,8 +352,8 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[48] = {
{0, 100, 2, "open_debug", 10, LINK_PROCS(open_debug)},
{0, 46, 2, "change_to_build_panel", 21, LINK_PROCS(change_to_build_panel)},
{0, 44, 2, "close_build_panel", 17, LINK_PROCS(close_build_panel)},
{0, 110, 2, "goto_next_jump_sticky", 21, LINK_PROCS(goto_next_jump_sticky)},
{0, 78, 2, "goto_prev_jump_sticky", 21, LINK_PROCS(goto_prev_jump_sticky)},
{0, 110, 2, "goto_next_jump_no_skips_sticky", 30, LINK_PROCS(goto_next_jump_no_skips_sticky)},
{0, 78, 2, "goto_prev_jump_no_skips_sticky", 30, LINK_PROCS(goto_prev_jump_no_skips_sticky)},
{0, 77, 2, "goto_first_jump_sticky", 22, LINK_PROCS(goto_first_jump_sticky)},
{0, 109, 2, "build_in_build_panel", 20, LINK_PROCS(build_in_build_panel)},
{0, 122, 2, "execute_any_cli", 15, LINK_PROCS(execute_any_cli)},

View File

@ -53,6 +53,17 @@ ms_style_verify(String line, int32_t left_paren_pos, int32_t right_paren_pos){
return(result);
}
static int32_t
try_skip_rust_arrow(String line){
int32_t pos = 0;
if (match_part(line, "-->")){
String sub = substr_tail(line, 3);
sub = skip_chop_whitespace(sub);
pos = (int32_t)(sub.str - line.str);
}
return(pos);
}
static bool32
parse_jump_location(String line, Name_Based_Jump_Location *location, int32_t *colon_char, bool32 *is_sub_error){
bool32 result = false;
@ -119,7 +130,9 @@ parse_jump_location(String line, Name_Based_Jump_Location *location, int32_t *co
}
if (!is_ms_style){
int32_t colon_pos1 = find_s_char(line, 0, ':');
int32_t start = try_skip_rust_arrow(line);
int32_t colon_pos1 = find_s_char(line, start, ':');
if (line.size > colon_pos1 + 1){
if (char_is_slash(line.str[colon_pos1 + 1])){
colon_pos1 = find_s_char(line, colon_pos1 + 1, ':');
@ -130,7 +143,7 @@ parse_jump_location(String line, Name_Based_Jump_Location *location, int32_t *co
int32_t colon_pos3 = find_s_char(line, colon_pos2 + 1, ':');
if (colon_pos3 + 1 <= line.size){
String filename = substr(line, 0, colon_pos1);
String filename = substr(line, start, colon_pos1 - start);
String line_number = substr(line, colon_pos1 + 1, colon_pos2 - colon_pos1 - 1);
String column_number = substr(line, colon_pos2 + 1, colon_pos3 - colon_pos2 - 1);

View File

@ -411,20 +411,12 @@ search_next_match(Application_Links *app, Search_Set *set, Search_Iter *it_ptr){
switch (range->type){
case SearchRange_FrontToBack:
{
find_result =
search_front_to_back(app, range,
iter.word,
&iter.pos,
&result);
find_result = search_front_to_back(app, range, iter.word, &iter.pos, &result);
}break;
case SearchRange_BackToFront:
{
find_result =
search_back_to_front(app, range,
iter.word,
&iter.back_pos,
&result);
find_result = search_back_to_front(app, range, iter.word, &iter.back_pos, &result);
}break;
case SearchRange_Wave:
@ -436,17 +428,11 @@ search_next_match(Application_Links *app, Search_Set *set, Search_Iter *it_ptr){
int32_t backward_result = FindResult_PastEnd;
if (iter.pos < range->start + range->size){
forward_result = search_front_to_back(app, range,
iter.word,
&iter.pos,
&forward_match);
forward_result = search_front_to_back(app, range, iter.word, &iter.pos, &forward_match);
}
if (iter.back_pos > range->start){
backward_result = search_back_to_front(app, range,
iter.word,
&iter.back_pos,
&backward_match);
backward_result = search_back_to_front(app, range, iter.word, &iter.back_pos, &backward_match);
}
if (forward_result == FindResult_FoundMatch){

View File

@ -721,8 +721,8 @@ generate_remapping_code_and_data(){
bind(mappings, '.', MDFR_ALT, change_to_build_panel);
bind(mappings, ',', MDFR_ALT, close_build_panel);
bind(mappings, 'n', MDFR_ALT, goto_next_jump_sticky);
bind(mappings, 'N', MDFR_ALT, goto_prev_jump_sticky);
bind(mappings, 'n', MDFR_ALT, goto_next_jump_no_skips_sticky);
bind(mappings, 'N', MDFR_ALT, goto_prev_jump_no_skips_sticky);
bind(mappings, 'M', MDFR_ALT, goto_first_jump_sticky);
bind(mappings, 'm', MDFR_ALT, build_in_build_panel);