t_ctor7.mod 561 B

1234567891011121314151617
  1. MODULE tctor7;
  2. // Set field in a record constructor + constant string concatenation
  3. // folded into a CHAR-array constructor element.
  4. TYPE S = SET OF [0..15];
  5. R = RECORD name : INTEGER; flags : S END;
  6. Line = ARRAY [0..11] OF CHAR;
  7. CONST Hi = "Hello";
  8. Wo = "World";
  9. HelloWorld = Line { Hi + " " + Wo };
  10. VAR r : R;
  11. VAR ExitCode : INTEGER;
  12. BEGIN
  13. r := R { 7, S{1,3,5} };
  14. IF (r.name = 7) AND (1 IN r.flags) AND (5 IN r.flags)
  15. AND (HelloWorld[0] = 'H') AND (HelloWorld[10] = 'd')
  16. THEN ExitCode := 42 ELSE ExitCode := 1 END
  17. END tctor7.