mirror of
https://github.com/sigmasternchen/macrofuck
synced 2025-03-15 07:08:56 +00:00
fix: macros with multiple arguments didn't work
This commit is contained in:
parent
76fb52c60c
commit
3f0b407cb3
3 changed files with 15 additions and 6 deletions
|
@ -95,13 +95,16 @@ static void handle_macro_definition(void) {
|
|||
fprintf(stderr, "preprocessor: macro: , expected, got: %s\n", yytext);
|
||||
panic("preprocessor syntax error");
|
||||
}
|
||||
} else {
|
||||
if (token != ID) {
|
||||
fprintf(stderr, "preprocessor: macro: identifier expected, got: %s\n", yytext);
|
||||
panic("preprocessor syntax error");
|
||||
}
|
||||
list_add(macro->argument_list, yylval.id);
|
||||
|
||||
token = yylex();
|
||||
}
|
||||
|
||||
if (token != ID) {
|
||||
fprintf(stderr, "preprocessor: macro: identifier expected, got: %s\n", yytext);
|
||||
panic("preprocessor syntax error");
|
||||
}
|
||||
list_add(macro->argument_list, yylval.id);
|
||||
is_first = false;
|
||||
}
|
||||
|
||||
token = yylex();
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#macro test(a, b, c) {
|
||||
print($a, $b, $c, '\n')
|
||||
}
|
||||
|
||||
test$('f', 'o', 'o');
|
|
@ -0,0 +1 @@
|
|||
[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]++++++++++<<<.>.>.>.
|
Loading…
Reference in a new issue