sub type_scheme {
    my ($line, $i, $state, $str);
    for $line (split(/\n/, $input)) {
        $i = 0;
        $state = 0; # 0 - nothing, 1 - string, 2 - translatable string
        while ($i < length($line)) {
            if (substr($line,$i,1) eq "\"") {
                if ($state == 2) {
                    $messages{$str} = [];
                    $str = '';
                    $state = 0;
                } elsif ($state == 1) {
                    $str = '';
                    $state = 0;
                } else {
                    $state = 1;
                    $str = '';
                    if ($i>0 && substr($line,$i-1,1) eq '_') {
                        $state = 2;
                    }
                }
            } elsif (!$state) {
                if (substr($line,$i,1) eq '_') {
                    $i++;
                    next;
                }
            } else {
                if (substr($line,$i,1) eq "\\") {
                    my $char = substr($line,$i+1,1);
                    if ($char ne "\"" && $char ne "\\") {
                       $str = $str . "\\";
                    }
                    $i++;
                }
                $str = $str . substr($line,$i,1);
            }
            $i++;
        }
    }
}
