Skip to content

Commit

Permalink
Change: Allow spaces in functions
Browse files Browse the repository at this point in the history
  • Loading branch information
p4plus2 committed Oct 4, 2023
1 parent baac3ff commit fe6cb12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/asar/arch-65816.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bool asblock_65816(char** word, int numwords)
for(int i = 1; i < numwords; i++){
if(i > 1) par += " ";
par += word[i];
}
}
unsigned int num;
int len=0;//declared here for A->generic fallback
bool explicitlen = false;
Expand Down
11 changes: 9 additions & 2 deletions src/asar/assembleblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2359,7 +2359,7 @@ void assembleblock(const char * block, int& single_line_for_tracker)
thetable=tablestack[tablestack.count-1];
tablestack.remove(tablestack.count-1);
}
else if (is3("function"))
else if (is("function") && numwords >= 3)
{
if (stricmp(word[2], "=")) asar_throw_error(0, error_type_block, error_id_broken_function_declaration);
if (!confirmqpar(word[1])) asar_throw_error(0, error_type_block, error_id_broken_function_declaration);
Expand All @@ -2374,7 +2374,14 @@ void assembleblock(const char * block, int& single_line_for_tracker)
//confirmqpar requires that all parentheses are matched, and a starting one exists, therefore it is harmless to not check for nulls
if (endpar[1]) asar_throw_error(0, error_type_block, error_id_broken_function_declaration);
*endpar=0;
createuserfunc(line, startpar, word[3]);

string pars;
for(int i = 3; i < numwords; i++){
if(i > 3) pars += " ";
pars += word[i];
}

createuserfunc(line, startpar, pars.data());
}
else if (is1("print"))
{
Expand Down

0 comments on commit fe6cb12

Please sign in to comment.