parser.py 586 B

123456789101112131415161718192021222324252627282930
  1. # parser tests
  2. try:
  3. compile
  4. except NameError:
  5. print("SKIP")
  6. raise SystemExit
  7. # completely empty string
  8. # uPy and CPy differ for this case
  9. #try:
  10. # compile("", "stdin", "single")
  11. #except SyntaxError:
  12. # print("SyntaxError")
  13. try:
  14. compile("", "stdin", "eval")
  15. except SyntaxError:
  16. print("SyntaxError")
  17. compile("", "stdin", "exec")
  18. # empty continued line
  19. try:
  20. compile("\\\n", "stdin", "single")
  21. except SyntaxError:
  22. print("SyntaxError")
  23. try:
  24. compile("\\\n", "stdin", "eval")
  25. except SyntaxError:
  26. print("SyntaxError")
  27. compile("\\\n", "stdin", "exec")