Gale Paeper wrote:
Frank Heckenbach wrote:
Gale Paeper wrote:
At least according to the documentation, none of the MacPascal dialect compilers allow nested comments in the `{ ... { ... } ... }' form. CodeWarrior Pascal and MPW Pascal compilers support a nest comments Pascal non-standard extension but you must use different comment delimiters for nesting; e.g. '{ ... (* ... *) ... }'.
Are these really nested comments, or are `(*' and `*)' just ignored within a `{ ... }' comment? In the latter case, also `{ (* }' and `{ *) }' would be comments. This (requiring matching delimiters) would be the behaviour of most compilers I've seen (including GPC in non-standard modes).
After some quickie blackbox compiler behavior checking, it doesn't appear that any of the MacPascal dialect compilers support what would be true nested comments although the documentation uses the term "nested" to describe the supported comment forms.
So did GPC some years ago for "non-mixed comments", but for the reasons I gave, I think speaking of nested comments here is really misleading.
What testing indicates is implemented in CodeWarrior Pascal, MPW Pascal, and THINK Pascal compilers is (to use THINK Pascal's documentation description):
{ Any text not containing right-brace } (* Any text not containing star-right-paren *)
which, if I've understood your comment correctly, is another way of describing your "latter case".
Yes, i.e. non-mixed, non-nested comments, in GPC's option naming.
{ ... (* ... { ... } ... *) ... } illegal - error after first '}' { ... (* ... } ... *) illegal - error after '}' { ... *) Non-matching begin-comment and end-comment delimiters don't form a closed comment { ... (* ... *) ... *) Non-matching begin-comment and end-comment delimiters don't form a closed comment
Note: For the unaccepted/illegal constructs, errors were reported. However, the reported errors weren't indicative of a malformed comment - just some sort of non-comment related illegal program construct. For example, the last two unclosed comment test cases resulted in illegal statement errors at the end of the file for the simple test program I was using.
GPC says "unterminated comment" here. Otherwise, its behaviour in default as well as `--mac-pascal' modes is just as you describe, AFAICS.
Frank