grabSelection pos1 pos2 toks mod
  | expr == defaultExp = if pat == defaultPat then error "Select pattern/sub-expr is not valid for thresholding!"
                                              else pNtoExp (patToPN pat)
  | otherwise          = expr
    where
      expr = locToExp pos1 pos2 toks mod
      pat = locToPat pos1 pos2 toks mod
grabSelection pos1 pos2 toks mod
  | expr == defaultExp = if pat == defaultPat then error "Select pattern/sub-expr is not valid for thresholding!"
                                              else pNtoExp (patToPN pat)
  | otherwise          = expr
    where
      expr = locToExp pos1 pos2 toks mod
      pat = locToPat pos1 pos2 toks mod
grabSelection pos1 pos2 toks mod
  | expr == defaultExp = if pat == defaultPat then error "Select pattern/sub-expr is not valid for thresholding!"
                                              else pNtoExp (patToPN pat)
  | otherwise          = expr
    where
      expr = locToExp pos1 pos2 toks mod
      pat = locToPat pos1 pos2 toks mod