t_except_parse.mod 587 B

12345678910111213141516171819202122232425262728
  1. MODULE TExceptParse;
  2. (* M1 parser/AST regression: EXCEPT is accepted on procedure and module
  3. bodies, RETRY is accepted inside a handler, and an empty body with
  4. only a handler parses. Until M2, Lower deliberately rejects EXCEPT
  5. with 230 so no handler is silently ignored; the test is an
  6. expect_fail on "not supported yet". *)
  7. VAR ExitCode: INTEGER;
  8. PROCEDURE Set42;
  9. BEGIN
  10. ExitCode := 42
  11. EXCEPT
  12. ExitCode := 1;
  13. RETRY
  14. END Set42;
  15. PROCEDURE EmptyBody;
  16. EXCEPT
  17. ExitCode := 2
  18. END EmptyBody;
  19. BEGIN
  20. ExitCode := 0;
  21. Set42
  22. EXCEPT
  23. ExitCode := 3;
  24. RETRY
  25. END TExceptParse.