engineer-man / piston-bot

I Run Code bot on Discord
https://emkc.org/run
MIT License
244 stars 36 forks source link

Semi-colon and 'class' in string literals breaks compilation when a boilerplate should be added #51

Closed Brikaa closed 3 years ago

Brikaa commented 3 years ago

https://github.com/engineer-man/piston/issues/305

HexF commented 3 years ago

Probably to do with this https://github.com/engineer-man/piston-bot/blob/42e8b1310f42bb8e9ecb615d6d687420f1d65248/src/cogs/utils/codeswap.py#L81

brtwrst commented 3 years ago

Anyone feeling up to fixing this? Needs a smarter replace algo that ignores semicolons that are inside quotes.

dev-null-undefined commented 3 years ago

Anyone feeling up to fixing this? Needs a smarter replace algo that ignores semicolons that are inside quotes.

What is the point of replacing all ; with ;\n? It seems to be working even without that.

Brikaa commented 3 years ago

Anyone feeling up to fixing this? Needs a smarter replace algo that ignores semicolons that are inside quotes.

What is the point of replacing all ; with ;\n? It seems to be working even without that.

I think it is for putting the imports at the top

brtwrst commented 3 years ago

it's if someone does an import and a command on the same line i guess

dev-null-undefined commented 3 years ago

it's if someone does an import and a command on the same line i guess Oh ok.

Seems like a pretty lazy fix but how about doing the same as right now and then replacing ;\n with ;