[ET Trac] [Einstein Toolkit] #2003: piraha_everywhere Zelmani stress test

Einstein Toolkit trac-noreply at einsteintoolkit.org
Wed Apr 5 04:24:39 CDT 2017


#2003: piraha_everywhere Zelmani stress test
---------------------+------------------------------------------------------
  Reporter:  rhaas   |       Owner:  sbrandt            
      Type:  defect  |      Status:  assigned           
  Priority:  major   |   Milestone:                     
 Component:  Cactus  |     Version:  development version
Resolution:          |    Keywords:  piraha             
---------------------+------------------------------------------------------

Comment (by rhaas):

 I think we cannot document it away since the documentation was present in
 at least one release and the breaking up in the middle of a token was used
 in at least one real life code out there, namely Zelmani.

 The pre-piraha docs said (git hash e8f2db41, 3 years ago):
 > '''General Syntax of CCL Files'''
 > Cactus Configuration Language (CCL) files are simple text files used to
 define configuration information for a thorn. CCL files are case
 independent, and may contain comments introduced by the hash ‘#’
 character, which indicates that the rest of the line is a comment. If the
 last non-blank character of a line in a CCL file is a backslash ‘\’, the
 following line is treated as a continuation of the current line.

 So it was included in at least one release.

 I think that, as documented and mimicking how the old parser worked, this
 can be made to work through a simple modification of the parse_src
 subroutine:
 {{{
 open(my $fd, "test.ccl") or die "cannot open $src";
 my $src_contents = "";
 my $line = "";
 while(<$fd>) {
   if(s/\\\s*\n//) {
     $line = "\n" . $line . $_;
   } else {
     $src_contents .= $line . $_;
     $line = "";
   }
 }
 close($fd);
 }}}
 which adds '\n' at the front to keep line numbers correct.

 A slightly more complex regex pattern can be used to allow for escaping of
 '\'.
 {{{
 open(my $fd, "test.ccl") or die "cannot open $src";
 my $src_contents = "";
 my $line = "";
 while(<$fd>) {
   if(m/(^|[^\\])([\\]{2})*\\\s*\n/) {
     s/\\\s*\n//;
     $line = "\n" . $line . $_;
   } else {
     $src_contents .= $line . $_;
     $line = "";
   }
 }
 }}}
 which looks for odd numbers of '\' at the end of a line.

 I admit it is not beautiful since some information about the ccl file
 content is lost.

-- 
Ticket URL: <https://trac.einsteintoolkit.org/ticket/2003#comment:31>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit


More information about the Trac mailing list