| 123456789101112131415161718192021222324252627 |
- program t60_charcaret;
- { t60 -- the two lexical character constants CALC needs: caret (^M) and
- decimal (#nn). CALC.PAS:113 is
- EofLine = ^M;
- `^M' is CR (13) and `#27' is ESC. Both are unquoted, both are CHARACTER
- constants, so `write (^M)' emits the byte CR and not the text "13" - which
- is why ParseAtom has to recognise them as literals, not only RdConst in a
- declaration.
- The last two lines pin the values without depending on the output bytes:
- EofLine and ^M are both 13, Esc and 27 are both 27. (EofLine is a plain
- constant, so it is a TScalar like every plain scalar constant; only the
- LITERAL carries the char flag. A typed `EofLine : Char = ^M' is what keeps
- the class - see t59.) }
- const
- EofLine = ^M;
- Esc = #27;
- begin
- write (^M);
- write (#27);
- writeln (EofLine = ^M);
- writeln (Esc = 27)
- end.
|