first-mate
Advanced tools
Comparing version 6.2.1 to 6.2.2-0
34
api.json
@@ -5,4 +5,4 @@ { | ||
"name": "GrammarRegistry", | ||
"filename": "src\\grammar-registry.coffee", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar-registry.coffee#L11", | ||
"filename": "src/grammar-registry.coffee", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar-registry.coffee#L11", | ||
"sections": [ | ||
@@ -23,3 +23,3 @@ { | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar-registry.coffee#L38", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar-registry.coffee#L39", | ||
"visibility": "Public", | ||
@@ -54,3 +54,3 @@ "summary": "Invoke the given callback when a grammar is added to the registry.", | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar-registry.coffee#L48", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar-registry.coffee#L49", | ||
"visibility": "Public", | ||
@@ -85,3 +85,3 @@ "summary": "Invoke the given callback when a grammar is updated due to a grammar\nit depends on being added or removed from the registry.", | ||
"sectionName": "Managing Grammars", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar-registry.coffee#L58", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar-registry.coffee#L59", | ||
"visibility": "Public", | ||
@@ -100,3 +100,3 @@ "summary": "Get all the grammars in this registry.", | ||
"sectionName": "Managing Grammars", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar-registry.coffee#L66", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar-registry.coffee#L67", | ||
"visibility": "Public", | ||
@@ -123,3 +123,3 @@ "summary": "Get a grammar with the given scope name.", | ||
"sectionName": "Managing Grammars", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar-registry.coffee#L78", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar-registry.coffee#L79", | ||
"visibility": "Public", | ||
@@ -146,3 +146,3 @@ "summary": "Add a grammar to this registry.", | ||
"sectionName": "Managing Grammars", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar-registry.coffee#L99", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar-registry.coffee#L100", | ||
"visibility": "Public", | ||
@@ -169,3 +169,3 @@ "summary": "Remove the grammar with the given scope name.", | ||
"sectionName": "Managing Grammars", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar-registry.coffee#L109", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar-registry.coffee#L110", | ||
"visibility": "Public", | ||
@@ -192,3 +192,3 @@ "summary": "Read a grammar synchronously but don't add it to the registry.", | ||
"sectionName": "Managing Grammars", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar-registry.coffee#L124", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar-registry.coffee#L125", | ||
"visibility": "Public", | ||
@@ -235,3 +235,3 @@ "summary": "Read a grammar asynchronously but don't add it to the registry.", | ||
"sectionName": "Managing Grammars", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar-registry.coffee#L141", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar-registry.coffee#L142", | ||
"visibility": "Public", | ||
@@ -258,3 +258,3 @@ "summary": "Read a grammar synchronously and add it to this registry.", | ||
"sectionName": "Managing Grammars", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar-registry.coffee#L154", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar-registry.coffee#L155", | ||
"visibility": "Public", | ||
@@ -307,4 +307,4 @@ "summary": "Read a grammar asynchronously and add it to the registry.", | ||
"name": "Grammar", | ||
"filename": "src\\grammar.coffee", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar.coffee#L19", | ||
"filename": "src/grammar.coffee", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar.coffee#L19", | ||
"sections": [ | ||
@@ -325,3 +325,3 @@ { | ||
"sectionName": "Event Subscription", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar.coffee#L59", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar.coffee#L59", | ||
"visibility": "Public", | ||
@@ -348,3 +348,3 @@ "summary": "Invoke the given callback when this grammar is updated due to a\ngrammar it depends on being added or removed from the registry.", | ||
"sectionName": "Tokenizing", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar.coffee#L71", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar.coffee#L71", | ||
"visibility": "Public", | ||
@@ -371,3 +371,3 @@ "summary": "Tokenize all lines in the given text.", | ||
"sectionName": "Tokenizing", | ||
"srcUrl": "https://github.com/atom/first-mate\\blob\\v6.2.1\\src\\grammar.coffee#L101", | ||
"srcUrl": "https://github.com/atom/first-mate/blob/v6.2.2-0/src/grammar.coffee#L101", | ||
"visibility": "Public", | ||
@@ -374,0 +374,0 @@ "summary": "Tokenize the line of text.", |
@@ -18,3 +18,3 @@ (function() { | ||
function GrammarRegistry(options) { | ||
var _ref1; | ||
var _ref1, _ref2; | ||
if (options == null) { | ||
@@ -24,2 +24,3 @@ options = {}; | ||
this.maxTokensPerLine = (_ref1 = options.maxTokensPerLine) != null ? _ref1 : Infinity; | ||
this.maxLineLength = (_ref2 = options.maxLineLength) != null ? _ref2 : Infinity; | ||
this.nullGrammar = new NullGrammar(this); | ||
@@ -197,2 +198,5 @@ this.clear(); | ||
} | ||
if (object.maxLineLength == null) { | ||
object.maxLineLength = this.maxLineLength; | ||
} | ||
grammar = new Grammar(this, object); | ||
@@ -199,0 +203,0 @@ grammar.path = grammarPath; |
@@ -33,3 +33,3 @@ (function() { | ||
} | ||
this.name = options.name, this.fileTypes = options.fileTypes, this.scopeName = options.scopeName, this.foldingStopMarker = options.foldingStopMarker, this.maxTokensPerLine = options.maxTokensPerLine; | ||
this.name = options.name, this.fileTypes = options.fileTypes, this.scopeName = options.scopeName, this.foldingStopMarker = options.foldingStopMarker, this.maxTokensPerLine = options.maxTokensPerLine, this.maxLineLength = options.maxLineLength; | ||
injections = options.injections, injectionSelector = options.injectionSelector, patterns = options.patterns, repository = options.repository, firstLineMatch = options.firstLineMatch; | ||
@@ -86,4 +86,4 @@ this.emitter = new Emitter; | ||
Grammar.prototype.tokenizeLine = function(line, ruleStack, firstLine, compatibilityMode) { | ||
var contentScopeName, initialRule, initialRuleStackLength, lastRule, lastSymbol, match, nextTags, openScopeTags, penultimateRule, popStack, position, previousPosition, previousRuleStackLength, rule, scopeName, tag, tags, tagsEnd, tagsStart, tokenCount, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; | ||
Grammar.prototype.tokenizeLine = function(inputLine, ruleStack, firstLine, compatibilityMode) { | ||
var contentScopeName, initialRule, initialRuleStackLength, lastRule, lastSymbol, line, match, nextTags, openScopeTags, penultimateRule, popStack, position, previousPosition, previousRuleStackLength, rule, scopeName, tag, tagCount, tags, tagsEnd, tagsStart, tokenCount, truncatedLine, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; | ||
if (firstLine == null) { | ||
@@ -96,2 +96,9 @@ firstLine = false; | ||
tags = []; | ||
truncatedLine = false; | ||
if (inputLine.length > this.maxLineLength) { | ||
line = inputLine.slice(0, this.maxLineLength); | ||
truncatedLine = true; | ||
} else { | ||
line = inputLine; | ||
} | ||
if (ruleStack != null) { | ||
@@ -141,12 +148,3 @@ ruleStack = ruleStack.slice(); | ||
if (tokenCount >= this.getMaxTokensPerLine() - 1) { | ||
tags.push(line.length - position); | ||
while (ruleStack.length > initialRuleStackLength) { | ||
_ref1 = ruleStack.pop(), scopeName = _ref1.scopeName, contentScopeName = _ref1.contentScopeName; | ||
if (contentScopeName) { | ||
tags.push(this.endIdForScope(contentScopeName)); | ||
} | ||
if (scopeName) { | ||
tags.push(this.endIdForScope(scopeName)); | ||
} | ||
} | ||
truncatedLine = true; | ||
break; | ||
@@ -178,3 +176,3 @@ } | ||
if (ruleStack.length > 1) { | ||
_ref2 = ruleStack.pop(), scopeName = _ref2.scopeName, contentScopeName = _ref2.contentScopeName; | ||
_ref1 = ruleStack.pop(), scopeName = _ref1.scopeName, contentScopeName = _ref1.contentScopeName; | ||
if (contentScopeName) { | ||
@@ -193,3 +191,3 @@ tags.push(this.endIdForScope(contentScopeName)); | ||
} else if (ruleStack.length > previousRuleStackLength) { | ||
_ref3 = ruleStack.slice(-2), (_ref4 = _ref3[0], penultimateRule = _ref4.rule), (_ref5 = _ref3[1], lastRule = _ref5.rule); | ||
_ref2 = ruleStack.slice(-2), (_ref3 = _ref2[0], penultimateRule = _ref3.rule), (_ref4 = _ref2[1], lastRule = _ref4.rule); | ||
if ((lastRule != null) && lastRule === penultimateRule) { | ||
@@ -213,2 +211,19 @@ popStack = true; | ||
} | ||
if (truncatedLine) { | ||
tagCount = tags.length; | ||
if (tags[tagCount - 1] > 0) { | ||
tags[tagCount - 1] += inputLine.length - position; | ||
} else { | ||
tags.push(inputLine.length - position); | ||
} | ||
while (ruleStack.length > initialRuleStackLength) { | ||
_ref5 = ruleStack.pop(), scopeName = _ref5.scopeName, contentScopeName = _ref5.contentScopeName; | ||
if (contentScopeName) { | ||
tags.push(this.endIdForScope(contentScopeName)); | ||
} | ||
if (scopeName) { | ||
tags.push(this.endIdForScope(scopeName)); | ||
} | ||
} | ||
} | ||
for (_k = 0, _len2 = ruleStack.length; _k < _len2; _k++) { | ||
@@ -219,6 +234,6 @@ rule = ruleStack[_k].rule; | ||
if (compatibilityMode) { | ||
return new TokenizeLineResult(line, openScopeTags, tags, ruleStack, this.registry); | ||
return new TokenizeLineResult(inputLine, openScopeTags, tags, ruleStack, this.registry); | ||
} else { | ||
return { | ||
line: line, | ||
line: inputLine, | ||
tags: tags, | ||
@@ -225,0 +240,0 @@ ruleStack: ruleStack |
@@ -0,0 +0,0 @@ module.exports = (function() { |
@@ -0,0 +0,0 @@ Copyright (c) 2013 GitHub Inc. |
{ | ||
"name": "first-mate", | ||
"version": "6.2.1", | ||
"version": "6.2.2-0", | ||
"description": "TextMate helpers", | ||
@@ -5,0 +5,0 @@ "main": "./lib/first-mate.js", |
@@ -0,0 +0,0 @@ # First Mate |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16286
0
648985
1