 textUtils = require './text-utils'
 
 whitespaceRegexesByTabLength = {}
+LEADING_WHITESPACE_REGEX = /^[ ]+/
+TRAILING_WHITESPACE_REGEX = /[ ]+$/
 
 # Private: Represents a single unit of text as selected by a grammar.
 module.exports =

    ret = ''

    for i in [startIndex...endIndex]
      character = str[i]
        .replace('&', '&amp;')
        .replace('"', '&quot;')
        .replace("'", '&#39;')
        .replace('<', '&lt;')
        .replace('>', '&gt;')
      ret += "<span class='character'>#{character}</span>"

    ret


    html = @value

    if @isHardTab
      classes = 'hard-tab'
      classes += ' indent-guide' if hasIndentGuide
      classes += ' invisible-character' if invisibles.tab
      html = html.replace /^./, (match) =>
        match = invisibles.tab ? match
        "<span class='#{classes}'>#{@wrapCharacters(match)}</span>"
