File: inp2ain.pl6

package info (click to toggle)
dmrgpp 6.06-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 113,900 kB
  • sloc: cpp: 80,986; perl: 14,772; ansic: 2,923; makefile: 83; sh: 17
file content (26 lines) | stat: -rwxr-xr-x 445 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl6

use v6;

my $myself = $*PROGRAM-NAME;

sub MAIN($file)
{
	my $input = open($file, :r);
	my Int $ln = 0;

	print "##Ainur1.0\n";
	for $file.IO.lines -> $line {
		++$ln;
		my $copy = $line;
		
		$copy ~~ s/\s+$//;
		$copy ~~ s/\.txt// if ($copy ~~ /OutputFile\=/);
		$copy ~~ s/\=(<-[\d\-\.\+]>.*$)/\=\"$0\"/;
		$copy ~~ s/\s+1\s+(<[\d\-\.\+]>+$)/\=\[$0\]/;

		my $sc = ($copy ~~ /^$/) ?? "" !! ";"; 
		print "$copy$sc\n";
	}
}