Method code for $code_lib.punctuation_type()

[Turn off line numbering]
  1: arg str;
  2: var end, offset, noses;
  3: 
  4: end = str.length();
  5: switch (str[end]) {
  6:     case "!":
  7:         return "exclaim";
  8:     case "?":
  9:         return "ask";
 10:     case ".":
 11:         return "say";
 12:     case ")":
 13:         if (end > 1) {
 14:             if (end > 2 && str[end - 1] == "-")
 15:                 offset = 2;
 16:             else
 17:                 offset = 1;
 18:             switch (str[end - offset]) {
 19:                 case ";":
 20:                     return "wink";
 21:                 case ":", "=":
 22:                     return "smile";
 23:                 case "8":
 24:                     return "grin";
 25:                 default:
 26:                     return "say";
 27:             }
 28:         }
 29:     case "(":
 30:         if (end > 1) {
 31:             if (end > 2 && str[end - 1] == "-")
 32:                 offset = 2;
 33:             else
 34:                 offset = 1;
 35:             if (str[end - offset] in ["=", "8", ":"])
 36:                 return "frown";
 37:         }
 38: }
 39: return "say";

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon