-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from debsourav33/master
Fix some Java, C_Like & Universal rules, add DO_NOT_MUTATE support for comby and reorder the rules
- Loading branch information
Showing
10 changed files
with
138 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
#include ==> DO_NOT_MUTATE | ||
|
||
:[expr:e] ==> /*:[expr:e]*/ | ||
:[[expr]]:[rest]:[lf~[\n]] ==> /*:[expr]:[rest]*/:[lf] | ||
if (:[cond]) ==> if (!:[cond]) | ||
if(:[cond]) ==> if (!:[cond]) | ||
if (:[cond]) ==> if (0) | ||
if(:[cond]) ==> if(0) | ||
if (:[cond]) ==> if (1) | ||
if(:[cond]) ==> if(1) | ||
if (:[cond]) ==> if (0==1) | ||
if(:[cond]) ==> if(0==1) | ||
if (:[cond]) ==> if (1==1) | ||
if(:[cond]) ==> if(1==1) | ||
while (:[cond]) ==> while (!:[cond]) | ||
while(:[cond]) ==> while(!:[cond]) | ||
else ==> | ||
:[[a]] && :[[b]] ==> :[[a]] && 1 | ||
:[[a]] && :[[b]] ==> 1 && :[[b]] | ||
:[[a]] || :[[b]] ==> :[[a]] || 0 | ||
:[[a]] || :[[b]] ==> :[[a]] || 0 | ||
|
||
||:[expr] ==> || (0==1) | ||
:[expr]|| ==> (0==1) || | ||
&&:[expr] ==> && (1==1) | ||
:[expr]&& ==> (1==1) && | ||
|
||
// ==> SKIP_MUTATING_REST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
synchronized ==> | ||
:[s~[ \t]*]import ==> DO_NOT_MUTATE | ||
:[s~[ \t]*]@:[annotation] ==> DO_NOT_MUTATE | ||
:[s~[ \t]*]\/*:[comment~.+] ==> DO_NOT_MUTATE | ||
:[s~[ \t]*]\/\/:[comment~.+] ==> DO_NOT_MUTATE | ||
:[s~[ \t]*]*:[comment~.+] ==> DO_NOT_MUTATE | ||
|
||
|
||
:[[a]] && :[[b]] ==> :[[a]] && true | ||
:[[a]] && :[[b]] ==> true && :[[b]] | ||
:[[a]] || :[[b]] ==> :[[a]] || false | ||
:[[a]] || :[[b]] ==> :[[a]] || false | ||
synchronized ==> | ||
|
||
:[spaces~[ \t]*]@:[annotation] ==> DO_NOT_MUTATE | ||
:[spaces~[ \t]*]/*:[comment~.+] ==> DO_NOT_MUTATE | ||
:[spaces~[ \t]*]//:[comment~.+] ==> DO_NOT_MUTATE | ||
:[spaces~[ \t]*]*:[comment~.+] ==> DO_NOT_MUTATE | ||
:[a]&&:[b] ==> :[a] && true | ||
:[a]&&:[b] ==> true && :[b] | ||
:[a]||:[b] ==> :[a] || false | ||
:[a]||:[b] ==> false || :[b] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,47 @@ | ||
print(:[1], :[2], :[3]) ==> print(:[3], :[2], :[1]) | ||
:[[v]] = :[[fn]](:[x]) ==> :[[v]] = :[[fn]]((:[x] - 1)) | ||
:[s~[ \t]*]import ==> DO_NOT_MUTATE | ||
|
||
if :[cond] ==> if not :[cond] | ||
while :[cond] ==> while not :[cond] | ||
|
||
:[body]continue ==> :[body] break | ||
:[body]break ==> :[body] continue | ||
|
||
print(:[1], :[2], :[3]) ==> print(:[3], :[2], :[1]) | ||
:[[v]] = :[[fn]](:[x]) ==> :[[v]] = :[[fn]]((:[x] - 1)) | ||
|
||
:[[a]] and :[[b]] ==> :[[a]] or :[[b]] | ||
:[[a]] or :[[b]] ==> :[[a]] and :[[b]] | ||
:[[a]] and :[[b]] ==> :[[a]] or True | ||
:[[a]] or :[[b]] ==> :[[a]] or False | ||
:[[a]] and :[[b]] ==> True and :[[b]] | ||
:[[a]] or :[[b]] ==> False or :[[b]] | ||
:[[a]] and :[[b]] ==> :[[a]] or True | ||
:[[a]] and :[[b]] ==> True or :[[b]] | ||
|
||
not :[[a]] ==> :[[a]] | ||
//:[[a]] ==> /:[[a]] | ||
/:[[a]] ==> //:[[a]] | ||
|
||
return :[expr]:[newline~[\n]] ==> return None:[newline] | ||
:[ spaces]:[expr]:[newline~[\n]] ==> :[spaces]pass:[newline] | ||
return :[expr]:[lf~[\n]] ==> return None:[lf] | ||
:[ s]:[expr]:[lf~[\n]] ==> :[s]pass:[lf] | ||
|
||
[:[expr]] ==> [] | ||
{:[expr]} ==> {} | ||
//:[[a]] ==> /:[[a]] | ||
/:[[a]] ==> //:[[a]] | ||
|
||
True ==> False | ||
|
||
@:[spaces~[ \t]*]:[annotation] :[body] ==> :[body] | ||
|
||
[:[expr]] ==> [] | ||
[:[first],:[rest]] ==> [:[first]] | ||
[:[first],:[rest]] ==> [:[rest]] | ||
,:[s~[ \t]*]:[[x]]:[bra~[\]]] ==> ] | ||
|
||
{:[expr]} ==> {} | ||
{:[first],:[rest]} ==> {:[first]} | ||
{:[first],:[rest]} ==> {:[rest]} | ||
,:[spaces~[ \t]*]:[[x]]:[bra~[\]]] ==> ] | ||
,:[spaces~[ \t]*]:[[x]]:[bra~[\}]] ==> } | ||
,:[s~[ \t]*]:[[x]]:[bra~[\}]] ==> } | ||
|
||
':[str]' ==> '' | ||
,:[item], ==> , | ||
|
||
,:[spaces~[ \t]*]:[[item1]],:[spaces~[ \t]*]:[[item2]] ==> ,:[[item2]],:[[item1]] | ||
,:[s~[ \t]*]:[[item1]],:[s~[ \t]*]:[[item2]] ==> ,:[[item2]],:[[item1]] | ||
:[par~[(]]:[~[ \t]*]:[[item1]],:[~[ \t]*]:[[item2]] ==> :[par]:[[item2]],:[[item1]] | ||
:[bra~[\[]]:[~[ \t]*]:[[item1]],:[~[ \t]*]:[[item2]] ==> :[bra]:[[item2]],:[[item1]] | ||
:[bra~[\[]]:[~[ \t]*]:[[item1]],:[~[ \t]*]:[[item2]] ==> :[bra]:[[item2]],:[[item1]] | ||
|
||
,:[item], ==> , | ||
':[str]' ==> '' | ||
|
||
@:[s~[ \t]*]:[annotation] :[body] ==> :[body] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.