 
     injected = false
     patterns = @getIncludedPatterns(baseGrammar)
-    scopes = scopesFromStack(ruleStack)
-    for injection in @injections
-      if injection.matcher.matches(scopes)
-        patterns.push(injection.patterns...)
-        injected = true
+    @injections?.getPatterns(ruleStack, patterns)
 
     scanner = @createScanner(patterns, firstLine, position)
     unless scanner.anchored or injected

  getMaxTokensPerLine: ->
    @maxTokensPerLine

class Rule
  grammar: null
  scopeName: null

  maxTokensPerLine: 100

  constructor: ({ @name, @fileTypes, @scopeName, injections, patterns, repository, @foldingStopMarker, firstLineMatch}) ->
    injections = new Injections(this, injections)
    @initialRule = new Rule(this, {@scopeName, patterns, injections})
    @repository = {}
    @firstLineRegex = new OnigRegExp(firstLineMatch) if firstLineMatch
