Repository URL to install this package:
|
Version:
1.16.0 ▾
|
{
"classes": {
"GrammarRegistry": {
"name": "GrammarRegistry",
"filename": "src/grammar-registry.coffee",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar-registry.coffee#L11",
"sections": [
{
"name": "Event Subscription",
"description": ""
},
{
"name": "Managing Grammars",
"description": ""
}
],
"classMethods": [],
"instanceMethods": [
{
"name": "onDidAddGrammar",
"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar-registry.coffee#L38",
"visibility": "Public",
"summary": "Invoke the given callback when a grammar is added to the registry.",
"description": "Invoke the given callback when a grammar is added to the registry.",
"arguments": [
{
"children": [
{
"name": "grammar",
"description": "{Grammar} that was added.",
"type": "Grammar",
"isOptional": false
}
],
"name": "callback",
"description": "{Function} to call when a grammar is added.",
"type": "Function",
"isOptional": false
}
],
"returnValues": [
{
"type": "Disposable",
"description": "Returns a {Disposable} on which `.dispose()` can be called to unsubscribe."
}
]
},
{
"name": "onDidUpdateGrammar",
"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar-registry.coffee#L48",
"visibility": "Public",
"summary": "Invoke the given callback when a grammar is updated due to a grammar\nit depends on being added or removed from the registry.",
"description": "Invoke the given callback when a grammar is updated due to a grammar\nit depends on being added or removed from the registry.",
"arguments": [
{
"children": [
{
"name": "grammar",
"description": "{Grammar} that was updated.",
"type": "Grammar",
"isOptional": false
}
],
"name": "callback",
"description": "{Function} to call when a grammar is updated.",
"type": "Function",
"isOptional": false
}
],
"returnValues": [
{
"type": "Disposable",
"description": "Returns a {Disposable} on which `.dispose()` can be called to unsubscribe."
}
]
},
{
"name": "getGrammars",
"sectionName": "Managing Grammars",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar-registry.coffee#L58",
"visibility": "Public",
"summary": "Get all the grammars in this registry.",
"description": "Get all the grammars in this registry.",
"returnValues": [
{
"type": "Array",
"description": "Returns a non-empty {Array} of {Grammar} instances."
}
]
},
{
"name": "grammarForScopeName",
"sectionName": "Managing Grammars",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar-registry.coffee#L66",
"visibility": "Public",
"summary": "Get a grammar with the given scope name.",
"description": "Get a grammar with the given scope name.",
"arguments": [
{
"name": "scopeName",
"description": "A {String} such as `\"source.js\"`.",
"type": "String",
"isOptional": false
}
],
"returnValues": [
{
"type": "Grammar",
"description": "Returns a {Grammar} or ."
}
]
},
{
"name": "addGrammar",
"sectionName": "Managing Grammars",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar-registry.coffee#L78",
"visibility": "Public",
"summary": "Add a grammar to this registry.",
"description": "Add a grammar to this registry.\n\nA 'grammar-added' event is emitted after the grammar is added.",
"arguments": [
{
"name": "grammar",
"description": "The {Grammar} to add. This should be a value previously returned from {::readGrammar} or {::readGrammarSync}.",
"type": "Grammar",
"isOptional": false
}
],
"returnValues": [
{
"type": "Disposable",
"description": "Returns a {Disposable} on which `.dispose()` can be called to remove the\ngrammar."
}
]
},
{
"name": "removeGrammarForScopeName",
"sectionName": "Managing Grammars",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar-registry.coffee#L99",
"visibility": "Public",
"summary": "Remove the grammar with the given scope name.",
"description": "Remove the grammar with the given scope name.",
"arguments": [
{
"name": "scopeName",
"description": "A {String} such as `\"source.js\"`.",
"type": "String",
"isOptional": false
}
],
"returnValues": [
{
"type": "Grammar",
"description": "Returns the removed {Grammar} or ."
}
]
},
{
"name": "readGrammarSync",
"sectionName": "Managing Grammars",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar-registry.coffee#L109",
"visibility": "Public",
"summary": "Read a grammar synchronously but don't add it to the registry.",
"description": "Read a grammar synchronously but don't add it to the registry.",
"arguments": [
{
"name": "grammarPath",
"description": "A {String} absolute file path to a grammar file.",
"type": "String",
"isOptional": false
}
],
"returnValues": [
{
"type": "Grammar",
"description": "Returns a {Grammar}."
}
]
},
{
"name": "readGrammar",
"sectionName": "Managing Grammars",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar-registry.coffee#L124",
"visibility": "Public",
"summary": "Read a grammar asynchronously but don't add it to the registry.",
"description": "Read a grammar asynchronously but don't add it to the registry.",
"arguments": [
{
"name": "grammarPath",
"description": "A {String} absolute file path to a grammar file.",
"type": "String",
"isOptional": false
},
{
"children": [
{
"name": "error",
"description": "An {Error}, may be null.",
"type": "Error",
"isOptional": false
},
{
"name": "grammar",
"description": "A {Grammar} or null if an error occured.",
"type": "Grammar",
"isOptional": false
}
],
"name": "callback",
"description": "A {Function} to call when read with the following arguments:",
"type": "Function",
"isOptional": false
}
],
"returnValues": [
{
"type": null,
"description": "Returns ."
}
]
},
{
"name": "loadGrammarSync",
"sectionName": "Managing Grammars",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar-registry.coffee#L141",
"visibility": "Public",
"summary": "Read a grammar synchronously and add it to this registry.",
"description": "Read a grammar synchronously and add it to this registry.",
"arguments": [
{
"name": "grammarPath",
"description": "A {String} absolute file path to a grammar file.",
"type": "String",
"isOptional": false
}
],
"returnValues": [
{
"type": "Grammar",
"description": "Returns a {Grammar}."
}
]
},
{
"name": "loadGrammar",
"sectionName": "Managing Grammars",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar-registry.coffee#L154",
"visibility": "Public",
"summary": "Read a grammar asynchronously and add it to the registry.",
"description": "Read a grammar asynchronously and add it to the registry.",
"arguments": [
{
"name": "grammarPath",
"description": "A {String} absolute file path to a grammar file.",
"type": "String",
"isOptional": false
},
{
"children": [
{
"name": "error",
"description": "An {Error}, may be null.",
"type": "Error",
"isOptional": false
},
{
"name": "grammar",
"description": "A {Grammar} or null if an error occured.",
"type": "Grammar",
"isOptional": false
}
],
"name": "callback",
"description": "A {Function} to call when loaded with the following arguments:",
"type": "Function",
"isOptional": false
}
],
"returnValues": [
{
"type": null,
"description": "Returns ."
}
]
}
],
"classProperties": [],
"instanceProperties": [],
"visibility": "Extended",
"summary": "Registry containing one or more grammars. ",
"description": "Registry containing one or more grammars. "
},
"Grammar": {
"name": "Grammar",
"filename": "src/grammar.coffee",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar.coffee#L19",
"sections": [
{
"name": "Event Subscription",
"description": ""
},
{
"name": "Tokenizing",
"description": ""
}
],
"classMethods": [],
"instanceMethods": [
{
"name": "onDidUpdate",
"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar.coffee#L59",
"visibility": "Public",
"summary": "Invoke the given callback when this grammar is updated due to a\ngrammar it depends on being added or removed from the registry.",
"description": "Invoke the given callback when this grammar is updated due to a\ngrammar it depends on being added or removed from the registry.",
"arguments": [
{
"name": "callback",
"description": "{Function} to call when this grammar is updated.",
"type": "Function",
"isOptional": false
}
],
"returnValues": [
{
"type": "Disposable",
"description": "Returns a {Disposable} on which `.dispose()` can be called to unsubscribe."
}
]
},
{
"name": "tokenizeLines",
"sectionName": "Tokenizing",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar.coffee#L71",
"visibility": "Public",
"summary": "Tokenize all lines in the given text.",
"description": "Tokenize all lines in the given text.",
"arguments": [
{
"name": "text",
"description": "A {String} containing one or more lines.",
"type": "String",
"isOptional": false
}
],
"returnValues": [
{
"type": "Array",
"description": "Returns an {Array} of token arrays for each line tokenized."
}
]
},
{
"name": "tokenizeLine",
"sectionName": "Tokenizing",
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.0/src/grammar.coffee#L101",
"visibility": "Public",
"summary": "Tokenize the line of text.",
"description": "Tokenize the line of text.",
"arguments": [
{
"name": "line",
"description": "A {String} of text to tokenize.",
"type": "String",
"isOptional": false
},
{
"name": "ruleStack",
"description": "An optional {Array} of rules previously returned from this method. This should be null when tokenizing the first line in the file.",
"type": "Array",
"isOptional": false
},
{
"name": "firstLine",
"description": "A optional {Boolean} denoting whether this is the first line in the file which defaults to `false`. This should be `true` when tokenizing the first line in the file.",
"type": "Boolean",
"isOptional": false
}
],
"returnValues": [
{
"type": "Object",
"description": "Returns an {Object} containing the following properties:\n\n* `line` The {String} of text that was tokenized.\n* `tags` An {Array} of integer scope ids and strings. Positive ids\n indicate the beginning of a scope, and negative tags indicate the end.\n To resolve ids to scope names, call {GrammarRegistry::scopeForId} with the\n absolute value of the id.\n* `tokens` This is a dynamic property. Invoking it will incur additional\n overhead, but will automatically translate the `tags` into token objects\n with `value` and `scopes` properties.\n* `ruleStack` An {Array} of rules representing the tokenized state at the\n end of the line. These should be passed back into this method when\n tokenizing the next line in the file."
}
]
}
],
"classProperties": [],
"instanceProperties": [],
"visibility": "Extended",
"summary": "Grammar that tokenizes lines of text.",
"description": "Grammar that tokenizes lines of text.\n\nThis class should not be instantiated directly but instead obtained from\na {GrammarRegistry} by calling {GrammarRegistry::loadGrammar}. "
}
}
}