mirror of
https://github.com/sigmasternchen/macrofuck
synced 2025-03-15 07:08:56 +00:00
feat: Remove semicolon after if statements
This commit is contained in:
parent
1970130145
commit
94f6441aaf
4 changed files with 14 additions and 14 deletions
10
src/parser.y
10
src/parser.y
|
@ -74,18 +74,18 @@ stats: /* empty */
|
|||
{
|
||||
$$ = block_new();
|
||||
}
|
||||
| stats stat SEMICOLON
|
||||
| stats stat
|
||||
{
|
||||
$$ = $1;
|
||||
block_add_statement($$, $2);
|
||||
}
|
||||
;
|
||||
|
||||
stat: print
|
||||
| definition
|
||||
| assignment
|
||||
stat: print SEMICOLON
|
||||
| definition SEMICOLON
|
||||
| assignment SEMICOLON
|
||||
| if
|
||||
| macrostat
|
||||
| macrostat SEMICOLON
|
||||
;
|
||||
|
||||
print: PRINT expr
|
||||
|
|
|
@ -2,18 +2,18 @@ if 1 {
|
|||
print "foo\n";
|
||||
} else {
|
||||
print "bar\n";
|
||||
};
|
||||
}
|
||||
|
||||
if 0 {
|
||||
print "foobar\n";
|
||||
} else {
|
||||
print "baz\n";
|
||||
};
|
||||
}
|
||||
|
||||
if 1 {
|
||||
print "no else\n";
|
||||
};
|
||||
}
|
||||
|
||||
if 0 {
|
||||
print "this should not be printed\n";
|
||||
};
|
||||
}
|
|
@ -5,10 +5,10 @@ if a {
|
|||
|
||||
if (a + 1) {
|
||||
print "b\n";
|
||||
};
|
||||
}
|
||||
|
||||
var b = (a - 1);
|
||||
if b {
|
||||
print "c\n";
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
if 1 {
|
||||
var b = 0;
|
||||
};
|
||||
}
|
||||
|
||||
if 1 {
|
||||
var b = 1;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue