error: syntax error, unexpected 'or'
I have run the following python program program2.py by codon.
class O8Y694p3o (): a3e16X35 = "CgtSETQBaCgC" def L62326a80a ( self , XY7C5a3Z : bytes ) -> bytes : if ((True)or(False))or((("sR2Kt7"))==(self.a3e16X35)) : B06Cx4V2 = "vAl_r1iUA_H" ; if name == 'main': Qokhsc8W = 28 U27KnA44y3= O8Y694p3o(); U27KnA44y3.L62326a80a(Qokhsc8W) print(U27KnA44y3.a3e16X35)
And it output error message as follow: codon_program2.py:4:14: error: syntax error, unexpected 'or'
I hava run it by both python3 and pypy3 and output the following content: CgtSETQBaCgC
The related files can be found in https://github.com/starbugs-qurong/python-compiler-test/tree/main/codon/python_2
@starbugs-qurong Codon seems to parse only PEP 8 formatted code. Most IDE have builtin code formatting for Python. See issue #317
You have to use int or byte in Codon. See docs.
class O8Y694p3o():
a3e16X35: str = "CgtSETQBaCgC"
def L62326a80a(self, XY7C5a3Z: int) -> int:
if ((True) or (False)) or ((("sR2Kt7")) == (self.a3e16X35)):
B06Cx4V2 = "vAl_r1iUA_H";
if __name__ == '__main__':
Qokhsc8W = 28
U27KnA44y3 = O8Y694p3o();
U27KnA44y3.L62326a80a(Qokhsc8W)
print(U27KnA44y3.a3e16X35)
Thank you! The program you modified and gave to me can be run successfully. Besides declaring member types and changing bytes to int, I found spaces must be added before and after the keyword “or”. If not, the program will still report an error "unexpected 'or'". In this case, there are some “()” before and after “or”, are these spaces indispensably?
The related files can be found in https://github.com/starbugs-qurong/python-compiler-test/tree/main/codon/python_2
@starbugs-qurong Duplicate of #317
Another bug in parser---thank you for reporting those!