     @nullGrammar = new NullGrammar(this)
     @addGrammar(@nullGrammar)
 
-  createToken: (value, scopes) -> {value, scopes}
+  # Public: Get all the grammars in this registry.
+  #
+  # Returns a non-empty {Array} of {Grammar} instances.
+  getGrammars: ->
+    _.clone(@grammars)
 
+  # Public: Get a grammar with the given scope name.
+  #
+  # * scopeName: A {String} such as `"source.js"`.
+  #
+  # Returns a {Grammar} or undefined.
+  grammarForScopeName: (scopeName) ->
+    @grammarsByScopeName[scopeName]
+
+  # Public: Remove a grammar from this registry.
+  #
+  # * grammar: The {Grammar} to remove.
+  removeGrammar: (grammar) ->
+    _.remove(@grammars, grammar)
+    delete @grammarsByScopeName[grammar.scopeName]
+    _.remove(@injectionGrammars, grammar)
+    @grammarUpdated(grammar.scopeName)
+
+  # Public: Remove the grammar with the given scope name.
+  #
+  # * scopeName: A {String} such as `"source.js"`.
+  removeGrammarForScopeName: (scopeName) ->
+    grammar = @grammarForScopeName(scopeName)
+    @removeGrammar(grammar) if grammar?
+
+  # Public: Add a grammar to this registry.
+  #
+  # A 'grammar-added' event is emitted after the grammar is added.
+  #
+  # * grammar: The {Grammar} to add. This should be a value previously returned
+  #            from {readGrammar} or {readGrammarSync}
   addGrammar: (grammar) ->
     @grammars.push(grammar)
     @grammarsByScopeName[grammar.scopeName] = grammar

Grammar = require './grammar'
NullGrammar = require './null-grammar'

module.exports =
class GrammarRegistry
  Emitter.includeInto(this)

    @grammarUpdated(grammar.scopeName)
    @emit 'grammar-added', grammar

  # Public: Read a grammar synchronously but don't add it to the registry.
  #
  # * grammarPath: A {String} absolute file path to a grammar file.
  #
  # Returns a {Grammar}.
  readGrammarSync: (grammarPath) ->
    @createGrammar(grammarPath, fs.readObjectSync(grammarPath))

  # Public: Read a grammar asynchronously but don't add it to the registry.
  #
  # * grammarPath: A {String} absolute file path to a grammar file.
  #
  # * callback: A {Function} to call when loaded with `(error, grammar)`
  #             arguments.
  readGrammar: (grammarPath, callback) ->
    fs.readObject grammarPath, (error, object) =>
      if error?
