       | [^#{controls}"'\s]+ # normal tokens
       | "[^"]*?" # strings
       | '\\?[^']' # char
+      | /[^\ /][^/]*?/ # regex
       )///
     if not match
       throw new Error "Could not recognize a token starting with `#{input[0..10]}`"

    mainCache = mainCache.map ({cache}) -> compileAssign cache
    varDecls = if varNames.length > 0 then ["var #{varNames.join ', '};"] else []
    content = mainCache.concat(varDecls, compiledCases.join '').join '\n'

    """(function(){
      #{content}}())"""


  if macros[name]
    expandMacro name
  else
    [firstChar] = name
    if firstChar is '-'
      "(- #{validIdentifier name[1...]})"
    else if firstChar is '/'
      # regex
      name
    else
      name
        .replace(/\+/g, 'plus_')
        .replace(/\-/g, 'minus_')
        .replace(/\*/g, 'times_')
        .replace(/\//g, 'over_')
        .replace(/\√/g, 'sqrt_')
        .replace(/\./g, 'dot_')
        .replace(/\&/g, 'and_')
        .replace(/\?/g, 'p_')
        .replace(/^const$/, 'const_')
        .replace(/^default$/, 'default_')

