1
0
mirror of https://github.com/ksherlock/x65.git synced 2024-06-11 16:29:31 +00:00

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 :x65macro_test_pass
echo x65 Scope Test >>results\unittest.txt 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 if %errorlevel% GTR 0 goto x65scope_test_fail
fc /B compare\x65scope.prg results\x65scope.prg >>results\unittest.txt fc /B compare\x65scope.prg results\x65scope.prg >>results\unittest.txt
if %errorlevel% GTR 0 goto x65scope_test_fail 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" include "../macros/x65macro.i"
sec sec

View File

@ -868,6 +868,7 @@ static const int nCPUs = sizeof(aCPUs) / sizeof(aCPUs[0]);
// hardtexted strings // hardtexted strings
static const strref c_comment("//"); static const strref c_comment("//");
static const strref word_char_range("!0-9a-zA-Z_@$!#"); 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("!0-9a-zA-Z_@$!.!:");
static const strref label_end_char_range_merlin("!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_!@#$%&()/\\-."); 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); macexp.copy(macro_src);
while (strref param = params.split_token_trim(token_macro)) { while (strref param = params.split_token_trim(token_macro)) {
strref a = arg_list.split_token_trim(token); 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()); PushContext(m.source_name, macexp.get_strref(), macexp.get_strref());
return STATUS_OK; return STATUS_OK;