Fixed macro issue that defines a label ending with :

This commit is contained in:
Carl-Henrik Skårstedt 2019-10-17 15:53:28 -07:00
parent d5080e925d
commit 2243803116
3 changed files with 16 additions and 2 deletions

View File

@ -74,7 +74,7 @@ goto exit
:x65macro_test_pass
echo x65 Scope Test >>results\unittest.txt
..\bin\x64\x65 x65scope.s results\x65scope.prg -lst -sym results\x65scope.sym
..\bin\x64\x65 x65scope.s results\x65scope.prg -lst -sym results\x65scope.sym >>results\unittest.txt
if %errorlevel% GTR 0 goto x65scope_test_fail
fc /B compare\x65scope.prg results\x65scope.prg >>results\unittest.txt
if %errorlevel% GTR 0 goto x65scope_test_fail

View File

@ -1,3 +1,16 @@
; Test macro defining a label
macro LabelMacro( lbl, str, len ) {
lbl:
TEXT str
const len = * - lbl
}
dc.w Label1
dc.b Label1_Len
LabelMacro Label1, "Hey!", Label1_Len
include "../macros/x65macro.i"
sec

View File

@ -868,6 +868,7 @@ static const int nCPUs = sizeof(aCPUs) / sizeof(aCPUs[0]);
// hardtexted strings
static const strref c_comment("//");
static const strref word_char_range("!0-9a-zA-Z_@$!#");
static const strref macro_arg_bookend("!0-9a-zA-Z_@$!.");
static const strref label_end_char_range("!0-9a-zA-Z_@$!.!:");
static const strref label_end_char_range_merlin("!0-9a-zA-Z_@$]:?");
static const strref filename_end_char_range("!0-9a-zA-Z_!@#$%&()/\\-.");
@ -2934,7 +2935,7 @@ StatusCode Asm::BuildMacro(Macro &m, strref arg_list) {
macexp.copy(macro_src);
while (strref param = params.split_token_trim(token_macro)) {
strref a = arg_list.split_token_trim(token);
macexp.replace_bookend(param, a, label_end_char_range);
macexp.replace_bookend(param, a, macro_arg_bookend);
}
PushContext(m.source_name, macexp.get_strref(), macexp.get_strref());
return STATUS_OK;