# Last edited on 2000-05-22 03:32:05 by stolfi # from select-simple-words /^$/{ # Empty word if (! complex) { print; } next; } /^[{][^{}]*[}]$/ { # Crust-only word if (! complex) { print; } next; } // { # Isolate the core and mantle: w = $0; if (! match(w, /^[{][^{}]*[{]/)) { word_error(("bad word \"" w "\"")); } w = substr(w,RLENGTH+1); if (! match(w, /[}][^{}]*[}]$/)) { word_error(("bad word \"" w "\"")); } w = substr(w,1,RSTART-1); # Replace "ch", "sh", "ee" by single letters to simplify processing: gsub(/[cs]h/, "S", w); gsub(/ee/, "S", w); gsub(/[ktpf]/, "k", w); # Condense all legal modifiers with core/mantle letters: w = gensub(/[ic]([Sk])/, "\\1", "g", w); w = gensub(/([Sk])[eh]*[eho]/, "\\1", "g", w); # Check for forbidden transitions: if (match(w, /[k].*[k]/) || match(w, /[Sk].*[^Sk{}].*[Sk]/)) { if (complex) { print; } } else { if (! complex) { print; } } next; } function word_error(msg) { printf "file %s, line %d: %s\n", FILENAME, FNR, msg > "/dev/stderr"; abort = 1; exit abort; }