       if matchRules
         for rule, ruleSet of matchRules
           matches = val.match ruleSet.regex
-          
+
           return unless matches
 
           matches.forEach (match,i)->

              ruleSet.dataSource match

  showMenu:(options, data)->
    
    {token,rule} = options
    @menu.destroy() if @menu
    o =


    @input.unsetClass 'kdinput'

    _oldMatches       = []
    @registeredTokens = {}

    for rule of o.match
      @registeredTokens[rule] = {}

    # @input.on "keydown", (event)=>
    #   val = @input.getValue().replace /\n/g,'<br/>'
    #   @layer.updatePartial val

    @input.on "keyup", (event)=>
      matchRules = @getOptions().match
