Tom Schneider wrote:
This code demonstrates a bug in gpc:
GNU Pascal version 20000707, based on gcc-2.95.2 19991024 (release).
which when called on this program as:
gpc --standard-pascal --nested-comments --transparent-file-names $nestbug.p -o $nestbug
will object as follows:
nestbug.p:54: parse error before `Documentation'
because, although the --nested-comments is on, it still can't handle this unbalanced right curlie bracket: }
What was called `--nested-comments' in previous GPC versions, is now called (more precisely, IMHO) `--no-mixed-comments'. The option `--nested-comments' now means really nested comments like `{ { } }'.
BTW, this *is* described prominently in the NEWS file or the News chapter in the GPC manual.
- ADDITIONAL BUG: Note also that GPC capitalizes the word
"Documentation", which is confusing and it should not do. Someone doing a case sensitive search would not find the problem!
That's why a case-sensitive search through Pascal code is a bad idea, I guess...
This occurs in other places in the code. GPC should NEVER change cases!!!! (Oh, I see. In German one capitalizes nouns. Perhaps this is why you thought to do it. The rest of the world does not and it will cause confusion and trouble. How about creating a --German command line option? :-)
It's not about German at all, as you should've noted from the following facts:
- The original GPC was created in Finland.
- GPC also capitalizes verbs, adverbs, perpositions, non-words, etc.
Seriously, I think we've discussed this matter before, in connection with `--transparent-file-names'. It's about avoiding conflicts with (e.g.) libc identifiers. When GPC supports some other form of name mangling, we can get away with this capitalization. If you like to offer your help, be welcome, otherwise this will be done according to our time schedules...
{ I infer that when comments are parsed gpc does not remember the kind of starting comment.
It does with `--no-mixed-comments'.
- If the curlies around the above paragraph are deleted, the message is:
nestbug.p:92: unterminated string or character constant nestbug.p:83: possible real start of unterminated constant
The program is sensitive to single quote marks!
Of course. Since the comment was closed (though unintentionally, see above), GPC expects Pascal code, and a single quote in Pascal code is quite significant.
The whole comment skipping code needs a careful overhaul!
Quite the opposite: It's just had a careful overhaul which implied a redefinition of one option. Please change your command-line accordingly.
The program does a successful goto to the end of the code from the halt routine, so that bug is FIXED. :-) :-) Thank you!
Fine. (But you are aware that a Halt routine which does exactly this is already built in?)
Frank