       throw new Error("addListener can not attach listeners!")
 
 class SinatraRouteParser
-  constructor: (route) ->
+constructor: (route) ->
     @keys = []
     route = route.substring(1)
     segments = []

    finally
      @init = false
      @initDone = true
  hashbangRouting: () =>
    @pushStateSupport = false
    if !@hashchangeSupport
      throw new Error("No hashchange support!")
    @transparentRouting()
  historyApiRouting: () =>
    @hashchangeSupport = false
    @transparentRouting()

  attachClickListener: =>

        throw error
      @previous = matched
      return matched

  find: (path) =>
    for candidate in @routes
      if params = candidate.route.parse(path, @paramVerifier)
        return {params: params, route: candidate.matchedRoute, fn: candidate.fn, urlPattern: candidate.urlPattern, path: path, metadata: candidate.metadata}

  addPostExecutionListener: (fn) =>
    @postExecutionListeners.push(fn)

  addExceptionListener: (fn) =>
    @exceptionListeners.push(fn)

  pushStateSupport: history && history.pushState
  hashchangeSupport: "onhashchange" of window
  hashBaseUrl: false
  disableUrlUpdate: false
  fallbackRoute: false
  init: false
  initDone: false
  clickCount: 0

  historyApiRouting: () =>
    @hashchangeSupport = false
    @transparentRouting()

  transparentRouting: () =>
    @init = true
