From cf142a57ea93d1cdabf8ff514454cbc7d6eda689 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 29 May 2017 12:02:25 -0400 Subject: [PATCH] fixed bug with relex index, turned off debug memory --- 4cpp/4cpp_lexer.h | 11 ++++++----- 4ed_app_target.cpp | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/4cpp/4cpp_lexer.h b/4cpp/4cpp_lexer.h index 0cbb80b8..5a348146 100644 --- a/4cpp/4cpp_lexer.h +++ b/4cpp/4cpp_lexer.h @@ -1361,10 +1361,7 @@ DOC_PARAM(array, A pointer to the token array that will be modified by the relex this array should already contain the tokens for the previous state of the file.) DOC_PARAM(start_pos, The start position of the edited region of the file. The start and end points are based on the edited region of the file before the edit.) -DOC_PARAM(end_pos, The end position of the edited region of the file. -In particular, end_pos is the first character after the edited region not effected by the edit. -Thus if the edited region contained one character end_pos - start_pos should equal 1. -The start and end points are based on the edited region of the file before the edit.) +DOC_PARAM(end_pos, The end position of the edited region of the file. In particular, end_pos is the first character after the edited region not effected by the edit. Thus if the edited region contained one character end_pos - start_pos should equal 1. The start and end points are based on the edited region of the file before the edit.) */{ Cpp_Relex_Range range = {0}; Cpp_Get_Token_Result get_result = {0}; @@ -1377,7 +1374,11 @@ The start and end points are based on the edited region of the file before the e get_result = cpp_get_token(*array, end_pos); range.end_token_index = get_result.token_index; - if (end_pos > array->tokens[range.end_token_index].start){ + i32_4tech token_start = 0; + if (range.end_token_index >= 0){ + token_start = array->tokens[range.end_token_index].start; + } + if (end_pos > token_start){ ++range.end_token_index; } if (range.end_token_index < 0){ diff --git a/4ed_app_target.cpp b/4ed_app_target.cpp index b6160a5b..67eddfd0 100644 --- a/4ed_app_target.cpp +++ b/4ed_app_target.cpp @@ -22,7 +22,7 @@ #include "4ed_system.h" #include "4ed_profile.h" -#define USE_DEBUG_MEMORY +//#define USE_DEBUG_MEMORY #define FSTRING_IMPLEMENTATION #define FSTRING_C