Oh, so it is already implemented :-)

same here:

TOF:
1 LINE # D/NEST LVL < STANFORD PASCAL, OPPOLZER VERSION OF 10.2011 > 12:07:15 07-24-2013 PAGE 1

        1           ) program DECOD ( INPUT , OUTPUT ) ;
        2           ) (*$N+*)
        3           ) var I : INTEGER ;
        4    356D  1)     C1 : CHAR ;
        5    357D  1)     C2 : CHAR ;
        6    358D  1)     CH : CHAR ;
        7    359D  1)     HEX : packed array [ 0 .. 15 ] of CHAR ;
        8    375D  1)
        9    375D  1) BEGIN (* HAUPTPROGRAMM *)
       10           ) (* A (* B (* C *) *) *)
       11           )   HEX := '0123456789ABCDEF' ;
       12      1N  1)   I := 0 ;
       13      1N  1)   while not ( EOF ( INPUT ) ) do

the (*$N+*) comment switches on the nested comment option

in line 10 you can see a nested comment using (* ... *)

no warnings

it looks a bit archaic, but remember: it is a compiler which has it's origin
in the 1970s.

Kind regards

Bernd




Am 24.07.2013 11:39, schrieb Sven Barth:
Am 24.07.2013 10:02, schrieb Jonas Maebe:

Comments of different types can be nested;
comments of the same type can be nested, if the compiler option N+ is set.
FPC supports nesting of {} comments. (* *) comments do not nest, and { } comments appearing inside (* *) comments are ignored (they don't start a new nesting level). Supporting four nestable comment would require quite a few changes and I'm not sure whether this would be nice. Are these also extensions that you added yourself?
You're sure regarding (* *) comments?

=== code begin ===

program test;

(*
comment 1
(*
comment 2
(*
comment 3
*)
*)
*)

begin

end.

=== code end ===

=== compile output begin ===

PS P:\tests\oneshots> fpc -Mobjfpc commenttest2.pas
Free Pascal Compiler version 2.6.0 [2011/12/25] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling commenttest2.pas
commenttest2.pas(5,3) Warning: Comment level 2 found
commenttest2.pas(7,3) Warning: Comment level 3 found
Linking commenttest2.exe
14 lines compiled, 0.1 sec , 25920 bytes code, 1644 bytes data
2 warning(s) issued

=== compile output end ===

Regards,
Sven
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel



_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to