     { match: nextMatch, pattern: matchedPattern }
 
   getScopes: ->
-    scopes = @parentRule?.getScopes() ? []
-    scopes = scopes.concat(@scopeName) if @scopeName
-    scopes
+    (@parentRule?.getScopes() ? []).concat(@scopeName)
 
 class Pattern
   parentRule: null

  captures: null

  constructor: (@parentRule, { name, match, begin, end, captures, beginCaptures, endCaptures, patterns, include}) ->
    if include
      patterns = @parentRule.grammar.repository[include.replace(/^#/, '')]?.patterns
      @includeRule = new Rule @parentRule.grammar, {@parentRule, patterns}
    else
      @scopeName = name
      if match
        @regex = new OnigRegExp(match)
        @captures = captures
        @nextRule = @parentRule
      else if begin
        @regex = new OnigRegExp(begin)
        @captures = beginCaptures ? captures
        endPattern = new Pattern(@parentRule, { name: @scopeName, match: end, captures: endCaptures ? captures })
        @nextRule = new Rule(@parentRule.grammar, {@parentRule, @scopeName, patterns, endPattern})

  getNextMatch: (line, position) ->
    if @includeRule
      @includeRule.getNextMatch(line, position)
    else
      {pattern: this, match: @regex?.search(line, position)}

  getTokensForMatch: (match) ->
    tokens = []


  constructor: (@grammar, {@parentRule, @scopeName, patterns, @endPattern}) ->
    patterns ?= []
    @patterns = []
    @patterns.push(@endPattern) if @endPattern
    for pattern in patterns
      if pattern.include
        repoName = pattern.include.replace(/^#/, "")
        includedPatterns = @grammar.repository[repoName]?.patterns ? []
        for includedPattern in includedPatterns
          @patterns.push(new Pattern(this, includedPattern))
      else
        @patterns.push(new Pattern(this, pattern))

  getNextTokens: (line, position) ->
    { match, pattern } = @getNextMatch(line, position)
