     lines = contents.split('\n')
     @firstLineRegex.test(lines[0..numberOfNewlinesInRegex].join('\n'))
 
-  matchesPath: (path) ->
-    return false unless path?
-    pathComponents = path.split(pathSplitRegex)
+  matchesPath: (filePath) ->
+    return false unless filePath?
+    pathComponents = filePath.split(pathSplitRegex)
     _.find @fileTypes, (fileType) ->
       fileTypeComponents = fileType.split(pathSplitRegex)
       pathSuffix = pathComponents[-fileTypeComponents.length..-1]

    @trigger 'grammar-updated'
    true

  getScore: (path, contents) ->
    contents = fsUtils.read(path) if not contents? and fsUtils.isFileSync(path)

    if syntax.grammarOverrideForPath(path) is @scopeName
      3
    else if @matchesContents(contents)
      2
    else if @matchesPath(path)
      1
    else
      -1

plist = require 'plist'
Token = require 'token'
{OnigRegExp, OnigScanner} = require 'oniguruma'
path = require 'path'
EventEmitter = require 'event-emitter'
pathSplitRegex = new RegExp("[#{path.sep}.]")
TextMateScopeSelector = require 'text-mate-scope-selector'

### Internal ###

module.exports =
class TextMateGrammar
  @load: (grammarPath, done) ->
    fsUtils.readObject grammarPath, (error, object) ->
      if error?
        done(error)
      else
        done(null, new TextMateGrammar(object))

  @loadSync: (grammarPath) ->
    new TextMateGrammar(fsUtils.readObjectSync(grammarPath))

  name: null
  rawPatterns: null
