Guest User

Untitled

a guest
Mar 23rd, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.62 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use warnings;
  4. use strict;
  5. #
  6. my $fp;
  7. my $generic_on = 0;
  8. my $input = "test.txt";
  9.  
  10. if (not open($fp, "<$input")) {
  11.     print STDERR "Can not open file: $input -> $!\n";
  12.     exit(1);
  13. };
  14.  
  15. while (my $line = <$fp>) {
  16.     chomp($line);
  17.  
  18.    if (($line =~ m/(\w+)\s*:\s*(\w+)(\s*range\s+(\w+)\s+to\s+(\w+)\s*)?(\s*:=\s*(\w+))?/gi) and ($generic_on == 1)) {
  19.        print "GENERIC FOUND: $1, $2, $7\n";
  20.    };
  21.  
  22. #  if ($line =~ m/entity\s+(\w+)\s+is/gi) {
  23. #      print "Entity: $line\n";
  24. #  };
  25.  
  26.     # Check for port
  27.     if ($line =~ m/port\s*\(/gi) {
  28.         print "In port: $line\n";
  29.     };
  30. };
Advertisement
Add Comment
Please, Sign In to add comment