 # Main scoring algorithm
 #
 
-doScore = (subject, subject_lw, prepQuery) ->
+scoreMain = (subject, subject_lw, prepQuery) ->
   query = prepQuery.query
   query_lw = prepQuery.query_lw
 

exports.score = (string, query, prepQuery, allowErrors, isPath) ->
  return 0 unless allowErrors or isMatch(string, prepQuery.core_lw, prepQuery.core_up)
  string_lw = string.toLowerCase()
  score = doScore(string, string_lw, prepQuery)
  if isPath then score = pathScore(string, string_lw, prepQuery, score)
  return Math.ceil(score)



  depth = prepQuery.depth

  # Get that many folder from subject
  while basePos > -1 and depth-- > 0
    basePos = subject.lastIndexOf(PathSeparator, basePos - 1)

  # Get basePath score, if BaseName is the whole string, no need to recompute
  # We still need to apply the folder depth and filename penalty.
  basePathScore = if (basePos is -1) then fullPathScore else
    extAdjust * scoreMain(subject.slice(basePos + 1, end + 1), subject_lw.slice(basePos + 1, end + 1), prepQuery)

  # Final score is linear interpolation between base score and full path score.
  # For low directory depth, interpolation favor base Path then include more of full path as depth increase
