new lexer

This commit is contained in:
Allen Webster 2019-09-26 20:52:29 -07:00
parent c9fe9175f6
commit ef02e75dc8
28 changed files with 11581 additions and 2379 deletions

View File

@ -2751,6 +2751,23 @@ data_match(Data a, Data b){
////////////////////////////////
internal b32
character_is_basic_ascii(char c){
return(' ' <= c && c <= '~');
}
internal b32
character_is_basic_ascii(u8 c){
return(' ' <= c && c <= '~');
}
internal b32
character_is_basic_ascii(u16 c){
return(' ' <= c && c <= '~');
}
internal b32
character_is_basic_ascii(u32 c){
return(' ' <= c && c <= '~');
}
internal b32
character_is_slash(char c){
return((c == '/') || (c == '\\'));

View File

@ -4,10 +4,9 @@
// TOP
#include "languages/4coder_language_cpp.h"
#include "languages/4coder_language_rust.h"
#include "languages/4coder_language_cs.h"
#include "languages/4coder_language_java.h"
#include "languages/generated_lexer_cpp.h"
#include "languages/generated_lexer_cpp.cpp"
CUSTOM_COMMAND_SIG(set_bindings_choose);
CUSTOM_COMMAND_SIG(set_bindings_default);

View File

@ -45,6 +45,7 @@
#include "4coder_string_match.cpp"
#include "4coder_buffer_seek_constructors.cpp"
#include "4coder_token.cpp"
#include "4coder_default_framework_variables.cpp"
#include "4coder_helper.cpp"
#include "4coder_seek.cpp"

View File

@ -2,24 +2,723 @@
#define command_id(c) (fcoder_metacmd_ID_##c)
#define command_metadata(c) (&fcoder_metacmd_table[command_id(c)])
#define command_metadata_by_id(id) (&fcoder_metacmd_table[id])
#define command_one_past_last_id 0
#define command_one_past_last_id 233
#if defined(CUSTOM_COMMAND_SIG)
#define PROC_LINKS(x,y) x
#else
#define PROC_LINKS(x,y) y
#endif
#if defined(CUSTOM_COMMAND_SIG)
CUSTOM_COMMAND_SIG(write_explicit_enum_flags);
CUSTOM_COMMAND_SIG(seek_beginning_of_textual_line);
CUSTOM_COMMAND_SIG(seek_end_of_textual_line);
CUSTOM_COMMAND_SIG(seek_beginning_of_line);
CUSTOM_COMMAND_SIG(seek_end_of_line);
CUSTOM_COMMAND_SIG(goto_beginning_of_file);
CUSTOM_COMMAND_SIG(goto_end_of_file);
CUSTOM_COMMAND_SIG(change_active_panel);
CUSTOM_COMMAND_SIG(change_active_panel_backwards);
CUSTOM_COMMAND_SIG(open_panel_vsplit);
CUSTOM_COMMAND_SIG(open_panel_hsplit);
CUSTOM_COMMAND_SIG(suppress_mouse);
CUSTOM_COMMAND_SIG(allow_mouse);
CUSTOM_COMMAND_SIG(toggle_mouse);
CUSTOM_COMMAND_SIG(set_mode_to_original);
CUSTOM_COMMAND_SIG(set_mode_to_notepad_like);
CUSTOM_COMMAND_SIG(toggle_highlight_line_at_cursor);
CUSTOM_COMMAND_SIG(toggle_highlight_enclosing_scopes);
CUSTOM_COMMAND_SIG(toggle_paren_matching_helper);
CUSTOM_COMMAND_SIG(toggle_fullscreen);
CUSTOM_COMMAND_SIG(remap_interactive);
CUSTOM_COMMAND_SIG(write_character);
CUSTOM_COMMAND_SIG(write_underscore);
CUSTOM_COMMAND_SIG(delete_char);
CUSTOM_COMMAND_SIG(backspace_char);
CUSTOM_COMMAND_SIG(set_mark);
CUSTOM_COMMAND_SIG(cursor_mark_swap);
CUSTOM_COMMAND_SIG(delete_range);
CUSTOM_COMMAND_SIG(backspace_alpha_numeric_boundary);
CUSTOM_COMMAND_SIG(delete_alpha_numeric_boundary);
CUSTOM_COMMAND_SIG(snipe_backward_whitespace_or_token_boundary);
CUSTOM_COMMAND_SIG(snipe_forward_whitespace_or_token_boundary);
CUSTOM_COMMAND_SIG(center_view);
CUSTOM_COMMAND_SIG(left_adjust_view);
CUSTOM_COMMAND_SIG(click_set_cursor_and_mark);
CUSTOM_COMMAND_SIG(click_set_cursor);
CUSTOM_COMMAND_SIG(click_set_cursor_if_lbutton);
CUSTOM_COMMAND_SIG(click_set_mark);
CUSTOM_COMMAND_SIG(mouse_wheel_scroll);
CUSTOM_COMMAND_SIG(move_up);
CUSTOM_COMMAND_SIG(move_down);
CUSTOM_COMMAND_SIG(move_up_10);
CUSTOM_COMMAND_SIG(move_down_10);
CUSTOM_COMMAND_SIG(move_down_textual);
CUSTOM_COMMAND_SIG(page_up);
CUSTOM_COMMAND_SIG(page_down);
CUSTOM_COMMAND_SIG(move_up_to_blank_line);
CUSTOM_COMMAND_SIG(move_down_to_blank_line);
CUSTOM_COMMAND_SIG(move_up_to_blank_line_skip_whitespace);
CUSTOM_COMMAND_SIG(move_down_to_blank_line_skip_whitespace);
CUSTOM_COMMAND_SIG(move_up_to_blank_line_end);
CUSTOM_COMMAND_SIG(move_down_to_blank_line_end);
CUSTOM_COMMAND_SIG(move_left);
CUSTOM_COMMAND_SIG(move_right);
CUSTOM_COMMAND_SIG(move_right_whitespace_boundary);
CUSTOM_COMMAND_SIG(move_left_whitespace_boundary);
CUSTOM_COMMAND_SIG(move_right_token_boundary);
CUSTOM_COMMAND_SIG(move_left_token_boundary);
CUSTOM_COMMAND_SIG(move_right_whitespace_or_token_boundary);
CUSTOM_COMMAND_SIG(move_left_whitespace_or_token_boundary);
CUSTOM_COMMAND_SIG(move_right_alpha_numeric_boundary);
CUSTOM_COMMAND_SIG(move_left_alpha_numeric_boundary);
CUSTOM_COMMAND_SIG(move_right_alpha_numeric_or_camel_boundary);
CUSTOM_COMMAND_SIG(move_left_alpha_numeric_or_camel_boundary);
CUSTOM_COMMAND_SIG(select_all);
CUSTOM_COMMAND_SIG(to_uppercase);
CUSTOM_COMMAND_SIG(to_lowercase);
CUSTOM_COMMAND_SIG(clean_all_lines);
CUSTOM_COMMAND_SIG(basic_change_active_panel);
CUSTOM_COMMAND_SIG(close_panel);
CUSTOM_COMMAND_SIG(show_scrollbar);
CUSTOM_COMMAND_SIG(hide_scrollbar);
CUSTOM_COMMAND_SIG(show_filebar);
CUSTOM_COMMAND_SIG(hide_filebar);
CUSTOM_COMMAND_SIG(toggle_filebar);
CUSTOM_COMMAND_SIG(toggle_line_wrap);
CUSTOM_COMMAND_SIG(toggle_fps_meter);
CUSTOM_COMMAND_SIG(increase_line_wrap);
CUSTOM_COMMAND_SIG(decrease_line_wrap);
CUSTOM_COMMAND_SIG(increase_face_size);
CUSTOM_COMMAND_SIG(decrease_face_size);
CUSTOM_COMMAND_SIG(mouse_wheel_change_face_size);
CUSTOM_COMMAND_SIG(toggle_virtual_whitespace);
CUSTOM_COMMAND_SIG(toggle_show_whitespace);
CUSTOM_COMMAND_SIG(toggle_line_numbers);
CUSTOM_COMMAND_SIG(eol_dosify);
CUSTOM_COMMAND_SIG(eol_nixify);
CUSTOM_COMMAND_SIG(exit_4coder);
CUSTOM_COMMAND_SIG(goto_line);
CUSTOM_COMMAND_SIG(search);
CUSTOM_COMMAND_SIG(reverse_search);
CUSTOM_COMMAND_SIG(search_identifier);
CUSTOM_COMMAND_SIG(reverse_search_identifier);
CUSTOM_COMMAND_SIG(replace_in_range);
CUSTOM_COMMAND_SIG(replace_in_buffer);
CUSTOM_COMMAND_SIG(replace_in_all_buffers);
CUSTOM_COMMAND_SIG(query_replace);
CUSTOM_COMMAND_SIG(query_replace_identifier);
CUSTOM_COMMAND_SIG(query_replace_selection);
CUSTOM_COMMAND_SIG(save_all_dirty_buffers);
CUSTOM_COMMAND_SIG(delete_file_query);
CUSTOM_COMMAND_SIG(save_to_query);
CUSTOM_COMMAND_SIG(rename_file_query);
CUSTOM_COMMAND_SIG(make_directory_query);
CUSTOM_COMMAND_SIG(move_line_up);
CUSTOM_COMMAND_SIG(move_line_down);
CUSTOM_COMMAND_SIG(duplicate_line);
CUSTOM_COMMAND_SIG(delete_line);
CUSTOM_COMMAND_SIG(open_file_in_quotes);
CUSTOM_COMMAND_SIG(open_matching_file_cpp);
CUSTOM_COMMAND_SIG(view_buffer_other_panel);
CUSTOM_COMMAND_SIG(swap_buffers_between_panels);
CUSTOM_COMMAND_SIG(kill_buffer);
CUSTOM_COMMAND_SIG(save);
CUSTOM_COMMAND_SIG(reopen);
CUSTOM_COMMAND_SIG(undo);
CUSTOM_COMMAND_SIG(redo);
CUSTOM_COMMAND_SIG(undo_all_buffers);
CUSTOM_COMMAND_SIG(redo_all_buffers);
CUSTOM_COMMAND_SIG(open_in_other);
CUSTOM_COMMAND_SIG(lister__quit);
CUSTOM_COMMAND_SIG(lister__activate);
CUSTOM_COMMAND_SIG(lister__write_character);
CUSTOM_COMMAND_SIG(lister__backspace_text_field);
CUSTOM_COMMAND_SIG(lister__move_up);
CUSTOM_COMMAND_SIG(lister__move_down);
CUSTOM_COMMAND_SIG(lister__wheel_scroll);
CUSTOM_COMMAND_SIG(lister__mouse_press);
CUSTOM_COMMAND_SIG(lister__mouse_release);
CUSTOM_COMMAND_SIG(lister__repaint);
CUSTOM_COMMAND_SIG(lister__write_character__default);
CUSTOM_COMMAND_SIG(lister__backspace_text_field__default);
CUSTOM_COMMAND_SIG(lister__move_up__default);
CUSTOM_COMMAND_SIG(lister__move_down__default);
CUSTOM_COMMAND_SIG(lister__write_character__file_path);
CUSTOM_COMMAND_SIG(lister__backspace_text_field__file_path);
CUSTOM_COMMAND_SIG(lister__write_character__fixed_list);
CUSTOM_COMMAND_SIG(interactive_switch_buffer);
CUSTOM_COMMAND_SIG(interactive_kill_buffer);
CUSTOM_COMMAND_SIG(interactive_open_or_new);
CUSTOM_COMMAND_SIG(interactive_new);
CUSTOM_COMMAND_SIG(interactive_open);
CUSTOM_COMMAND_SIG(command_lister);
CUSTOM_COMMAND_SIG(auto_tab_whole_file);
CUSTOM_COMMAND_SIG(auto_tab_line_at_cursor);
CUSTOM_COMMAND_SIG(auto_tab_range);
CUSTOM_COMMAND_SIG(write_and_auto_tab);
CUSTOM_COMMAND_SIG(list_all_locations);
CUSTOM_COMMAND_SIG(list_all_substring_locations);
CUSTOM_COMMAND_SIG(list_all_locations_case_insensitive);
CUSTOM_COMMAND_SIG(list_all_substring_locations_case_insensitive);
CUSTOM_COMMAND_SIG(list_all_locations_of_identifier);
CUSTOM_COMMAND_SIG(list_all_locations_of_identifier_case_insensitive);
CUSTOM_COMMAND_SIG(list_all_locations_of_selection);
CUSTOM_COMMAND_SIG(list_all_locations_of_selection_case_insensitive);
CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition);
CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition_of_identifier);
CUSTOM_COMMAND_SIG(word_complete);
CUSTOM_COMMAND_SIG(goto_jump_at_cursor);
CUSTOM_COMMAND_SIG(goto_jump_at_cursor_same_panel);
CUSTOM_COMMAND_SIG(goto_next_jump);
CUSTOM_COMMAND_SIG(goto_prev_jump);
CUSTOM_COMMAND_SIG(goto_next_jump_no_skips);
CUSTOM_COMMAND_SIG(goto_prev_jump_no_skips);
CUSTOM_COMMAND_SIG(goto_first_jump);
CUSTOM_COMMAND_SIG(goto_first_jump_same_panel_sticky);
CUSTOM_COMMAND_SIG(newline_or_goto_position);
CUSTOM_COMMAND_SIG(newline_or_goto_position_same_panel);
CUSTOM_COMMAND_SIG(view_jump_list_with_lister);
CUSTOM_COMMAND_SIG(log_graph__escape);
CUSTOM_COMMAND_SIG(log_graph__scroll_wheel);
CUSTOM_COMMAND_SIG(log_graph__page_up);
CUSTOM_COMMAND_SIG(log_graph__page_down);
CUSTOM_COMMAND_SIG(log_graph__click_select_event);
CUSTOM_COMMAND_SIG(log_graph__click_jump_to_event_source);
CUSTOM_COMMAND_SIG(show_the_log_graph);
CUSTOM_COMMAND_SIG(copy);
CUSTOM_COMMAND_SIG(cut);
CUSTOM_COMMAND_SIG(paste);
CUSTOM_COMMAND_SIG(paste_next);
CUSTOM_COMMAND_SIG(paste_and_indent);
CUSTOM_COMMAND_SIG(paste_next_and_indent);
CUSTOM_COMMAND_SIG(execute_previous_cli);
CUSTOM_COMMAND_SIG(execute_any_cli);
CUSTOM_COMMAND_SIG(build_search);
CUSTOM_COMMAND_SIG(build_in_build_panel);
CUSTOM_COMMAND_SIG(close_build_panel);
CUSTOM_COMMAND_SIG(change_to_build_panel);
CUSTOM_COMMAND_SIG(close_all_code);
CUSTOM_COMMAND_SIG(open_all_code);
CUSTOM_COMMAND_SIG(open_all_code_recursive);
CUSTOM_COMMAND_SIG(load_project);
CUSTOM_COMMAND_SIG(project_fkey_command);
CUSTOM_COMMAND_SIG(project_go_to_root_directory);
CUSTOM_COMMAND_SIG(setup_new_project);
CUSTOM_COMMAND_SIG(setup_build_bat);
CUSTOM_COMMAND_SIG(setup_build_sh);
CUSTOM_COMMAND_SIG(setup_build_bat_and_sh);
CUSTOM_COMMAND_SIG(project_command_lister);
CUSTOM_COMMAND_SIG(list_all_functions_current_buffer);
CUSTOM_COMMAND_SIG(list_all_functions_current_buffer_lister);
CUSTOM_COMMAND_SIG(list_all_functions_all_buffers);
CUSTOM_COMMAND_SIG(list_all_functions_all_buffers_lister);
CUSTOM_COMMAND_SIG(select_surrounding_scope);
CUSTOM_COMMAND_SIG(select_next_scope_absolute);
CUSTOM_COMMAND_SIG(select_prev_scope_absolute);
CUSTOM_COMMAND_SIG(place_in_scope);
CUSTOM_COMMAND_SIG(delete_current_scope);
CUSTOM_COMMAND_SIG(scope_absorb_down);
CUSTOM_COMMAND_SIG(open_long_braces);
CUSTOM_COMMAND_SIG(open_long_braces_semicolon);
CUSTOM_COMMAND_SIG(open_long_braces_break);
CUSTOM_COMMAND_SIG(if0_off);
CUSTOM_COMMAND_SIG(write_todo);
CUSTOM_COMMAND_SIG(write_hack);
CUSTOM_COMMAND_SIG(write_note);
CUSTOM_COMMAND_SIG(write_block);
CUSTOM_COMMAND_SIG(write_zero_struct);
CUSTOM_COMMAND_SIG(comment_line);
CUSTOM_COMMAND_SIG(uncomment_line);
CUSTOM_COMMAND_SIG(comment_line_toggle);
CUSTOM_COMMAND_SIG(snippet_lister);
CUSTOM_COMMAND_SIG(set_bindings_choose);
CUSTOM_COMMAND_SIG(set_bindings_default);
CUSTOM_COMMAND_SIG(set_bindings_mac_default);
CUSTOM_COMMAND_SIG(miblo_increment_basic);
CUSTOM_COMMAND_SIG(miblo_decrement_basic);
CUSTOM_COMMAND_SIG(miblo_increment_time_stamp);
CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp);
CUSTOM_COMMAND_SIG(miblo_increment_time_stamp_minute);
CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp_minute);
CUSTOM_COMMAND_SIG(rename_parameter);
CUSTOM_COMMAND_SIG(write_explicit_enum_values);
#endif
struct Command_Metadata{
PROC_LINKS(Custom_Command_Function, void) *proc;
char *name;
i32 name_len;
int32_t name_len;
char *description;
i32 description_len;
int32_t description_len;
char *source_name;
i32 source_name_len;
i32 line_number;
int32_t source_name_len;
int32_t line_number;
};
static Command_Metadata fcoder_metacmd_table[0] = {
static Command_Metadata fcoder_metacmd_table[233] = {
{ PROC_LINKS(write_explicit_enum_flags, 0), "write_explicit_enum_flags", 25, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in to give each a unique power of 2 value, starting from 1. Existing values are overwritten.", 194, "c:\\work\\4ed\\code\\4coder_experiments.cpp", 39, 502 },
{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "c:\\work\\4ed\\code\\4coder_seek.cpp", 32, 29 },
{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "c:\\work\\4ed\\code\\4coder_seek.cpp", 32, 35 },
{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "c:\\work\\4ed\\code\\4coder_seek.cpp", 32, 41 },
{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "c:\\work\\4ed\\code\\4coder_seek.cpp", 32, 47 },
{ PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "c:\\work\\4ed\\code\\4coder_seek.cpp", 32, 53 },
{ PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "c:\\work\\4ed\\code\\4coder_seek.cpp", 32, 61 },
{ PROC_LINKS(change_active_panel, 0), "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 201 },
{ PROC_LINKS(change_active_panel_backwards, 0), "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 211 },
{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 221 },
{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 231 },
{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 294 },
{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 300 },
{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 306 },
{ PROC_LINKS(set_mode_to_original, 0), "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 312 },
{ PROC_LINKS(set_mode_to_notepad_like, 0), "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 318 },
{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 324 },
{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 330 },
{ PROC_LINKS(toggle_paren_matching_helper, 0), "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 336 },
{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 342 },
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "c:\\work\\4ed\\code\\4coder_default_framework.cpp", 45, 350 },
{ 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", 41, 57 },
{ PROC_LINKS(write_underscore, 0), "write_underscore", 16, "Inserts an underscore.", 22, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 66 },
{ PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 73 },
{ PROC_LINKS(backspace_char, 0), "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 90 },
{ PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 109 },
{ PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 118 },
{ PROC_LINKS(delete_range, 0), "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 128 },
{ PROC_LINKS(backspace_alpha_numeric_boundary, 0), "backspace_alpha_numeric_boundary", 32, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 148 },
{ PROC_LINKS(delete_alpha_numeric_boundary, 0), "delete_alpha_numeric_boundary", 29, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 156 },
{ PROC_LINKS(snipe_backward_whitespace_or_token_boundary, 0), "snipe_backward_whitespace_or_token_boundary", 43, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 176 },
{ PROC_LINKS(snipe_forward_whitespace_or_token_boundary, 0), "snipe_forward_whitespace_or_token_boundary", 42, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 184 },
{ PROC_LINKS(center_view, 0), "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 197 },
{ 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", 41, 211 },
{ PROC_LINKS(click_set_cursor_and_mark, 0), "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 223 },
{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 235 },
{ PROC_LINKS(click_set_cursor_if_lbutton, 0), "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 247 },
{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 261 },
{ PROC_LINKS(mouse_wheel_scroll, 0), "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 273 },
{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 334 },
{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 340 },
{ PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 346 },
{ PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 352 },
{ PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 358 },
{ PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 368 },
{ PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 376 },
{ PROC_LINKS(move_up_to_blank_line, 0), "move_up_to_blank_line", 21, "Seeks the cursor up to the next blank line.", 43, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 405 },
{ PROC_LINKS(move_down_to_blank_line, 0), "move_down_to_blank_line", 23, "Seeks the cursor down to the next blank line.", 45, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 411 },
{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 417 },
{ PROC_LINKS(move_down_to_blank_line_skip_whitespace, 0), "move_down_to_blank_line_skip_whitespace", 39, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 423 },
{ PROC_LINKS(move_up_to_blank_line_end, 0), "move_up_to_blank_line_end", 25, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 429 },
{ PROC_LINKS(move_down_to_blank_line_end, 0), "move_down_to_blank_line_end", 27, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 435 },
{ PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 441 },
{ PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 453 },
{ PROC_LINKS(move_right_whitespace_boundary, 0), "move_right_whitespace_boundary", 30, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 475 },
{ PROC_LINKS(move_left_whitespace_boundary, 0), "move_left_whitespace_boundary", 29, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 483 },
{ PROC_LINKS(move_right_token_boundary, 0), "move_right_token_boundary", 25, "Seek right for the next end of a token.", 39, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 491 },
{ PROC_LINKS(move_left_token_boundary, 0), "move_left_token_boundary", 24, "Seek left for the next beginning of a token.", 44, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 499 },
{ PROC_LINKS(move_right_whitespace_or_token_boundary, 0), "move_right_whitespace_or_token_boundary", 39, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 507 },
{ PROC_LINKS(move_left_whitespace_or_token_boundary, 0), "move_left_whitespace_or_token_boundary", 38, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 515 },
{ PROC_LINKS(move_right_alpha_numeric_boundary, 0), "move_right_alpha_numeric_boundary", 33, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 523 },
{ PROC_LINKS(move_left_alpha_numeric_boundary, 0), "move_left_alpha_numeric_boundary", 32, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 531 },
{ PROC_LINKS(move_right_alpha_numeric_or_camel_boundary, 0), "move_right_alpha_numeric_or_camel_boundary", 42, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 539 },
{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 547 },
{ PROC_LINKS(select_all, 0), "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 568 },
{ PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 581 },
{ PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 594 },
{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 607 },
{ PROC_LINKS(basic_change_active_panel, 0), "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 641 },
{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 649 },
{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 658 },
{ PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 665 },
{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 672 },
{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 679 },
{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 686 },
{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 695 },
{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 708 },
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 714 },
{ PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 727 },
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 740 },
{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 751 },
{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 762 },
{ 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", 41, 779 },
{ 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", 41, 789 },
{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 798 },
{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 804 },
{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 812 },
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 820 },
{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 828 },
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1039 },
{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1045 },
{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1051 },
{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1062 },
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1113 },
{ PROC_LINKS(replace_in_buffer, 0), "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1122 },
{ PROC_LINKS(replace_in_all_buffers, 0), "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1131 },
{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1219 },
{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1239 },
{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1255 },
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1290 },
{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1315 },
{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1353 },
{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1388 },
{ 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", 41, 1428 },
{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1461 },
{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1467 },
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1473 },
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1487 },
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1552 },
{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1584 },
{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1597 },
{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1609 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1645 },
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1653 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1665 },
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1723 },
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1736 },
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1750 },
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1824 },
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "c:\\work\\4ed\\code\\4coder_base_commands.cpp", 41, 1927 },
{ PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 8 },
{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 15 },
{ PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 30 },
{ PROC_LINKS(lister__backspace_text_field, 0), "lister__backspace_text_field", 28, "A lister mode command that dispatches to the lister's backspace text field handler.", 83, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 40 },
{ PROC_LINKS(lister__move_up, 0), "lister__move_up", 15, "A lister mode command that dispatches to the lister's navigate up handler.", 74, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 50 },
{ PROC_LINKS(lister__move_down, 0), "lister__move_down", 17, "A lister mode command that dispatches to the lister's navigate down handler.", 76, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 60 },
{ PROC_LINKS(lister__wheel_scroll, 0), "lister__wheel_scroll", 20, "A lister mode command that scrolls the list in response to the mouse wheel.", 75, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 70 },
{ PROC_LINKS(lister__mouse_press, 0), "lister__mouse_press", 19, "A lister mode command that beings a click interaction with a list item under the mouse.", 87, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 84 },
{ PROC_LINKS(lister__mouse_release, 0), "lister__mouse_release", 21, "A lister mode command that ends a click interaction with a list item under the mouse, possibly activating it.", 109, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 95 },
{ PROC_LINKS(lister__repaint, 0), "lister__repaint", 15, "A lister mode command that updates the lists UI data.", 53, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 110 },
{ PROC_LINKS(lister__write_character__default, 0), "lister__write_character__default", 32, "A lister mode command that inserts a new character to the text field.", 69, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 120 },
{ PROC_LINKS(lister__backspace_text_field__default, 0), "lister__backspace_text_field__default", 37, "A lister mode command that backspaces one character from the text field.", 72, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 139 },
{ PROC_LINKS(lister__move_up__default, 0), "lister__move_up__default", 24, "A lister mode command that moves the highlighted item one up in the list.", 73, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 153 },
{ PROC_LINKS(lister__move_down__default, 0), "lister__move_down__default", 26, "A lister mode command that moves the highlighted item one down in the list.", 75, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 168 },
{ PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 183 },
{ PROC_LINKS(lister__backspace_text_field__file_path, 0), "lister__backspace_text_field__file_path", 39, "A lister mode command that backspaces one character from the text field of a file system list.", 94, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 208 },
{ PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 249 },
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 723 },
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 742 },
{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 815 },
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 854 },
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 887 },
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "c:\\work\\4ed\\code\\4coder_lists.cpp", 33, 969 },
{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "c:\\work\\4ed\\code\\4coder_auto_indent.cpp", 39, 526 },
{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "c:\\work\\4ed\\code\\4coder_auto_indent.cpp", 39, 535 },
{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "c:\\work\\4ed\\code\\4coder_auto_indent.cpp", 39, 545 },
{ 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", 39, 555 },
{ 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", 34, 166 },
{ 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", 34, 172 },
{ 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", 34, 178 },
{ 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", 34, 184 },
{ 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", 34, 190 },
{ 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", 34, 196 },
{ 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", 34, 202 },
{ 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", 34, 208 },
{ PROC_LINKS(list_all_locations_of_type_definition, 0), "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "c:\\work\\4ed\\code\\4coder_search.cpp", 34, 214 },
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "c:\\work\\4ed\\code\\4coder_search.cpp", 34, 222 },
{ 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", 34, 376 },
{ PROC_LINKS(goto_jump_at_cursor, 0), "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "c:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 39, 353 },
{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), "goto_jump_at_cursor_same_panel", 30, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "c:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 39, 380 },
{ PROC_LINKS(goto_next_jump, 0), "goto_next_jump", 14, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "c:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 39, 469 },
{ PROC_LINKS(goto_prev_jump, 0), "goto_prev_jump", 14, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "c:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 39, 486 },
{ PROC_LINKS(goto_next_jump_no_skips, 0), "goto_next_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "c:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 39, 499 },
{ PROC_LINKS(goto_prev_jump_no_skips, 0), "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "c:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 39, 516 },
{ PROC_LINKS(goto_first_jump, 0), "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "c:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 39, 530 },
{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "c:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 39, 547 },
{ PROC_LINKS(newline_or_goto_position, 0), "newline_or_goto_position", 24, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "c:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 39, 569 },
{ PROC_LINKS(newline_or_goto_position_same_panel, 0), "newline_or_goto_position_same_panel", 35, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "c:\\work\\4ed\\code\\4coder_jump_sticky.cpp", 39, 586 },
{ PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "c:\\work\\4ed\\code\\4coder_jump_lister.cpp", 39, 104 },
{ PROC_LINKS(log_graph__escape, 0), "log_graph__escape", 17, "Ends the log grapher", 20, "c:\\work\\4ed\\code\\4coder_log_parser.cpp", 38, 906 },
{ PROC_LINKS(log_graph__scroll_wheel, 0), "log_graph__scroll_wheel", 23, "Scrolls the log graph", 21, "c:\\work\\4ed\\code\\4coder_log_parser.cpp", 38, 915 },
{ PROC_LINKS(log_graph__page_up, 0), "log_graph__page_up", 18, "Scroll the log graph up one whole page", 38, "c:\\work\\4ed\\code\\4coder_log_parser.cpp", 38, 926 },
{ PROC_LINKS(log_graph__page_down, 0), "log_graph__page_down", 20, "Scroll the log graph down one whole page", 40, "c:\\work\\4ed\\code\\4coder_log_parser.cpp", 38, 934 },
{ PROC_LINKS(log_graph__click_select_event, 0), "log_graph__click_select_event", 29, "Select the event record at the mouse point in the log graph", 59, "c:\\work\\4ed\\code\\4coder_log_parser.cpp", 38, 968 },
{ PROC_LINKS(log_graph__click_jump_to_event_source, 0), "log_graph__click_jump_to_event_source", 37, "Jump to the code that logged the event record at the mouse point in the log graph", 81, "c:\\work\\4ed\\code\\4coder_log_parser.cpp", 38, 987 },
{ PROC_LINKS(show_the_log_graph, 0), "show_the_log_graph", 18, "Parser *log* and displays the 'log graph' UI", 44, "c:\\work\\4ed\\code\\4coder_log_parser.cpp", 38, 1035 },
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "c:\\work\\4ed\\code\\4coder_clipboard.cpp", 37, 19 },
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "c:\\work\\4ed\\code\\4coder_clipboard.cpp", 37, 28 },
{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "c:\\work\\4ed\\code\\4coder_clipboard.cpp", 37, 39 },
{ PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "c:\\work\\4ed\\code\\4coder_clipboard.cpp", 37, 73 },
{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "c:\\work\\4ed\\code\\4coder_clipboard.cpp", 37, 114 },
{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "c:\\work\\4ed\\code\\4coder_clipboard.cpp", 37, 121 },
{ PROC_LINKS(execute_previous_cli, 0), "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "c:\\work\\4ed\\code\\4coder_system_command.cpp", 42, 7 },
{ PROC_LINKS(execute_any_cli, 0), "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "c:\\work\\4ed\\code\\4coder_system_command.cpp", 42, 22 },
{ PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "c:\\work\\4ed\\code\\4coder_build_commands.cpp", 42, 128 },
{ PROC_LINKS(build_in_build_panel, 0), "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "c:\\work\\4ed\\code\\4coder_build_commands.cpp", 42, 163 },
{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "c:\\work\\4ed\\code\\4coder_build_commands.cpp", 42, 178 },
{ PROC_LINKS(change_to_build_panel, 0), "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "c:\\work\\4ed\\code\\4coder_build_commands.cpp", 42, 184 },
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "c:\\work\\4ed\\code\\4coder_project_commands.cpp", 44, 921 },
{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "c:\\work\\4ed\\code\\4coder_project_commands.cpp", 44, 927 },
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "c:\\work\\4ed\\code\\4coder_project_commands.cpp", 44, 933 },
{ 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", 44, 941 },
{ PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "c:\\work\\4ed\\code\\4coder_project_commands.cpp", 44, 948 },
{ PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "c:\\work\\4ed\\code\\4coder_project_commands.cpp", 44, 971 },
{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "c:\\work\\4ed\\code\\4coder_project_commands.cpp", 44, 1306 },
{ PROC_LINKS(setup_build_bat, 0), "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "c:\\work\\4ed\\code\\4coder_project_commands.cpp", 44, 1313 },
{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "c:\\work\\4ed\\code\\4coder_project_commands.cpp", 44, 1319 },
{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "c:\\work\\4ed\\code\\4coder_project_commands.cpp", 44, 1325 },
{ PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "c:\\work\\4ed\\code\\4coder_project_commands.cpp", 44, 1340 },
{ 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", 41, 276 },
{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "c:\\work\\4ed\\code\\4coder_function_list.cpp", 41, 286 },
{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "c:\\work\\4ed\\code\\4coder_function_list.cpp", 41, 298 },
{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "c:\\work\\4ed\\code\\4coder_function_list.cpp", 41, 304 },
{ PROC_LINKS(select_surrounding_scope, 0), "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "c:\\work\\4ed\\code\\4coder_scope_commands.cpp", 42, 352 },
{ PROC_LINKS(select_next_scope_absolute, 0), "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "c:\\work\\4ed\\code\\4coder_scope_commands.cpp", 42, 367 },
{ PROC_LINKS(select_prev_scope_absolute, 0), "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "c:\\work\\4ed\\code\\4coder_scope_commands.cpp", 42, 386 },
{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "c:\\work\\4ed\\code\\4coder_scope_commands.cpp", 42, 460 },
{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "c:\\work\\4ed\\code\\4coder_scope_commands.cpp", 42, 466 },
{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "c:\\work\\4ed\\code\\4coder_scope_commands.cpp", 42, 698 },
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 46 },
{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 54 },
{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 62 },
{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 70 },
{ PROC_LINKS(write_todo, 0), "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 76 },
{ PROC_LINKS(write_hack, 0), "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 82 },
{ PROC_LINKS(write_note, 0), "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 88 },
{ PROC_LINKS(write_block, 0), "write_block", 11, "At the cursor, insert a block comment.", 38, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 94 },
{ PROC_LINKS(write_zero_struct, 0), "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 100 },
{ PROC_LINKS(comment_line, 0), "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 125 },
{ PROC_LINKS(uncomment_line, 0), "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 137 },
{ PROC_LINKS(comment_line_toggle, 0), "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 149 },
{ PROC_LINKS(snippet_lister, 0), "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "c:\\work\\4ed\\code\\4coder_combined_write_commands.cpp", 51, 235 },
{ PROC_LINKS(set_bindings_choose, 0), "set_bindings_choose", 19, "Remap keybindings using the 'choose' mapping rule.", 50, "c:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 46, 41 },
{ PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "c:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 46, 51 },
{ PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "c:\\work\\4ed\\code\\4coder_remapping_commands.cpp", 46, 66 },
{ PROC_LINKS(miblo_increment_basic, 0), "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "c:\\work\\4ed\\code\\4coder_miblo_numbers.cpp", 41, 29 },
{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "c:\\work\\4ed\\code\\4coder_miblo_numbers.cpp", 41, 44 },
{ PROC_LINKS(miblo_increment_time_stamp, 0), "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\work\\4ed\\code\\4coder_miblo_numbers.cpp", 41, 231 },
{ PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "c:\\work\\4ed\\code\\4coder_miblo_numbers.cpp", 41, 237 },
{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "c:\\work\\4ed\\code\\4coder_miblo_numbers.cpp", 41, 243 },
{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "c:\\work\\4ed\\code\\4coder_miblo_numbers.cpp", 41, 249 },
{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "c:\\work\\4ed\\code\\4coder_experiments.cpp", 39, 187 },
{ PROC_LINKS(write_explicit_enum_values, 0), "write_explicit_enum_values", 26, "If the cursor is found to be on the '{' of an enum definition, the values of the enum will be filled in sequentially starting from zero. Existing values are overwritten.", 170, "c:\\work\\4ed\\code\\4coder_experiments.cpp", 39, 496 },
};
static int32_t fcoder_metacmd_ID_write_explicit_enum_flags = 0;
static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 1;
static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 2;
static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 3;
static int32_t fcoder_metacmd_ID_seek_end_of_line = 4;
static int32_t fcoder_metacmd_ID_goto_beginning_of_file = 5;
static int32_t fcoder_metacmd_ID_goto_end_of_file = 6;
static int32_t fcoder_metacmd_ID_change_active_panel = 7;
static int32_t fcoder_metacmd_ID_change_active_panel_backwards = 8;
static int32_t fcoder_metacmd_ID_open_panel_vsplit = 9;
static int32_t fcoder_metacmd_ID_open_panel_hsplit = 10;
static int32_t fcoder_metacmd_ID_suppress_mouse = 11;
static int32_t fcoder_metacmd_ID_allow_mouse = 12;
static int32_t fcoder_metacmd_ID_toggle_mouse = 13;
static int32_t fcoder_metacmd_ID_set_mode_to_original = 14;
static int32_t fcoder_metacmd_ID_set_mode_to_notepad_like = 15;
static int32_t fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 16;
static int32_t fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 17;
static int32_t fcoder_metacmd_ID_toggle_paren_matching_helper = 18;
static int32_t fcoder_metacmd_ID_toggle_fullscreen = 19;
static int32_t fcoder_metacmd_ID_remap_interactive = 20;
static int32_t fcoder_metacmd_ID_write_character = 21;
static int32_t fcoder_metacmd_ID_write_underscore = 22;
static int32_t fcoder_metacmd_ID_delete_char = 23;
static int32_t fcoder_metacmd_ID_backspace_char = 24;
static int32_t fcoder_metacmd_ID_set_mark = 25;
static int32_t fcoder_metacmd_ID_cursor_mark_swap = 26;
static int32_t fcoder_metacmd_ID_delete_range = 27;
static int32_t fcoder_metacmd_ID_backspace_alpha_numeric_boundary = 28;
static int32_t fcoder_metacmd_ID_delete_alpha_numeric_boundary = 29;
static int32_t fcoder_metacmd_ID_snipe_backward_whitespace_or_token_boundary = 30;
static int32_t fcoder_metacmd_ID_snipe_forward_whitespace_or_token_boundary = 31;
static int32_t fcoder_metacmd_ID_center_view = 32;
static int32_t fcoder_metacmd_ID_left_adjust_view = 33;
static int32_t fcoder_metacmd_ID_click_set_cursor_and_mark = 34;
static int32_t fcoder_metacmd_ID_click_set_cursor = 35;
static int32_t fcoder_metacmd_ID_click_set_cursor_if_lbutton = 36;
static int32_t fcoder_metacmd_ID_click_set_mark = 37;
static int32_t fcoder_metacmd_ID_mouse_wheel_scroll = 38;
static int32_t fcoder_metacmd_ID_move_up = 39;
static int32_t fcoder_metacmd_ID_move_down = 40;
static int32_t fcoder_metacmd_ID_move_up_10 = 41;
static int32_t fcoder_metacmd_ID_move_down_10 = 42;
static int32_t fcoder_metacmd_ID_move_down_textual = 43;
static int32_t fcoder_metacmd_ID_page_up = 44;
static int32_t fcoder_metacmd_ID_page_down = 45;
static int32_t fcoder_metacmd_ID_move_up_to_blank_line = 46;
static int32_t fcoder_metacmd_ID_move_down_to_blank_line = 47;
static int32_t fcoder_metacmd_ID_move_up_to_blank_line_skip_whitespace = 48;
static int32_t fcoder_metacmd_ID_move_down_to_blank_line_skip_whitespace = 49;
static int32_t fcoder_metacmd_ID_move_up_to_blank_line_end = 50;
static int32_t fcoder_metacmd_ID_move_down_to_blank_line_end = 51;
static int32_t fcoder_metacmd_ID_move_left = 52;
static int32_t fcoder_metacmd_ID_move_right = 53;
static int32_t fcoder_metacmd_ID_move_right_whitespace_boundary = 54;
static int32_t fcoder_metacmd_ID_move_left_whitespace_boundary = 55;
static int32_t fcoder_metacmd_ID_move_right_token_boundary = 56;
static int32_t fcoder_metacmd_ID_move_left_token_boundary = 57;
static int32_t fcoder_metacmd_ID_move_right_whitespace_or_token_boundary = 58;
static int32_t fcoder_metacmd_ID_move_left_whitespace_or_token_boundary = 59;
static int32_t fcoder_metacmd_ID_move_right_alpha_numeric_boundary = 60;
static int32_t fcoder_metacmd_ID_move_left_alpha_numeric_boundary = 61;
static int32_t fcoder_metacmd_ID_move_right_alpha_numeric_or_camel_boundary = 62;
static int32_t fcoder_metacmd_ID_move_left_alpha_numeric_or_camel_boundary = 63;
static int32_t fcoder_metacmd_ID_select_all = 64;
static int32_t fcoder_metacmd_ID_to_uppercase = 65;
static int32_t fcoder_metacmd_ID_to_lowercase = 66;
static int32_t fcoder_metacmd_ID_clean_all_lines = 67;
static int32_t fcoder_metacmd_ID_basic_change_active_panel = 68;
static int32_t fcoder_metacmd_ID_close_panel = 69;
static int32_t fcoder_metacmd_ID_show_scrollbar = 70;
static int32_t fcoder_metacmd_ID_hide_scrollbar = 71;
static int32_t fcoder_metacmd_ID_show_filebar = 72;
static int32_t fcoder_metacmd_ID_hide_filebar = 73;
static int32_t fcoder_metacmd_ID_toggle_filebar = 74;
static int32_t fcoder_metacmd_ID_toggle_line_wrap = 75;
static int32_t fcoder_metacmd_ID_toggle_fps_meter = 76;
static int32_t fcoder_metacmd_ID_increase_line_wrap = 77;
static int32_t fcoder_metacmd_ID_decrease_line_wrap = 78;
static int32_t fcoder_metacmd_ID_increase_face_size = 79;
static int32_t fcoder_metacmd_ID_decrease_face_size = 80;
static int32_t fcoder_metacmd_ID_mouse_wheel_change_face_size = 81;
static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 82;
static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 83;
static int32_t fcoder_metacmd_ID_toggle_line_numbers = 84;
static int32_t fcoder_metacmd_ID_eol_dosify = 85;
static int32_t fcoder_metacmd_ID_eol_nixify = 86;
static int32_t fcoder_metacmd_ID_exit_4coder = 87;
static int32_t fcoder_metacmd_ID_goto_line = 88;
static int32_t fcoder_metacmd_ID_search = 89;
static int32_t fcoder_metacmd_ID_reverse_search = 90;
static int32_t fcoder_metacmd_ID_search_identifier = 91;
static int32_t fcoder_metacmd_ID_reverse_search_identifier = 92;
static int32_t fcoder_metacmd_ID_replace_in_range = 93;
static int32_t fcoder_metacmd_ID_replace_in_buffer = 94;
static int32_t fcoder_metacmd_ID_replace_in_all_buffers = 95;
static int32_t fcoder_metacmd_ID_query_replace = 96;
static int32_t fcoder_metacmd_ID_query_replace_identifier = 97;
static int32_t fcoder_metacmd_ID_query_replace_selection = 98;
static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 99;
static int32_t fcoder_metacmd_ID_delete_file_query = 100;
static int32_t fcoder_metacmd_ID_save_to_query = 101;
static int32_t fcoder_metacmd_ID_rename_file_query = 102;
static int32_t fcoder_metacmd_ID_make_directory_query = 103;
static int32_t fcoder_metacmd_ID_move_line_up = 104;
static int32_t fcoder_metacmd_ID_move_line_down = 105;
static int32_t fcoder_metacmd_ID_duplicate_line = 106;
static int32_t fcoder_metacmd_ID_delete_line = 107;
static int32_t fcoder_metacmd_ID_open_file_in_quotes = 108;
static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 109;
static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 110;
static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 111;
static int32_t fcoder_metacmd_ID_kill_buffer = 112;
static int32_t fcoder_metacmd_ID_save = 113;
static int32_t fcoder_metacmd_ID_reopen = 114;
static int32_t fcoder_metacmd_ID_undo = 115;
static int32_t fcoder_metacmd_ID_redo = 116;
static int32_t fcoder_metacmd_ID_undo_all_buffers = 117;
static int32_t fcoder_metacmd_ID_redo_all_buffers = 118;
static int32_t fcoder_metacmd_ID_open_in_other = 119;
static int32_t fcoder_metacmd_ID_lister__quit = 120;
static int32_t fcoder_metacmd_ID_lister__activate = 121;
static int32_t fcoder_metacmd_ID_lister__write_character = 122;
static int32_t fcoder_metacmd_ID_lister__backspace_text_field = 123;
static int32_t fcoder_metacmd_ID_lister__move_up = 124;
static int32_t fcoder_metacmd_ID_lister__move_down = 125;
static int32_t fcoder_metacmd_ID_lister__wheel_scroll = 126;
static int32_t fcoder_metacmd_ID_lister__mouse_press = 127;
static int32_t fcoder_metacmd_ID_lister__mouse_release = 128;
static int32_t fcoder_metacmd_ID_lister__repaint = 129;
static int32_t fcoder_metacmd_ID_lister__write_character__default = 130;
static int32_t fcoder_metacmd_ID_lister__backspace_text_field__default = 131;
static int32_t fcoder_metacmd_ID_lister__move_up__default = 132;
static int32_t fcoder_metacmd_ID_lister__move_down__default = 133;
static int32_t fcoder_metacmd_ID_lister__write_character__file_path = 134;
static int32_t fcoder_metacmd_ID_lister__backspace_text_field__file_path = 135;
static int32_t fcoder_metacmd_ID_lister__write_character__fixed_list = 136;
static int32_t fcoder_metacmd_ID_interactive_switch_buffer = 137;
static int32_t fcoder_metacmd_ID_interactive_kill_buffer = 138;
static int32_t fcoder_metacmd_ID_interactive_open_or_new = 139;
static int32_t fcoder_metacmd_ID_interactive_new = 140;
static int32_t fcoder_metacmd_ID_interactive_open = 141;
static int32_t fcoder_metacmd_ID_command_lister = 142;
static int32_t fcoder_metacmd_ID_auto_tab_whole_file = 143;
static int32_t fcoder_metacmd_ID_auto_tab_line_at_cursor = 144;
static int32_t fcoder_metacmd_ID_auto_tab_range = 145;
static int32_t fcoder_metacmd_ID_write_and_auto_tab = 146;
static int32_t fcoder_metacmd_ID_list_all_locations = 147;
static int32_t fcoder_metacmd_ID_list_all_substring_locations = 148;
static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 149;
static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 150;
static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 151;
static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 152;
static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 153;
static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 154;
static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition = 155;
static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 156;
static int32_t fcoder_metacmd_ID_word_complete = 157;
static int32_t fcoder_metacmd_ID_goto_jump_at_cursor = 158;
static int32_t fcoder_metacmd_ID_goto_jump_at_cursor_same_panel = 159;
static int32_t fcoder_metacmd_ID_goto_next_jump = 160;
static int32_t fcoder_metacmd_ID_goto_prev_jump = 161;
static int32_t fcoder_metacmd_ID_goto_next_jump_no_skips = 162;
static int32_t fcoder_metacmd_ID_goto_prev_jump_no_skips = 163;
static int32_t fcoder_metacmd_ID_goto_first_jump = 164;
static int32_t fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 165;
static int32_t fcoder_metacmd_ID_newline_or_goto_position = 166;
static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel = 167;
static int32_t fcoder_metacmd_ID_view_jump_list_with_lister = 168;
static int32_t fcoder_metacmd_ID_log_graph__escape = 169;
static int32_t fcoder_metacmd_ID_log_graph__scroll_wheel = 170;
static int32_t fcoder_metacmd_ID_log_graph__page_up = 171;
static int32_t fcoder_metacmd_ID_log_graph__page_down = 172;
static int32_t fcoder_metacmd_ID_log_graph__click_select_event = 173;
static int32_t fcoder_metacmd_ID_log_graph__click_jump_to_event_source = 174;
static int32_t fcoder_metacmd_ID_show_the_log_graph = 175;
static int32_t fcoder_metacmd_ID_copy = 176;
static int32_t fcoder_metacmd_ID_cut = 177;
static int32_t fcoder_metacmd_ID_paste = 178;
static int32_t fcoder_metacmd_ID_paste_next = 179;
static int32_t fcoder_metacmd_ID_paste_and_indent = 180;
static int32_t fcoder_metacmd_ID_paste_next_and_indent = 181;
static int32_t fcoder_metacmd_ID_execute_previous_cli = 182;
static int32_t fcoder_metacmd_ID_execute_any_cli = 183;
static int32_t fcoder_metacmd_ID_build_search = 184;
static int32_t fcoder_metacmd_ID_build_in_build_panel = 185;
static int32_t fcoder_metacmd_ID_close_build_panel = 186;
static int32_t fcoder_metacmd_ID_change_to_build_panel = 187;
static int32_t fcoder_metacmd_ID_close_all_code = 188;
static int32_t fcoder_metacmd_ID_open_all_code = 189;
static int32_t fcoder_metacmd_ID_open_all_code_recursive = 190;
static int32_t fcoder_metacmd_ID_load_project = 191;
static int32_t fcoder_metacmd_ID_project_fkey_command = 192;
static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 193;
static int32_t fcoder_metacmd_ID_setup_new_project = 194;
static int32_t fcoder_metacmd_ID_setup_build_bat = 195;
static int32_t fcoder_metacmd_ID_setup_build_sh = 196;
static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 197;
static int32_t fcoder_metacmd_ID_project_command_lister = 198;
static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 199;
static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 200;
static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers = 201;
static int32_t fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 202;
static int32_t fcoder_metacmd_ID_select_surrounding_scope = 203;
static int32_t fcoder_metacmd_ID_select_next_scope_absolute = 204;
static int32_t fcoder_metacmd_ID_select_prev_scope_absolute = 205;
static int32_t fcoder_metacmd_ID_place_in_scope = 206;
static int32_t fcoder_metacmd_ID_delete_current_scope = 207;
static int32_t fcoder_metacmd_ID_scope_absorb_down = 208;
static int32_t fcoder_metacmd_ID_open_long_braces = 209;
static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 210;
static int32_t fcoder_metacmd_ID_open_long_braces_break = 211;
static int32_t fcoder_metacmd_ID_if0_off = 212;
static int32_t fcoder_metacmd_ID_write_todo = 213;
static int32_t fcoder_metacmd_ID_write_hack = 214;
static int32_t fcoder_metacmd_ID_write_note = 215;
static int32_t fcoder_metacmd_ID_write_block = 216;
static int32_t fcoder_metacmd_ID_write_zero_struct = 217;
static int32_t fcoder_metacmd_ID_comment_line = 218;
static int32_t fcoder_metacmd_ID_uncomment_line = 219;
static int32_t fcoder_metacmd_ID_comment_line_toggle = 220;
static int32_t fcoder_metacmd_ID_snippet_lister = 221;
static int32_t fcoder_metacmd_ID_set_bindings_choose = 222;
static int32_t fcoder_metacmd_ID_set_bindings_default = 223;
static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 224;
static int32_t fcoder_metacmd_ID_miblo_increment_basic = 225;
static int32_t fcoder_metacmd_ID_miblo_decrement_basic = 226;
static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp = 227;
static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp = 228;
static int32_t fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 229;
static int32_t fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 230;
static int32_t fcoder_metacmd_ID_rename_parameter = 231;
static int32_t fcoder_metacmd_ID_write_explicit_enum_values = 232;
#endif

1105
4coder_lex_gen_cpp.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -8,13 +8,16 @@
#include "4coder_base_types.h"
#include "4coder_token.h"
#include "languages/generated_lexer_cpp.h"
#include "4coder_base_types.cpp"
#include "4coder_stringf.cpp"
#include "4coder_malloc_allocator.cpp"
#include "4coder_token.cpp"
#include "languages/generated_lexer_cpp.cpp"
#include "4coder_file.h"
#include "languages/4coder_language_cpp.h"
#include <stdio.h>
#include <stdlib.h>
@ -412,7 +415,7 @@ require_define(Reader *reader, i64 *opt_pos_out){
b32 success = false;
Token token = get_token(reader);
if (token.sub_kind == TokenCppKind_Define){
if (token.sub_kind == TokenCppKind_PPDefine){
success = true;
if (opt_pos_out != 0){
*opt_pos_out = token.pos;

View File

@ -46,7 +46,8 @@ internal Table_Lookup
table_lookup(Table_u64_u64 *table, u64 key){
Table_Lookup result = {};
if (key != table_empty_key && key != table_erased_key){
if (key != table_empty_key && key != table_erased_key &&
table->slot_count > 0){
u64 *keys = table->keys;
u32 slot_count = table->slot_count;
@ -205,7 +206,8 @@ internal Table_Lookup
table_lookup(Table_u32_u16 *table, u32 key){
Table_Lookup result = {};
if (key != table_empty_u32_key && key != table_erased_u32_key){
if (key != table_empty_u32_key && key != table_erased_u32_key &&
table->slot_count > 0){
u32 *keys = table->keys;
u32 slot_count = table->slot_count;
@ -357,13 +359,15 @@ table_free(Table_Data_u64 *table){
internal Table_Lookup
table_lookup(Table_Data_u64 *table, Data key){
Table_Lookup result = {};
if (table->slot_count > 0){
u64 *hashes = table->hashes;
u32 slot_count = table->slot_count;
u64 hash = table_hash(key);
u32 first_index = hash % slot_count;
u32 index = first_index;
Table_Lookup result = {};
result.hash = hash;
for (;;){
if (hash == hashes[index]){
@ -393,6 +397,7 @@ table_lookup(Table_Data_u64 *table, Data key){
break;
}
}
}
return(result);
}
@ -514,7 +519,8 @@ internal Table_Lookup
table_lookup(Table_u64_Data *table, u64 key){
Table_Lookup result = {};
if (key != table_empty_key && key != table_erased_key){
if (key != table_empty_key && key != table_erased_key &&
table->slot_count > 0){
u64 *keys = table->keys;
u32 slot_count = table->slot_count;
@ -622,9 +628,8 @@ table_insert(Table_u64_Data *table, u64 key, Data val){
}
internal b32
table_erase(Table_u64_Data *table, u64 key){
table_erase(Table_u64_Data *table, Table_Lookup lookup){
b32 result = false;
Table_Lookup lookup = table_lookup(table, key);
if (lookup.found_match){
table->keys[lookup.index] = 0;
block_zero_struct(&table->vals[lookup.index]);
@ -634,6 +639,12 @@ table_erase(Table_u64_Data *table, u64 key){
return(result);
}
internal b32
table_erase(Table_u64_Data *table, u64 key){
Table_Lookup lookup = table_lookup(table, key);
return(table_erase(table, lookup));
}
internal void
table_clear(Table_u64_Data *table){
block_zero_dynamic_array(table->keys, table->slot_count);
@ -667,13 +678,15 @@ table_free(Table_Data_Data *table){
internal Table_Lookup
table_lookup(Table_Data_Data *table, Data key){
Table_Lookup result = {};
if (table->slot_count > 0){
u64 *hashes = table->hashes;
u32 slot_count = table->slot_count;
u64 hash = table_hash(key);
u32 first_index = hash % slot_count;
u32 index = first_index;
Table_Lookup result = {};
result.hash = hash;
for (;;){
if (hash == hashes[index]){
@ -703,6 +716,7 @@ table_lookup(Table_Data_Data *table, Data key){
break;
}
}
}
return(result);
}

27
4coder_token.cpp Normal file
View File

@ -0,0 +1,27 @@
/*
* 4coder token types
*/
// TOP
internal void
token_list_push(Arena *arena, Token_List *list, Token *token){
Token_Block *block = list->last;
if (block == 0 || block->count + 1 > block->max){
block = push_array(arena, Token_Block, 1);
block->next = 0;
block->prev = 0;
u32 new_max = round_up_u32(1, KB(4));
block->tokens = push_array(arena, Token, new_max);
block->count = 0;
block->max = new_max;
zdll_push_back(list->first, list->last, block);
list->node_count += 1;
}
block_copy_struct(&block->tokens[block->count], token);
block->count += 1;
list->total_count += 1;
}
// BOTTOM

View File

@ -28,6 +28,24 @@ enum{
TokenBaseKind_COUNT,
};
char *token_base_kind_names[] ={
"EOF",
"Whitespace",
"LexError",
"Comment",
"Keyword",
"Preprocessor",
"Identifier",
"Operator",
"LiteralInteger",
"LiteralFloat",
"LiteralString",
"ScopeOpen",
"ScopeClose",
"ParentheticalOpen",
"ParentheticalClose",
};
typedef u16 Token_Base_Flag;
enum{
TokenBaseFlag_PreprocessorBody = 1,
@ -48,6 +66,21 @@ struct Token_Array{
i64 max;
};
struct Token_Block{
Token_Block *next;
Token_Block *prev;
Token *tokens;
i32 count;
i32 max;
};
struct Token_List{
Token_Block *first;
Token_Block *last;
i32 node_count;
i32 total_count;
};
#endif
// BOTTOM

View File

@ -1956,7 +1956,7 @@ Managed_Scope_Get_Attachment(Application_Links *app, Managed_Scope scope, Manage
}
else{
#define M \
"ERROR: scope attachment already exists with a size smaller than the requested size; no attachment pointer can returned."
"ERROR: scope attachment already exists with a size smaller than the requested size; no attachment pointer can be returned."
print_message(app, string_u8_litexpr(M));
}
}

33
build_generator.bat Normal file
View File

@ -0,0 +1,33 @@
@echo off
REM usage: build_generator <src-file> <binary-output-path> [release]
REM src-file: a relative path to the target of a unity-build for a generator
REM binary-output-path: a relative path where the generator.exe will be written, assumed to be "." if unset
set code_home=%~dp0
if %code_home:~-1%==\ (set code_home=%code_home:~0,-1%)
if NOT "%Platform%" == "X64" IF NOT "%Platform%" == "x64" (call "%code_home%\windows_scripts\setup_cl_x64.bat")
set src=%1
if "%src%" == "" (echo error: no input file & exit)
set dst=%2
if "%dst%" == "" (set dst=".")
set opts=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4457 /wd4146 /WX
set opts=%opts% /GR- /nologo /FC
set debug=/Zi
set release=/O2 /Zi
set mode=%debug%
if "%3" == "release" (set mode=%release%)
set full_src="%cd%\%src%"
pushd %dst%
call cl /I"%code_home%" %opts% %mode% %full_src% /Fegenerator
popd

View File

@ -1,9 +1,5 @@
@echo off
REM This stores the path of the buildsuper.bat script
REM in CODE_HOME. This way you can always include the
REM default files no matter where you store your code.
REM And no matter how you call buildsuper.bat.
set code_home=%~dp0
if %code_home:~-1%==\ (set code_home=%code_home:~0,-1%)

View File

@ -1,24 +0,0 @@
/*
4coder_language_cpp.cpp - C++ language parser.
*/
// TOP
internal Token_Array
lex_cpp_initial(Base_Allocator *allocator, String_Const_u8 contents){
Token_Array result = {};
result.tokens = base_array(allocator, Token, 2);
result.count = 2;
result.max = 2;
result.tokens[0].pos = 0;
result.tokens[0].size = contents.size;
result.tokens[0].kind = TokenBaseKind_COUNT;
result.tokens[0].sub_kind = 0;
result.tokens[1].pos = contents.size;
result.tokens[1].size = 0;
result.tokens[1].kind = TokenBaseKind_EOF;
return(result);
}
// BOTTOM

View File

@ -1,19 +0,0 @@
/*
4coder_language_cpp.h - C++ language extension for the token types.
*/
// TOP
#if !defined(FCODER_LANGUAGE_CPP_H)
#define FCODER_LANGUAGE_CPP_H
enum{
};
#endif
// BOTTOM

View File

@ -1,122 +0,0 @@
/*
4coder_language_cs.h - Sets up the C# language context.
*/
// TOP
#if !defined(FCODER_LANGUAGE_CS_H)
#define FCODER_LANGUAGE_CS_H
#if 0
static Parse_Context_ID parse_context_language_cs;
#define PSAT(s, t) {s, sizeof(s)-1, t}
static void
init_language_cs(Application_Links *app){
if (parse_context_language_cs != 0) return;
Parser_String_And_Type kw[] = {
PSAT("abstract", CPP_TOKEN_KEY_OTHER),
PSAT("as", CPP_TOKEN_KEY_OTHER),
PSAT("base", CPP_TOKEN_KEY_OTHER),
PSAT("bool", CPP_TOKEN_KEY_OTHER),
PSAT("byte", CPP_TOKEN_KEY_OTHER),
PSAT("char", CPP_TOKEN_KEY_OTHER),
PSAT("checked", CPP_TOKEN_KEY_OTHER),
PSAT("class", CPP_TOKEN_KEY_OTHER),
PSAT("const", CPP_TOKEN_KEY_OTHER),
PSAT("decimal", CPP_TOKEN_KEY_OTHER),
PSAT("delegate", CPP_TOKEN_KEY_OTHER),
PSAT("double", CPP_TOKEN_KEY_OTHER),
PSAT("enum", CPP_TOKEN_KEY_OTHER),
PSAT("event", CPP_TOKEN_KEY_OTHER),
PSAT("explicit", CPP_TOKEN_KEY_OTHER),
PSAT("extern", CPP_TOKEN_KEY_OTHER),
PSAT("false", CPP_TOKEN_KEY_OTHER),
PSAT("fixed", CPP_TOKEN_KEY_OTHER),
PSAT("float", CPP_TOKEN_KEY_OTHER),
PSAT("implicit", CPP_TOKEN_KEY_OTHER),
PSAT("int", CPP_TOKEN_KEY_OTHER),
PSAT("interface", CPP_TOKEN_KEY_OTHER),
PSAT("internal", CPP_TOKEN_KEY_OTHER),
PSAT("is", CPP_TOKEN_KEY_OTHER),
PSAT("long", CPP_TOKEN_KEY_OTHER),
PSAT("namespace", CPP_TOKEN_KEY_OTHER),
PSAT("new", CPP_TOKEN_KEY_OTHER),
PSAT("null", CPP_TOKEN_KEY_OTHER),
PSAT("object", CPP_TOKEN_KEY_OTHER),
PSAT("operator", CPP_TOKEN_KEY_OTHER),
PSAT("out", CPP_TOKEN_KEY_OTHER),
PSAT("override", CPP_TOKEN_KEY_OTHER),
PSAT("params", CPP_TOKEN_KEY_OTHER),
PSAT("private", CPP_TOKEN_KEY_OTHER),
PSAT("protected", CPP_TOKEN_KEY_OTHER),
PSAT("public", CPP_TOKEN_KEY_OTHER),
PSAT("readonly", CPP_TOKEN_KEY_OTHER),
PSAT("ref", CPP_TOKEN_KEY_OTHER),
PSAT("sbyte", CPP_TOKEN_KEY_OTHER),
PSAT("sealed", CPP_TOKEN_KEY_OTHER),
PSAT("short", CPP_TOKEN_KEY_OTHER),
PSAT("sizeof", CPP_TOKEN_KEY_OTHER),
PSAT("stackalloc", CPP_TOKEN_KEY_OTHER),
PSAT("static", CPP_TOKEN_KEY_OTHER),
PSAT("string", CPP_TOKEN_KEY_OTHER),
PSAT("struct", CPP_TOKEN_KEY_OTHER),
PSAT("this", CPP_TOKEN_KEY_OTHER),
PSAT("true", CPP_TOKEN_KEY_OTHER),
PSAT("typeof", CPP_TOKEN_KEY_OTHER),
PSAT("uint", CPP_TOKEN_KEY_OTHER),
PSAT("ulong", CPP_TOKEN_KEY_OTHER),
PSAT("unchecked", CPP_TOKEN_KEY_OTHER),
PSAT("unsafe", CPP_TOKEN_KEY_OTHER),
PSAT("ushort", CPP_TOKEN_KEY_OTHER),
PSAT("using", CPP_TOKEN_KEY_OTHER),
PSAT("void", CPP_TOKEN_KEY_OTHER),
PSAT("volatile", CPP_TOKEN_KEY_OTHER),
PSAT("if", CPP_TOKEN_IF),
PSAT("else", CPP_TOKEN_ELSE),
PSAT("switch", CPP_TOKEN_SWITCH),
PSAT("case", CPP_TOKEN_CASE),
PSAT("do", CPP_TOKEN_DO),
PSAT("for", CPP_TOKEN_FOR),
PSAT("foreach", CPP_TOKEN_FOR),
PSAT("in", CPP_TOKEN_KEY_OTHER),
PSAT("while", CPP_TOKEN_WHILE),
PSAT("break", CPP_TOKEN_BREAK),
PSAT("continue", CPP_TOKEN_CONTINUE),
PSAT("default", CPP_TOKEN_DEFAULT),
PSAT("goto", CPP_TOKEN_GOTO),
PSAT("return", CPP_TOKEN_RETURN),
PSAT("yield", CPP_TOKEN_KEY_OTHER),
PSAT("throw", CPP_TOKEN_THROW),
PSAT("try", CPP_TOKEN_TRY),
PSAT("catch", CPP_TOKEN_CATCH),
PSAT("finally", CPP_TOKEN_CATCH),
PSAT("lock", CPP_TOKEN_KEY_OTHER),
};
Parser_String_And_Type pp[] = {
PSAT("if", CPP_PP_IF),
PSAT("else", CPP_PP_ELSE),
PSAT("elif", CPP_PP_ELIF),
PSAT("endif", CPP_PP_ENDIF),
PSAT("define", CPP_PP_DEFINED),
PSAT("undef", CPP_PP_UNDEF),
PSAT("warning", CPP_PP_ERROR),
PSAT("error", CPP_PP_ERROR),
PSAT("line", CPP_PP_LINE),
PSAT("pragma", CPP_PP_PRAGMA),
PSAT("region", CPP_PP_UNKNOWN),
PSAT("endregion", CPP_PP_UNKNOWN),
};
parse_context_language_cs = create_parse_context(app, kw, ArrayCount(kw), pp, ArrayCount(pp));
}
#undef PSAT
#endif
#endif
// BOTTOM

View File

@ -1,82 +0,0 @@
/*
4coder_language_java.h - Sets up the Java language context.
*/
// TOP
#if !defined(FCODER_LANGUAGE_JAVA_H)
#define FCODER_LANGUAGE_JAVA_H
#if 0
static Parse_Context_ID parse_context_language_java;
#define PSAT(s, t) {s, sizeof(s)-1, t}
static void
init_language_java(Application_Links *app){
if (parse_context_language_java != 0) return;
Parser_String_And_Type kw[] = {
PSAT("abstract", CPP_TOKEN_KEY_OTHER),
PSAT("assert", CPP_TOKEN_KEY_OTHER),
PSAT("boolean", CPP_TOKEN_KEY_OTHER),
PSAT("char", CPP_TOKEN_KEY_OTHER),
PSAT("class", CPP_TOKEN_KEY_OTHER),
PSAT("const", CPP_TOKEN_KEY_OTHER),
PSAT("default", CPP_TOKEN_KEY_OTHER),
PSAT("double", CPP_TOKEN_KEY_OTHER),
PSAT("enum", CPP_TOKEN_KEY_OTHER),
PSAT("extends", CPP_TOKEN_KEY_OTHER),
PSAT("final", CPP_TOKEN_KEY_OTHER),
PSAT("float", CPP_TOKEN_KEY_OTHER),
PSAT("implements", CPP_TOKEN_KEY_OTHER),
PSAT("import", CPP_TOKEN_KEY_OTHER),
PSAT("instanceof", CPP_TOKEN_KEY_OTHER),
PSAT("int", CPP_TOKEN_KEY_OTHER),
PSAT("interface", CPP_TOKEN_KEY_OTHER),
PSAT("long", CPP_TOKEN_KEY_OTHER),
PSAT("native", CPP_TOKEN_KEY_OTHER),
PSAT("new", CPP_TOKEN_KEY_OTHER),
PSAT("package", CPP_TOKEN_KEY_OTHER),
PSAT("private", CPP_TOKEN_KEY_OTHER),
PSAT("protected", CPP_TOKEN_KEY_OTHER),
PSAT("public", CPP_TOKEN_KEY_OTHER),
PSAT("return", CPP_TOKEN_KEY_OTHER),
PSAT("short", CPP_TOKEN_KEY_OTHER),
PSAT("static", CPP_TOKEN_KEY_OTHER),
PSAT("strictfp", CPP_TOKEN_KEY_OTHER),
PSAT("super", CPP_TOKEN_KEY_OTHER),
PSAT("synchronized", CPP_TOKEN_KEY_OTHER),
PSAT("this", CPP_TOKEN_KEY_OTHER),
PSAT("transient", CPP_TOKEN_KEY_OTHER),
PSAT("void", CPP_TOKEN_KEY_OTHER),
PSAT("volatile", CPP_TOKEN_KEY_OTHER),
PSAT("true", CPP_TOKEN_KEY_OTHER),
PSAT("false", CPP_TOKEN_KEY_OTHER),
PSAT("null", CPP_TOKEN_KEY_OTHER),
PSAT("if", CPP_TOKEN_IF),
PSAT("else", CPP_TOKEN_ELSE),
PSAT("switch", CPP_TOKEN_SWITCH),
PSAT("case", CPP_TOKEN_CASE),
PSAT("while", CPP_TOKEN_WHILE),
PSAT("do", CPP_TOKEN_DO),
PSAT("for", CPP_TOKEN_FOR),
PSAT("goto", CPP_TOKEN_GOTO),
PSAT("break", CPP_TOKEN_BREAK),
PSAT("continue", CPP_TOKEN_CONTINUE),
PSAT("throw", CPP_TOKEN_THROW),
PSAT("throws", CPP_TOKEN_THROW),
PSAT("try", CPP_TOKEN_TRY),
PSAT("catch", CPP_TOKEN_CATCH),
PSAT("finally", CPP_TOKEN_CATCH),
};
parse_context_language_java = create_parse_context(app, kw, ArrayCount(kw), 0, 0);
}
#undef PSAT
#endif
#endif
// BOTTOM

View File

@ -1,81 +0,0 @@
/*
4coder_language_rust.h - Sets up the Rust language context.
*/
// TOP
#if !defined(FCODER_LANGUAGE_RUST_H)
#define FCODER_LANGUAGE_RUST_H
#if 0
static Parse_Context_ID parse_context_language_rust;
#define PSAT(s, t) {s, sizeof(s)-1, t}
static void
init_language_rust(Application_Links *app){
if (parse_context_language_rust != 0) return;
Parser_String_And_Type kw[] = {
PSAT("abstract", CPP_TOKEN_KEY_OTHER),
PSAT("alignof", CPP_TOKEN_KEY_OTHER),
PSAT("as", CPP_TOKEN_KEY_OTHER),
PSAT("become", CPP_TOKEN_KEY_OTHER),
PSAT("box", CPP_TOKEN_KEY_OTHER),
PSAT("const", CPP_TOKEN_KEY_OTHER),
PSAT("crate", CPP_TOKEN_KEY_OTHER),
PSAT("enum", CPP_TOKEN_KEY_OTHER),
PSAT("extern", CPP_TOKEN_KEY_OTHER),
PSAT("false", CPP_TOKEN_KEY_OTHER),
PSAT("final", CPP_TOKEN_KEY_OTHER),
PSAT("fn", CPP_TOKEN_KEY_OTHER),
PSAT("impl", CPP_TOKEN_KEY_OTHER),
PSAT("in", CPP_TOKEN_KEY_OTHER),
PSAT("let", CPP_TOKEN_KEY_OTHER),
PSAT("loop", CPP_TOKEN_KEY_OTHER),
PSAT("macro", CPP_TOKEN_KEY_OTHER),
PSAT("match", CPP_TOKEN_KEY_OTHER),
PSAT("mod", CPP_TOKEN_KEY_OTHER),
PSAT("move", CPP_TOKEN_KEY_OTHER),
PSAT("mut", CPP_TOKEN_KEY_OTHER),
PSAT("offsetof", CPP_TOKEN_KEY_OTHER),
PSAT("override", CPP_TOKEN_KEY_OTHER),
PSAT("priv", CPP_TOKEN_KEY_OTHER),
PSAT("proc", CPP_TOKEN_KEY_OTHER),
PSAT("pub", CPP_TOKEN_KEY_OTHER),
PSAT("pure", CPP_TOKEN_KEY_OTHER),
PSAT("ref", CPP_TOKEN_KEY_OTHER),
PSAT("return", CPP_TOKEN_KEY_OTHER),
PSAT("Self", CPP_TOKEN_KEY_OTHER),
PSAT("self", CPP_TOKEN_KEY_OTHER),
PSAT("sizeof", CPP_TOKEN_KEY_OTHER),
PSAT("static", CPP_TOKEN_KEY_OTHER),
PSAT("struct", CPP_TOKEN_KEY_OTHER),
PSAT("super", CPP_TOKEN_KEY_OTHER),
PSAT("trait", CPP_TOKEN_KEY_OTHER),
PSAT("true", CPP_TOKEN_KEY_OTHER),
PSAT("type", CPP_TOKEN_KEY_OTHER),
PSAT("typeof", CPP_TOKEN_KEY_OTHER),
PSAT("unsafe", CPP_TOKEN_KEY_OTHER),
PSAT("unsized", CPP_TOKEN_KEY_OTHER),
PSAT("use", CPP_TOKEN_KEY_OTHER),
PSAT("virtual", CPP_TOKEN_KEY_OTHER),
PSAT("where", CPP_TOKEN_KEY_OTHER),
PSAT("break", CPP_TOKEN_BREAK),
PSAT("continue", CPP_TOKEN_CONTINUE),
PSAT("do", CPP_TOKEN_DO),
PSAT("else", CPP_TOKEN_ELSE),
PSAT("for", CPP_TOKEN_FOR),
PSAT("if", CPP_TOKEN_IF),
PSAT("while", CPP_TOKEN_WHILE),
PSAT("yield", CPP_TOKEN_KEY_OTHER),
};
parse_context_language_rust = create_parse_context(app, kw, ArrayCount(kw), 0, 0);
}
#undef PSAT
#endif
#endif
// BOTTOM

View File

@ -0,0 +1,489 @@
/*
4coder_lexer_cpp_test.cpp - A tester for the C++ lexer.
*/
// TOP
#if 0
0.
0.f
0.1
0.1f
0.0
0.0f
0.F
0.0F
.0
.0f
.1
.9
.1f
.9f
0.e1
0.e1f
0.e1F
0.E1f
0.E1F
0.e+1
0.e+1f
0.e+1F
0.E+1f
0.E+1F
0.e-1
0.e-1f
0.e-1F
0.E-1f
0.E-1F
0.l
0.1
0.1l
0.0l
0.L
0.0L
.0l
.1l
.9l
0.e1
0.e1l
0.e1L
0.E1l
0.E1L
0.e+1
0.e+1l
0.e+1L
0.E+1l
0.E+1L
0.e-1
0.e-1l
0.e-1L
0.E-1l
0.E-1L
0x0
0x1
0xa
0xf
0xg
0xA
0xF
0xG
0x01
0x0a
0x0f
0x0g
0x0A
0x0F
0x0G
0x0z
0x1z
0xaz
0xfz
0xAz
0xFz
0x01z
0x0az
0x0fz
0x0Az
0x0Fz
0x0l
0x1l
0xal
0xfl
0xAl
0xFl
0x01l
0x0al
0x0fl
0x0Al
0x0Fl
0x0u
0x1u
0xau
0xfu
0xAu
0xFu
0x01u
0x0au
0x0fu
0x0Au
0x0Fu
0x0L
0x1L
0xaL
0xfL
0xAL
0xFL
0x01L
0x0aL
0x0fL
0x0AL
0x0FL
0x0U
0x1U
0xaU
0xfU
0xAU
0xFU
0x01U
0x0aU
0x0fU
0x0AU
0x0FU
0x0lu
0x1lu
0xalu
0xflu
0xAlu
0xFlu
0x01lu
0x0alu
0x0flu
0x0Alu
0x0Flu
0x0Lu
0x1Lu
0xaLu
0xfLu
0xALu
0xFLu
0x01Lu
0x0aLu
0x0fLu
0x0ALu
0x0FLu
0x0lU
0x1lU
0xalU
0xflU
0xAlU
0xFlU
0x01lU
0x0alU
0x0flU
0x0AlU
0x0FlU
0x0LU
0x1LU
0xaLU
0xfLU
0xALU
0xFLU
0x01LU
0x0aLU
0x0fLU
0x0ALU
0x0FLU
0x0ul
0x1ul
0xaul
0xful
0xAul
0xFul
0x01ul
0x0aul
0x0ful
0x0Aul
0x0Ful
0x0uL
0x1uL
0xauL
0xfuL
0xAuL
0xFuL
0x01uL
0x0auL
0x0fuL
0x0AuL
0x0FuL
0x0Ul
0x1Ul
0xaUl
0xfUl
0xAUl
0xFUl
0x01Ul
0x0aUl
0x0fUl
0x0AUl
0x0FUl
0x0UL
0x1UL
0xaUL
0xfUL
0xAUL
0xFUL
0x01UL
0x0aUL
0x0fUL
0x0AUL
0x0FUL
0x0llu
0x1llu
0xallu
0xfllu
0xAllu
0xFllu
0x01llu
0x0allu
0x0fllu
0x0Allu
0x0Fllu
0x0LLu
0x1LLu
0xaLLu
0xfLLu
0xALLu
0xFLLu
0x01LLu
0x0aLLu
0x0fLLu
0x0ALLu
0x0FLLu
0x0llU
0x1llU
0xallU
0xfllU
0xAllU
0xFllU
0x01llU
0x0allU
0x0fllU
0x0AllU
0x0FllU
0x0LLU
0x1LLU
0xaLLU
0xfLLU
0xALLU
0xFLLU
0x01LLU
0x0aLLU
0x0fLLU
0x0ALLU
0x0FLLU
0x0ull
0x1ull
0xaull
0xfull
0xAull
0xFull
0x01ull
0x0aull
0x0full
0x0Aull
0x0Full
0x0uLL
0x1uLL
0xauLL
0xfuLL
0xAuLL
0xFuLL
0x01uLL
0x0auLL
0x0fuLL
0x0AuLL
0x0FuLL
0x0Ull
0x1Ull
0xaUll
0xfUll
0xAUll
0xFUll
0x01Ull
0x0aUll
0x0fUll
0x0AUll
0x0FUll
0x0ULL
0x1ULL
0xaULL
0xfULL
0xAULL
0xFULL
0x01ULL
0x0aULL
0x0fULL
0x0AULL
0x0FULL
01
07
08
09
010
011
077
078
087
"foo"
"foo
foo"
"foo\
bar"
L"foo"
L"foo
Lfoo"
L"foo\
bar"
u"foo"
u"foo
ufoo"
u"foo\
bar"
u8"foo"
u8"foo
u8foo"
u8"foo\
bar"
U"foo"
U"foo
Ufoo"
U"foo\
bar"
R"(foo)"
R"bar(foo)bar"
R"foo(foo)foo"
LR"bar(foo)bar"
uR"bar(foo)bar"
u8R"bar(foo)bar"
UR"bar(foo)bar"
LR"foo(foo)foo"
uR"foo(foo)foo"
u8R"foo(foo)foo"
UR"foo(foo)foo"
R"bar(foo
\
)bar"
R"foo(foo
\
)foo"
R"bar(foo
"
)"
)b"
)ba"
)bar"
R"bar(foo
)bar
)bar
)bar
)bar"
#error ``` Foo bar is bad news bears! ```
#endif
#include "4coder_base_types.h"
#include "4coder_token.h"
#include "generated_lexer_cpp.h"
#include "4coder_base_types.cpp"
#include "4coder_token.cpp"
#include "generated_lexer_cpp.cpp"
#include "4coder_stringf.cpp"
#include "4coder_malloc_allocator.cpp"
#include <stdio.h>
#include <time.h>
internal void
print_token_list(Token_List *list, String_Const_u8 text){
for (Token_Block *block = list->first;
block != 0;
block = block->next){
i32 count = block->count;
Token *token = block->tokens;
for (i32 i = 0; i < count; i += 1, token += 1){
printf("[%5llu, %5llu) %20s / %20s : 0x%04x / 0x%04x\n",
token->pos, token->pos + token->size,
token_base_kind_names[token->kind],
token_cpp_kind_names[token->sub_kind],
token->flags, token->sub_flags);
printf("\t:%.*s:\n", token->size, text.str + token->pos);
}
}
}
internal String_Const_u8
file_read_all(Arena *arena, FILE *file){
String_Const_u8 result = {};
fseek(file, 0, SEEK_END);
result.size = ftell(file);
fseek(file, 0, SEEK_SET);
result.str = push_array(arena, u8, result.size + 1);
fread(result.str, result.size, 1, file);
result.str[result.size] = 0;
return(result);
}
int main(void){
Arena arena_ = make_arena_malloc();
Arena *arena = &arena_;
String_Const_u8 path_to_self = string_u8_litexpr(__FILE__);
path_to_self = string_remove_last_folder(path_to_self);
String_Const_u8 path_to_src = string_remove_last_folder(path_to_self);
String_Const_u8 test_file_name = push_u8_stringf(arena, "%.*s/languages/4coder_lexer_cpp_test.cpp",
string_expand(path_to_src));
FILE *test_file = fopen((char*)test_file_name.str, "rb");
if (test_file == 0){
printf("error: count not open test file %s\n", test_file_name.str);
exit(1);
}
String_Const_u8 text = file_read_all(arena, test_file);
fclose(test_file);
Token_List list = lex_full_input_cpp(arena, text);
print_token_list(&list, text);
for (i32 i = 0; i < KB(4); i += 1){
fprintf(stdout, "\n");
}
fflush(stdout);
return(0);
}
// BOTTOM

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,375 @@
#if !defined(FCODER_LEX_GEN_HAND_WRITTEN_TYPES)
#define FCODER_LEX_GEN_HAND_WRITTEN_TYPES
struct Lexeme_Table_Value{
Token_Base_Kind base_kind;
u16 sub_kind;
};
struct Lexeme_Table_Lookup{
b32 found_match;
Token_Base_Kind base_kind;
u16 sub_kind;
};
#endif
typedef u16 Token_Cpp_Kind;
enum{
TokenCppKind_EOF = 0,
TokenCppKind_Whitespace = 1,
TokenCppKind_LexError = 2,
TokenCppKind_BlockComment = 3,
TokenCppKind_LineComment = 4,
TokenCppKind_Backslash = 5,
TokenCppKind_LiteralInteger = 6,
TokenCppKind_LiteralIntegerU = 7,
TokenCppKind_LiteralIntegerL = 8,
TokenCppKind_LiteralIntegerUL = 9,
TokenCppKind_LiteralIntegerLL = 10,
TokenCppKind_LiteralIntegerULL = 11,
TokenCppKind_LiteralIntegerHex = 12,
TokenCppKind_LiteralIntegerHexU = 13,
TokenCppKind_LiteralIntegerHexL = 14,
TokenCppKind_LiteralIntegerHexUL = 15,
TokenCppKind_LiteralIntegerHexLL = 16,
TokenCppKind_LiteralIntegerHexULL = 17,
TokenCppKind_LiteralIntegerOct = 18,
TokenCppKind_LiteralIntegerOctU = 19,
TokenCppKind_LiteralIntegerOctL = 20,
TokenCppKind_LiteralIntegerOctUL = 21,
TokenCppKind_LiteralIntegerOctLL = 22,
TokenCppKind_LiteralIntegerOctULL = 23,
TokenCppKind_LiteralFloat32 = 24,
TokenCppKind_LiteralFloat64 = 25,
TokenCppKind_LiteralString = 26,
TokenCppKind_LiteralStringWide = 27,
TokenCppKind_LiteralStringUTF8 = 28,
TokenCppKind_LiteralStringUTF16 = 29,
TokenCppKind_LiteralStringUTF32 = 30,
TokenCppKind_LiteralStringRaw = 31,
TokenCppKind_LiteralStringWideRaw = 32,
TokenCppKind_LiteralStringUTF8Raw = 33,
TokenCppKind_LiteralStringUTF16Raw = 34,
TokenCppKind_LiteralStringUTF32Raw = 35,
TokenCppKind_LiteralCharacter = 36,
TokenCppKind_LiteralCharacterWide = 37,
TokenCppKind_LiteralCharacterUTF8 = 38,
TokenCppKind_LiteralCharacterUTF16 = 39,
TokenCppKind_LiteralCharacterUTF32 = 40,
TokenCppKind_PPIncludeFile = 41,
TokenCppKind_PPErrorMessage = 42,
TokenCppKind_KeywordGeneric = 43,
TokenCppKind_BraceOp = 44,
TokenCppKind_BraceCl = 45,
TokenCppKind_ParenOp = 46,
TokenCppKind_BrackOp = 47,
TokenCppKind_ParenCl = 48,
TokenCppKind_BrackCl = 49,
TokenCppKind_Semicolon = 50,
TokenCppKind_Colon = 51,
TokenCppKind_DotDotDot = 52,
TokenCppKind_ColonColon = 53,
TokenCppKind_PlusPlus = 54,
TokenCppKind_MinusMinus = 55,
TokenCppKind_Dot = 56,
TokenCppKind_Arrow = 57,
TokenCppKind_Plus = 58,
TokenCppKind_Minus = 59,
TokenCppKind_Not = 60,
TokenCppKind_Tilde = 61,
TokenCppKind_Star = 62,
TokenCppKind_And = 63,
TokenCppKind_DotStar = 64,
TokenCppKind_ArrowStar = 65,
TokenCppKind_Div = 66,
TokenCppKind_Mod = 67,
TokenCppKind_LeftLeft = 68,
TokenCppKind_RightRight = 69,
TokenCppKind_Compare = 70,
TokenCppKind_Less = 71,
TokenCppKind_LessEq = 72,
TokenCppKind_Grtr = 73,
TokenCppKind_GrtrEq = 74,
TokenCppKind_EqEq = 75,
TokenCppKind_NotEq = 76,
TokenCppKind_Xor = 77,
TokenCppKind_Or = 78,
TokenCppKind_AndAnd = 79,
TokenCppKind_OrOr = 80,
TokenCppKind_Ternary = 81,
TokenCppKind_Eq = 82,
TokenCppKind_PlusEq = 83,
TokenCppKind_MinusEq = 84,
TokenCppKind_StarEq = 85,
TokenCppKind_DivEq = 86,
TokenCppKind_ModEq = 87,
TokenCppKind_LeftLeftEq = 88,
TokenCppKind_RightRightEq = 89,
TokenCppKind_Comma = 90,
TokenCppKind_PPStringify = 91,
TokenCppKind_PPConcat = 92,
TokenCppKind_Void = 93,
TokenCppKind_Bool = 94,
TokenCppKind_Char = 95,
TokenCppKind_Int = 96,
TokenCppKind_Float = 97,
TokenCppKind_Double = 98,
TokenCppKind_Long = 99,
TokenCppKind_Short = 100,
TokenCppKind_Unsigned = 101,
TokenCppKind_Signed = 102,
TokenCppKind_Const = 103,
TokenCppKind_Volatile = 104,
TokenCppKind_Asm = 105,
TokenCppKind_Break = 106,
TokenCppKind_Case = 107,
TokenCppKind_Catch = 108,
TokenCppKind_Continue = 109,
TokenCppKind_Default = 110,
TokenCppKind_Do = 111,
TokenCppKind_Else = 112,
TokenCppKind_For = 113,
TokenCppKind_Goto = 114,
TokenCppKind_If = 115,
TokenCppKind_Return = 116,
TokenCppKind_Switch = 117,
TokenCppKind_Try = 118,
TokenCppKind_While = 119,
TokenCppKind_StaticAssert = 120,
TokenCppKind_ConstCast = 121,
TokenCppKind_DynamicCast = 122,
TokenCppKind_ReinterpretCast = 123,
TokenCppKind_StaticCast = 124,
TokenCppKind_Class = 125,
TokenCppKind_Enum = 126,
TokenCppKind_Struct = 127,
TokenCppKind_Typedef = 128,
TokenCppKind_Union = 129,
TokenCppKind_Template = 130,
TokenCppKind_Typename = 131,
TokenCppKind_Friend = 132,
TokenCppKind_Namespace = 133,
TokenCppKind_Private = 134,
TokenCppKind_Protected = 135,
TokenCppKind_Public = 136,
TokenCppKind_Using = 137,
TokenCppKind_Extern = 138,
TokenCppKind_Export = 139,
TokenCppKind_Inline = 140,
TokenCppKind_Static = 141,
TokenCppKind_Virtual = 142,
TokenCppKind_AlignAs = 143,
TokenCppKind_Explicit = 144,
TokenCppKind_NoExcept = 145,
TokenCppKind_NullPtr = 146,
TokenCppKind_Operator = 147,
TokenCppKind_Register = 148,
TokenCppKind_This = 149,
TokenCppKind_ThreadLocal = 150,
TokenCppKind_SizeOf = 151,
TokenCppKind_AlignOf = 152,
TokenCppKind_DeclType = 153,
TokenCppKind_TypeID = 154,
TokenCppKind_New = 155,
TokenCppKind_Delete = 156,
TokenCppKind_LiteralTrue = 157,
TokenCppKind_LiteralFalse = 158,
TokenCppKind_Identifier = 159,
TokenCppKind_PPInclude = 160,
TokenCppKind_PPVersion = 161,
TokenCppKind_PPDefine = 162,
TokenCppKind_PPUndef = 163,
TokenCppKind_PPIf = 164,
TokenCppKind_PPIfDef = 165,
TokenCppKind_PPIfNDef = 166,
TokenCppKind_PPElse = 167,
TokenCppKind_PPElIf = 168,
TokenCppKind_PPEndIf = 169,
TokenCppKind_PPError = 170,
TokenCppKind_PPImport = 171,
TokenCppKind_PPUsing = 172,
TokenCppKind_PPLine = 173,
TokenCppKind_PPPragma = 174,
TokenCppKind_PPUnknown = 175,
TokenCppKind_PPDefined = 176,
TokenCppKind_COUNT = 177,
};
char *token_cpp_kind_names[] = {
"EOF",
"Whitespace",
"LexError",
"BlockComment",
"LineComment",
"Backslash",
"LiteralInteger",
"LiteralIntegerU",
"LiteralIntegerL",
"LiteralIntegerUL",
"LiteralIntegerLL",
"LiteralIntegerULL",
"LiteralIntegerHex",
"LiteralIntegerHexU",
"LiteralIntegerHexL",
"LiteralIntegerHexUL",
"LiteralIntegerHexLL",
"LiteralIntegerHexULL",
"LiteralIntegerOct",
"LiteralIntegerOctU",
"LiteralIntegerOctL",
"LiteralIntegerOctUL",
"LiteralIntegerOctLL",
"LiteralIntegerOctULL",
"LiteralFloat32",
"LiteralFloat64",
"LiteralString",
"LiteralStringWide",
"LiteralStringUTF8",
"LiteralStringUTF16",
"LiteralStringUTF32",
"LiteralStringRaw",
"LiteralStringWideRaw",
"LiteralStringUTF8Raw",
"LiteralStringUTF16Raw",
"LiteralStringUTF32Raw",
"LiteralCharacter",
"LiteralCharacterWide",
"LiteralCharacterUTF8",
"LiteralCharacterUTF16",
"LiteralCharacterUTF32",
"PPIncludeFile",
"PPErrorMessage",
"KeywordGeneric",
"BraceOp",
"BraceCl",
"ParenOp",
"BrackOp",
"ParenCl",
"BrackCl",
"Semicolon",
"Colon",
"DotDotDot",
"ColonColon",
"PlusPlus",
"MinusMinus",
"Dot",
"Arrow",
"Plus",
"Minus",
"Not",
"Tilde",
"Star",
"And",
"DotStar",
"ArrowStar",
"Div",
"Mod",
"LeftLeft",
"RightRight",
"Compare",
"Less",
"LessEq",
"Grtr",
"GrtrEq",
"EqEq",
"NotEq",
"Xor",
"Or",
"AndAnd",
"OrOr",
"Ternary",
"Eq",
"PlusEq",
"MinusEq",
"StarEq",
"DivEq",
"ModEq",
"LeftLeftEq",
"RightRightEq",
"Comma",
"PPStringify",
"PPConcat",
"Void",
"Bool",
"Char",
"Int",
"Float",
"Double",
"Long",
"Short",
"Unsigned",
"Signed",
"Const",
"Volatile",
"Asm",
"Break",
"Case",
"Catch",
"Continue",
"Default",
"Do",
"Else",
"For",
"Goto",
"If",
"Return",
"Switch",
"Try",
"While",
"StaticAssert",
"ConstCast",
"DynamicCast",
"ReinterpretCast",
"StaticCast",
"Class",
"Enum",
"Struct",
"Typedef",
"Union",
"Template",
"Typename",
"Friend",
"Namespace",
"Private",
"Protected",
"Public",
"Using",
"Extern",
"Export",
"Inline",
"Static",
"Virtual",
"AlignAs",
"Explicit",
"NoExcept",
"NullPtr",
"Operator",
"Register",
"This",
"ThreadLocal",
"SizeOf",
"AlignOf",
"DeclType",
"TypeID",
"New",
"Delete",
"LiteralTrue",
"LiteralFalse",
"Identifier",
"PPInclude",
"PPVersion",
"PPDefine",
"PPUndef",
"PPIf",
"PPIfDef",
"PPIfNDef",
"PPElse",
"PPElIf",
"PPEndIf",
"PPError",
"PPImport",
"PPUsing",
"PPLine",
"PPPragma",
"PPUnknown",
"PPDefined",
};

View File

@ -0,0 +1,45 @@
#if !defined(FCODER_LEX_GEN_HAND_WRITTEN)
#define FCODER_LEX_GEN_HAND_WRITTEN
internal u64
lexeme_hash(u64 seed, u8 *ptr, umem size){
u64 result = 0;
for (umem i = 0; i < size; i += 1, ptr += 1){
result ^= ((*ptr) ^ result*59) + seed;
}
return(result);
}
internal Lexeme_Table_Lookup
lexeme_table_lookup(u64 *hash_array, String_Const_u8 *key_array,
Lexeme_Table_Value *value_array, i32 slot_count, u64 seed,
u8 *ptr, umem size){
Lexeme_Table_Lookup result = {};
u64 hash = lexeme_hash(seed, ptr, size);
u64 comparison_hash = hash | 1;
i32 first_index = (hash % slot_count);
i32 index = first_index;
for (;;){
if (hash_array[index] == comparison_hash){
if (string_match(SCu8(ptr, size), key_array[index])){
result.found_match = true;
result.base_kind = value_array[index].base_kind;
result.sub_kind = value_array[index].sub_kind;
break;
}
}
else if (hash_array[index] == 0){
break;
}
index += 1;
if (index == slot_count){
index = 0;
}
if (index == first_index){
break;
}
}
return(result);
}
#endif

View File

@ -0,0 +1,15 @@
#if !defined(FCODER_LEX_GEN_HAND_WRITTEN_TYPES)
#define FCODER_LEX_GEN_HAND_WRITTEN_TYPES
struct Lexeme_Table_Value{
Token_Base_Kind base_kind;
u16 sub_kind;
};
struct Lexeme_Table_Lookup{
b32 found_match;
Token_Base_Kind base_kind;
u16 sub_kind;
};
#endif

File diff suppressed because it is too large Load Diff

116
lexer_generator/pcg_basic.c Normal file
View File

@ -0,0 +1,116 @@
/*
* PCG Random Number Generation for C.
*
* Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For additional information about the PCG random number generation scheme,
* including its license and other licensing options, visit
*
* http://www.pcg-random.org
*/
/*
* This code is derived from the full C implementation, which is in turn
* derived from the canonical C++ PCG implementation. The C++ version
* has many additional features and is preferable if you can use C++ in
* your project.
*/
#include "pcg_basic.h"
// state for global RNGs
static pcg32_random_t pcg32_global = PCG32_INITIALIZER;
// pcg32_srandom(initstate, initseq)
// pcg32_srandom_r(rng, initstate, initseq):
// Seed the rng. Specified in two parts, state initializer and a
// sequence selection constant (a.k.a. stream id)
void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initstate, uint64_t initseq)
{
rng->state = 0U;
rng->inc = (initseq << 1u) | 1u;
pcg32_random_r(rng);
rng->state += initstate;
pcg32_random_r(rng);
}
void pcg32_srandom(uint64_t seed, uint64_t seq)
{
pcg32_srandom_r(&pcg32_global, seed, seq);
}
// pcg32_random()
// pcg32_random_r(rng)
// Generate a uniformly distributed 32-bit random number
uint32_t pcg32_random_r(pcg32_random_t* rng)
{
uint64_t oldstate = rng->state;
rng->state = oldstate * 6364136223846793005ULL + rng->inc;
uint32_t xorshifted = (uint32_t)(((oldstate >> 18u) ^ oldstate) >> 27u);
uint32_t rot = oldstate >> 59u;
return (xorshifted >> rot) | (xorshifted << ((-rot) & 31));
}
uint32_t pcg32_random()
{
return pcg32_random_r(&pcg32_global);
}
// pcg32_boundedrand(bound):
// pcg32_boundedrand_r(rng, bound):
// Generate a uniformly distributed number, r, where 0 <= r < bound
uint32_t pcg32_boundedrand_r(pcg32_random_t* rng, uint32_t bound)
{
// To avoid bias, we need to make the range of the RNG a multiple of
// bound, which we do by dropping output less than a threshold.
// A naive scheme to calculate the threshold would be to do
//
// uint32_t threshold = 0x100000000ull % bound;
//
// but 64-bit div/mod is slower than 32-bit div/mod (especially on
// 32-bit platforms). In essence, we do
//
// uint32_t threshold = (0x100000000ull-bound) % bound;
//
// because this version will calculate the same modulus, but the LHS
// value is less than 2^32.
uint32_t threshold = -bound % bound;
// Uniformity guarantees that this loop will terminate. In practice, it
// should usually terminate quickly; on average (assuming all bounds are
// equally likely), 82.25% of the time, we can expect it to require just
// one iteration. In the worst case, someone passes a bound of 2^31 + 1
// (i.e., 2147483649), which invalidates almost 50% of the range. In
// practice, bounds are typically small and only a tiny amount of the range
// is eliminated.
for (;;) {
uint32_t r = pcg32_random_r(rng);
if (r >= threshold)
return r % bound;
}
}
uint32_t pcg32_boundedrand(uint32_t bound)
{
return pcg32_boundedrand_r(&pcg32_global, bound);
}

View File

@ -0,0 +1,78 @@
/*
* PCG Random Number Generation for C.
*
* Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For additional information about the PCG random number generation scheme,
* including its license and other licensing options, visit
*
* http://www.pcg-random.org
*/
/*
* This code is derived from the full C implementation, which is in turn
* derived from the canonical C++ PCG implementation. The C++ version
* has many additional features and is preferable if you can use C++ in
* your project.
*/
#ifndef PCG_BASIC_H_INCLUDED
#define PCG_BASIC_H_INCLUDED 1
#include <inttypes.h>
#if __cplusplus
extern "C" {
#endif
struct pcg_state_setseq_64 { // Internals are *Private*.
uint64_t state; // RNG state. All values are possible.
uint64_t inc; // Controls which RNG sequence (stream) is
// selected. Must *always* be odd.
};
typedef struct pcg_state_setseq_64 pcg32_random_t;
// If you *must* statically initialize it, here's one.
#define PCG32_INITIALIZER { 0x853c49e6748fea9bULL, 0xda3e39cb94b95bdbULL }
// pcg32_srandom(initstate, initseq)
// pcg32_srandom_r(rng, initstate, initseq):
// Seed the rng. Specified in two parts, state initializer and a
// sequence selection constant (a.k.a. stream id)
void pcg32_srandom(uint64_t initstate, uint64_t initseq);
void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initstate,
uint64_t initseq);
// pcg32_random()
// pcg32_random_r(rng)
// Generate a uniformly distributed 32-bit random number
uint32_t pcg32_random(void);
uint32_t pcg32_random_r(pcg32_random_t* rng);
// pcg32_boundedrand(bound):
// pcg32_boundedrand_r(rng, bound):
// Generate a uniformly distributed number, r, where 0 <= r < bound
uint32_t pcg32_boundedrand(uint32_t bound);
uint32_t pcg32_boundedrand_r(pcg32_random_t* rng, uint32_t bound);
#if __cplusplus
}
#endif
#endif // PCG_BASIC_H_INCLUDED

View File

@ -467,11 +467,6 @@ build_and_run(Arena *arena, char *cdir, char *filename, char *name, u32 flags){
}
}
internal void
fsm_generator(Arena *arena, char *cdir){
build_and_run(arena, cdir, "meta/4ed_fsm_table_generator.cpp", "fsmgen", OPTS | DEBUG_INFO);
}
internal void
string_build(Arena *arena, char *cdir){
char *dir = fm_str(arena, BUILD_DIR);
@ -574,8 +569,6 @@ build_main(Arena *arena, char *cdir, b32 update_local_theme, u32 flags, u32 arch
internal void
standard_build(Arena *arena, char *cdir, u32 flags, u32 arch){
//fsm_generator(arena, cdir);
//do_buildsuper(arena, cdir, fm_str(arena, custom_files[Custom_Default]), arch);
do_buildsuper(arena, cdir, fm_str(arena, custom_files[Custom_Experiments]), arch);
//do_buildsuper(arena, cdir, fm_str(arena, custom_files[Custom_Casey]), arch);
@ -602,8 +595,6 @@ get_4coder_dist_name(Arena *arena, u32 platform, char *tier, u32 arch){
internal void
package(Arena *arena, char *cdir){
// NOTE(allen): meta
fsm_generator(arena, cdir);
char *build_dir = fm_str(arena, BUILD_DIR);
char *pack_dir = fm_str(arena, PACK_DIR);
char *fonts_source_dir = fm_str(arena, "../4coder-non-source/dist_files/fonts");

View File

@ -1,988 +0,0 @@
/*
* FSM table generator:
* Generate FSM tables as ".c" files from FSM functions.
*
* 23.03.2016 (dd.mm.yyyy)
*/
// TOP
#include "../4coder_base_types.h"
#include "../4coder_base_types.cpp"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define LEXER_TABLE_FILE "4coder_lib/4cpp_lexer_tables.c"
#include "../4coder_lib/4cpp_lexer_types.h"
#include "../4ed_mem.cpp"
struct Whitespace_FSM{
unsigned char pp_state;
unsigned char white_done;
};
Whitespace_FSM
whitespace_skip_fsm(Whitespace_FSM wfsm, char c){
if (wfsm.pp_state != LSPP_default){
if (c == '\n') wfsm.pp_state = LSPP_default;
}
if (!(c == ' ' || c == '\n' || c == '\t' || c == '\r' || c == '\f' || c == '\v')){
wfsm.white_done = 1;
}
return(wfsm);
}
#define FSM_SIG(n) Cpp_Lex_FSM n(Cpp_Lex_FSM fsm, char c, b32 get_flags)
typedef FSM_SIG(FSM_Function);
FSM_SIG(int_fsm){
switch (fsm.state){
case LSINT_default:
{
switch (c){
case 'u': case 'U': fsm.state = LSINT_u; break;
case 'l': fsm.state = LSINT_l; break;
case 'L': fsm.state = LSINT_L; break;
default: fsm.emit_token = true; break;
}
}break;
case LSINT_u:
{
switch (c){
case 'l': fsm.state = LSINT_ul; break;
case 'L': fsm.state = LSINT_uL; break;
default: fsm.emit_token = true; break;
}
}break;
case LSINT_l:
{
switch (c){
case 'l': fsm.state = LSINT_ll; break;
case 'U': case 'u': fsm.state = LSINT_extra; break;
default: fsm.emit_token = true; break;
}
}break;
case LSINT_L:
{
switch (c){
case 'L': fsm.state = LSINT_ll; break;
case 'U': case 'u': fsm.state = LSINT_extra; break;
default: fsm.emit_token = true; break;
}
}break;
case LSINT_ul:
{
switch (c){
case 'l': fsm.state = LSINT_extra; break;
default: fsm.emit_token = true; break;
}
}break;
case LSINT_uL:
{
switch (c){
case 'L': fsm.state = LSINT_extra; break;
default: fsm.emit_token = true; break;
}
}break;
case LSINT_ll:
{
switch (c){
case 'u': case 'U': fsm.state = LSINT_extra; break;
default: fsm.emit_token = true; break;
}
}break;
case LSINT_extra:
fsm.emit_token = true;
break;
}
return(fsm);
}
FSM_SIG(normal_str_fsm){
if (!get_flags){
switch (fsm.state){
case LSSTR_default:
case LSSTR_multiline:
{
switch (c){
case '\n': case 0: fsm.state = LSSTR_error; fsm.emit_token = true; break;
case '\\': fsm.state = LSSTR_escape; break;
case '"': fsm.emit_token = true; break;
default: break;
}
}break;
case LSSTR_escape:
{
switch (c){
case '\n': fsm.state = LSSTR_multiline; break;
default: fsm.state = LSSTR_default; break;
}
}break;
}
}
else{
switch (fsm.state){
case LSSTR_multiline:
{
fsm.flags = 1;
}break;
}
}
return(fsm);
}
FSM_SIG(normal_char_fsm){
if (!get_flags){
switch (fsm.state){
case LSSTR_default:
case LSSTR_multiline:
{
switch (c){
case '\n': case 0: fsm.state = LSSTR_error; fsm.emit_token = true; break;
case '\\': fsm.state = LSSTR_escape; break;
case '\'': fsm.emit_token = true; break;
default: break;
}
}break;
case LSSTR_escape:
{
switch (c){
case '\n': fsm.state = LSSTR_multiline; break;
default: fsm.state = LSSTR_default; break;
}
}break;
}
}
else{
switch (fsm.state){
case LSSTR_multiline:
{
fsm.flags = 1;
}break;
}
}
return(fsm);
}
FSM_SIG(raw_str_fsm){
if (!get_flags){
switch (fsm.state){
case LSSTR_default:
{
switch (c){
case 0: case ')': case '\\': case ' ': case '\n': fsm.emit_token = true; break;
case '(': fsm.state = LSSTR_get_delim; fsm.emit_token = true; break;
default: break;
}
}break;
case LSSTR_get_delim:
case LSSTR_multiline:
{
switch (c){
case '\n': fsm.state = LSSTR_multiline; break;
case 0: case '"': fsm.state = LSSTR_check_delim; fsm.emit_token = true; break;
default: break;
}
}break;
}
}
else{
switch (fsm.state){
case LSSTR_multiline:
{
fsm.flags = 1;
}break;
}
}
return(fsm);
}
FSM_SIG(include_str_fsm){
switch (fsm.state){
case LSSTR_default:
{
switch (c){
case '\n': case 0: fsm.state = LSSTR_error; fsm.emit_token = true; break;
case '>': fsm.emit_token = true; break;
default: break;
}
}break;
}
return(fsm);
}
b32
is_identifier_char(u8 c, b32 ignore_string_delims){
b32 result = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || c == '$' || c >= 128 || (ignore_string_delims && (c == '\'' || c == '"'));
return(result);
}
b32
is_identifier_char_restricted(u8 c, b32 ignore_string_delims){
b32 result = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c >= 128 || (ignore_string_delims && (c == '\'' || c == '"'));
return(result);
}
b32
is_identifier_char_non_numeric(u8 c, b32 ignore_string_delims){
b32 result = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || c == '$' || c >= 128 || (ignore_string_delims && (c == '\'' || c == '"'));
return(result);
}
Cpp_Lex_FSM
main_fsm(Cpp_Lex_FSM fsm, uint8_t pp_state, uint8_t c, b32 ignore_string_delims){
if (c == 0){
switch (fsm.state){
case LS_string_R:
case LS_string_LUu8:
case LS_string_u:
{
fsm.state = LS_identifier;
}break;
}
fsm.emit_token = true;
}
else{
switch (pp_state){
case LSPP_error:
{
fsm.state = LS_error_message;
if (c == '\n'){
fsm.emit_token = true;
}
}break;
default:
switch (fsm.state){
case LS_default:
if (!ignore_string_delims && c == 'R'){
fsm.state = LS_string_R;
}
else if (!ignore_string_delims && (c == 'U' || c == 'L')){
fsm.state = LS_string_LUu8;
}
else if (!ignore_string_delims && c == 'u'){
fsm.state = LS_string_u;
}
else if (is_identifier_char_non_numeric(c, ignore_string_delims)){
fsm.state = LS_identifier;
}
else if (c >= '1' && c <= '9'){
fsm.state = LS_number;
}
else if (c == '0'){
fsm.state = LS_number0;
}
else{
switch (c){
case '\'':
{
if (ignore_string_delims){
fsm.state = LS_identifier;
}
else{
fsm.state = LS_char;
fsm.emit_token = true;
}
}break;
case '"':
{
if (ignore_string_delims){
fsm.state = LS_identifier;
}
else{
fsm.state = LS_string_normal;
fsm.emit_token = true;
}
}break;
case '/': fsm.state = LS_comment_pre; break;
case '.': fsm.state = LS_dot; break;
case '<':
if (pp_state == LSPP_include && !ignore_string_delims){
fsm.state = LS_string_include;
fsm.emit_token = true;
}
else{
fsm.state = LS_less;
}
break;
case '>': fsm.state = LS_more; break;
case '-': fsm.state = LS_minus; break;
case '&': fsm.state = LS_and; break;
case '|': fsm.state = LS_or; break;
case '+': fsm.state = LS_plus; break;
case ':': fsm.state = LS_colon; break;
case '*': case '%': case '^': case '=':
case '!': fsm.state = LS_single_op; break;
case '#':
if (pp_state == LSPP_default){
fsm.state = LS_pp;
}
else{
fsm.state = LS_pound;
}
break;
#define OperCase(op,type) case op: fsm.emit_token = true; break;
OperCase('{', CPP_TOKEN_BRACE_OPEN);
OperCase('}', CPP_TOKEN_BRACE_CLOSE);
OperCase('[', CPP_TOKEN_BRACKET_OPEN);
OperCase(']', CPP_TOKEN_BRACKET_CLOSE);
OperCase('(', CPP_TOKEN_PARENTHESE_OPEN);
OperCase(')', CPP_TOKEN_PARENTHESE_CLOSE);
OperCase('~', CPP_TOKEN_TILDE);
OperCase(',', CPP_TOKEN_COMMA);
OperCase(';', CPP_TOKEN_SEMICOLON);
OperCase('?', CPP_TOKEN_TERNARY_QMARK);
OperCase('@', CPP_TOKEN_JUNK);
OperCase('\\', CPP_TOKEN_JUNK);
#undef OperCase
}
}
break;
case LS_identifier:
{
b32 is_ident = is_identifier_char(c, ignore_string_delims);
if (!is_ident){
fsm.emit_token = true;
}
}
break;
case LS_pound:
{
fsm.emit_token = true;
}break;
case LS_pp:
{
if (c == ' ' || c == '\r' || c == '\v' || c == '\f'){
// NOTE(allen): do nothing
}
else if (is_identifier_char_restricted(c, ignore_string_delims)){
fsm.state = LS_ppdef;
}
else{
fsm.emit_token = true;
}
}break;
case LS_ppdef:
{
int is_ident = is_identifier_char_restricted(c, ignore_string_delims);
if (!is_ident){
fsm.emit_token = true;
}
}break;
case LS_string_R:
{
if (ignore_string_delims){
fsm.state = LS_count;
fsm.emit_token = true;
}
else{
switch (c){
case '"': fsm.state = LS_string_raw; fsm.emit_token = true; break;
default:
{
fsm.state = LS_identifier;
b32 is_ident = is_identifier_char(c, ignore_string_delims);
if (!is_ident){
fsm.emit_token = true;
}
}break;
}
}
}break;
case LS_string_LUu8:
{
if (ignore_string_delims){
fsm.state = LS_count;
fsm.emit_token = true;
}
else{
switch (c){
case '"': fsm.state = LS_string_normal; fsm.emit_token = true; break;
case '\'': fsm.state = LS_char; fsm.emit_token = true; break;
case 'R': fsm.state = LS_string_R; break;
default:
{
fsm.state = LS_identifier;
b32 is_ident = is_identifier_char(c, ignore_string_delims);
if (!is_ident){
fsm.emit_token = true;
}
}break;
}
}
}break;
case LS_string_u:
{
if (ignore_string_delims){
fsm.state = LS_count;
fsm.emit_token = true;
}
else{
switch (c){
case '"': fsm.state = LS_string_normal; fsm.emit_token = true; break;
case '\'': fsm.state = LS_char; fsm.emit_token = true; break;
case '8': fsm.state = LS_string_LUu8; break;
case 'R': fsm.state = LS_string_R; break;
default:
{
fsm.state = LS_identifier;
b32 is_ident = is_identifier_char(c, ignore_string_delims);
if (!is_ident){
fsm.emit_token = true;
}
}break;
}
}
}break;
case LS_number:
if (c >= '0' && c <= '9'){
fsm.state = LS_number;
}
else{
switch (c){
case '.': fsm.state = LS_float; break;
default: fsm.emit_token = true; break;
}
}
break;
case LS_number0:
if (c >= '0' && c <= '9'){
fsm.state = LS_number;
}
else if (c == 'x'){
fsm.state = LS_hex;
}
else if (c == '.'){
fsm.state = LS_float;
}
else{
fsm.emit_token = true;
}
break;
case LS_float:
if (!(c >= '0' && c <= '9')){
switch (c){
case 'e': fsm.state = LS_crazy_float0; break;
default: fsm.emit_token = true; break;
}
}
break;
case LS_crazy_float0:
{
if (('0' <= c && c <= '9') || c == '-' || c == '+'){
fsm.state = LS_crazy_float1;
}
else{
fsm.emit_token = true;
}
}
break;
case LS_crazy_float1:
{
if (!(c >= '0' && c <= '9')){
fsm.emit_token = true;
}
}
break;
case LS_hex:
{
int is_hex = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') || c >= 128;
if (!is_hex){
fsm.emit_token = true;
}
}break;
case LS_dot:
{
if (c >= '0' && c <= '9'){
fsm.state = LS_float;
}
else{
switch (c){
case '.': fsm.state = LS_ellipsis; break;
case '*': fsm.emit_token = true; break;
default: fsm.emit_token = true; break;
}
}
}break;
case LS_ellipsis: fsm.emit_token = true; break;
case LS_less:
{
switch (c){
case '<': fsm.state = LS_single_op; break;
case '=': fsm.emit_token = true; break;
default: fsm.emit_token = true; break;
}
}break;
case LS_more:
{
switch (c){
case '>': fsm.state = LS_single_op; break;
case '=': fsm.emit_token = true; break;
default: fsm.emit_token = true; break;
}
}break;
case LS_comment_pre:
{
switch (c){
case '/': fsm.state = LS_comment; break;
case '*': fsm.state = LS_comment_block; break;
case '=': fsm.emit_token = true; break;
default: fsm.emit_token = true; break;
}
}break;
case LS_comment:
{
switch (c){
case '\\': fsm.state = LS_comment_slashed; break;
case '\n': fsm.emit_token = true; break;
}
}break;
case LS_comment_slashed:
{
switch (c){
case '\r': case '\f': case '\v': break;
default: fsm.state = LS_comment; break;
}
}break;
case LS_comment_block:
{
switch (c){
case '*': fsm.state = LS_comment_block_ending; break;
}
}break;
case LS_comment_block_ending:
{
switch (c){
case '*': fsm.state = LS_comment_block_ending; break;
case '/': fsm.emit_token = true; break;
default: fsm.state = LS_comment_block; break;
}
}break;
case LS_minus:
{
switch (c){
case '>': fsm.state = LS_arrow; break;
case '-': fsm.emit_token = true; break;
case '=': fsm.emit_token = true; break;
default: fsm.emit_token = true; break;
}
}break;
case LS_arrow:
{
switch (c){
case '*': fsm.emit_token = true; break;
default: fsm.emit_token = true; break;
}
}break;
case LS_and:
switch (c){
case '&': fsm.emit_token = true; break;
case '=': fsm.emit_token = true; break;
default: fsm.emit_token = true; break;
}
break;
case LS_or:
{
switch (c){
case '|': fsm.emit_token = true; break;
case '=': fsm.emit_token = true; break;
default: fsm.emit_token = true; break;
}
}break;
case LS_plus:
{
switch (c){
case '+': fsm.emit_token = true; break;
case '=': fsm.emit_token = true; break;
default: fsm.emit_token = true; break;
}
}break;
case LS_colon:
{
switch (c){
case ':': fsm.emit_token = true; break;
default: fsm.emit_token = true; break;
}
}break;
case LS_single_op:
{
switch (c){
case '=': fsm.emit_token = true; break;
default: fsm.emit_token = true; break;
}
}break;
}
break;
}
}
return(fsm);
}
static void
begin_table(FILE *file, char *type, char *group_name, char *table_name){
fprintf(file, "%s %s_%s[] = {\n", type, group_name, table_name);
}
static void
begin_table(FILE *file, char *type, char *table_name){
fprintf(file, "%s %s[] = {\n", type, table_name);
}
static void
begin_ptr_table(FILE *file, char *type, char *table_name){
fprintf(file, "%s * %s[] = {\n", type, table_name);
}
static void
do_table_item(FILE *file, uint16_t item){
fprintf(file, "%3d,", (int32_t)item);
}
static void
do_table_item_binary(FILE *file, uint16_t item){
if (item == 0){
fprintf(file, "0x00,");
}
else{
fprintf(file, "%#04x,", item);
}
}
static void
do_table_item_direct(FILE *file, char *item, char *tail){
fprintf(file, "%s%s,", item, tail);
}
static void
end_row(FILE *file){
fprintf(file, "\n");
}
static void
end_table(FILE *file){
fprintf(file, "};\n\n");
}
struct FSM_Tables{
u8 *full_transition_table;
u8 *marks;
u8 *eq_class;
u8 *eq_class_rep;
u8 *reduced_transition_table;
u8 *flags;
u8 eq_class_counter;
u16 state_count;
};
static void
allocate_full_tables(FSM_Tables *table, uint8_t state_count){
table->full_transition_table = (uint8_t*)malloc(state_count * 256);
table->marks = (uint8_t*)malloc(state_count * 256);
table->eq_class = (uint8_t*)malloc(state_count * 256);
table->eq_class_rep = (uint8_t*)malloc(state_count * 256);
table->state_count = state_count;
block_zero(table->marks, 256);
}
static void
do_table_reduction(FSM_Tables *table, uint16_t state_count){
{
table->eq_class_counter = 0;
uint8_t *c_line = table->full_transition_table;
for (uint16_t c = 0; c < 256; ++c){
if (table->marks[c] == 0){
table->eq_class[c] = table->eq_class_counter;
table->eq_class_rep[table->eq_class_counter] = (uint8_t)c;
uint8_t *c2_line = c_line + state_count;
for (uint16_t c2 = c + 1; c2 < 256; ++c2){
if (block_compare(c_line, c2_line, state_count) == 0){
table->marks[c2] = 1;
table->eq_class[c2] = table->eq_class_counter;
}
c2_line += state_count;
}
++table->eq_class_counter;
}
c_line += state_count;
}
}
table->reduced_transition_table = (uint8_t*)malloc(state_count * table->eq_class_counter);
{
uint8_t *r_line = table->reduced_transition_table;
for (uint16_t eq = 0; eq < table->eq_class_counter; ++eq){
uint8_t *u_line = table->full_transition_table + state_count * table->eq_class_rep[eq];
block_copy(r_line, u_line, state_count);
r_line += state_count;
}
}
}
static FSM_Tables
generate_whitespace_skip_table(){
uint8_t state_count = LSPP_count;
FSM_Tables table = {};
allocate_full_tables(&table, state_count);
int32_t i = 0;
Whitespace_FSM wfsm = {};
Whitespace_FSM new_wfsm;
for (uint16_t c = 0; c < 256; ++c){
for (uint8_t state = 0; state < state_count; ++state){
wfsm.pp_state = state;
wfsm.white_done = 0;
new_wfsm = whitespace_skip_fsm(wfsm, (uint8_t)c);
table.full_transition_table[i++] = new_wfsm.pp_state + state_count*new_wfsm.white_done;
}
}
do_table_reduction(&table, state_count);
return(table);
}
static FSM_Tables
generate_table(u8 state_count, FSM_Function *fsm_call){
FSM_Tables table = {};
allocate_full_tables(&table, state_count);
i32 i = 0;
Cpp_Lex_FSM fsm = {};
Cpp_Lex_FSM new_fsm = {};
for (uint16_t c = 0; c < 256; ++c){
for (u8 state = 0; state < state_count; ++state){
fsm.state = state;
fsm.emit_token = false;
new_fsm = fsm_call(fsm, (u8)c, false);
table.full_transition_table[i++] = new_fsm.state + state_count*new_fsm.emit_token;
}
}
for (u8 state = 0; state < state_count; ++state){
fsm.state = state;
fsm.emit_token = false;
fsm.flags = 0;
new_fsm = fsm_call(fsm, 0, true);
if (new_fsm.flags != 0){
if (table.flags == 0){
table.flags = (u8*)malloc(state_count);
memset(table.flags, 0, state_count);
}
table.flags[state] = new_fsm.flags;
}
}
do_table_reduction(&table, state_count);
return(table);
}
static FSM_Tables
generate_fsm_table(uint8_t pp_state, b32 ignore_string_delims){
uint8_t state_count = LS_count;
FSM_Tables table = {};
allocate_full_tables(&table, state_count);
int32_t i = 0;
Cpp_Lex_FSM fsm = {};
Cpp_Lex_FSM new_fsm = {};
for (uint16_t c = 0; c < 256; ++c){
for (uint8_t state = 0; state < state_count; ++state){
fsm.state = state;
fsm.emit_token = false;
new_fsm = main_fsm(fsm, pp_state, (uint8_t)c, ignore_string_delims);
table.full_transition_table[i++] = new_fsm.state + state_count*new_fsm.emit_token;
}
}
do_table_reduction(&table, state_count);
return(table);
}
static void
render_fsm_table(FILE *file, FSM_Tables tables, char *group_name){
begin_table(file, "u16", group_name, "eq_classes");
for (u16 c = 0; c < 256; ++c){
if ((c % 16) == 0 && c > 0){
end_row(file);
}
do_table_item(file, tables.eq_class[c]*tables.state_count);
}
end_row(file);
end_table(file);
fprintf(file, "const i32 num_%s_eq_classes = %d;\n\n", group_name, tables.eq_class_counter);
i32 i = 0;
begin_table(file, "u8", group_name, "table");
for (u16 c = 0; c < tables.eq_class_counter; ++c){
for (u8 state = 0; state < tables.state_count; ++state){
do_table_item(file, tables.reduced_transition_table[i++]);
}
end_row(file);
}
end_table(file);
if (tables.flags != 0){
begin_table(file, "u8", group_name, "flags");
for (u8 state = 0; state < tables.state_count; ++state){
if ((state % 4) == 0 && state > 0){
end_row(file);
}
do_table_item_binary(file, tables.flags[state]);
}
end_row(file);
end_table(file);
}
}
static void
render_variable(FILE *file, char *type, char *variable, uint32_t x){
fprintf(file, "%s %s = %d;\n\n", type, variable, x);
}
static void
render_comment(FILE *file, char *comment){
fprintf(file, "/*\n%s*/\n", comment);
}
struct PP_Names{
uint8_t pp_state;
char *name;
b32 ignore_string_delims;
};
static PP_Names pp_names[] = {
{LSPP_default, "main_fsm", false},
{LSPP_include, "pp_include_fsm", false},
{LSPP_macro_identifier, "pp_macro_fsm", false},
{LSPP_identifier, "pp_identifier_fsm", false},
{LSPP_body_if, "pp_body_if_fsm", false},
{LSPP_body, "pp_body_fsm", false},
{LSPP_number, "pp_number_fsm", false},
{LSPP_error, "pp_error_fsm", false},
{LSPP_junk, "pp_junk_fsm", false},
{LSPP_default, "no_string_fsm", true },
};
int
main(){
FILE *file = fopen(LEXER_TABLE_FILE, "wb");
FSM_Tables wtables = generate_whitespace_skip_table();
render_fsm_table(file, wtables, "whitespace_fsm");
FSM_Tables itables = generate_table(LSINT_count, int_fsm);
render_fsm_table(file, itables, "int_fsm");
{
struct{
char *name;
uint8_t count;
FSM_Function *fsm_call;
} static tables[] = {
{"raw_str", LSSTR_count, raw_str_fsm },
{"normal_str", LSSTR_count, normal_str_fsm },
{"include_str", LSSTR_include_count, include_str_fsm },
{"normal_char", LSSTR_count, normal_char_fsm }
};
for (u32 i = 0; i < ArrayCount(tables); ++i){
FSM_Tables str_tables = generate_table(tables[i].count, tables[i].fsm_call);
render_fsm_table(file, str_tables, tables[i].name);
}
}
for (int32_t i = 0; i < ArrayCount(pp_names); ++i){
FSM_Tables tables = generate_fsm_table(pp_names[i].pp_state, pp_names[i].ignore_string_delims);
render_fsm_table(file, tables, pp_names[i].name);
}
begin_ptr_table(file, "uint16_t", "get_eq_classes");
for (int32_t i = 0; i < ArrayCount(pp_names); ++i){
do_table_item_direct(file, pp_names[i].name, "_eq_classes");
end_row(file);
}
end_table(file);
begin_ptr_table(file, "uint8_t", "get_table");
for (int32_t i = 0; i < ArrayCount(pp_names); ++i){
do_table_item_direct(file, pp_names[i].name, "_table");
end_row(file);
}
end_table(file);
fclose(file);
return(0);
}
// BOTTOM

View File

@ -72,13 +72,28 @@ command_list = {
{ .name = "run pinky one time",
.out = "*run*", .footer_panel = false, .save_dirty_files = false,
.cmd = { { "pushd ..\\..\\pinky\\build & one_time", .os = "win" }, }, },
{ .name = "run generator",
.out = "*run*", .footer_panel = false, .save_dirty_files = true,
.cmd = { { "..\\build\\generator", .os = "win" }, }, },
{ .name = "build C++ lexer generator",
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
.cmd = { { "build_generator 4coder_lex_gen_cpp.cpp ..\\build", .os = "win" }, }, },
{ .name = "build token tester",
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
.cmd = { { "build_generator languages\\4coder_lexer_cpp_test.cpp ..\\build", .os = "win" }, }, }
};
fkey_command[1] = "build x64";
fkey_command[3] = "build x86";
fkey_command[4] = "build metadata";
fkey_command[5] = "build config parser generator";
fkey_command[6] = "generate config parser";
//fkey_command[1] = "build x64";
//fkey_command[3] = "build x86";
//fkey_command[4] = "build metadata";
fkey_command[1] = "build C++ lexer generator";
fkey_command[2] = "build token tester";
fkey_command[3] = "run generator";
fkey_command[9] = "build one time";
fkey_command[10] = "run one time";
fkey_command[12] = "package";