#!/usr/bin/env perl6
use v6.d;

use Grammar::TokenProcessing;

my %*SUB-MAIN-OPTS = :named-anywhere;

#| Transform a token lines in a grammar role into token lines with fuzzy matching.
sub MAIN(
        Str $inputFileName where *.IO.f,     #= Input file name.
        :o(:$output) = Whatever,             #= Output file; if not given the output is STDOUT.
        Bool :$add-protos = False,           #= Should proto tokens/rules/regexes be added or not.
        Str :$sym-name = '',                 #= Sym name. I and empty string ('') then no sym is put in.
        Bool :$add-exclusions = True,        #= Should exclusions be added to token extensions or not?
        Str :$method = 'nearest-neighbors',  #= Method to find the word exclusions; one of 'nearest-neighbors' and 'stem-rules'.
        Str :$func-name = 'is-fuzzy-match'   #= Function name to do fuzzy matching with.
         ) {
    enhance-token-specs($inputFileName, $output,
            :$add-protos,
            :$sym-name,
            :$add-exclusions,
            stem-rules => Whatever,
            nearest-neighbors-rules => Whatever,
            :$method,
            :$func-name )
}