Thanks to a new command "ReadNC" written by Frank Luebeck, you can include multi-line comments into your file. This web page explains how to use the "ReadNC" command.
"ReadNC" reads files, possibly with comments inside a
'%COMMENT' - '%ENDCOMMENT' block, in the following sense:
Any line beginning %COMMENT will be ignored as will all subsequent lines
up to and including a matching %ENDCOMMENT line (i.e., a %COMMENT and
%ENDCOMMENT block).
Example: Download ReadNC_example.gap or, enter the following text into a file called "ReadNC_example.gap", and save to your computer. (Unless it is saved to "/home/wdj/gapfiles/ReadNC_example.gap" you will have to modify the path below slightly.)
######################### begin ReadNC_example.gap##############################
Read("/home/wdj/gapfiles/ReadNC.gap"); #replace by your own path to ReadNC.gap
Print("\n This examples tests `Read` and `ReadNC` in GAP.\n");
%COMMENT
Print("\n But GAP does not read commands within %COMMENT - %ENDCOMMENT blocks.\n");
%ENDCOMMENT
Print("\n GAP reads commands outside %COMMENT - %ENDCOMMENT blocks.\n\n");
######################### end ReadNC_example.gap#################################
To test the ReadNC command, try both
Read("/home/wdj/gapfiles/ReadNC_example.gap");
(this will return some GAP syntax error messages)
and
ReadNC("/home/wdj/gapfiles/ReadNC_example.gap");
in GAP. You should have the following output:
gap> Read("/home/wdj/gapfiles/ReadNC_example.gap");
This examples tests `Read` and `ReadNC` in GAP.
Syntax error: expression expected in /home/wdj/gapfiles/ReadNC_example.gap line 21
%COMMENT
^
Syntax error: expression expected in /home/wdj/gapfiles/ReadNC_example.gap line 25
%ENDCOMMENT
^
gap> ReadNC("/home/wdj/gapfiles/ReadNC_example.gap");
This examples tests `Read` and `ReadNC` in GAP.
GAP reads commands outside %COMMENT - %ENDCOMMENT blocks.
true
gap> Read("/home/wdj/gapfiles/ReadNC_example.gap");
This examples tests `Read` and `ReadNC` in GAP.
GAP reads commands outside %COMMENT - %ENDCOMMENT blocks.
Notice that the second print command in
read_example.gap was not executed since it was within a
%COMMENT-%ENDCOMMENT block.
To start using this command, download the file: ReadNC.gap to a directory on your computer (unless it is "/home/wdj/gapfiles" you will have to modify the path below slightly). When you wish to use it, first type the following command into GAP.
Read("/home/wdj/gapfiles/ReadNC.gap");
If you simply add the above line to your .gaprc file
then the new "ReadNC" command will be ready next time
you start GAP.
Last updated 12-27-2004.
This page is at the url: http://cadigweb.ew.usna.edu/~wdj/gap/read_no_comments.html