https://github.com/epiqc/ScaffCC
Revision 0d46b5398a2b397a658cccd70666ae556e594db4 authored by epiqc on 07 October 2016, 01:45:03 UTC, committed by epiqc on 07 October 2016, 01:45:03 UTC
1 parent e59c354
Tip revision: 0d46b5398a2b397a658cccd70666ae556e594db4 authored by epiqc on 07 October 2016, 01:45:03 UTC
changelog
changelog
Tip revision: 0d46b53
leaves.pl
#!/usr/bin/perl
open FIN, $ARGV[0] or die "Unable to open $ARGV[0]! $!\n";
my $in_func = 0;
my $leaf = 1;
my $buffer = [];
while (<FIN>) {
if (/#Function (\w+)/) {
$in_func = 1;
push @$buffer, $_;
} elsif (/#EndFunction/) {
push @$buffer, $_;
if ( $leaf ) {
print @$buffer;
print "\n";
}
$in_func = 0;
$leaf = 1;
$buffer = ();
} elsif ( $in_func and $leaf ) {
my ($ts, $op, @args) = split / /;
$leaf = 0 if ( $op !~ /^(?:GateName|PrepZ|MeasX|MeasZ|CNOT|H|S|Sdag|T|Tdag|X|Y|Z|Fredkin)$/ );
push @$buffer, $_ if ( $leaf );
}
}
Computing file changes ...