#!/usr/bin/perl

use strict;
use warnings;

my @high_in = `highlight --list-scripts=langs`;
my @gitweb_out;

foreach(@high_in){
  my @l = split(/:\s([[:ascii:]]+?)( \( ([\s,[:ascii:]]*) \))*$/, $_);

  #Output in gitweb $ext_highlight format
  if($l[1]){
    print"(map { \$_ => \'$l[1]\' } qw($l[1]";
    if($l[3]) {
      print " $l[3]";
    }
    print")),\n";
  }
}

