mirror of
https://github.com/ksherlock/x65.git
synced 2025-04-09 02:37:07 +00:00
Macros can use strings
This commit is contained in:
parent
842b68b342
commit
9e542033b8
19
struse.h
19
struse.h
@ -590,6 +590,7 @@ public:
|
||||
strref split_token_trim(char c);
|
||||
strref split_token_any_trim(const strref chars);
|
||||
strref split_token_track_parens(char c);
|
||||
strref split_token_track_parens_quote(char c);
|
||||
strref split_token_trim_track_parens(char c);
|
||||
strref split_range(const strref range, strl_t pos=0);
|
||||
strref split_range_trim(const strref range, strl_t pos=0);
|
||||
@ -4162,6 +4163,24 @@ strref strref::split_token_track_parens(char c)
|
||||
return r;
|
||||
}
|
||||
|
||||
strref strref::split_token_track_parens_quote(char c)
|
||||
{
|
||||
if (length>=2 && string[0] == '"') {
|
||||
strl_t o = 1;
|
||||
while (o < length && string[o] != '"') { ++o; }
|
||||
if (o < length) {
|
||||
strref r = strref(string, o + 1);
|
||||
*this += o + 1;
|
||||
return r;
|
||||
}
|
||||
}
|
||||
int t = find_skip_parens(c);
|
||||
if (t < 0) t = (int)length;
|
||||
strref r = strref(string, strl_t(t));
|
||||
*this += t + 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
strref strref::split_token_any( const strref chars )
|
||||
{
|
||||
strref r; int t = find_any_char_of( chars );
|
||||
|
6
x65.cpp
6
x65.cpp
@ -3421,8 +3421,8 @@ StatusCode Asm::BuildMacro(Macro &m, strref arg_list) {
|
||||
strref pchk = params;
|
||||
strref arg = arg_list;
|
||||
int dSize = 0;
|
||||
char token = arg_list.find(',')>=0 ? ',' : ' ';
|
||||
char token_macro = m.params_first_line && params.find(',') < 0 ? ' ' : ',';
|
||||
char token = ',';// arg_list.find(',') >= 0 ? ',' : ' ';
|
||||
char token_macro = ',';// m.params_first_line&& params.find(',') < 0 ? ' ' : ',';
|
||||
while (strref param = pchk.split_token_trim(token_macro)) {
|
||||
strref a = arg.split_token_trim(token);
|
||||
if (param.get_len() < a.get_len()) {
|
||||
@ -3436,7 +3436,7 @@ StatusCode Asm::BuildMacro(Macro &m, strref arg_list) {
|
||||
strovl macexp(buffer, mac_size);
|
||||
macexp.copy(macro_src);
|
||||
while (strref param = params.split_token_trim(token_macro)) {
|
||||
strref a = arg_list.split_token_trim(token);
|
||||
strref a = arg_list.split_token_track_parens_quote(token);
|
||||
macexp.replace_bookend(param, a, macro_arg_bookend);
|
||||
}
|
||||
PushContext(m.source_name, macexp.get_strref(), macexp.get_strref());
|
||||
|
Loading…
x
Reference in New Issue
Block a user