       array[i] = '[' + match + ']'
     array.join ''
 
-  # get the regex to find the next token
+  ###
+    Get the regex to find the next token.
+  ###
   getParseRegexForToken = (token, config) ->
     switch token
       when 'jDDDD' then parseTokenThreeDigits

      k += 1 if leap is 1
    jm = 7 + div(k, 30)
    jd = mod(k, 30) + 1
    return jy: jy, jm: jm, jd: jd

  # Calculates the Julian Day number from Gregorian or Julian
  # calendar dates. This integer number corresponds to the noon of
  # the date (i.e. 12 hours of Universal Time).
  # The procedure was tested to be good since 1 March, -100100 (of both
  # calendars) up to a few million years into the future.
  #
  # @param gy Calendar year (years BC numbered 0, -1, -2, ...)
  # @param gm Calendar month (1 to 12)
  # @param gd Calendar day of the month (1 to 28/29/30/31)
  # @return Julian Day number
  g2d = (gy, gm, gd) ->
    d = div((gy + div(gm - 8, 6) + 100100) * 1461, 4) +
        div(153 * mod(gm + 9, 12) + 2, 5) + gd - 34840408
    d = d - div(div(gy + 100100 + div(gm - 8, 6), 100) * 3, 4) + 752
    d

  # Calculates Gregorian and Julian calendar dates from the Julian Day number
  # (jdn) for the period since jdn=-34839655 (i.e. the year -100100 of both
  # calendars) to some millions years ahead of the present.
  #
  # @param jdn Julian Day number
  # @return
  #   gy: Calendar year (years BC numbered 0, -1, -2, ...)
  #   gm: Calendar month (1 to 12)
  #   gd: Calendar day of the month M (1 to 28/29/30/31)
  d2g = (jdn) ->
    j = 4 * jdn + 139361631
    j = j + div(div(4 * jdn + 183187720, 146097) * 3, 4) * 4 - 3908

      when 'jMM', 'jDD', 'jYY', 'jM', 'jD' then parseTokenOneOrTwoDigits
      else new RegExp token.replace '\\', ''

  ###
    Function to convert string input to date.
  ###
  addTimeToArrayFromToken = (token, input, config) ->
    datePartArray = config._a
    switch token
