From 6804168cefd4babdc2efcff6835d7453ba5a532e Mon Sep 17 00:00:00 2001 From: ketmar Date: Sat, 27 Jun 2020 04:51:23 +0000 Subject: [PATCH] urlocase: don't translate urasm-specific tokens (unless we're doing upcase translation) FossilOrigin-Name: 0abae42d75bc093a978212b44d914e32102689829bf1b906289ee3795cebbe1f --- src/urlocase.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/urlocase.c b/src/urlocase.c index 660f664..a8994db 100644 --- a/src/urlocase.c +++ b/src/urlocase.c @@ -315,7 +315,7 @@ static int vstr_part_check_token_list (const VStr *str, size_t start, size_t len // ////////////////////////////////////////////////////////////////////////// // -#define URASM_COMMAND_TOKENS (52) +#define URASM_COMMAND_TOKENS (19) static const char *UrAsmCommands[URASM_COMMAND_TOKENS] = { "EQU", @@ -332,6 +332,21 @@ static const char *UrAsmCommands[URASM_COMMAND_TOKENS] = { "MACRO", "ENDM", // + // + "MODULE", + "ENDMODULE", + // + "IF", + "IFX", + "ELSE", + "ELSEIF", + "ELSEIFX", + "ENDIF", +}; + + +#define ASM_COMMAND_TOKENS (33) +static const char *asmCommands[ASM_COMMAND_TOKENS] = { "ORG", "DISP", "ENDDISP", @@ -348,19 +363,9 @@ static const char *UrAsmCommands[URASM_COMMAND_TOKENS] = { "INCLUDE", "INCBIN", // - "MODULE", - "ENDMODULE", - // "DUP", "EDUP", // - "IF", - "IFX", - "ELSE", - "ELSEIF", - "ELSEIFX", - "ENDIF", - // "DEFINCR", "DEFB", "DB", @@ -433,7 +438,8 @@ static void translate (VStr *text, int mode_lower) { vstr_part_check_token_list(text, pos, epos-pos, URA_REGS16, 4) || vstr_part_check_token_list(text, pos, epos-pos, URA_REGS16A, 4) || vstr_part_check_token_list(text, pos, epos-pos, URA_COND, 8) || - vstr_part_check_token_list(text, pos, epos-pos, UrAsmCommands, URASM_COMMAND_TOKENS); + vstr_part_check_token_list(text, pos, epos-pos, asmCommands, ASM_COMMAND_TOKENS) || + (!mode_lower && vstr_part_check_token_list(text, pos, epos-pos, UrAsmCommands, URASM_COMMAND_TOKENS)); /* fix case if found */ if (found) { for (; pos < epos; ++pos) { -- 2.11.4.GIT