From 66797bd921bef1e190e9131c94a14bd441252aad Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sun, 20 Nov 2022 16:00:04 -0800 Subject: [PATCH 01/25] Decafe Using Original Scripts --- .gitignore | 1 - lib/first-mate.js | 14 + lib/grammar-registry.js | 273 ++++++++++ lib/grammar.js | 395 +++++++++++++++ lib/injections.js | 71 +++ lib/null-grammar.js | 29 ++ lib/pattern.js | 336 +++++++++++++ lib/rule.js | 189 +++++++ lib/scanner.js | 74 +++ lib/scope-selector-matchers.js | 325 ++++++++++++ lib/scope-selector-parser.js | 879 +++++++++++++++++++++++++++++++++ lib/scope-selector.js | 37 ++ package-lock.json | 6 +- 13 files changed, 2626 insertions(+), 3 deletions(-) create mode 100644 lib/first-mate.js create mode 100644 lib/grammar-registry.js create mode 100644 lib/grammar.js create mode 100644 lib/injections.js create mode 100644 lib/null-grammar.js create mode 100644 lib/pattern.js create mode 100644 lib/rule.js create mode 100644 lib/scanner.js create mode 100644 lib/scope-selector-matchers.js create mode 100644 lib/scope-selector-parser.js create mode 100644 lib/scope-selector.js diff --git a/.gitignore b/.gitignore index b84d4db..a9d1858 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ node_modules/ .DS_Store npm-debug.log -lib/ api.json diff --git a/lib/first-mate.js b/lib/first-mate.js new file mode 100644 index 0000000..1ec2e41 --- /dev/null +++ b/lib/first-mate.js @@ -0,0 +1,14 @@ +(function() { + module.exports = { + ScopeSelector: require('./scope-selector'), + GrammarRegistry: require('./grammar-registry'), + Grammar: require('./grammar') + }; + + Object.defineProperty(module.exports, 'OnigRegExp', { + get: function() { + return require('oniguruma').OnigRegExp; + } + }); + +}).call(this); diff --git a/lib/grammar-registry.js b/lib/grammar-registry.js new file mode 100644 index 0000000..ebcf628 --- /dev/null +++ b/lib/grammar-registry.js @@ -0,0 +1,273 @@ +(function() { + var CSON, Disposable, Emitter, EmitterMixin, Grammar, GrammarRegistry, Grim, NullGrammar, _, _ref; + + _ = require('underscore-plus'); + + CSON = require('season'); + + _ref = require('event-kit'), Emitter = _ref.Emitter, Disposable = _ref.Disposable; + + Grim = require('grim'); + + Grammar = require('./grammar'); + + NullGrammar = require('./null-grammar'); + + module.exports = GrammarRegistry = (function() { + function GrammarRegistry(options) { + var _ref1, _ref2; + if (options == null) { + options = {}; + } + this.maxTokensPerLine = (_ref1 = options.maxTokensPerLine) != null ? _ref1 : Infinity; + this.maxLineLength = (_ref2 = options.maxLineLength) != null ? _ref2 : Infinity; + this.nullGrammar = new NullGrammar(this); + this.clear(); + } + + GrammarRegistry.prototype.clear = function() { + this.emitter = new Emitter; + this.grammars = []; + this.grammarsByScopeName = {}; + this.injectionGrammars = []; + this.grammarOverridesByPath = {}; + this.scopeIdCounter = -1; + this.idsByScope = {}; + this.scopesById = {}; + return this.addGrammar(this.nullGrammar); + }; + + + /* + Section: Event Subscription + */ + + GrammarRegistry.prototype.onDidAddGrammar = function(callback) { + return this.emitter.on('did-add-grammar', callback); + }; + + GrammarRegistry.prototype.onDidUpdateGrammar = function(callback) { + return this.emitter.on('did-update-grammar', callback); + }; + + GrammarRegistry.prototype.onDidRemoveGrammar = function(callback) { + return this.emitter.on('did-remove-grammar', callback); + }; + + + /* + Section: Managing Grammars + */ + + GrammarRegistry.prototype.getGrammars = function() { + return _.clone(this.grammars); + }; + + GrammarRegistry.prototype.grammarForScopeName = function(scopeName) { + return this.grammarsByScopeName[scopeName]; + }; + + GrammarRegistry.prototype.addGrammar = function(grammar) { + this.grammars.push(grammar); + this.grammarsByScopeName[grammar.scopeName] = grammar; + if (grammar.injectionSelector != null) { + this.injectionGrammars.push(grammar); + } + this.grammarUpdated(grammar.scopeName); + if (Grammar.includeDeprecatedAPIs) { + this.emit('grammar-added', grammar); + } + this.emitter.emit('did-add-grammar', grammar); + return new Disposable((function(_this) { + return function() { + return _this.removeGrammar(grammar); + }; + })(this)); + }; + + GrammarRegistry.prototype.removeGrammar = function(grammar) { + _.remove(this.grammars, grammar); + delete this.grammarsByScopeName[grammar.scopeName]; + _.remove(this.injectionGrammars, grammar); + this.grammarUpdated(grammar.scopeName); + this.emitter.emit('did-remove-grammar', grammar); + return void 0; + }; + + GrammarRegistry.prototype.removeGrammarForScopeName = function(scopeName) { + var grammar; + grammar = this.grammarForScopeName(scopeName); + if (grammar != null) { + this.removeGrammar(grammar); + } + return grammar; + }; + + GrammarRegistry.prototype.readGrammarSync = function(grammarPath) { + var grammar, _ref1; + grammar = (_ref1 = CSON.readFileSync(grammarPath)) != null ? _ref1 : {}; + if (typeof grammar.scopeName === 'string' && grammar.scopeName.length > 0) { + return this.createGrammar(grammarPath, grammar); + } else { + throw new Error("Grammar missing required scopeName property: " + grammarPath); + } + }; + + GrammarRegistry.prototype.readGrammar = function(grammarPath, callback) { + CSON.readFile(grammarPath, (function(_this) { + return function(error, grammar) { + if (grammar == null) { + grammar = {}; + } + if (error != null) { + return typeof callback === "function" ? callback(error) : void 0; + } else { + if (typeof grammar.scopeName === 'string' && grammar.scopeName.length > 0) { + return typeof callback === "function" ? callback(null, _this.createGrammar(grammarPath, grammar)) : void 0; + } else { + return typeof callback === "function" ? callback(new Error("Grammar missing required scopeName property: " + grammarPath)) : void 0; + } + } + }; + })(this)); + return void 0; + }; + + GrammarRegistry.prototype.loadGrammarSync = function(grammarPath) { + var grammar; + grammar = this.readGrammarSync(grammarPath); + this.addGrammar(grammar); + return grammar; + }; + + GrammarRegistry.prototype.loadGrammar = function(grammarPath, callback) { + this.readGrammar(grammarPath, (function(_this) { + return function(error, grammar) { + if (error != null) { + return typeof callback === "function" ? callback(error) : void 0; + } else { + _this.addGrammar(grammar); + return typeof callback === "function" ? callback(null, grammar) : void 0; + } + }; + })(this)); + return void 0; + }; + + GrammarRegistry.prototype.startIdForScope = function(scope) { + var id; + if (!(id = this.idsByScope[scope])) { + id = this.scopeIdCounter; + this.scopeIdCounter -= 2; + this.idsByScope[scope] = id; + this.scopesById[id] = scope; + } + return id; + }; + + GrammarRegistry.prototype.endIdForScope = function(scope) { + return this.startIdForScope(scope) - 1; + }; + + GrammarRegistry.prototype.scopeForId = function(id) { + if ((id % 2) === -1) { + return this.scopesById[id]; + } else { + return this.scopesById[id + 1]; + } + }; + + GrammarRegistry.prototype.grammarUpdated = function(scopeName) { + var grammar, _i, _len, _ref1; + _ref1 = this.grammars; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + grammar = _ref1[_i]; + if (grammar.scopeName !== scopeName) { + if (grammar.grammarUpdated(scopeName)) { + if (Grammar.includeDeprecatedAPIs) { + this.emit('grammar-updated', grammar); + } + this.emitter.emit('did-update-grammar', grammar); + } + } + } + }; + + GrammarRegistry.prototype.createGrammar = function(grammarPath, object) { + var grammar; + if (object.maxTokensPerLine == null) { + object.maxTokensPerLine = this.maxTokensPerLine; + } + if (object.maxLineLength == null) { + object.maxLineLength = this.maxLineLength; + } + if (object.limitLineLength === false) { + object.maxLineLength = Infinity; + } + grammar = new Grammar(this, object); + grammar.path = grammarPath; + return grammar; + }; + + GrammarRegistry.prototype.decodeTokens = function(lineText, tags, scopeTags, fn) { + var expectedScopeName, index, offset, poppedScopeName, scopeNames, tag, token, tokens, _i, _len; + if (scopeTags == null) { + scopeTags = []; + } + offset = 0; + scopeNames = scopeTags.map((function(_this) { + return function(tag) { + return _this.scopeForId(tag); + }; + })(this)); + tokens = []; + for (index = _i = 0, _len = tags.length; _i < _len; index = ++_i) { + tag = tags[index]; + if (tag >= 0) { + token = { + value: lineText.substring(offset, offset + tag), + scopes: scopeNames.slice() + }; + if (fn != null) { + token = fn(token, index); + } + tokens.push(token); + offset += tag; + } else if ((tag % 2) === -1) { + scopeTags.push(tag); + scopeNames.push(this.scopeForId(tag)); + } else { + scopeTags.pop(); + expectedScopeName = this.scopeForId(tag + 1); + poppedScopeName = scopeNames.pop(); + if (poppedScopeName !== expectedScopeName) { + throw new Error("Expected popped scope to be " + expectedScopeName + ", but it was " + poppedScopeName); + } + } + } + return tokens; + }; + + return GrammarRegistry; + + })(); + + if (Grim.includeDeprecatedAPIs) { + EmitterMixin = require('emissary').Emitter; + EmitterMixin.includeInto(GrammarRegistry); + GrammarRegistry.prototype.on = function(eventName) { + switch (eventName) { + case 'grammar-added': + Grim.deprecate("Call GrammarRegistry::onDidAddGrammar instead"); + break; + case 'grammar-updated': + Grim.deprecate("Call GrammarRegistry::onDidUpdateGrammar instead"); + break; + default: + Grim.deprecate("Call explicit event subscription methods instead"); + } + return EmitterMixin.prototype.on.apply(this, arguments); + }; + } + +}).call(this); diff --git a/lib/grammar.js b/lib/grammar.js new file mode 100644 index 0000000..a19e0e2 --- /dev/null +++ b/lib/grammar.js @@ -0,0 +1,395 @@ +(function() { + var Emitter, EmitterMixin, Grammar, Grim, Injections, OnigRegExp, OnigString, Pattern, Rule, ScopeSelector, TokenizeLineResult, fs, path, _, _ref; + + path = require('path'); + + _ = require('underscore-plus'); + + fs = require('fs-plus'); + + _ref = require('oniguruma'), OnigRegExp = _ref.OnigRegExp, OnigString = _ref.OnigString; + + Emitter = require('event-kit').Emitter; + + Grim = require('grim'); + + Injections = require('./injections'); + + Pattern = require('./pattern'); + + Rule = require('./rule'); + + ScopeSelector = require('./scope-selector'); + + module.exports = Grammar = (function() { + Grammar.prototype.registration = null; + + function Grammar(registry, options) { + var contentRegex, firstLineMatch, injectionSelector, injections, patterns, repository; + this.registry = registry; + if (options == null) { + options = {}; + } + 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, contentRegex = options.contentRegex; + this.emitter = new Emitter; + this.repository = null; + this.initialRule = null; + if (injectionSelector != null) { + this.injectionSelector = new ScopeSelector(injectionSelector); + } else { + this.injectionSelector = null; + } + if (firstLineMatch) { + this.firstLineRegex = new OnigRegExp(firstLineMatch); + } else { + this.firstLineRegex = null; + } + if (contentRegex) { + this.contentRegex = new OnigRegExp(contentRegex); + } else { + this.contentRegex = null; + } + if (this.fileTypes == null) { + this.fileTypes = []; + } + this.includedGrammarScopes = []; + this.rawPatterns = patterns; + this.rawRepository = repository; + this.rawInjections = injections; + this.updateRules(); + } + + + /* + Section: Event Subscription + */ + + Grammar.prototype.onDidUpdate = function(callback) { + return this.emitter.on('did-update', callback); + }; + + + /* + Section: Tokenizing + */ + + Grammar.prototype.tokenizeLines = function(text, compatibilityMode) { + var lastLine, line, lineNumber, lines, ruleStack, scopes, tags, _i, _len, _ref1, _results; + if (compatibilityMode == null) { + compatibilityMode = true; + } + lines = text.split('\n'); + lastLine = lines.length - 1; + ruleStack = null; + scopes = []; + _results = []; + for (lineNumber = _i = 0, _len = lines.length; _i < _len; lineNumber = ++_i) { + line = lines[lineNumber]; + _ref1 = this.tokenizeLine(line, ruleStack, lineNumber === 0, compatibilityMode, lineNumber !== lastLine), tags = _ref1.tags, ruleStack = _ref1.ruleStack; + _results.push(this.registry.decodeTokens(line, tags, scopes)); + } + return _results; + }; + + Grammar.prototype.tokenizeLine = function(inputLine, ruleStack, firstLine, compatibilityMode, appendNewLine) { + var contentScopeName, initialRuleStackLength, lastRule, lastSymbol, line, match, nextTags, openScopeTags, penultimateRule, popStack, position, previousPosition, previousRuleStackLength, rule, scopeName, string, stringWithNewLine, tag, tagCount, tags, tagsEnd, tagsStart, tokenCount, truncatedLine, _i, _j, _k, _len, _len1, _len2, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; + if (firstLine == null) { + firstLine = false; + } + if (compatibilityMode == null) { + compatibilityMode = true; + } + if (appendNewLine == null) { + appendNewLine = true; + } + tags = []; + truncatedLine = false; + if (inputLine.length > this.maxLineLength) { + line = inputLine.slice(0, this.maxLineLength); + truncatedLine = true; + } else { + line = inputLine; + } + string = new OnigString(line); + stringWithNewLine = appendNewLine ? new OnigString(line + '\n') : string; + if (ruleStack != null) { + ruleStack = ruleStack.slice(); + if (compatibilityMode) { + openScopeTags = []; + for (_i = 0, _len = ruleStack.length; _i < _len; _i++) { + _ref1 = ruleStack[_i], scopeName = _ref1.scopeName, contentScopeName = _ref1.contentScopeName; + if (scopeName) { + openScopeTags.push(this.registry.startIdForScope(scopeName)); + } + if (contentScopeName) { + openScopeTags.push(this.registry.startIdForScope(contentScopeName)); + } + } + } + } else { + if (compatibilityMode) { + openScopeTags = []; + } + _ref2 = this.initialRule, scopeName = _ref2.scopeName, contentScopeName = _ref2.contentScopeName; + ruleStack = [ + { + rule: this.initialRule, + scopeName: scopeName, + contentScopeName: contentScopeName + } + ]; + if (scopeName) { + tags.push(this.startIdForScope(this.initialRule.scopeName)); + } + if (contentScopeName) { + tags.push(this.startIdForScope(this.initialRule.contentScopeName)); + } + } + initialRuleStackLength = ruleStack.length; + position = 0; + tokenCount = 0; + while (true) { + previousRuleStackLength = ruleStack.length; + previousPosition = position; + if (position > line.length) { + break; + } + if (tokenCount >= this.getMaxTokensPerLine() - 1) { + truncatedLine = true; + break; + } + if (match = _.last(ruleStack).rule.getNextTags(ruleStack, string, stringWithNewLine, position, firstLine)) { + nextTags = match.nextTags, tagsStart = match.tagsStart, tagsEnd = match.tagsEnd; + if (position < tagsStart) { + tags.push(tagsStart - position); + tokenCount++; + } + tags.push.apply(tags, nextTags); + for (_j = 0, _len1 = nextTags.length; _j < _len1; _j++) { + tag = nextTags[_j]; + if (tag >= 0) { + tokenCount++; + } + } + position = tagsEnd; + } else { + if (position < line.length || line.length === 0) { + tags.push(line.length - position); + } + break; + } + if (position === previousPosition) { + if (ruleStack.length === previousRuleStackLength) { + console.error("Popping rule because it loops at column " + position + " of line '" + line + "'", _.clone(ruleStack)); + if (ruleStack.length > 1) { + _ref3 = ruleStack.pop(), scopeName = _ref3.scopeName, contentScopeName = _ref3.contentScopeName; + if (contentScopeName) { + tags.push(this.endIdForScope(contentScopeName)); + } + if (scopeName) { + tags.push(this.endIdForScope(scopeName)); + } + } else { + if (position < line.length || (line.length === 0 && tags.length === 0)) { + tags.push(line.length - position); + } + break; + } + } else if (ruleStack.length > previousRuleStackLength) { + _ref4 = ruleStack.slice(-2), (_ref5 = _ref4[0], penultimateRule = _ref5.rule), (_ref6 = _ref4[1], lastRule = _ref6.rule); + if ((lastRule != null) && lastRule === penultimateRule) { + popStack = true; + } + if (((lastRule != null ? lastRule.scopeName : void 0) != null) && penultimateRule.scopeName === lastRule.scopeName) { + popStack = true; + } + if (popStack) { + ruleStack.pop(); + lastSymbol = _.last(tags); + if (lastSymbol < 0 && lastSymbol === this.startIdForScope(lastRule.scopeName)) { + tags.pop(); + } + tags.push(line.length - position); + break; + } + } + } + } + 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) { + _ref7 = ruleStack.pop(), scopeName = _ref7.scopeName, contentScopeName = _ref7.contentScopeName; + if (contentScopeName) { + tags.push(this.endIdForScope(contentScopeName)); + } + if (scopeName) { + tags.push(this.endIdForScope(scopeName)); + } + } + } + for (_k = 0, _len2 = ruleStack.length; _k < _len2; _k++) { + rule = ruleStack[_k].rule; + rule.clearAnchorPosition(); + } + if (compatibilityMode) { + return new TokenizeLineResult(inputLine, openScopeTags, tags, ruleStack, this.registry); + } else { + return { + line: inputLine, + tags: tags, + ruleStack: ruleStack + }; + } + }; + + Grammar.prototype.activate = function() { + return this.registration = this.registry.addGrammar(this); + }; + + Grammar.prototype.deactivate = function() { + var _ref1; + this.emitter = new Emitter; + if ((_ref1 = this.registration) != null) { + _ref1.dispose(); + } + return this.registration = null; + }; + + Grammar.prototype.updateRules = function() { + this.initialRule = this.createRule({ + scopeName: this.scopeName, + patterns: this.rawPatterns + }); + this.repository = this.createRepository(); + return this.injections = new Injections(this, this.rawInjections); + }; + + Grammar.prototype.getInitialRule = function() { + return this.initialRule; + }; + + Grammar.prototype.getRepository = function() { + return this.repository; + }; + + Grammar.prototype.createRepository = function() { + var data, name, repository, _ref1; + repository = {}; + _ref1 = this.rawRepository; + for (name in _ref1) { + data = _ref1[name]; + if ((data.begin != null) || (data.match != null)) { + data = { + patterns: [data], + tempName: name + }; + } + repository[name] = this.createRule(data); + } + return repository; + }; + + Grammar.prototype.addIncludedGrammarScope = function(scope) { + if (!_.include(this.includedGrammarScopes, scope)) { + return this.includedGrammarScopes.push(scope); + } + }; + + Grammar.prototype.grammarUpdated = function(scopeName) { + if (!_.include(this.includedGrammarScopes, scopeName)) { + return false; + } + this.updateRules(); + this.registry.grammarUpdated(this.scopeName); + if (Grim.includeDeprecatedAPIs) { + this.emit('grammar-updated'); + } + this.emitter.emit('did-update'); + return true; + }; + + Grammar.prototype.startIdForScope = function(scope) { + return this.registry.startIdForScope(scope); + }; + + Grammar.prototype.endIdForScope = function(scope) { + return this.registry.endIdForScope(scope); + }; + + Grammar.prototype.scopeForId = function(id) { + return this.registry.scopeForId(id); + }; + + Grammar.prototype.createRule = function(options) { + return new Rule(this, this.registry, options); + }; + + Grammar.prototype.createPattern = function(options) { + return new Pattern(this, this.registry, options); + }; + + Grammar.prototype.getMaxTokensPerLine = function() { + return this.maxTokensPerLine; + }; + + Grammar.prototype.scopesFromStack = function(stack, rule, endPatternMatch) { + var contentScopeName, scopeName, scopes, _i, _len, _ref1; + scopes = []; + for (_i = 0, _len = stack.length; _i < _len; _i++) { + _ref1 = stack[_i], scopeName = _ref1.scopeName, contentScopeName = _ref1.contentScopeName; + if (scopeName) { + scopes.push(scopeName); + } + if (contentScopeName) { + scopes.push(contentScopeName); + } + } + if (endPatternMatch && (rule != null ? rule.contentScopeName : void 0) && rule === stack[stack.length - 1]) { + scopes.pop(); + } + return scopes; + }; + + return Grammar; + + })(); + + if (Grim.includeDeprecatedAPIs) { + EmitterMixin = require('emissary').Emitter; + EmitterMixin.includeInto(Grammar); + Grammar.prototype.on = function(eventName) { + if (eventName === 'did-update') { + Grim.deprecate("Call Grammar::onDidUpdate instead"); + } else { + Grim.deprecate("Call explicit event subscription methods instead"); + } + return EmitterMixin.prototype.on.apply(this, arguments); + }; + } + + TokenizeLineResult = (function() { + function TokenizeLineResult(line, openScopeTags, tags, ruleStack, registry) { + this.line = line; + this.openScopeTags = openScopeTags; + this.tags = tags; + this.ruleStack = ruleStack; + this.registry = registry; + } + + Object.defineProperty(TokenizeLineResult.prototype, 'tokens', { + get: function() { + return this.registry.decodeTokens(this.line, this.tags, this.openScopeTags); + } + }); + + return TokenizeLineResult; + + })(); + +}).call(this); diff --git a/lib/injections.js b/lib/injections.js new file mode 100644 index 0000000..571c85a --- /dev/null +++ b/lib/injections.js @@ -0,0 +1,71 @@ +(function() { + var Injections, Scanner, ScopeSelector, _; + + _ = require('underscore-plus'); + + Scanner = require('./scanner'); + + ScopeSelector = require('./scope-selector'); + + module.exports = Injections = (function() { + function Injections(grammar, injections) { + var pattern, patterns, regex, selector, values, _i, _len, _ref, _ref1; + this.grammar = grammar; + if (injections == null) { + injections = {}; + } + this.injections = []; + this.scanners = {}; + for (selector in injections) { + values = injections[selector]; + if (!((values != null ? (_ref = values.patterns) != null ? _ref.length : void 0 : void 0) > 0)) { + continue; + } + patterns = []; + _ref1 = values.patterns; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + regex = _ref1[_i]; + pattern = this.grammar.createPattern(regex); + patterns.push.apply(patterns, pattern.getIncludedPatterns(this.grammar, patterns)); + } + this.injections.push({ + selector: new ScopeSelector(selector), + patterns: patterns + }); + } + } + + Injections.prototype.getScanner = function(injection) { + var scanner; + if (injection.scanner != null) { + return injection.scanner; + } + scanner = new Scanner(injection.patterns); + injection.scanner = scanner; + return scanner; + }; + + Injections.prototype.getScanners = function(ruleStack) { + var injection, scanner, scanners, scopes, _i, _len, _ref; + if (this.injections.length === 0) { + return []; + } + scanners = []; + scopes = this.grammar.scopesFromStack(ruleStack); + _ref = this.injections; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + injection = _ref[_i]; + if (!(injection.selector.matches(scopes))) { + continue; + } + scanner = this.getScanner(injection); + scanners.push(scanner); + } + return scanners; + }; + + return Injections; + + })(); + +}).call(this); diff --git a/lib/null-grammar.js b/lib/null-grammar.js new file mode 100644 index 0000000..d06217d --- /dev/null +++ b/lib/null-grammar.js @@ -0,0 +1,29 @@ +(function() { + var Grammar, NullGrammar, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Grammar = require('./grammar'); + + module.exports = NullGrammar = (function(_super) { + __extends(NullGrammar, _super); + + function NullGrammar(registry) { + var name, scopeName; + name = 'Null Grammar'; + scopeName = 'text.plain.null-grammar'; + NullGrammar.__super__.constructor.call(this, registry, { + name: name, + scopeName: scopeName + }); + } + + NullGrammar.prototype.getScore = function() { + return 0; + }; + + return NullGrammar; + + })(Grammar); + +}).call(this); diff --git a/lib/pattern.js b/lib/pattern.js new file mode 100644 index 0000000..1eac46f --- /dev/null +++ b/lib/pattern.js @@ -0,0 +1,336 @@ +(function() { + var AllCustomCaptureIndicesRegex, AllDigitsRegex, DigitRegex, Pattern, _, + __slice = [].slice; + + _ = require('underscore-plus'); + + AllCustomCaptureIndicesRegex = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/g; + + AllDigitsRegex = /\\\d+/g; + + DigitRegex = /\\\d+/; + + module.exports = Pattern = (function() { + function Pattern(grammar, registry, options) { + var applyEndPatternLast, begin, beginCaptures, capture, captures, contentName, end, endCaptures, endPattern, group, match, name, patterns, _ref, _ref1; + this.grammar = grammar; + this.registry = registry; + if (options == null) { + options = {}; + } + name = options.name, contentName = options.contentName, match = options.match, begin = options.begin, end = options.end, patterns = options.patterns; + captures = options.captures, beginCaptures = options.beginCaptures, endCaptures = options.endCaptures, applyEndPatternLast = options.applyEndPatternLast; + this.include = options.include, this.popRule = options.popRule, this.hasBackReferences = options.hasBackReferences; + this.pushRule = null; + this.backReferences = null; + this.scopeName = name; + this.contentScopeName = contentName; + if (match) { + if ((end || this.popRule) && (this.hasBackReferences != null ? this.hasBackReferences : this.hasBackReferences = DigitRegex.test(match))) { + this.match = match; + } else { + this.regexSource = match; + } + this.captures = captures; + } else if (begin) { + this.regexSource = begin; + this.captures = beginCaptures != null ? beginCaptures : captures; + endPattern = this.grammar.createPattern({ + match: end, + captures: endCaptures != null ? endCaptures : captures, + popRule: true + }); + this.pushRule = this.grammar.createRule({ + scopeName: this.scopeName, + contentScopeName: this.contentScopeName, + patterns: patterns, + endPattern: endPattern, + applyEndPatternLast: applyEndPatternLast + }); + } + if (this.captures != null) { + _ref = this.captures; + for (group in _ref) { + capture = _ref[group]; + if (((_ref1 = capture.patterns) != null ? _ref1.length : void 0) > 0 && !capture.rule) { + capture.scopeName = this.scopeName; + capture.rule = this.grammar.createRule(capture); + } + } + } + this.anchored = this.hasAnchor(); + } + + Pattern.prototype.getRegex = function(firstLine, position, anchorPosition) { + if (this.anchored) { + return this.replaceAnchor(firstLine, position, anchorPosition); + } else { + return this.regexSource; + } + }; + + Pattern.prototype.hasAnchor = function() { + var character, escape, _i, _len, _ref; + if (!this.regexSource) { + return false; + } + escape = false; + _ref = this.regexSource; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + character = _ref[_i]; + if (escape && (character === 'A' || character === 'G' || character === 'z')) { + return true; + } + escape = !escape && character === '\\'; + } + return false; + }; + + Pattern.prototype.replaceAnchor = function(firstLine, offset, anchor) { + var character, escape, escaped, placeholder, _i, _len, _ref; + escaped = []; + placeholder = '\uFFFF'; + escape = false; + _ref = this.regexSource; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + character = _ref[_i]; + if (escape) { + switch (character) { + case 'A': + if (firstLine) { + escaped.push("\\" + character); + } else { + escaped.push(placeholder); + } + break; + case 'G': + if (offset === anchor) { + escaped.push("\\" + character); + } else { + escaped.push(placeholder); + } + break; + case 'z': + escaped.push('$(?!\n)(?= 1) { + grammarName = name.slice(0, +(hashIndex - 1) + 1 || 9e9); + ruleName = name.slice(hashIndex + 1); + this.grammar.addIncludedGrammarScope(grammarName); + return (_ref = this.registry.grammarForScopeName(grammarName)) != null ? _ref.getRepository()[ruleName] : void 0; + } else if (name === '$self') { + return this.grammar.getInitialRule(); + } else if (name === '$base') { + return baseGrammar.getInitialRule(); + } else { + this.grammar.addIncludedGrammarScope(name); + return (_ref1 = this.registry.grammarForScopeName(name)) != null ? _ref1.getInitialRule() : void 0; + } + }; + + Pattern.prototype.getIncludedPatterns = function(baseGrammar, included) { + var rule, _ref; + if (this.include) { + rule = this.ruleForInclude(baseGrammar, this.include); + return (_ref = rule != null ? rule.getIncludedPatterns(baseGrammar, included) : void 0) != null ? _ref : []; + } else { + return [this]; + } + }; + + Pattern.prototype.resolveScopeName = function(scopeName, line, captureIndices) { + var resolvedScopeName; + return resolvedScopeName = scopeName.replace(AllCustomCaptureIndicesRegex, function(match, index, commandIndex, command) { + var capture, replacement; + capture = captureIndices[parseInt(index != null ? index : commandIndex)]; + if (capture != null) { + replacement = line.substring(capture.start, capture.end); + while (replacement[0] === '.') { + replacement = replacement.substring(1); + } + switch (command) { + case 'downcase': + return replacement.toLowerCase(); + case 'upcase': + return replacement.toUpperCase(); + default: + return replacement; + } + } else { + return match; + } + }); + }; + + Pattern.prototype.handleMatch = function(stack, line, captureIndices, rule, endPatternMatch) { + var contentScopeName, end, ruleToPush, scopeName, start, tags, zeroWidthMatch, _ref; + tags = []; + zeroWidthMatch = captureIndices[0].start === captureIndices[0].end; + if (this.popRule) { + if (zeroWidthMatch && _.last(stack).zeroWidthMatch && _.last(stack).rule.anchorPosition === captureIndices[0].end) { + return false; + } + contentScopeName = _.last(stack).contentScopeName; + if (contentScopeName) { + tags.push(this.grammar.endIdForScope(contentScopeName)); + } + } else if (this.scopeName) { + scopeName = this.resolveScopeName(this.scopeName, line, captureIndices); + tags.push(this.grammar.startIdForScope(scopeName)); + } + if (this.captures) { + tags.push.apply(tags, this.tagsForCaptureIndices(line, captureIndices.slice(), captureIndices, stack)); + } else { + _ref = captureIndices[0], start = _ref.start, end = _ref.end; + if (end !== start) { + tags.push(end - start); + } + } + if (this.pushRule) { + ruleToPush = this.pushRule.getRuleToPush(line, captureIndices); + ruleToPush.anchorPosition = captureIndices[0].end; + contentScopeName = ruleToPush.contentScopeName; + if (contentScopeName) { + contentScopeName = this.resolveScopeName(contentScopeName, line, captureIndices); + tags.push(this.grammar.startIdForScope(contentScopeName)); + } + stack.push({ + rule: ruleToPush, + scopeName: scopeName, + contentScopeName: contentScopeName, + zeroWidthMatch: zeroWidthMatch + }); + } else { + if (this.popRule) { + scopeName = stack.pop().scopeName; + } + if (scopeName) { + tags.push(this.grammar.endIdForScope(scopeName)); + } + } + return tags; + }; + + Pattern.prototype.tagsForCaptureRule = function(rule, line, captureStart, captureEnd, stack) { + var captureTags, captureText, offset, openScopes, tag, tags, _i, _len; + captureText = line.substring(captureStart, captureEnd); + tags = rule.grammar.tokenizeLine(captureText, __slice.call(stack).concat([{ + rule: rule + }]), false, true, false).tags; + openScopes = []; + captureTags = []; + offset = 0; + for (_i = 0, _len = tags.length; _i < _len; _i++) { + tag = tags[_i]; + if (!(tag < 0 || (tag > 0 && offset < captureEnd))) { + continue; + } + captureTags.push(tag); + if (tag >= 0) { + offset += tag; + } else { + if (tag % 2 === 0) { + openScopes.pop(); + } else { + openScopes.push(tag); + } + } + } + while (openScopes.length > 0) { + captureTags.push(openScopes.pop() - 1); + } + return captureTags; + }; + + Pattern.prototype.tagsForCaptureIndices = function(line, currentCaptureIndices, allCaptureIndices, stack) { + var captureHasNoScope, captureRule, captureTags, childCapture, emptyCapture, parentCapture, parentCaptureScope, previousChildCaptureEnd, scope, tags, _ref, _ref1; + parentCapture = currentCaptureIndices.shift(); + tags = []; + if (scope = (_ref = this.captures[parentCapture.index]) != null ? _ref.name : void 0) { + parentCaptureScope = this.resolveScopeName(scope, line, allCaptureIndices); + tags.push(this.grammar.startIdForScope(parentCaptureScope)); + } + if (captureRule = (_ref1 = this.captures[parentCapture.index]) != null ? _ref1.rule : void 0) { + captureTags = this.tagsForCaptureRule(captureRule, line, parentCapture.start, parentCapture.end, stack); + tags.push.apply(tags, captureTags); + while (currentCaptureIndices.length && currentCaptureIndices[0].start < parentCapture.end) { + currentCaptureIndices.shift(); + } + } else { + previousChildCaptureEnd = parentCapture.start; + while (currentCaptureIndices.length && currentCaptureIndices[0].start < parentCapture.end) { + childCapture = currentCaptureIndices[0]; + emptyCapture = childCapture.end - childCapture.start === 0; + captureHasNoScope = !this.captures[childCapture.index]; + if (emptyCapture || captureHasNoScope) { + currentCaptureIndices.shift(); + continue; + } + if (childCapture.start > previousChildCaptureEnd) { + tags.push(childCapture.start - previousChildCaptureEnd); + } + captureTags = this.tagsForCaptureIndices(line, currentCaptureIndices, allCaptureIndices, stack); + tags.push.apply(tags, captureTags); + previousChildCaptureEnd = childCapture.end; + } + if (parentCapture.end > previousChildCaptureEnd) { + tags.push(parentCapture.end - previousChildCaptureEnd); + } + } + if (parentCaptureScope) { + if (tags.length > 1) { + tags.push(this.grammar.endIdForScope(parentCaptureScope)); + } else { + tags.pop(); + } + } + return tags; + }; + + return Pattern; + + })(); + +}).call(this); diff --git a/lib/rule.js b/lib/rule.js new file mode 100644 index 0000000..aac0275 --- /dev/null +++ b/lib/rule.js @@ -0,0 +1,189 @@ +(function() { + var Rule, Scanner, _, + __slice = [].slice; + + _ = require('underscore-plus'); + + Scanner = require('./scanner'); + + module.exports = Rule = (function() { + function Rule(grammar, registry, _arg) { + var pattern, patterns, _i, _len, _ref, _ref1; + this.grammar = grammar; + this.registry = registry; + _ref = _arg != null ? _arg : {}, this.scopeName = _ref.scopeName, this.contentScopeName = _ref.contentScopeName, patterns = _ref.patterns, this.endPattern = _ref.endPattern, this.applyEndPatternLast = _ref.applyEndPatternLast; + this.patterns = []; + _ref1 = patterns != null ? patterns : []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + pattern = _ref1[_i]; + if (!pattern.disabled) { + this.patterns.push(this.grammar.createPattern(pattern)); + } + } + if (this.endPattern && !this.endPattern.hasBackReferences) { + if (this.applyEndPatternLast) { + this.patterns.push(this.endPattern); + } else { + this.patterns.unshift(this.endPattern); + } + } + this.scannersByBaseGrammarName = {}; + this.createEndPattern = null; + this.anchorPosition = -1; + } + + Rule.prototype.getIncludedPatterns = function(baseGrammar, included) { + var allPatterns, pattern, _i, _len, _ref; + if (included == null) { + included = []; + } + if (_.include(included, this)) { + return []; + } + included = included.concat([this]); + allPatterns = []; + _ref = this.patterns; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + pattern = _ref[_i]; + allPatterns.push.apply(allPatterns, pattern.getIncludedPatterns(baseGrammar, included)); + } + return allPatterns; + }; + + Rule.prototype.clearAnchorPosition = function() { + return this.anchorPosition = -1; + }; + + Rule.prototype.getScanner = function(baseGrammar) { + var patterns, scanner; + if (scanner = this.scannersByBaseGrammarName[baseGrammar.name]) { + return scanner; + } + patterns = this.getIncludedPatterns(baseGrammar); + scanner = new Scanner(patterns); + this.scannersByBaseGrammarName[baseGrammar.name] = scanner; + return scanner; + }; + + Rule.prototype.scanInjections = function(ruleStack, line, position, firstLine) { + var baseGrammar, injections, result, scanner, _i, _len, _ref; + baseGrammar = ruleStack[0].rule.grammar; + if (injections = baseGrammar.injections) { + _ref = injections.getScanners(ruleStack); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + scanner = _ref[_i]; + result = scanner.findNextMatch(line, firstLine, position, this.anchorPosition); + if (result != null) { + return result; + } + } + } + }; + + Rule.prototype.normalizeCaptureIndices = function(line, captureIndices) { + var capture, lineLength, _i, _len; + lineLength = line.length; + for (_i = 0, _len = captureIndices.length; _i < _len; _i++) { + capture = captureIndices[_i]; + capture.end = Math.min(capture.end, lineLength); + capture.start = Math.min(capture.start, lineLength); + } + }; + + Rule.prototype.findNextMatch = function(ruleStack, lineWithNewline, position, firstLine) { + var baseGrammar, injection, injectionGrammar, result, results, scanner, scopes, _i, _j, _len, _len1, _ref, _ref1; + baseGrammar = ruleStack[0].rule.grammar; + results = []; + scanner = this.getScanner(baseGrammar); + if (result = scanner.findNextMatch(lineWithNewline, firstLine, position, this.anchorPosition)) { + results.push(result); + } + if (result = this.scanInjections(ruleStack, lineWithNewline, position, firstLine)) { + _ref = baseGrammar.injections.injections; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + injection = _ref[_i]; + if (injection.scanner === result.scanner) { + if (injection.selector.getPrefix(this.grammar.scopesFromStack(ruleStack)) === 'L') { + results.unshift(result); + } else { + results.push(result); + } + } + } + } + scopes = null; + _ref1 = this.registry.injectionGrammars; + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + injectionGrammar = _ref1[_j]; + if (injectionGrammar === this.grammar) { + continue; + } + if (injectionGrammar === baseGrammar) { + continue; + } + if (scopes == null) { + scopes = this.grammar.scopesFromStack(ruleStack); + } + if (injectionGrammar.injectionSelector.matches(scopes)) { + scanner = injectionGrammar.getInitialRule().getScanner(injectionGrammar, position, firstLine); + if (result = scanner.findNextMatch(lineWithNewline, firstLine, position, this.anchorPosition)) { + if (injectionGrammar.injectionSelector.getPrefix(scopes) === 'L') { + results.unshift(result); + } else { + results.push(result); + } + } + } + } + if (results.length > 1) { + return _.min(results, (function(_this) { + return function(result) { + _this.normalizeCaptureIndices(lineWithNewline, result.captureIndices); + return result.captureIndices[0].start; + }; + })(this)); + } else if (results.length === 1) { + result = results[0]; + this.normalizeCaptureIndices(lineWithNewline, result.captureIndices); + return result; + } + }; + + Rule.prototype.getNextTags = function(ruleStack, line, lineWithNewline, position, firstLine) { + var captureIndices, endPatternMatch, firstCapture, index, nextTags, result, scanner; + result = this.findNextMatch(ruleStack, lineWithNewline, position, firstLine); + if (result == null) { + return null; + } + index = result.index, captureIndices = result.captureIndices, scanner = result.scanner; + firstCapture = captureIndices[0]; + endPatternMatch = this.endPattern === scanner.patterns[index]; + if (nextTags = scanner.handleMatch(result, ruleStack, line, this, endPatternMatch)) { + return { + nextTags: nextTags, + tagsStart: firstCapture.start, + tagsEnd: firstCapture.end + }; + } + }; + + Rule.prototype.getRuleToPush = function(line, beginPatternCaptureIndices) { + var rule; + if (this.endPattern.hasBackReferences) { + rule = this.grammar.createRule({ + scopeName: this.scopeName, + contentScopeName: this.contentScopeName + }); + rule.endPattern = this.endPattern.resolveBackReferences(line, beginPatternCaptureIndices); + rule.patterns = [rule.endPattern].concat(__slice.call(this.patterns)); + return rule; + } else { + return this; + } + }; + + return Rule; + + })(); + +}).call(this); diff --git a/lib/scanner.js b/lib/scanner.js new file mode 100644 index 0000000..ac9041d --- /dev/null +++ b/lib/scanner.js @@ -0,0 +1,74 @@ +(function() { + var OnigScanner, Scanner; + + OnigScanner = require('oniguruma').OnigScanner; + + module.exports = Scanner = (function() { + function Scanner(patterns) { + var pattern, _i, _len, _ref; + this.patterns = patterns != null ? patterns : []; + this.anchored = false; + _ref = this.patterns; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + pattern = _ref[_i]; + if (!pattern.anchored) { + continue; + } + this.anchored = true; + break; + } + this.anchoredScanner = null; + this.firstLineAnchoredScanner = null; + this.firstLineScanner = null; + this.scanner = null; + } + + Scanner.prototype.createScanner = function(firstLine, position, anchorPosition) { + var patterns, scanner; + patterns = this.patterns.map(function(pattern) { + return pattern.getRegex(firstLine, position, anchorPosition); + }); + return scanner = new OnigScanner(patterns); + }; + + Scanner.prototype.getScanner = function(firstLine, position, anchorPosition) { + if (!this.anchored) { + if (this.scanner == null) { + this.scanner = this.createScanner(firstLine, position, anchorPosition); + } + return this.scanner; + } + if (firstLine) { + if (position === anchorPosition) { + return this.firstLineAnchoredScanner != null ? this.firstLineAnchoredScanner : this.firstLineAnchoredScanner = this.createScanner(firstLine, position, anchorPosition); + } else { + return this.firstLineScanner != null ? this.firstLineScanner : this.firstLineScanner = this.createScanner(firstLine, position, anchorPosition); + } + } else if (position === anchorPosition) { + return this.anchoredScanner != null ? this.anchoredScanner : this.anchoredScanner = this.createScanner(firstLine, position, anchorPosition); + } else { + return this.scanner != null ? this.scanner : this.scanner = this.createScanner(firstLine, position, anchorPosition); + } + }; + + Scanner.prototype.findNextMatch = function(line, firstLine, position, anchorPosition) { + var match, scanner; + scanner = this.getScanner(firstLine, position, anchorPosition); + match = scanner.findNextMatchSync(line, position); + if (match != null) { + match.scanner = this; + } + return match; + }; + + Scanner.prototype.handleMatch = function(match, stack, line, rule, endPatternMatch) { + var pattern; + pattern = this.patterns[match.index]; + return pattern.handleMatch(stack, line, match.captureIndices, rule, endPatternMatch); + }; + + return Scanner; + + })(); + +}).call(this); diff --git a/lib/scope-selector-matchers.js b/lib/scope-selector-matchers.js new file mode 100644 index 0000000..1955a06 --- /dev/null +++ b/lib/scope-selector-matchers.js @@ -0,0 +1,325 @@ +(function() { + var AndMatcher, CompositeMatcher, GroupMatcher, NegateMatcher, OrMatcher, PathMatcher, ScopeMatcher, SegmentMatcher, TrueMatcher; + + SegmentMatcher = (function() { + function SegmentMatcher(segments) { + this.segment = segments[0].join('') + segments[1].join(''); + } + + SegmentMatcher.prototype.matches = function(scope) { + return scope === this.segment; + }; + + SegmentMatcher.prototype.getPrefix = function(scope) {}; + + SegmentMatcher.prototype.toCssSelector = function() { + return this.segment.split('.').map(function(dotFragment) { + return '.' + dotFragment.replace(/\+/g, '\\+'); + }).join(''); + }; + + SegmentMatcher.prototype.toCssSyntaxSelector = function() { + return this.segment.split('.').map(function(dotFragment) { + return '.syntax--' + dotFragment.replace(/\+/g, '\\+'); + }).join(''); + }; + + return SegmentMatcher; + + })(); + + TrueMatcher = (function() { + function TrueMatcher() {} + + TrueMatcher.prototype.matches = function() { + return true; + }; + + TrueMatcher.prototype.getPrefix = function(scopes) {}; + + TrueMatcher.prototype.toCssSelector = function() { + return '*'; + }; + + TrueMatcher.prototype.toCssSyntaxSelector = function() { + return '*'; + }; + + return TrueMatcher; + + })(); + + ScopeMatcher = (function() { + function ScopeMatcher(first, others) { + var segment, _i, _len; + this.segments = [first]; + for (_i = 0, _len = others.length; _i < _len; _i++) { + segment = others[_i]; + this.segments.push(segment[1]); + } + } + + ScopeMatcher.prototype.matches = function(scope) { + var lastDotIndex, matcherSegment, matcherSegmentIndex, nextDotIndex, scopeSegment, _i, _len, _ref; + lastDotIndex = 0; + _ref = this.segments; + for (matcherSegmentIndex = _i = 0, _len = _ref.length; _i < _len; matcherSegmentIndex = ++_i) { + matcherSegment = _ref[matcherSegmentIndex]; + if (lastDotIndex > scope.length) { + break; + } + nextDotIndex = scope.indexOf('.', lastDotIndex); + if (nextDotIndex === -1) { + nextDotIndex = scope.length; + } + scopeSegment = scope.substring(lastDotIndex, nextDotIndex); + if (!matcherSegment.matches(scopeSegment)) { + return false; + } + lastDotIndex = nextDotIndex + 1; + } + return matcherSegmentIndex === this.segments.length; + }; + + ScopeMatcher.prototype.getPrefix = function(scope) { + var index, scopeSegments, segment, _i, _len, _ref; + scopeSegments = scope.split('.'); + if (scopeSegments.length < this.segments.length) { + return false; + } + _ref = this.segments; + for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) { + segment = _ref[index]; + if (segment.matches(scopeSegments[index])) { + if (segment.prefix != null) { + return segment.prefix; + } + } + } + }; + + ScopeMatcher.prototype.toCssSelector = function() { + return this.segments.map(function(matcher) { + return matcher.toCssSelector(); + }).join(''); + }; + + ScopeMatcher.prototype.toCssSyntaxSelector = function() { + return this.segments.map(function(matcher) { + return matcher.toCssSyntaxSelector(); + }).join(''); + }; + + return ScopeMatcher; + + })(); + + GroupMatcher = (function() { + function GroupMatcher(prefix, selector) { + this.prefix = prefix != null ? prefix[0] : void 0; + this.selector = selector; + } + + GroupMatcher.prototype.matches = function(scopes) { + return this.selector.matches(scopes); + }; + + GroupMatcher.prototype.getPrefix = function(scopes) { + if (this.selector.matches(scopes)) { + return this.prefix; + } + }; + + GroupMatcher.prototype.toCssSelector = function() { + return this.selector.toCssSelector(); + }; + + GroupMatcher.prototype.toCssSyntaxSelector = function() { + return this.selector.toCssSyntaxSelector(); + }; + + return GroupMatcher; + + })(); + + PathMatcher = (function() { + function PathMatcher(prefix, first, others) { + var matcher, _i, _len; + this.prefix = prefix != null ? prefix[0] : void 0; + this.matchers = [first]; + for (_i = 0, _len = others.length; _i < _len; _i++) { + matcher = others[_i]; + this.matchers.push(matcher[1]); + } + } + + PathMatcher.prototype.matches = function(scopes) { + var index, matcher, scope, _i, _len; + index = 0; + matcher = this.matchers[index]; + for (_i = 0, _len = scopes.length; _i < _len; _i++) { + scope = scopes[_i]; + if (matcher.matches(scope)) { + matcher = this.matchers[++index]; + } + if (matcher == null) { + return true; + } + } + return false; + }; + + PathMatcher.prototype.getPrefix = function(scopes) { + if (this.matches(scopes)) { + return this.prefix; + } + }; + + PathMatcher.prototype.toCssSelector = function() { + return this.matchers.map(function(matcher) { + return matcher.toCssSelector(); + }).join(' '); + }; + + PathMatcher.prototype.toCssSyntaxSelector = function() { + return this.matchers.map(function(matcher) { + return matcher.toCssSyntaxSelector(); + }).join(' '); + }; + + return PathMatcher; + + })(); + + OrMatcher = (function() { + function OrMatcher(left, right) { + this.left = left; + this.right = right; + } + + OrMatcher.prototype.matches = function(scopes) { + return this.left.matches(scopes) || this.right.matches(scopes); + }; + + OrMatcher.prototype.getPrefix = function(scopes) { + return this.left.getPrefix(scopes) || this.right.getPrefix(scopes); + }; + + OrMatcher.prototype.toCssSelector = function() { + return "" + (this.left.toCssSelector()) + ", " + (this.right.toCssSelector()); + }; + + OrMatcher.prototype.toCssSyntaxSelector = function() { + return "" + (this.left.toCssSyntaxSelector()) + ", " + (this.right.toCssSyntaxSelector()); + }; + + return OrMatcher; + + })(); + + AndMatcher = (function() { + function AndMatcher(left, right) { + this.left = left; + this.right = right; + } + + AndMatcher.prototype.matches = function(scopes) { + return this.left.matches(scopes) && this.right.matches(scopes); + }; + + AndMatcher.prototype.getPrefix = function(scopes) { + if (this.left.matches(scopes) && this.right.matches(scopes)) { + return this.left.getPrefix(scopes); + } + }; + + AndMatcher.prototype.toCssSelector = function() { + if (this.right instanceof NegateMatcher) { + return "" + (this.left.toCssSelector()) + (this.right.toCssSelector()); + } else { + return "" + (this.left.toCssSelector()) + " " + (this.right.toCssSelector()); + } + }; + + AndMatcher.prototype.toCssSyntaxSelector = function() { + if (this.right instanceof NegateMatcher) { + return "" + (this.left.toCssSyntaxSelector()) + (this.right.toCssSyntaxSelector()); + } else { + return "" + (this.left.toCssSyntaxSelector()) + " " + (this.right.toCssSyntaxSelector()); + } + }; + + return AndMatcher; + + })(); + + NegateMatcher = (function() { + function NegateMatcher(matcher) { + this.matcher = matcher; + } + + NegateMatcher.prototype.matches = function(scopes) { + return !this.matcher.matches(scopes); + }; + + NegateMatcher.prototype.getPrefix = function(scopes) {}; + + NegateMatcher.prototype.toCssSelector = function() { + return ":not(" + (this.matcher.toCssSelector()) + ")"; + }; + + NegateMatcher.prototype.toCssSyntaxSelector = function() { + return ":not(" + (this.matcher.toCssSyntaxSelector()) + ")"; + }; + + return NegateMatcher; + + })(); + + CompositeMatcher = (function() { + function CompositeMatcher(left, operator, right) { + switch (operator) { + case '|': + this.matcher = new OrMatcher(left, right); + break; + case '&': + this.matcher = new AndMatcher(left, right); + break; + case '-': + this.matcher = new AndMatcher(left, new NegateMatcher(right)); + } + } + + CompositeMatcher.prototype.matches = function(scopes) { + return this.matcher.matches(scopes); + }; + + CompositeMatcher.prototype.getPrefix = function(scopes) { + return this.matcher.getPrefix(scopes); + }; + + CompositeMatcher.prototype.toCssSelector = function() { + return this.matcher.toCssSelector(); + }; + + CompositeMatcher.prototype.toCssSyntaxSelector = function() { + return this.matcher.toCssSyntaxSelector(); + }; + + return CompositeMatcher; + + })(); + + module.exports = { + AndMatcher: AndMatcher, + CompositeMatcher: CompositeMatcher, + GroupMatcher: GroupMatcher, + NegateMatcher: NegateMatcher, + OrMatcher: OrMatcher, + PathMatcher: PathMatcher, + ScopeMatcher: ScopeMatcher, + SegmentMatcher: SegmentMatcher, + TrueMatcher: TrueMatcher + }; + +}).call(this); diff --git a/lib/scope-selector-parser.js b/lib/scope-selector-parser.js new file mode 100644 index 0000000..74d0f0a --- /dev/null +++ b/lib/scope-selector-parser.js @@ -0,0 +1,879 @@ +module.exports = (function() { + /* + * Generated by PEG.js 0.8.0. + * + * http://pegjs.majda.cz/ + */ + + function peg$subclass(child, parent) { + function ctor() { this.constructor = child; } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); + } + + function SyntaxError(message, expected, found, offset, line, column) { + this.message = message; + this.expected = expected; + this.found = found; + this.offset = offset; + this.line = line; + this.column = column; + + this.name = "SyntaxError"; + } + + peg$subclass(SyntaxError, Error); + + function parse(input) { + var options = arguments.length > 1 ? arguments[1] : {}, + + peg$FAILED = {}, + + peg$startRuleFunctions = { start: peg$parsestart }, + peg$startRuleFunction = peg$parsestart, + + peg$c0 = peg$FAILED, + peg$c1 = function(selector) { + return selector; + }, + peg$c2 = [], + peg$c3 = /^[a-zA-Z0-9+_]/, + peg$c4 = { type: "class", value: "[a-zA-Z0-9+_]", description: "[a-zA-Z0-9+_]" }, + peg$c5 = /^[a-zA-Z0-9\-+_]/, + peg$c6 = { type: "class", value: "[a-zA-Z0-9\\-+_]", description: "[a-zA-Z0-9\\-+_]" }, + peg$c7 = function(segment) { + return new matchers.SegmentMatcher(segment); + }, + peg$c8 = /^[*]/, + peg$c9 = { type: "class", value: "[*]", description: "[*]" }, + peg$c10 = function(scopeName) { + return new matchers.TrueMatcher(); + }, + peg$c11 = ".", + peg$c12 = { type: "literal", value: ".", description: "\".\"" }, + peg$c13 = function(first, others) { + return new matchers.ScopeMatcher(first, others); + }, + peg$c14 = null, + peg$c15 = /^[LRB]/, + peg$c16 = { type: "class", value: "[LRB]", description: "[LRB]" }, + peg$c17 = ":", + peg$c18 = { type: "literal", value: ":", description: "\":\"" }, + peg$c19 = function(prefix, first, others) { + return new matchers.PathMatcher(prefix, first, others); + }, + peg$c20 = "(", + peg$c21 = { type: "literal", value: "(", description: "\"(\"" }, + peg$c22 = ")", + peg$c23 = { type: "literal", value: ")", description: "\")\"" }, + peg$c24 = function(prefix, selector) { + return new matchers.GroupMatcher(prefix, selector); + }, + peg$c25 = "-", + peg$c26 = { type: "literal", value: "-", description: "\"-\"" }, + peg$c27 = function(group) { + return new matchers.NegateMatcher(group); + }, + peg$c28 = function(path) { + return new matchers.NegateMatcher(path); + }, + peg$c29 = /^[|&\-]/, + peg$c30 = { type: "class", value: "[|&\\-]", description: "[|&\\-]" }, + peg$c31 = function(left, operator, right) { + return new matchers.CompositeMatcher(left, operator, right); + }, + peg$c32 = ",", + peg$c33 = { type: "literal", value: ",", description: "\",\"" }, + peg$c34 = function(left, right) { + if (right) + return new matchers.OrMatcher(left, right); + else + return left; + }, + peg$c35 = /^[ \t]/, + peg$c36 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, + + peg$currPos = 0, + peg$reportedPos = 0, + peg$cachedPos = 0, + peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$silentFails = 0, + + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function text() { + return input.substring(peg$reportedPos, peg$currPos); + } + + function offset() { + return peg$reportedPos; + } + + function line() { + return peg$computePosDetails(peg$reportedPos).line; + } + + function column() { + return peg$computePosDetails(peg$reportedPos).column; + } + + function expected(description) { + throw peg$buildException( + null, + [{ type: "other", description: description }], + peg$reportedPos + ); + } + + function error(message) { + throw peg$buildException(message, null, peg$reportedPos); + } + + function peg$computePosDetails(pos) { + function advance(details, startPos, endPos) { + var p, ch; + + for (p = startPos; p < endPos; p++) { + ch = input.charAt(p); + if (ch === "\n") { + if (!details.seenCR) { details.line++; } + details.column = 1; + details.seenCR = false; + } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { + details.line++; + details.column = 1; + details.seenCR = true; + } else { + details.column++; + details.seenCR = false; + } + } + } + + if (peg$cachedPos !== pos) { + if (peg$cachedPos > pos) { + peg$cachedPos = 0; + peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; + } + advance(peg$cachedPosDetails, peg$cachedPos, pos); + peg$cachedPos = pos; + } + + return peg$cachedPosDetails; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildException(message, expected, pos) { + function cleanupExpected(expected) { + var i = 1; + + expected.sort(function(a, b) { + if (a.description < b.description) { + return -1; + } else if (a.description > b.description) { + return 1; + } else { + return 0; + } + }); + + while (i < expected.length) { + if (expected[i - 1] === expected[i]) { + expected.splice(i, 1); + } else { + i++; + } + } + } + + function buildMessage(expected, found) { + function stringEscape(s) { + function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } + + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\x08/g, '\\b') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\f/g, '\\f') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) + .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) + .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); + } + + var expectedDescs = new Array(expected.length), + expectedDesc, foundDesc, i; + + for (i = 0; i < expected.length; i++) { + expectedDescs[i] = expected[i].description; + } + + expectedDesc = expected.length > 1 + ? expectedDescs.slice(0, -1).join(", ") + + " or " + + expectedDescs[expected.length - 1] + : expectedDescs[0]; + + foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; + + return "Expected " + expectedDesc + " but " + foundDesc + " found."; + } + + var posDetails = peg$computePosDetails(pos), + found = pos < input.length ? input.charAt(pos) : null; + + if (expected !== null) { + cleanupExpected(expected); + } + + return new SyntaxError( + message !== null ? message : buildMessage(expected, found), + expected, + found, + pos, + posDetails.line, + posDetails.column + ); + } + + function peg$parsestart() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$parseselector(); + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c1(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + return s0; + } + + function peg$parsesegment() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = []; + if (peg$c3.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c4); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c3.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c4); } + } + } + } else { + s3 = peg$c0; + } + if (s3 !== peg$FAILED) { + s4 = []; + if (peg$c5.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c6); } + } + while (s5 !== peg$FAILED) { + s4.push(s5); + if (peg$c5.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c6); } + } + } + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c0; + } + } else { + peg$currPos = s2; + s2 = peg$c0; + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c7(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (peg$c8.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c9); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c10(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } + + return s0; + } + + function peg$parsescope() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parsesegment(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c11; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c12); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parsesegment(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$c0; + } + } else { + peg$currPos = s3; + s3 = peg$c0; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c11; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c12); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parsesegment(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$c0; + } + } else { + peg$currPos = s3; + s3 = peg$c0; + } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c13(s1, s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + return s0; + } + + function peg$parsepath() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + s1 = peg$currPos; + if (peg$c15.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c16); } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c17; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } + } + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + if (s1 === peg$FAILED) { + s1 = peg$c14; + } + if (s1 !== peg$FAILED) { + s2 = peg$parsescope(); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + s5 = peg$parse_(); + if (s5 !== peg$FAILED) { + s6 = peg$parsescope(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$c0; + } + } else { + peg$currPos = s4; + s4 = peg$c0; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + s5 = peg$parse_(); + if (s5 !== peg$FAILED) { + s6 = peg$parsescope(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$c0; + } + } else { + peg$currPos = s4; + s4 = peg$c0; + } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c19(s1, s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + return s0; + } + + function peg$parsegroup() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + s1 = peg$currPos; + if (peg$c15.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c16); } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c17; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } + } + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$c0; + } + } else { + peg$currPos = s1; + s1 = peg$c0; + } + if (s1 === peg$FAILED) { + s1 = peg$c14; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 40) { + s2 = peg$c20; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c21); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s4 = peg$parseselector(); + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s6 = peg$c22; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c23); } + } + if (s6 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c24(s1, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + + return s0; + } + + function peg$parseexpression() { + var s0, s1, s2, s3, s4; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 45) { + s1 = peg$c25; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c26); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parsegroup(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c27(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 45) { + s1 = peg$c25; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c26); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parsepath(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c28(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$parsegroup(); + if (s0 === peg$FAILED) { + s0 = peg$parsepath(); + } + } + } + + return s0; + } + + function peg$parsecomposite() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseexpression(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + if (peg$c29.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsecomposite(); + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c31(s1, s3, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$parseexpression(); + } + + return s0; + } + + function peg$parseselector() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parsecomposite(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s3 = peg$c32; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c33); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseselector(); + if (s5 === peg$FAILED) { + s5 = peg$c14; + } + if (s5 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c34(s1, s5); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + } else { + peg$currPos = s0; + s0 = peg$c0; + } + if (s0 === peg$FAILED) { + s0 = peg$parsecomposite(); + } + + return s0; + } + + function peg$parse_() { + var s0, s1; + + s0 = []; + if (peg$c35.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c36); } + } + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c35.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c36); } + } + } + + return s0; + } + + var matchers = require('./scope-selector-matchers'); + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail({ type: "end", description: "end of input" }); + } + + throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); + } + } + + return { + SyntaxError: SyntaxError, + parse: parse + }; +})(); \ No newline at end of file diff --git a/lib/scope-selector.js b/lib/scope-selector.js new file mode 100644 index 0000000..0bbbfe1 --- /dev/null +++ b/lib/scope-selector.js @@ -0,0 +1,37 @@ +(function() { + var ScopeSelector, ScopeSelectorParser; + + ScopeSelectorParser = require('../lib/scope-selector-parser'); + + module.exports = ScopeSelector = (function() { + function ScopeSelector(source) { + this.matcher = ScopeSelectorParser.parse(source); + } + + ScopeSelector.prototype.matches = function(scopes) { + if (typeof scopes === 'string') { + scopes = [scopes]; + } + return this.matcher.matches(scopes); + }; + + ScopeSelector.prototype.getPrefix = function(scopes) { + if (typeof scopes === 'string') { + scopes = [scopes]; + } + return this.matcher.getPrefix(scopes); + }; + + ScopeSelector.prototype.toCssSelector = function() { + return this.matcher.toCssSelector(); + }; + + ScopeSelector.prototype.toCssSyntaxSelector = function() { + return this.matcher.toCssSyntaxSelector(); + }; + + return ScopeSelector; + + })(); + +}).call(this); diff --git a/package-lock.json b/package-lock.json index 15b11ee..3c6ebc5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "first-mate", "version": "7.4.3", "license": "MIT", "dependencies": { @@ -825,7 +826,7 @@ "node_modules/grunt-atomdoc": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/grunt-atomdoc/-/grunt-atomdoc-1.0.1.tgz", - "integrity": "sha1-1fDuKVwBc/9N6p1AvCI+drjM8cc=", + "integrity": "sha512-/DM4+o+23UXNqeoQbuh48i+jVIR5xeXT8o+pB+nyffDTXLjWT+oqy6+9zXyceQImmGZ6EmYlCDKAXezuqKnmVw==", "dev": true, "dependencies": { "donna": "~1.0", @@ -2305,7 +2306,7 @@ "grunt-atomdoc": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/grunt-atomdoc/-/grunt-atomdoc-1.0.1.tgz", - "integrity": "sha1-1fDuKVwBc/9N6p1AvCI+drjM8cc=", + "integrity": "sha512-/DM4+o+23UXNqeoQbuh48i+jVIR5xeXT8o+pB+nyffDTXLjWT+oqy6+9zXyceQImmGZ6EmYlCDKAXezuqKnmVw==", "dev": true, "requires": { "donna": "~1.0", @@ -2508,6 +2509,7 @@ }, "jasmine-node": { "version": "git+ssh://git@github.com/kevinsawicki/jasmine-node.git#81af4f953a2b7dfb5bde8331c05362a4b464c5ef", + "integrity": "sha512-OvqXUF5P3qkt6qYIkMeTRfBRp0V2BcQYhmUfax40vP0CcjxNbXy1hKaxTj/fidXU72bp/zf8UEJd5DqZI+Ojlg==", "dev": true, "from": "jasmine-node@git+https://github.com/kevinsawicki/jasmine-node.git#81af4f953a2b7dfb5bde8331c05362a4b464c5ef", "requires": { From 39120e240e709525dc37e5cf54dc8b5982134d3d Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sun, 20 Nov 2022 16:05:15 -0800 Subject: [PATCH 02/25] Moved tests, to test the JS files themselves --- spec/grammar-registry-spec.coffee | 2 +- spec/grammar-spec.coffee | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/grammar-registry-spec.coffee b/spec/grammar-registry-spec.coffee index 7944eb5..fc20741 100644 --- a/spec/grammar-registry-spec.coffee +++ b/spec/grammar-registry-spec.coffee @@ -1,5 +1,5 @@ path = require 'path' -GrammarRegistry = require '../src/grammar-registry' +GrammarRegistry = require '../lib/grammar-registry' describe "GrammarRegistry", -> registry = null diff --git a/spec/grammar-spec.coffee b/spec/grammar-spec.coffee index c68cbda..53b2152 100644 --- a/spec/grammar-spec.coffee +++ b/spec/grammar-spec.coffee @@ -1,8 +1,8 @@ path = require 'path' _ = require 'underscore-plus' fs = require 'fs-plus' -GrammarRegistry = require '../src/grammar-registry' -Grammar = require '../src/grammar' +GrammarRegistry = require '../lib/grammar-registry' +Grammar = require '../lib/grammar' describe "Grammar tokenization", -> [grammar, registry] = [] From 32377ddfee221f11fc54acbdc835af8c310c2e2c Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sun, 20 Nov 2022 16:11:11 -0800 Subject: [PATCH 03/25] Removed using grunt from tests, to ensure decaf doesn't override js during testing --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2819d22..e7a749c 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "TextMate helpers", "main": "./lib/first-mate.js", "scripts": { - "test": "grunt test", + "test": "node node_modules/jasmine-focused/bin/jasmine-focused --coffee --captureExceptions spec", "prepare": "grunt prepublish", "benchmark": "node_modules/.bin/coffee benchmark/benchmark.coffee" }, From c3d873a2039a86a1f212473bb17b860051348cf2 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sun, 20 Nov 2022 16:11:31 -0800 Subject: [PATCH 04/25] Decaf `first-mate.js` --- lib/first-mate.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/first-mate.js b/lib/first-mate.js index 1ec2e41..6689d8c 100644 --- a/lib/first-mate.js +++ b/lib/first-mate.js @@ -1,14 +1,12 @@ -(function() { - module.exports = { - ScopeSelector: require('./scope-selector'), - GrammarRegistry: require('./grammar-registry'), - Grammar: require('./grammar') - }; - Object.defineProperty(module.exports, 'OnigRegExp', { - get: function() { - return require('oniguruma').OnigRegExp; - } - }); +module.exports = { + ScopeSelector: require("./scope-selector.js"), + GrammarRegistry: require("./grammar-registry.js"), + Grammar: require("./grammar.js") +}; -}).call(this); +Object.defineProperty(module.exports, 'OnigRegExp', { + get: function() { + return require('oniguruma').OnigRegExp; + } +}); From c3bfc8912d4aba45c112565152a127b6543ee59c Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sun, 20 Nov 2022 16:42:48 -0800 Subject: [PATCH 05/25] Decafe `null-grammar.js` --- lib/null-grammar.js | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/lib/null-grammar.js b/lib/null-grammar.js index d06217d..73d3591 100644 --- a/lib/null-grammar.js +++ b/lib/null-grammar.js @@ -1,29 +1,15 @@ -(function() { - var Grammar, NullGrammar, - __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; +const Grammar = require("./grammar.js"); - Grammar = require('./grammar'); +// A grammar with no patterns that is always available from a {GrammarRegistry} +// even when it is completely empty. +class NullGrammar extends Grammar { + constructor(registry) { + super(registry, { name: "Null Grammar", scopeName: "text.plain.null-grammar" }); + } - module.exports = NullGrammar = (function(_super) { - __extends(NullGrammar, _super); + getScore() { + return 0; + } +} - function NullGrammar(registry) { - var name, scopeName; - name = 'Null Grammar'; - scopeName = 'text.plain.null-grammar'; - NullGrammar.__super__.constructor.call(this, registry, { - name: name, - scopeName: scopeName - }); - } - - NullGrammar.prototype.getScore = function() { - return 0; - }; - - return NullGrammar; - - })(Grammar); - -}).call(this); +module.exports = NullGrammar; From 55c8e97992438229ec8ad4eeb64f021a16082b4e Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sun, 20 Nov 2022 16:50:35 -0800 Subject: [PATCH 06/25] Decafe `scope-selector.js` --- lib/scope-selector.js | 85 +++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/lib/scope-selector.js b/lib/scope-selector.js index 0bbbfe1..f498e23 100644 --- a/lib/scope-selector.js +++ b/lib/scope-selector.js @@ -1,37 +1,50 @@ -(function() { - var ScopeSelector, ScopeSelectorParser; - - ScopeSelectorParser = require('../lib/scope-selector-parser'); - - module.exports = ScopeSelector = (function() { - function ScopeSelector(source) { - this.matcher = ScopeSelectorParser.parse(source); +const ScopeSelectorParser = require("./scope-selector-parser.js"); + +class ScopeSelector { + // Create a new scope selector + // + // source - A {String} to parse as a scope selector + constructor(source) { + this.matcher = ScopeSelectorParser.parse(source); + } + + // Check if this scope selector matches the scopes. + // + // scopes - An {Array} of {String}s or a single {String}. + // + // Returns a {Boolean}. + matches(scopes) { + if (typeof scopes === "string") { + scopes = [scopes]; } - - ScopeSelector.prototype.matches = function(scopes) { - if (typeof scopes === 'string') { - scopes = [scopes]; - } - return this.matcher.matches(scopes); - }; - - ScopeSelector.prototype.getPrefix = function(scopes) { - if (typeof scopes === 'string') { - scopes = [scopes]; - } - return this.matcher.getPrefix(scopes); - }; - - ScopeSelector.prototype.toCssSelector = function() { - return this.matcher.toCssSelector(); - }; - - ScopeSelector.prototype.toCssSyntaxSelector = function() { - return this.matcher.toCssSyntaxSelector(); - }; - - return ScopeSelector; - - })(); - -}).call(this); + return this.matcher.matches(scopes); + } + + // Gets the prefix of this scope selector. + // + // scopes - An {Array} of {String}s or a single {String}. + // + // Returns a {String} if there is a prefix or undefined otherwise. + getPrefix(scopes) { + if (typeof scopes === "string") { + scopes = [scopes]; + } + return this.matcher.getPrefix(scopes); + } + + // Convert this TextMate scope selector to a CSS selector. + // + // Returns a {String}. + toCssSelector() { + return this.matcher.toCssSelector(); + } + + // Conver this TextMate scope selector to a CSS selector, prefixing scopes with `syntax--` + // + // Returns a {String} + toCssSyntaxSelector() { + return this.matcher.toCssSyntaxSelector(); + } +} + +module.exports = ScopeSelector; From c78f1ebc32f627e83a112741e1ce7252dacf4a14 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sun, 20 Nov 2022 17:04:10 -0800 Subject: [PATCH 07/25] Update our GH Actions Test Runner --- .github/workflows/ci.yml | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b80db07..a660214 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,26 +1,25 @@ name: CI -on: [push] - -env: - CI: true +on: + - push + - pull_request jobs: - Test: + test: + name: Test strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-20.04, macos-latest, windows-2019] + fail-fast: false runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v2 - with: - node-version: '14' - - name: Install windows-build-tools - if: ${{ matrix.os == 'windows-latest' }} - run: | - npm config set msvs_version 2019 - - name: Install dependencies - run: npm i - - name: Run tests - run: npm test + - name: Checkout our Source + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Install Dependencies + run: npm install + - name: Run Tests + run: npm test From 7b82fb6cacf6b34c2669787e7d629f2739be2436 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sun, 20 Nov 2022 17:19:14 -0800 Subject: [PATCH 08/25] Remove `prepublish` script so hopefully actions can run --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index e7a749c..e4ab9e3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,6 @@ "main": "./lib/first-mate.js", "scripts": { "test": "node node_modules/jasmine-focused/bin/jasmine-focused --coffee --captureExceptions spec", - "prepare": "grunt prepublish", "benchmark": "node_modules/.bin/coffee benchmark/benchmark.coffee" }, "repository": { From 60f3e16b190e3efcee01f9bb064db037ef938eb5 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sun, 20 Nov 2022 17:22:32 -0800 Subject: [PATCH 09/25] Essentially Bogus commit for CI to run --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a660214..34a9266 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: CI Tests on: - push @@ -22,4 +22,4 @@ jobs: - name: Install Dependencies run: npm install - name: Run Tests - run: npm test + run: npm test From beab7388634cdea30b511654343661fb7f1191e8 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Mon, 21 Nov 2022 20:05:52 -0800 Subject: [PATCH 10/25] Decaf `scope-selector-matchers.js` --- lib/scope-selector-matchers.js | 552 ++++++++++++++++----------------- 1 file changed, 264 insertions(+), 288 deletions(-) diff --git a/lib/scope-selector-matchers.js b/lib/scope-selector-matchers.js index 1955a06..d52bcb9 100644 --- a/lib/scope-selector-matchers.js +++ b/lib/scope-selector-matchers.js @@ -1,325 +1,301 @@ -(function() { - var AndMatcher, CompositeMatcher, GroupMatcher, NegateMatcher, OrMatcher, PathMatcher, ScopeMatcher, SegmentMatcher, TrueMatcher; +class SegmentMatcher { + constructor(segments) { + this.segment = segments[0].join('') + segments[1].join(''); + } - SegmentMatcher = (function() { - function SegmentMatcher(segments) { - this.segment = segments[0].join('') + segments[1].join(''); - } - - SegmentMatcher.prototype.matches = function(scope) { - return scope === this.segment; - }; + matches(scope) { + return scope === this.segment; + } - SegmentMatcher.prototype.getPrefix = function(scope) {}; + getPrefix(scope) { - SegmentMatcher.prototype.toCssSelector = function() { - return this.segment.split('.').map(function(dotFragment) { - return '.' + dotFragment.replace(/\+/g, '\\+'); - }).join(''); - }; + } - SegmentMatcher.prototype.toCssSyntaxSelector = function() { - return this.segment.split('.').map(function(dotFragment) { - return '.syntax--' + dotFragment.replace(/\+/g, '\\+'); - }).join(''); - }; + toCssSelector() { + return this.segment.split('.').map((dotFragment) => { + return '.' + dotFragment.replace(/\+/g, '\\+'); + }).join(''); + } - return SegmentMatcher; + toCssSyntaxSelector() { + return this.segment.split('.').map((dotFragment) => { + return '.syntax--' + dotFragment.replace(/\+/g, '\\+'); + }).join(''); + } +} - })(); +class TrueMatcher { + constructor() { - TrueMatcher = (function() { - function TrueMatcher() {} + } - TrueMatcher.prototype.matches = function() { - return true; - }; + matches() { + return true; + } - TrueMatcher.prototype.getPrefix = function(scopes) {}; + getPrefix(scopes) { - TrueMatcher.prototype.toCssSelector = function() { - return '*'; - }; + } - TrueMatcher.prototype.toCssSyntaxSelector = function() { - return '*'; - }; + toCssSelector() { + return '*'; + } - return TrueMatcher; + toCssSyntaxSelector() { + return '*'; + } +} - })(); +class ScopeMatcher { + constructor(first, others) { + this.segments = [first]; - ScopeMatcher = (function() { - function ScopeMatcher(first, others) { - var segment, _i, _len; - this.segments = [first]; - for (_i = 0, _len = others.length; _i < _len; _i++) { - segment = others[_i]; - this.segments.push(segment[1]); - } + for(let i = 0; i < others.length; i++) { + this.segments.push(others[i][1]); } - - ScopeMatcher.prototype.matches = function(scope) { - var lastDotIndex, matcherSegment, matcherSegmentIndex, nextDotIndex, scopeSegment, _i, _len, _ref; - lastDotIndex = 0; - _ref = this.segments; - for (matcherSegmentIndex = _i = 0, _len = _ref.length; _i < _len; matcherSegmentIndex = ++_i) { - matcherSegment = _ref[matcherSegmentIndex]; - if (lastDotIndex > scope.length) { - break; - } - nextDotIndex = scope.indexOf('.', lastDotIndex); - if (nextDotIndex === -1) { - nextDotIndex = scope.length; - } - scopeSegment = scope.substring(lastDotIndex, nextDotIndex); - if (!matcherSegment.matches(scopeSegment)) { - return false; - } - lastDotIndex = nextDotIndex + 1; + } + + matches(scope) { + // This should be further worked on, but any logical changes caused failing tests. + let matcherSegment, matcherSegmentIndex, _i; + let lastDotIndex = 0; + for (matcherSegmentIndex = _i = 0; _i < this.segments.length; matcherSegmentIndex = ++_i) { + matcherSegment = this.segments[matcherSegmentIndex]; + if (lastDotIndex > scope.length) { + break; } - return matcherSegmentIndex === this.segments.length; - }; - - ScopeMatcher.prototype.getPrefix = function(scope) { - var index, scopeSegments, segment, _i, _len, _ref; - scopeSegments = scope.split('.'); - if (scopeSegments.length < this.segments.length) { - return false; + let nextDotIndex = scope.indexOf('.', lastDotIndex); + if (nextDotIndex === -1) { + nextDotIndex = scope.length; } - _ref = this.segments; - for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) { - segment = _ref[index]; - if (segment.matches(scopeSegments[index])) { - if (segment.prefix != null) { - return segment.prefix; - } - } + let scopeSegment = scope.substring(lastDotIndex, nextDotIndex); + if (!matcherSegment.matches(scopeSegment)) { + return false; } - }; - - ScopeMatcher.prototype.toCssSelector = function() { - return this.segments.map(function(matcher) { - return matcher.toCssSelector(); - }).join(''); - }; - - ScopeMatcher.prototype.toCssSyntaxSelector = function() { - return this.segments.map(function(matcher) { - return matcher.toCssSyntaxSelector(); - }).join(''); - }; - - return ScopeMatcher; - - })(); - - GroupMatcher = (function() { - function GroupMatcher(prefix, selector) { - this.prefix = prefix != null ? prefix[0] : void 0; - this.selector = selector; + lastDotIndex = nextDotIndex + 1; } + return matcherSegmentIndex === this.segments.length; + } - GroupMatcher.prototype.matches = function(scopes) { - return this.selector.matches(scopes); - }; - - GroupMatcher.prototype.getPrefix = function(scopes) { - if (this.selector.matches(scopes)) { - return this.prefix; - } - }; - - GroupMatcher.prototype.toCssSelector = function() { - return this.selector.toCssSelector(); - }; - - GroupMatcher.prototype.toCssSyntaxSelector = function() { - return this.selector.toCssSyntaxSelector(); - }; - - return GroupMatcher; - - })(); - - PathMatcher = (function() { - function PathMatcher(prefix, first, others) { - var matcher, _i, _len; - this.prefix = prefix != null ? prefix[0] : void 0; - this.matchers = [first]; - for (_i = 0, _len = others.length; _i < _len; _i++) { - matcher = others[_i]; - this.matchers.push(matcher[1]); - } + getPrefix(scope) { + let scopeSegments = scope.split('.'); + if (scopeSegments.length < this.segments.length) { + return false; } - PathMatcher.prototype.matches = function(scopes) { - var index, matcher, scope, _i, _len; - index = 0; - matcher = this.matchers[index]; - for (_i = 0, _len = scopes.length; _i < _len; _i++) { - scope = scopes[_i]; - if (matcher.matches(scope)) { - matcher = this.matchers[++index]; - } - if (matcher == null) { - return true; + for (let i = 0; i < this.segments.length; i++) { + if (this.segments[i].matches(scopeSegments[i])) { + if (this.segments[i].prefix != null) { + return this.segments[i].prefix; } } - return false; - }; - - PathMatcher.prototype.getPrefix = function(scopes) { - if (this.matches(scopes)) { - return this.prefix; - } - }; - - PathMatcher.prototype.toCssSelector = function() { - return this.matchers.map(function(matcher) { - return matcher.toCssSelector(); - }).join(' '); - }; - - PathMatcher.prototype.toCssSyntaxSelector = function() { - return this.matchers.map(function(matcher) { - return matcher.toCssSyntaxSelector(); - }).join(' '); - }; - - return PathMatcher; - - })(); - - OrMatcher = (function() { - function OrMatcher(left, right) { - this.left = left; - this.right = right; } + } + + toCssSelector() { + return this.segments.map((matcher) => { + return matcher.toCssSelector(); + }).join(''); + } + + toCssSyntaxSelector() { + return this.segments.map((matcher) => { + return matcher.toCssSyntaxSelector(); + }).join(''); + } +} + +class GroupMatcher { + constructor(prefix, selector) { + this.prefix = prefix != null ? prefix[0] : void 0; + this.selector = selector; + } + + matches(scopes) { + return this.selector.matches(scopes); + } + + getPrefix(scopes) { + if (this.selector.matches(scopes)) { + return this.prefix; + } + } - OrMatcher.prototype.matches = function(scopes) { - return this.left.matches(scopes) || this.right.matches(scopes); - }; - - OrMatcher.prototype.getPrefix = function(scopes) { - return this.left.getPrefix(scopes) || this.right.getPrefix(scopes); - }; - - OrMatcher.prototype.toCssSelector = function() { - return "" + (this.left.toCssSelector()) + ", " + (this.right.toCssSelector()); - }; - - OrMatcher.prototype.toCssSyntaxSelector = function() { - return "" + (this.left.toCssSyntaxSelector()) + ", " + (this.right.toCssSyntaxSelector()); - }; + toCssSelector() { + return this.selector.toCssSelector(); + } - return OrMatcher; + toCssSyntaxSelector() { + return this.selector.toCssSyntaxSelector(); + } +} - })(); +class PathMatcher { + constructor(prefix, first, others) { + this.prefix = prefix != null ? prefix[0] : void 0; + this.matchers = [first]; - AndMatcher = (function() { - function AndMatcher(left, right) { - this.left = left; - this.right = right; + for (let i = 0; i < others.length; i++) { + this.matchers.push(others[i][1]); } - - AndMatcher.prototype.matches = function(scopes) { - return this.left.matches(scopes) && this.right.matches(scopes); - }; - - AndMatcher.prototype.getPrefix = function(scopes) { - if (this.left.matches(scopes) && this.right.matches(scopes)) { - return this.left.getPrefix(scopes); + } + + matches(scopes) { + // This could likely be reduced further, but additional changes + // caused inconsistent tests. + let index = 0; + let matcher = this.matchers[index]; + for (let i = 0; i < scopes.length; i++) { + let scope = scopes[i]; + + if (matcher.matches(scope)) { + matcher = this.matchers[++index]; } - }; - - AndMatcher.prototype.toCssSelector = function() { - if (this.right instanceof NegateMatcher) { - return "" + (this.left.toCssSelector()) + (this.right.toCssSelector()); - } else { - return "" + (this.left.toCssSelector()) + " " + (this.right.toCssSelector()); - } - }; - - AndMatcher.prototype.toCssSyntaxSelector = function() { - if (this.right instanceof NegateMatcher) { - return "" + (this.left.toCssSyntaxSelector()) + (this.right.toCssSyntaxSelector()); - } else { - return "" + (this.left.toCssSyntaxSelector()) + " " + (this.right.toCssSyntaxSelector()); + if (matcher == null) { + return true; } - }; - - return AndMatcher; - - })(); - - NegateMatcher = (function() { - function NegateMatcher(matcher) { - this.matcher = matcher; } + return false; + } - NegateMatcher.prototype.matches = function(scopes) { - return !this.matcher.matches(scopes); - }; - - NegateMatcher.prototype.getPrefix = function(scopes) {}; - - NegateMatcher.prototype.toCssSelector = function() { - return ":not(" + (this.matcher.toCssSelector()) + ")"; - }; - - NegateMatcher.prototype.toCssSyntaxSelector = function() { - return ":not(" + (this.matcher.toCssSyntaxSelector()) + ")"; - }; - - return NegateMatcher; - - })(); - - CompositeMatcher = (function() { - function CompositeMatcher(left, operator, right) { - switch (operator) { - case '|': - this.matcher = new OrMatcher(left, right); - break; - case '&': - this.matcher = new AndMatcher(left, right); - break; - case '-': - this.matcher = new AndMatcher(left, new NegateMatcher(right)); - } + getPrefix(scopes) { + if (this.matches(scopes)) { + return this.prefix; } + } + + toCssSelector() { + return this.matchers.map((matcher) => { + return matcher.toCssSelector(); + }).join(' '); + } + + toCssSyntaxSelector() { + return this.matchers.map((matcher) => { + return matcher.toCssSyntaxSelector(); + }).join(' '); + } + +} + +class OrMatcher { + constructor(left, right) { + this.left = left; + this.right = right; + } + + matches(scopes) { + return this.left.matches(scopes) || this.right.matches(scopes); + } + + getPrefix(scopes) { + return this.left.getPrefix(scopes) || this.right.getPrefix(scopes); + } + + toCssSelector() { + return `${this.left.toCssSelector()}, ${this.right.toCssSelector()}`; + } + + toCssSyntaxSelector() { + return `${this.left.toCssSyntaxSelector()}, ${this.right.toCssSyntaxSelector()}`; + } +} + +class AndMatcher { + constructor(left, right) { + this.left = left; + this.right = right; + } + + matches(scopes) { + return this.left.matches(scopes) && this.right.matches(scopes); + } + + getPrefix(scopes) { + if (this.left.matches(scopes) && this.right.matches(scopes)) { + return this.left.getPrefix(scopes); + } + } - CompositeMatcher.prototype.matches = function(scopes) { - return this.matcher.matches(scopes); - }; - - CompositeMatcher.prototype.getPrefix = function(scopes) { - return this.matcher.getPrefix(scopes); - }; - - CompositeMatcher.prototype.toCssSelector = function() { - return this.matcher.toCssSelector(); - }; - - CompositeMatcher.prototype.toCssSyntaxSelector = function() { - return this.matcher.toCssSyntaxSelector(); - }; - - return CompositeMatcher; - - })(); - - module.exports = { - AndMatcher: AndMatcher, - CompositeMatcher: CompositeMatcher, - GroupMatcher: GroupMatcher, - NegateMatcher: NegateMatcher, - OrMatcher: OrMatcher, - PathMatcher: PathMatcher, - ScopeMatcher: ScopeMatcher, - SegmentMatcher: SegmentMatcher, - TrueMatcher: TrueMatcher - }; + toCssSelector() { + if (this.right instanceof NegateMatcher) { + return `${this.left.toCssSelector()}${this.right.toCssSelector()}`; + } else { + return `${this.left.toCssSelector()} ${this.right.toCssSelector()}`; + } + } -}).call(this); + toCssSyntaxSelector() { + if (this.right instanceof NegateMatcher) { + return `${this.left.toCssSyntaxSelector()}${this.right.toCssSyntaxSelector()}`; + } else { + return `${this.left.toCssSyntaxSelector()} ${this.right.toCssSyntaxSelector()}`; + } + } +} + +class NegateMatcher { + constructor(matcher) { + this.matcher = matcher; + } + + matches(scopes) { + return !this.matcher.matches(scopes); + } + + getPrefix(scopes) { + + } + + toCssSelector() { + return `:not(${this.matcher.toCssSelector()})`; + } + + toCssSyntaxSelector() { + return `:not(${this.matcher.toCssSyntaxSelector()})`; + } +} + +class CompositeMatcher { + constructor(left, operator, right) { + switch(operator) { + case '|': + this.matcher = new OrMatcher(left, right); + break; + case '&': + this.matcher = new AndMatcher(left, right); + break; + case '-': + this.matcher = new AndMatcher(left, new NegateMatcher(right)); + break; + } + } + + matches(scopes) { + return this.matcher.matches(scopes); + } + + getPrefix(scopes) { + return this.matcher.getPrefix(scopes); + } + + toCssSelector() { + return this.matcher.toCssSelector(); + } + + toCssSyntaxSelector() { + return this.matcher.toCssSyntaxSelector(); + } +} + +module.exports = { + AndMatcher: AndMatcher, + CompositeMatcher: CompositeMatcher, + GroupMatcher: GroupMatcher, + NegateMatcher: NegateMatcher, + OrMatcher: OrMatcher, + PathMatcher: PathMatcher, + ScopeMatcher: ScopeMatcher, + SegmentMatcher: SegmentMatcher, + TrueMatcher: TrueMatcher +}; From 159f614f7036c2fde579dc22c7b34a629ef31c65 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Mon, 21 Nov 2022 20:07:04 -0800 Subject: [PATCH 11/25] Added @Sertonix's Suggestion --- lib/first-mate.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/first-mate.js b/lib/first-mate.js index 6689d8c..4db9737 100644 --- a/lib/first-mate.js +++ b/lib/first-mate.js @@ -2,11 +2,8 @@ module.exports = { ScopeSelector: require("./scope-selector.js"), GrammarRegistry: require("./grammar-registry.js"), - Grammar: require("./grammar.js") -}; - -Object.defineProperty(module.exports, 'OnigRegExp', { - get: function() { - return require('oniguruma').OnigRegExp; + Grammar: require("./grammar.js"), + get OnigRegExp() { + return require("oniguruma").OnigRegExp; } -}); +}; From dd048aa3ab067418e531d510077f91a7ae1a3125 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Mon, 21 Nov 2022 21:30:45 -0800 Subject: [PATCH 12/25] Decafe `scanner.js` - Added Comments --- lib/scanner.js | 139 +++++++++++++++++++++++++++---------------------- 1 file changed, 78 insertions(+), 61 deletions(-) diff --git a/lib/scanner.js b/lib/scanner.js index ac9041d..bf841e7 100644 --- a/lib/scanner.js +++ b/lib/scanner.js @@ -1,74 +1,91 @@ -(function() { - var OnigScanner, Scanner; - OnigScanner = require('oniguruma').OnigScanner; +const OnigScanner = require("oniguruma").OnigScanner; - module.exports = Scanner = (function() { - function Scanner(patterns) { - var pattern, _i, _len, _ref; - this.patterns = patterns != null ? patterns : []; - this.anchored = false; - _ref = this.patterns; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - pattern = _ref[_i]; - if (!pattern.anchored) { - continue; - } - this.anchored = true; - break; +// Wrapper class for {OnigScanner} that caches them based on the presence of any +// anchor characters that change based on the current position being scanned. +// +// See {Pattern::replaceAnchor} for more details. + +class Scanner { + constructor(patterns) { + this.patterns = patterns != null ? patterns : []; + this.anchored = false; + + for (let i = 0; i < this.patterns.length; i++) { + if (!this.patterns[i].anchored) { + continue; } - this.anchoredScanner = null; - this.firstLineAnchoredScanner = null; - this.firstLineScanner = null; - this.scanner = null; + this.anchored = true; + break; } - Scanner.prototype.createScanner = function(firstLine, position, anchorPosition) { - var patterns, scanner; - patterns = this.patterns.map(function(pattern) { - return pattern.getRegex(firstLine, position, anchorPosition); - }); - return scanner = new OnigScanner(patterns); - }; + this.anchoredScanner = null; + this.firstLineAnchoredScanner = null; + this.firstLineScanner = null; + this.scanner = null; + } - Scanner.prototype.getScanner = function(firstLine, position, anchorPosition) { - if (!this.anchored) { - if (this.scanner == null) { - this.scanner = this.createScanner(firstLine, position, anchorPosition); - } - return this.scanner; + // Create a new {OnigScanner} with the given options. + createScanner(firstLine, position, anchorPosition) { + let patterns = this.patterns.map((pattern) => { + return pattern.getRegex(firstLine, position, anchorPosition); + }); + return new OnigScanner(patterns); + } + + // Get the {OnigScanner} for the given position and options. + getScanner(firstLine, position, anchorPosition) { + if (!this.anchored) { + if (this.scanner == null) { + this.scanner = this.createScanner(firstLine, position, anchorPosition); } - if (firstLine) { - if (position === anchorPosition) { - return this.firstLineAnchoredScanner != null ? this.firstLineAnchoredScanner : this.firstLineAnchoredScanner = this.createScanner(firstLine, position, anchorPosition); - } else { - return this.firstLineScanner != null ? this.firstLineScanner : this.firstLineScanner = this.createScanner(firstLine, position, anchorPosition); - } - } else if (position === anchorPosition) { - return this.anchoredScanner != null ? this.anchoredScanner : this.anchoredScanner = this.createScanner(firstLine, position, anchorPosition); + return this.scanner; + } + if (firstLine) { + if (position === anchorPosition) { + return this.firstLineAnchoredScanner != null ? this.firstLineAnchoredScanner : this.firstLineAnchoredScanner = this.createScanner(firstLine, position, anchorPosition); } else { - return this.scanner != null ? this.scanner : this.scanner = this.createScanner(firstLine, position, anchorPosition); + return this.firstLineScanner != null ? this.firstLineScanner : this.firstLineScanner = this.createScanner(firstLine, position, anchorPosition); } - }; - - Scanner.prototype.findNextMatch = function(line, firstLine, position, anchorPosition) { - var match, scanner; - scanner = this.getScanner(firstLine, position, anchorPosition); - match = scanner.findNextMatchSync(line, position); - if (match != null) { - match.scanner = this; - } - return match; - }; + } else if (position === anchorPosition) { + return this.anchoredScanner != null ? this.anchoredScanner : this.anchoredScanner = this.createScanner(firstLine, position, anchorPosition); + } else { + return this.scanner != null ? this.scanner : this.scanner = this.createScanner(firstLine, position, anchorPosition); + } + } - Scanner.prototype.handleMatch = function(match, stack, line, rule, endPatternMatch) { - var pattern; - pattern = this.patterns[match.index]; - return pattern.handleMatch(stack, line, match.captureIndices, rule, endPatternMatch); - }; + // Public: Find the next match on the line start at the given position. + // + // line - the string being scanned. + // firstLine - true if the first line is being scanned. + // position = numeric position to start scanning at. + // anchorPosition - numeric position of the last anchored match. + // + // Returns an Object with details about the match or null if no match found. + findNextMatch(line, firstLine, position, anchorPosition) { + let scanner = this.getScanner(firstLine, position, anchorPosition); + let match = scanner.findNextMatchSync(line, position); + if (match != null) { + match.scanner = this; + } + return match; + } - return Scanner; + // Public: Handle the given match by calling `handleMatch` on the + // matched {Pattern} + // + // match - An object returned from a previous call to `findNextMatch` + // stack - An array of {Rule} objects. + // line - The string being scanned. + // rule - The rule that matched. + // endpatternMatch - true if the rule's end pattern matched. + // + // Returns an array of toekns representing the match. + handleMatch(match, stack, line, rule, endPatternMatch) { + let pattern = this.patterns[match.index]; + return pattern.handleMatch(stack, line, match.captureIndices, rule, endPatternMatch); + } - })(); +} -}).call(this); +module.exports = Scanner; From dc79638a5d7c49ebe2c989e03afdb5d49e7139c6 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Mon, 21 Nov 2022 21:42:44 -0800 Subject: [PATCH 13/25] Decaf `injections.js` --- lib/injections.js | 111 ++++++++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 62 deletions(-) diff --git a/lib/injections.js b/lib/injections.js index 571c85a..a91088b 100644 --- a/lib/injections.js +++ b/lib/injections.js @@ -1,71 +1,58 @@ -(function() { - var Injections, Scanner, ScopeSelector, _; - - _ = require('underscore-plus'); - - Scanner = require('./scanner'); - - ScopeSelector = require('./scope-selector'); +const _ = require("underscore-plus"); +const Scanner = require("./scanner.js"); +const ScopeSelector = require("./scope-selector.js"); + +class Injections { + constructor(grammar, injections) { + this.grammar = grammar; + if (injections == null) { + injections = {}; + } + this.injections = []; + this.scanners = {}; - module.exports = Injections = (function() { - function Injections(grammar, injections) { - var pattern, patterns, regex, selector, values, _i, _len, _ref, _ref1; - this.grammar = grammar; - if (injections == null) { - injections = {}; + for (const selector in injections) { + let values = injections[selector]; + if (!((values != null ? values.patterns != null ? values.patterns.length : void 0 : void 0) > 0)) { + continue; } - this.injections = []; - this.scanners = {}; - for (selector in injections) { - values = injections[selector]; - if (!((values != null ? (_ref = values.patterns) != null ? _ref.length : void 0 : void 0) > 0)) { - continue; - } - patterns = []; - _ref1 = values.patterns; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - regex = _ref1[_i]; - pattern = this.grammar.createPattern(regex); - patterns.push.apply(patterns, pattern.getIncludedPatterns(this.grammar, patterns)); - } - this.injections.push({ - selector: new ScopeSelector(selector), - patterns: patterns - }); + let patterns = []; + for (let i = 0; i < values.patterns.length; i++) { + let pattern = this.grammar.createPattern(values.patterns[i]); + patterns.push.apply(patterns, pattern.getIncludedPatterns(this.grammar, patterns)); } + this.injections.push({ + selector: new ScopeSelector(selector), + patterns: patterns + }); } + } - Injections.prototype.getScanner = function(injection) { - var scanner; - if (injection.scanner != null) { - return injection.scanner; - } - scanner = new Scanner(injection.patterns); - injection.scanner = scanner; - return scanner; - }; + getScanner(injection) { + if (injection.scanner != null) { + return injection.scanner; + } + injection.scanner = new Scanner(injection.patterns); + return injection.scanner; + } - Injections.prototype.getScanners = function(ruleStack) { - var injection, scanner, scanners, scopes, _i, _len, _ref; - if (this.injections.length === 0) { - return []; - } - scanners = []; - scopes = this.grammar.scopesFromStack(ruleStack); - _ref = this.injections; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - injection = _ref[_i]; - if (!(injection.selector.matches(scopes))) { - continue; - } - scanner = this.getScanner(injection); - scanners.push(scanner); + getScanners(ruleStack) { + if (this.injections.length === 0) { + return []; + } + let scanners = []; + let scopes = this.grammar.scopesFromStack(ruleStack); + for (let i = 0; i < this.injections.length; i++) { + let injection = this.injections[i]; + if (!(injection.selector.matches(scopes))) { + continue; } - return scanners; - }; - - return Injections; + let scanner = this.getScanner(injection); + scanners.push(scanner); + } + return scanners; + } - })(); +} -}).call(this); +module.exports = Injections; From 6b72b6a1cf254e54a7bf5fccecc3ac165f4498c7 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Tue, 22 Nov 2022 01:15:39 -0800 Subject: [PATCH 14/25] Decaf `grammar-registry.js` --- lib/grammar-registry.js | 535 ++++++++++++++++++++++------------------ 1 file changed, 293 insertions(+), 242 deletions(-) diff --git a/lib/grammar-registry.js b/lib/grammar-registry.js index ebcf628..9b3a543 100644 --- a/lib/grammar-registry.js +++ b/lib/grammar-registry.js @@ -1,273 +1,324 @@ -(function() { - var CSON, Disposable, Emitter, EmitterMixin, Grammar, GrammarRegistry, Grim, NullGrammar, _, _ref; - - _ = require('underscore-plus'); - - CSON = require('season'); - - _ref = require('event-kit'), Emitter = _ref.Emitter, Disposable = _ref.Disposable; - - Grim = require('grim'); - - Grammar = require('./grammar'); - - NullGrammar = require('./null-grammar'); - - module.exports = GrammarRegistry = (function() { - function GrammarRegistry(options) { - var _ref1, _ref2; - if (options == null) { - options = {}; - } - this.maxTokensPerLine = (_ref1 = options.maxTokensPerLine) != null ? _ref1 : Infinity; - this.maxLineLength = (_ref2 = options.maxLineLength) != null ? _ref2 : Infinity; - this.nullGrammar = new NullGrammar(this); - this.clear(); +const _ = require("underscore-plus"); +const CSON = require("season"); +const Grim = require("grim"); +const { Emitter, Disposable } = require("event-kit"); +const Grammar = require("./grammar.js"); +const NullGrammar = require("./null-grammar.js"); + +// Extended: Registry containing one or more grammars. +class GrammarRegistry { + constructor(options) { + if (options == null) { + options = {}; } + this.maxTokensPerLine = options.maxTokensPerLine != null ? options.maxTokensPerLine : Infinity; + this.maxLineLength = options.maxLineLength != null ? options.maxLineLength : Infinity; + this.nullGrammar = new NullGrammar(this); + this.clear(); + } - GrammarRegistry.prototype.clear = function() { - this.emitter = new Emitter; - this.grammars = []; - this.grammarsByScopeName = {}; - this.injectionGrammars = []; - this.grammarOverridesByPath = {}; - this.scopeIdCounter = -1; - this.idsByScope = {}; - this.scopesById = {}; - return this.addGrammar(this.nullGrammar); - }; - - - /* - Section: Event Subscription - */ - - GrammarRegistry.prototype.onDidAddGrammar = function(callback) { - return this.emitter.on('did-add-grammar', callback); - }; + clear() { + this.emitter = new Emitter; + this.grammars = []; + this.grammarsByScopeName = {}; + this.injectionGrammars = []; + this.grammarOverridesByPath = {}; + this.scopeIdCounter = -1; + this.idsByScope = {}; + this.scopesById = {}; + return this.addGrammar(this.nullGrammar); + } - GrammarRegistry.prototype.onDidUpdateGrammar = function(callback) { - return this.emitter.on('did-update-grammar', callback); - }; + // ### + // Section: Event Subscription + // ### + + // Public: Invoke the given callback when a grammar is added to the registry. + // + // * `callback` {Function} to call when a grammar is added. + // * `grammar` {Grammar} that was added. + // + // Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. + onDidAddGrammar(callback) { + return this.emitter.on('did-add-grammar', callback); + } - GrammarRegistry.prototype.onDidRemoveGrammar = function(callback) { - return this.emitter.on('did-remove-grammar', callback); - }; + // Public: Invoke the given callback when a grammar is updated due to a grammar + // it depends on being added or removed from the registry. + // + // * `callback` {Function} to call when a grammar is updated. + // * `grammar` {Grammar} that was updated. + // + // Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. + onDidUpdateGrammar(callback) { + return this.emitter.on('did-update-grammar', callback); + } + // Public: Invoke the given callback when a grammar is removed from the registry. + // + // * `callback` {Function} to call when a grammar is removed. + // * `grammar` {Grammar} that was removed. + // + // Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. + onDidRemoveGrammar(callback) { + return this.emitter.on('did-remove-grammar', callback); + } - /* - Section: Managing Grammars - */ + // ### + // Section: Managing Grammars + // ### - GrammarRegistry.prototype.getGrammars = function() { - return _.clone(this.grammars); - }; + // Public: Get all the grammars in this registry. + // + // Returns a non-empty {Array} of {Grammar} instances. + getGrammars() { + return _.clone(this.grammars); + } - GrammarRegistry.prototype.grammarForScopeName = function(scopeName) { - return this.grammarsByScopeName[scopeName]; - }; + // Public: Get a grammar with the given scope name. + // + // * `scopeName` A {String} such as `"source.js"`. + // + // Returns a {Grammar} or undefined. + grammarForScopeName(scopeName) { + return this.grammarsByScopeName[scopeName]; + } - GrammarRegistry.prototype.addGrammar = function(grammar) { - this.grammars.push(grammar); - this.grammarsByScopeName[grammar.scopeName] = grammar; - if (grammar.injectionSelector != null) { - this.injectionGrammars.push(grammar); - } - this.grammarUpdated(grammar.scopeName); - if (Grammar.includeDeprecatedAPIs) { - this.emit('grammar-added', grammar); - } - this.emitter.emit('did-add-grammar', grammar); - return new Disposable((function(_this) { - return function() { - return _this.removeGrammar(grammar); - }; - })(this)); - }; + // 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}. + // + // Returns a {Disposable} on which `.dispose()` can be called to remove the + // grammar. + addGrammar(grammar) { + this.grammars.push(grammar); + this.grammarsByScopeName[grammar.scopeName] = grammar; + if (grammar.injectionSelector != null) { + this.injectionGrammars.push(grammar); + } + this.grammarUpdated(grammar.scopeName); + if (Grammar.includeDeprecatedAPIs) { + this.emit('grammar-added', grammar); + } + this.emitter.emit('did-add-grammar', grammar); + return new Disposable(((_this) => { + return function() { + return _this.removeGrammar(grammar); + }; + })(this)); + } - GrammarRegistry.prototype.removeGrammar = function(grammar) { - _.remove(this.grammars, grammar); - delete this.grammarsByScopeName[grammar.scopeName]; - _.remove(this.injectionGrammars, grammar); - this.grammarUpdated(grammar.scopeName); - this.emitter.emit('did-remove-grammar', grammar); - return void 0; - }; + removeGrammar(grammar) { + _.remove(this.grammars, grammar); + delete this.grammarsByScopeName[grammar.scopeName]; + _.remove(this.injectionGrammars, grammar); + this.grammarUpdated(grammar.scopeName); + this.emitter.emit('did-remove-grammar', grammar); + return void 0; + } - GrammarRegistry.prototype.removeGrammarForScopeName = function(scopeName) { - var grammar; - grammar = this.grammarForScopeName(scopeName); - if (grammar != null) { - this.removeGrammar(grammar); - } - return grammar; - }; + // Public: Remove the grammar with the given scope name. + // + // * `scopeName` A {String} such as `"source.js"`. + // + // Returns the removed {Grammar} or undefined. + removeGrammarForScopeName(scopeName) { + let grammar = this.grammarForScopeName(scopeName); + if (grammar != null) { + this.removeGrammar(grammar); + } + return grammar; + } - GrammarRegistry.prototype.readGrammarSync = function(grammarPath) { - var grammar, _ref1; - grammar = (_ref1 = CSON.readFileSync(grammarPath)) != null ? _ref1 : {}; - if (typeof grammar.scopeName === 'string' && grammar.scopeName.length > 0) { - return this.createGrammar(grammarPath, grammar); - } else { - throw new Error("Grammar missing required scopeName property: " + grammarPath); - } - }; + // 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) { + // Adding `grammarFile` to avoid reading from disk twice + let grammarFile = CSON.readFileSync(grammarPath); + let grammar = grammarFile != null ? grammarFile : {}; + if (typeof grammar.scopeName === 'string' && grammar.scopeName.length > 0) { + return this.createGrammar(grammarPath, grammar); + } else { + throw new Error(`Grammar missing required scopeName property: ${grammarPath}`); + } + } - GrammarRegistry.prototype.readGrammar = function(grammarPath, callback) { - CSON.readFile(grammarPath, (function(_this) { - return function(error, grammar) { - if (grammar == null) { - grammar = {}; - } - if (error != null) { - return typeof callback === "function" ? callback(error) : void 0; + // 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 read with the following arguments: + // * `error` An {Error}, may be null. + // * `grammar` A {Grammar} or null if an error occured. + // + // Returns undefined. + readGrammar(grammarPath, callback) { + CSON.readFile(grammarPath, ((_this) => { + return function(error, grammar) { + if (grammar == null) { + grammar = {}; + } + if (error != null) { + return typeof callback === "function" ? callback(error) : void 0; + } else { + if (typeof grammar.scopeName === 'string' && grammar.scopeName.length > 0) { + return typeof callback === "function" ? callback(null, _this.createGrammar(grammarPath, grammar)) : void 0; } else { - if (typeof grammar.scopeName === 'string' && grammar.scopeName.length > 0) { - return typeof callback === "function" ? callback(null, _this.createGrammar(grammarPath, grammar)) : void 0; - } else { - return typeof callback === "function" ? callback(new Error("Grammar missing required scopeName property: " + grammarPath)) : void 0; - } + return typeof callback === "function" ? callback(new Error(`Grammar missing required scopeName property: ${grammarPath}`)) : void 0; } - }; - })(this)); - return void 0; - }; + } + } + })(this)); + return void 0; + } - GrammarRegistry.prototype.loadGrammarSync = function(grammarPath) { - var grammar; - grammar = this.readGrammarSync(grammarPath); - this.addGrammar(grammar); - return grammar; - }; + // Public: Read a grammar synchronously and add it to this registry. + // + // * `grammarPath` A {String} absolute file path to a grammar file. + // + // Returns a {Grammar}. + loadGrammarSync(grammarPath) { + let grammar = this.readGrammarSync(grammarPath); + this.addGrammar(grammar); + return grammar; + } - GrammarRegistry.prototype.loadGrammar = function(grammarPath, callback) { - this.readGrammar(grammarPath, (function(_this) { - return function(error, grammar) { - if (error != null) { - return typeof callback === "function" ? callback(error) : void 0; - } else { - _this.addGrammar(grammar); - return typeof callback === "function" ? callback(null, grammar) : void 0; - } - }; - })(this)); - return void 0; - }; + // Public: Read a grammar asynchronously and add it to the registry. + // + // * `grammarPath` A {String} absolute file path to a grammar file. + // * `callback` A {Function} to call when loaded with the following arguments: + // * `error` An {Error}, may be null. + // * `grammar` A {Grammar} or null if an error occured. + // + // Returns undefined. + loadGrammar(grammarPath, callback) { + this.readGrammar(grammarPath, ((_this) => { + return function(error, grammar) { + if (error != null) { + return typeof callback === "function" ? callback(error) : void 0; + } else { + _this.addGrammar(grammar); + return typeof callback === "function" ? callback(null, grammar) : void 0; + } + }; + })(this)); + return void 0; + } - GrammarRegistry.prototype.startIdForScope = function(scope) { - var id; - if (!(id = this.idsByScope[scope])) { - id = this.scopeIdCounter; - this.scopeIdCounter -= 2; - this.idsByScope[scope] = id; - this.scopesById[id] = scope; - } - return id; - }; + startIdForScope(scope) { + let id; + if (!(id = this.idsByScope[scope])) { + id = this.scopeIdCounter; + this.scopeIdCounter -= 2; + this.idsByScope[scope] = id; + this.scopesById[id] = scope; + } + return id; + } - GrammarRegistry.prototype.endIdForScope = function(scope) { - return this.startIdForScope(scope) - 1; - }; + endIdForScope(scope) { + return this.startIdForScope(scope) - 1; + } - GrammarRegistry.prototype.scopeForId = function(id) { - if ((id % 2) === -1) { - return this.scopesById[id]; - } else { - return this.scopesById[id + 1]; - } - }; + scopeForId(id) { + if ((id % 2) === -1) { + return this.scopesById[id]; // start id + } else { + return this.scopesById[id + 1]; // end id + } + } - GrammarRegistry.prototype.grammarUpdated = function(scopeName) { - var grammar, _i, _len, _ref1; - _ref1 = this.grammars; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - grammar = _ref1[_i]; - if (grammar.scopeName !== scopeName) { - if (grammar.grammarUpdated(scopeName)) { - if (Grammar.includeDeprecatedAPIs) { - this.emit('grammar-updated', grammar); - } - this.emitter.emit('did-update-grammar', grammar); + grammarUpdated(scopeName) { + for (let i = 0; i < this.grammars.length; i++) { + if (this.grammars[i].scopeName !== scopeName) { + if (this.grammars[i].grammarUpdated(scopeName)) { + if (Grammar.includeDeprecatedAPIs) { + this.emit("grammar-updated", grammar); } + this.emitter.emit("did-update-grammar"); } } - }; + } + } - GrammarRegistry.prototype.createGrammar = function(grammarPath, object) { - var grammar; - if (object.maxTokensPerLine == null) { - object.maxTokensPerLine = this.maxTokensPerLine; - } - if (object.maxLineLength == null) { - object.maxLineLength = this.maxLineLength; - } - if (object.limitLineLength === false) { - object.maxLineLength = Infinity; - } - grammar = new Grammar(this, object); - grammar.path = grammarPath; - return grammar; - }; + createGrammar(grammarPath, object) { + if (object.maxTokensPerLine == null) { + object.maxTokensPerLine = this.maxTokensPerLine; + } + if (object.maxLineLength == null) { + object.maxLineLength = this.maxLineLength; + } + if (object.limitLineLength === false) { + object.maxLineLength = Infinity; + } + let grammar = new Grammar(this, object); + grammar.path = grammarPath; + return grammar; + } - GrammarRegistry.prototype.decodeTokens = function(lineText, tags, scopeTags, fn) { - var expectedScopeName, index, offset, poppedScopeName, scopeNames, tag, token, tokens, _i, _len; - if (scopeTags == null) { - scopeTags = []; - } - offset = 0; - scopeNames = scopeTags.map((function(_this) { - return function(tag) { - return _this.scopeForId(tag); + decodeTokens(lineText, tags, scopeTags, fn) { + if (scopeTags == null) { + scopeTags = []; + } + let offset = 0; + let scopeNames = scopeTags.map(((_this) => { + return function(tag) { + return _this.scopeForId(tag); + }; + })(this)); + let tokens = []; + for (let i = 0; i < tags.length; ++i) { + // positive numbers indicate string content with length equaling the number. + let tag = tags[i]; + if (tag >= 0) { + let token = { + value: lineText.substring(offset, offset + tag), + scopes: scopeNames.slice() }; - })(this)); - tokens = []; - for (index = _i = 0, _len = tags.length; _i < _len; index = ++_i) { - tag = tags[index]; - if (tag >= 0) { - token = { - value: lineText.substring(offset, offset + tag), - scopes: scopeNames.slice() - }; - if (fn != null) { - token = fn(token, index); - } - tokens.push(token); - offset += tag; - } else if ((tag % 2) === -1) { - scopeTags.push(tag); - scopeNames.push(this.scopeForId(tag)); - } else { - scopeTags.pop(); - expectedScopeName = this.scopeForId(tag + 1); - poppedScopeName = scopeNames.pop(); - if (poppedScopeName !== expectedScopeName) { - throw new Error("Expected popped scope to be " + expectedScopeName + ", but it was " + poppedScopeName); - } + if (fn != null) { + token = fn(token, index); + } + tokens.push(token); + offset += tag; + // odd negative numbers are being scope tags + } else if ((tag % 2) === -1) { + scopeTags.push(tag); + scopeNames.push(this.scopeForId(tag)); + // even negative numbers are end scope tags + } else { + scopeTags.pop(); + let expectedScopeName = this.scopeForId(tag + 1); + let poppedScopeName = scopeNames.pop(); + if (poppedScopeName !== expectedScopeName) { + throw new Error(`Expected popped scope to be ${expectedScopeName}, but it was ${poppedScopeName}`); } } - return tokens; - }; - - return GrammarRegistry; - - })(); - - if (Grim.includeDeprecatedAPIs) { - EmitterMixin = require('emissary').Emitter; - EmitterMixin.includeInto(GrammarRegistry); - GrammarRegistry.prototype.on = function(eventName) { - switch (eventName) { - case 'grammar-added': - Grim.deprecate("Call GrammarRegistry::onDidAddGrammar instead"); - break; - case 'grammar-updated': - Grim.deprecate("Call GrammarRegistry::onDidUpdateGrammar instead"); - break; - default: - Grim.deprecate("Call explicit event subscription methods instead"); - } - return EmitterMixin.prototype.on.apply(this, arguments); - }; + } + return tokens; } +} + +if (Grim.includeDeprecatedAPIs) { + EmitterMixin = require('emissary').Emitter; + EmitterMixin.includeInto(GrammarRegistry); + GrammarRegistry.prototype.on = function(eventName) { + switch (eventName) { + case 'grammar-added': + Grim.deprecate("Call GrammarRegistry::onDidAddGrammar instead"); + break; + case 'grammar-updated': + Grim.deprecate("Call GrammarRegistry::onDidUpdateGrammar instead"); + break; + default: + Grim.deprecate("Call explicit event subscription methods instead"); + } + return EmitterMixin.prototype.on.apply(this, arguments); + }; +} -}).call(this); +module.exports = GrammarRegistry; From db3c1b12889c560c05a73ecbea2cf84975f13e60 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Tue, 22 Nov 2022 18:12:59 -0800 Subject: [PATCH 15/25] Added @Sertonix suggestion --- lib/grammar-registry.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/grammar-registry.js b/lib/grammar-registry.js index 9b3a543..13629e2 100644 --- a/lib/grammar-registry.js +++ b/lib/grammar-registry.js @@ -104,11 +104,9 @@ class GrammarRegistry { this.emit('grammar-added', grammar); } this.emitter.emit('did-add-grammar', grammar); - return new Disposable(((_this) => { - return function() { - return _this.removeGrammar(grammar); - }; - })(this)); + return new Disposable(() => { + this.removeGrammar(grammar); + }); } removeGrammar(grammar) { @@ -289,7 +287,7 @@ class GrammarRegistry { } else if ((tag % 2) === -1) { scopeTags.push(tag); scopeNames.push(this.scopeForId(tag)); - // even negative numbers are end scope tags + // even negative numbers are end scope tags } else { scopeTags.pop(); let expectedScopeName = this.scopeForId(tag + 1); From d78f78cbceb226bc2f59bf781b009fa1726fe2a3 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Tue, 22 Nov 2022 21:06:14 -0800 Subject: [PATCH 16/25] Decaf `grammar.js` Add Comments --- lib/grammar.js | 743 ++++++++++++++++++++++++++----------------------- 1 file changed, 393 insertions(+), 350 deletions(-) diff --git a/lib/grammar.js b/lib/grammar.js index a19e0e2..1916ebe 100644 --- a/lib/grammar.js +++ b/lib/grammar.js @@ -1,395 +1,438 @@ -(function() { - var Emitter, EmitterMixin, Grammar, Grim, Injections, OnigRegExp, OnigString, Pattern, Rule, ScopeSelector, TokenizeLineResult, fs, path, _, _ref; - - path = require('path'); - - _ = require('underscore-plus'); - - fs = require('fs-plus'); - - _ref = require('oniguruma'), OnigRegExp = _ref.OnigRegExp, OnigString = _ref.OnigString; - - Emitter = require('event-kit').Emitter; - - Grim = require('grim'); - - Injections = require('./injections'); - - Pattern = require('./pattern'); - - Rule = require('./rule'); - - ScopeSelector = require('./scope-selector'); - - module.exports = Grammar = (function() { - Grammar.prototype.registration = null; - - function Grammar(registry, options) { - var contentRegex, firstLineMatch, injectionSelector, injections, patterns, repository; - this.registry = registry; - if (options == null) { - options = {}; - } - 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, contentRegex = options.contentRegex; - this.emitter = new Emitter; - this.repository = null; - this.initialRule = null; - if (injectionSelector != null) { - this.injectionSelector = new ScopeSelector(injectionSelector); - } else { - this.injectionSelector = null; - } - if (firstLineMatch) { - this.firstLineRegex = new OnigRegExp(firstLineMatch); - } else { - this.firstLineRegex = null; - } - if (contentRegex) { - this.contentRegex = new OnigRegExp(contentRegex); - } else { - this.contentRegex = null; - } - if (this.fileTypes == null) { - this.fileTypes = []; - } - this.includedGrammarScopes = []; - this.rawPatterns = patterns; - this.rawRepository = repository; - this.rawInjections = injections; - this.updateRules(); +const path = require("path"); +const _ = require("underscore-plus"); +const fs = require("fs-plus"); +const {OnigRegExp, OnigString} = require("oniguruma"); +const {Emitter} = require("event-kit"); +const Grim = require("grim"); +const Injections = require("./injections.js"); +const Pattern = require("./pattern.js"); +const Rule = require("./rule.js"); +const ScopeSelector = require("./scope-selector.js"); + +// Extended: Grammar that tokenizes lines of text. +// +// This class should not be instantiated directly but instead obtained from +// a {GrammarRegistry} by calling {GrammarRegistry::loadGrammar}. +class Grammar { + constructor(registry, options) { + this.registry = registry; + if (options == null) { + options = {}; + } + this.name = options.name; + this.fileTypes = options.fileTypes; + this.scopeName = options.scopeName; + this.foldingStopMarker = options.folderingStopMarker; + this.maxTokensPerLine = options.maxTokensPerLine; + this.maxLineLength = options.maxLineLength; + + let injections = options.injections; + let injectionSelector = options.injectionSelector; + let patterns = options.patterns; + let repository = options.repository; + let firstLineMatch = options.firstLineMatch; + let contentRegex = options.contentRegex; + + this.emitter = new Emitter; + this.repository = null; + this.initialRule = null; + + if (injectionSelector != null) { + this.injectionSelector = new ScopeSelector(injectionSelector); + } else { + this.injectionSelector = null; + } + if (firstLineMatch) { + this.firstLineRegex = new OnigRegExp(firstLineMatch); + } else { + this.firstLineRegex = null; + } + if (contentRegex) { + this.contentRegex = new OnigRegExp(contentRegex); + } else { + this.contentRegex = null; + } + if (this.fileTypes == null) { + this.fileTypes = []; } + this.includedGrammarScopes = []; + this.rawPatterns = patterns; + this.rawRepository = repository; + this.rawInjections = injections; + this.updateRules(); + } - /* - Section: Event Subscription - */ - - Grammar.prototype.onDidUpdate = function(callback) { - return this.emitter.on('did-update', callback); - }; - + // ### + // Section: Event Subscription + // ### + + // Public: Invoke the given callback when this grammar is updated due to a + // grammar it depends on being added or removed from the registry. + // + // * `callback` {Function} to call when this grammar is updated. + // + // Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. + onDidUpdate(callback) { + return this.emitter.on('did-update', callback); + } - /* - Section: Tokenizing - */ + // ### + // Section: Tokenizing + // ### + + // Public: Tokenize all lines in the given text. + // + // * `text` A {String} containing one or more lines. + // + // Returns an {Array} of token arrays for each line tokenizied. + tokenizeLines(text, compatibilityMode) { + if (compatibilityMode == null) { + compatibilityMode = true; + } + let lines = text.split('\n'); + let lastLine = lines.length - 1; + let ruleStack = null; + let scopes = []; + let _results = []; + for (let i = 0; i < lines.length; ++i) { + let line = lines[i]; + let _ref1 = this.tokenizeLine(line, ruleStack, i === 0, compatibilityMode, i !== lastLine); + let tags = _ref1.tags; + ruleStack = _ref1.ruleStack; + _results.push(this.registry.decodeTokens(line, tags, scopes)); + } + return _results; + } - Grammar.prototype.tokenizeLines = function(text, compatibilityMode) { - var lastLine, line, lineNumber, lines, ruleStack, scopes, tags, _i, _len, _ref1, _results; - if (compatibilityMode == null) { - compatibilityMode = true; + //Public: Tokenize the line of text. + // + //* `line` A {String} of text to tokenize. + //* `ruleStack` An optional {Array} of rules previously returned from this + // method. This should be null when tokenizing the first line in the file. + //* `firstLine` 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. + // + //Returns an {Object} containing the following properties: + //* `line` The {String} of text that was tokenized. + //* `tags` An {Array} of integer scope ids and strings. Positive ids + // indicate the beginning of a scope, and negative tags indicate the end. + // To resolve ids to scope names, call {GrammarRegistry::scopeForId} with the + // absolute value of the id. + //* `tokens` This is a dynamic property. Invoking it will incur additional + // overhead, but will automatically translate the `tags` into token objects + // with `value` and `scopes` properties. + //* `ruleStack` An {Array} of rules representing the tokenized state at the + // end of the line. These should be passed back into this method when + // tokenizing the next line in the file. + tokenizeLine(inputLine, ruleStack, firstLine, compatibilityMode, appendNewLine) { // todo + let line, openScopeTags; + if (firstLine == null) { + firstLine = false; + } + if (compatibilityMode == null) { + compatibilityMode = true; + } + if (appendNewLine == null) { + appendNewLine = true; + } + let tags = []; + let truncatedLine = false; + if (inputLine.length > this.maxLineLength) { + line = inputLine.slice(0, this.maxLineLength); + truncatedLine = true; + } else { + line = inputLine; + } + let string = new OnigString(line); + let stringWithNewLine = appendNewLine ? new OnigString(line + '\n') : string; + if (ruleStack != null) { + ruleStack = ruleStack.slice(); + if (compatibilityMode) { + openScopeTags = []; + for (let i = 0; i < ruleStack.length; i++) { + if (ruleStack[i].scopeName) { + openScopeTags.push(this.registry.startIdForScope(ruleStack[i].scopeName)); + } + if (ruleStack[i].contentScopeName) { + openScopeTags.push(this.registry.startIdForScope(ruleStack[i].contentScopeName)); + } + } } - lines = text.split('\n'); - lastLine = lines.length - 1; - ruleStack = null; - scopes = []; - _results = []; - for (lineNumber = _i = 0, _len = lines.length; _i < _len; lineNumber = ++_i) { - line = lines[lineNumber]; - _ref1 = this.tokenizeLine(line, ruleStack, lineNumber === 0, compatibilityMode, lineNumber !== lastLine), tags = _ref1.tags, ruleStack = _ref1.ruleStack; - _results.push(this.registry.decodeTokens(line, tags, scopes)); + } else { + if (compatibilityMode) { + openScopeTags = []; } - return _results; - }; - - Grammar.prototype.tokenizeLine = function(inputLine, ruleStack, firstLine, compatibilityMode, appendNewLine) { - var contentScopeName, initialRuleStackLength, lastRule, lastSymbol, line, match, nextTags, openScopeTags, penultimateRule, popStack, position, previousPosition, previousRuleStackLength, rule, scopeName, string, stringWithNewLine, tag, tagCount, tags, tagsEnd, tagsStart, tokenCount, truncatedLine, _i, _j, _k, _len, _len1, _len2, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; - if (firstLine == null) { - firstLine = false; + ruleStack = [ + { + rule: this.initialRule, + scopeName: this.initialRule.scopeName, + contentScopeName: this.initialRule.contentScopeName + } + ]; + if (this.initialRule.scopeName) { + tags.push(this.startIdForScope(this.initialRule.scopeName)); } - if (compatibilityMode == null) { - compatibilityMode = true; + if (this.initialRule.contentScopeName) { + tags.push(this.startIdForScope(this.initialRule.contentScopeName)); } - if (appendNewLine == null) { - appendNewLine = true; + } + let initialRuleStackLength = ruleStack.length; + let position = 0; + let tokenCount = 0; + while (true) { + let previousRuleStackLength = ruleStack.length; + let previousPosition = position; + + if (position > line.length) { + break; } - tags = []; - truncatedLine = false; - if (inputLine.length > this.maxLineLength) { - line = inputLine.slice(0, this.maxLineLength); + if (tokenCount >= this.getMaxTokensPerLine() - 1) { truncatedLine = true; - } else { - line = inputLine; + break; } - string = new OnigString(line); - stringWithNewLine = appendNewLine ? new OnigString(line + '\n') : string; - if (ruleStack != null) { - ruleStack = ruleStack.slice(); - if (compatibilityMode) { - openScopeTags = []; - for (_i = 0, _len = ruleStack.length; _i < _len; _i++) { - _ref1 = ruleStack[_i], scopeName = _ref1.scopeName, contentScopeName = _ref1.contentScopeName; - if (scopeName) { - openScopeTags.push(this.registry.startIdForScope(scopeName)); - } - if (contentScopeName) { - openScopeTags.push(this.registry.startIdForScope(contentScopeName)); - } - } - } - } else { - if (compatibilityMode) { - openScopeTags = []; + + let match = _.last(ruleStack).rule.getNextTags(ruleStack, string, stringWithNewLine, position, firstLine); + if (match) { + // Unmatched text before next tags + + if (position < match.tagsStart) { + tags.push(match.tagsStart - position); + tokenCount++; } - _ref2 = this.initialRule, scopeName = _ref2.scopeName, contentScopeName = _ref2.contentScopeName; - ruleStack = [ - { - rule: this.initialRule, - scopeName: scopeName, - contentScopeName: contentScopeName + tags.push.apply(tags, match.nextTags); + for (let j = 0; j < match.nextTags.length; j++) { + if (match.nextTags[j] >= 0) { + tokenCount++; } - ]; - if (scopeName) { - tags.push(this.startIdForScope(this.initialRule.scopeName)); } - if (contentScopeName) { - tags.push(this.startIdForScope(this.initialRule.contentScopeName)); + position = match.tagsEnd; + } else { + // Push filler token for unmatched text at end of line. + if (position < line.length || line.length === 0) { + tags.push(line.length - position); } + break; } - initialRuleStackLength = ruleStack.length; - position = 0; - tokenCount = 0; - while (true) { - previousRuleStackLength = ruleStack.length; - previousPosition = position; - if (position > line.length) { - break; - } - if (tokenCount >= this.getMaxTokensPerLine() - 1) { - truncatedLine = true; - break; - } - if (match = _.last(ruleStack).rule.getNextTags(ruleStack, string, stringWithNewLine, position, firstLine)) { - nextTags = match.nextTags, tagsStart = match.tagsStart, tagsEnd = match.tagsEnd; - if (position < tagsStart) { - tags.push(tagsStart - position); - tokenCount++; - } - tags.push.apply(tags, nextTags); - for (_j = 0, _len1 = nextTags.length; _j < _len1; _j++) { - tag = nextTags[_j]; - if (tag >= 0) { - tokenCount++; - } - } - position = tagsEnd; - } else { - if (position < line.length || line.length === 0) { - tags.push(line.length - position); - } - break; - } - if (position === previousPosition) { - if (ruleStack.length === previousRuleStackLength) { - console.error("Popping rule because it loops at column " + position + " of line '" + line + "'", _.clone(ruleStack)); - if (ruleStack.length > 1) { - _ref3 = ruleStack.pop(), scopeName = _ref3.scopeName, contentScopeName = _ref3.contentScopeName; - if (contentScopeName) { - tags.push(this.endIdForScope(contentScopeName)); - } - if (scopeName) { - tags.push(this.endIdForScope(scopeName)); - } - } else { - if (position < line.length || (line.length === 0 && tags.length === 0)) { - tags.push(line.length - position); - } - break; - } - } else if (ruleStack.length > previousRuleStackLength) { - _ref4 = ruleStack.slice(-2), (_ref5 = _ref4[0], penultimateRule = _ref5.rule), (_ref6 = _ref4[1], lastRule = _ref6.rule); - if ((lastRule != null) && lastRule === penultimateRule) { - popStack = true; + if (position === previousPosition) { + if (ruleStack.length === previousRuleStackLength) { + console.error(`Popping rule because it loops at column ${position} of line ${line}`, _.clone(ruleStack)); + + if (ruleStack.length > 1) { + let poppedStack = ruleStack.pop(); + let contentScopeName = poppedStack.contentScopeName; + let scopeName = poppedStack.scopeName; + if (contentScopeName) { + tags.push(this.endIdForScope(contentScopeName)); } - if (((lastRule != null ? lastRule.scopeName : void 0) != null) && penultimateRule.scopeName === lastRule.scopeName) { - popStack = true; + if (scopeName) { + tags.push(this.endIdForScope(scopeName)); } - if (popStack) { - ruleStack.pop(); - lastSymbol = _.last(tags); - if (lastSymbol < 0 && lastSymbol === this.startIdForScope(lastRule.scopeName)) { - tags.pop(); - } + } else { + if (position < line.length || (line.length === 0 && tags.length === 0)) { tags.push(line.length - position); - break; } + break; } - } - } - 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) { - _ref7 = ruleStack.pop(), scopeName = _ref7.scopeName, contentScopeName = _ref7.contentScopeName; - if (contentScopeName) { - tags.push(this.endIdForScope(contentScopeName)); + } else if (ruleStack.length > previousRuleStackLength) { // Stack size increased with zero length match + let slicedStack = ruleStack.slice(-2); + let penultimateRule = slicedStack[0].rule; + let lastRule = slicedStack[1].rule; + let popStack; + + if ((lastRule != null) && lastRule === penultimateRule) { + popStack = true; } - if (scopeName) { - tags.push(this.endIdForScope(scopeName)); + // Same exact rule was pushed but position wasn't advanced + if (((lastRule != null ? lastRule.scopeName : void 0) != null) && penultimateRule.scopeName === lastRule.scopeName) { + popStack = true; + } + // Rule with same scope name as previous rule was pushed but position wasn't advanced. + if (popStack) { + ruleStack.pop(); + let lastSymbol = _.last(tags); + if (lastSymbol < 0 && lastSymbol === this.startIdForScope(lastRule.scopeName)) { + tags.pop(); // also pop the duplicated start scope if it was pushed + } + tags.push(line.length - position); + break; } } } - for (_k = 0, _len2 = ruleStack.length; _k < _len2; _k++) { - rule = ruleStack[_k].rule; - rule.clearAnchorPosition(); - } - if (compatibilityMode) { - return new TokenizeLineResult(inputLine, openScopeTags, tags, ruleStack, this.registry); + } + if (truncatedLine) { + let tagCount = tags.length; + if (tags[tagCount - 1] > 0) { + tags[tagCount - 1] += inputLine.length - position; } else { - return { - line: inputLine, - tags: tags, - ruleStack: ruleStack - }; + tags.push(inputLine.length - position); } - }; + while (ruleStack.length > initialRuleStackLength) { + let poppedStack = ruleStack.pop(); + let scopeName = poppedStack.scopeName; + let contentScopeName = poppedStack.contentScopeName; - Grammar.prototype.activate = function() { - return this.registration = this.registry.addGrammar(this); - }; - - Grammar.prototype.deactivate = function() { - var _ref1; - this.emitter = new Emitter; - if ((_ref1 = this.registration) != null) { - _ref1.dispose(); - } - return this.registration = null; - }; - - Grammar.prototype.updateRules = function() { - this.initialRule = this.createRule({ - scopeName: this.scopeName, - patterns: this.rawPatterns - }); - this.repository = this.createRepository(); - return this.injections = new Injections(this, this.rawInjections); - }; - - Grammar.prototype.getInitialRule = function() { - return this.initialRule; - }; - - Grammar.prototype.getRepository = function() { - return this.repository; - }; - - Grammar.prototype.createRepository = function() { - var data, name, repository, _ref1; - repository = {}; - _ref1 = this.rawRepository; - for (name in _ref1) { - data = _ref1[name]; - if ((data.begin != null) || (data.match != null)) { - data = { - patterns: [data], - tempName: name - }; + if (contentScopeName) { + tags.push(this.endIdForScope(contentScopeName)); } - repository[name] = this.createRule(data); - } - return repository; - }; - - Grammar.prototype.addIncludedGrammarScope = function(scope) { - if (!_.include(this.includedGrammarScopes, scope)) { - return this.includedGrammarScopes.push(scope); - } - }; - - Grammar.prototype.grammarUpdated = function(scopeName) { - if (!_.include(this.includedGrammarScopes, scopeName)) { - return false; - } - this.updateRules(); - this.registry.grammarUpdated(this.scopeName); - if (Grim.includeDeprecatedAPIs) { - this.emit('grammar-updated'); - } - this.emitter.emit('did-update'); - return true; - }; - - Grammar.prototype.startIdForScope = function(scope) { - return this.registry.startIdForScope(scope); - }; - - Grammar.prototype.endIdForScope = function(scope) { - return this.registry.endIdForScope(scope); - }; - - Grammar.prototype.scopeForId = function(id) { - return this.registry.scopeForId(id); - }; - - Grammar.prototype.createRule = function(options) { - return new Rule(this, this.registry, options); - }; - - Grammar.prototype.createPattern = function(options) { - return new Pattern(this, this.registry, options); - }; - - Grammar.prototype.getMaxTokensPerLine = function() { - return this.maxTokensPerLine; - }; - - Grammar.prototype.scopesFromStack = function(stack, rule, endPatternMatch) { - var contentScopeName, scopeName, scopes, _i, _len, _ref1; - scopes = []; - for (_i = 0, _len = stack.length; _i < _len; _i++) { - _ref1 = stack[_i], scopeName = _ref1.scopeName, contentScopeName = _ref1.contentScopeName; if (scopeName) { - scopes.push(scopeName); - } - if (contentScopeName) { - scopes.push(contentScopeName); + tags.push(this.endIdForScope(scopeName)); } } - if (endPatternMatch && (rule != null ? rule.contentScopeName : void 0) && rule === stack[stack.length - 1]) { - scopes.pop(); - } - return scopes; - }; + } + for (let k = 0; k < ruleStack.length; k++) { + let rule = ruleStack[k].rule; + rule.clearAnchorPosition(); + } + if (compatibilityMode) { + return new TokenizeLineResult(inputLine, openScopeTags, tags, ruleStack, this.registry); + } else { + return { + line: inputLine, + tags: tags, + ruleStack: ruleStack + }; + } + } + + activate() { + return this.registration = this.registry.addGrammar(this); + } - return Grammar; + deactivate() { + this.emitter = new Emitter; + if (this.registration != null) { + this.registration.dispose(); + } + return this.registration = null; + } - })(); + updateRules() { + this.initialRule = this.createRule({ + scopeName: this.scopeName, + patterns: this.rawPatterns + }); + this.repository = this.createRepository(); + return this.injections = new Injections(this, this.rawInjections); + } - if (Grim.includeDeprecatedAPIs) { - EmitterMixin = require('emissary').Emitter; - EmitterMixin.includeInto(Grammar); - Grammar.prototype.on = function(eventName) { - if (eventName === 'did-update') { - Grim.deprecate("Call Grammar::onDidUpdate instead"); - } else { - Grim.deprecate("Call explicit event subscription methods instead"); + getInitialRule() { + return this.initialRule; + } + + getRepository() { + return this.repository; + } + + createRepository() { + let repository = {}; + for (const name in this.rawRepository) { + let data = this.rawRepository[name]; + if ((data.begin != null) || (data.match != null)) { + data = { + patterns: [data], + tempName: name + }; } - return EmitterMixin.prototype.on.apply(this, arguments); - }; + repository[name] = this.createRule(data); + } + return repository; + } + + addIncludedGrammarScope(scope) { + if (!_.include(this.includedGrammarScopes, scope)) { + return this.includedGrammarScopes.push(scope); + } } - TokenizeLineResult = (function() { - function TokenizeLineResult(line, openScopeTags, tags, ruleStack, registry) { - this.line = line; - this.openScopeTags = openScopeTags; - this.tags = tags; - this.ruleStack = ruleStack; - this.registry = registry; + grammarUpdated(scopeName) { + if (!_.include(this.includedGrammarScopes, scopeName)) { + return false; } + this.updateRules(); + this.registry.grammarUpdated(this.scopeName); + if (Grim.includeDeprecatedAPIs) { + this.emit('grammar-updated'); + } + this.emitter.emit('did-update'); + return true; + } + + startIdForScope(scope) { + return this.registry.startIdForScope(scope); + } + + endIdForScope(scope) { + return this.registry.endIdForScope(scope); + } + + scopeForId(id) { + return this.registry.scopeForId(id); + } - Object.defineProperty(TokenizeLineResult.prototype, 'tokens', { - get: function() { - return this.registry.decodeTokens(this.line, this.tags, this.openScopeTags); + createRule(options) { + return new Rule(this, this.registry, options); + } + + createPattern(options) { + return new Pattern(this, this.registry, options); + } + + getMaxTokensPerLine() { + return this.maxTokensPerLine; + } + + scopesFromStack(stack, rule, endPatternMatch) { + let scopes = []; + for (let i = 0; i < stack.length; i++) { + if (stack[i].scopeName) { + scopes.push(stack[i].scopeName); } - }); + if (stack[i].contentScopeName) { + scopes.push(stack[i].contentScopeName); + } + } + // Pop the last content name scope if the end pattern at the top of the stack + // was matched since only text between the begin/end patterns should have the content name scope. + if (endPatternMatch && (rule != null ? rule.contentScopeName : void 0) && rule === stack[stack.length -1]) { + scopes.pop(); + } + return scopes; + } +} + +Grammar.prototype.registration = null; // todo - find most exact way to implement this. Likely could be this.variable + - return TokenizeLineResult; +if (Grim.includeDeprecatedAPIs) { + EmitterMixin = require('emissary').Emitter; + EmitterMixin.includeInto(Grammar); + Grammar.prototype.on = function(eventName) { + if (eventName === 'did-update') { + Grim.deprecate("Call Grammar::onDidUpdate instead"); + } else { + Grim.deprecate("Call explicit event subscription methods instead"); + } + return EmitterMixin.prototype.on.apply(this, arguments); + }; +} + +class TokenizeLineResult { + constructor(line, openScopeTags, tags, ruleStack, registry) { + this.line = line; + this.openScopeTags = openScopeTags; + this.tags = tags; + this.ruleStack = ruleStack; + this.registry = registry; + } - })(); +} + +Object.defineProperty(TokenizeLineResult.prototype, 'tokens', { + get: function() { + return this.registry.decodeTokens(this.line, this.tags, this.openScopeTags); + } +}); -}).call(this); +module.exports = Grammar; From 6a351f97017bbe7a9d2f8f42cdcfc98e66179424 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Tue, 22 Nov 2022 23:21:40 -0800 Subject: [PATCH 17/25] Decaf `rule.js` - Added `TODO`s --- lib/rule.js | 331 ++++++++++++++++++++++++++-------------------------- 1 file changed, 168 insertions(+), 163 deletions(-) diff --git a/lib/rule.js b/lib/rule.js index aac0275..2b9319d 100644 --- a/lib/rule.js +++ b/lib/rule.js @@ -1,189 +1,194 @@ -(function() { - var Rule, Scanner, _, - __slice = [].slice; +const _ = require("underscore-plus"); +const Scanner = require("./scanner.js"); - _ = require('underscore-plus'); +let __slice = [].slice; - Scanner = require('./scanner'); +class Rule { + constructor(grammar, registry, _arg) { + let args = _arg != null ? _arg : {}; + this.grammar = grammar; + this.registry = registry; + this.patterns = []; + this.scopeName = args.scopeName; + this.contentScopeName = args.contentScopeName; + this.endPattern = args.endPattern; + this.applyEndPatternLast = args.applyEndPatternLast; - module.exports = Rule = (function() { - function Rule(grammar, registry, _arg) { - var pattern, patterns, _i, _len, _ref, _ref1; - this.grammar = grammar; - this.registry = registry; - _ref = _arg != null ? _arg : {}, this.scopeName = _ref.scopeName, this.contentScopeName = _ref.contentScopeName, patterns = _ref.patterns, this.endPattern = _ref.endPattern, this.applyEndPatternLast = _ref.applyEndPatternLast; - this.patterns = []; - _ref1 = patterns != null ? patterns : []; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - pattern = _ref1[_i]; - if (!pattern.disabled) { - this.patterns.push(this.grammar.createPattern(pattern)); - } + let patterns = args.patterns; + let pattern; + + let ref1 = patterns != null ? patterns : []; + for (let i = 0; i < ref1.length; i++) { + pattern = ref1[i]; + if (!pattern.disabled) { + this.patterns.push(this.grammar.createPattern(pattern)); } - if (this.endPattern && !this.endPattern.hasBackReferences) { - if (this.applyEndPatternLast) { - this.patterns.push(this.endPattern); - } else { - this.patterns.unshift(this.endPattern); - } + } + if (this.endPattern && !this.endPattern.hasBackReferences) { + if (this.applyEndPatternLast) { + this.patterns.push(this.endPattern); + } else { + this.patterns.unshift(this.endPattern); } - this.scannersByBaseGrammarName = {}; - this.createEndPattern = null; - this.anchorPosition = -1; } + this.scannersByBaseGrammarName = {}; + this.createEndPattern = null; + this.anchorPosition = -1; + } - Rule.prototype.getIncludedPatterns = function(baseGrammar, included) { - var allPatterns, pattern, _i, _len, _ref; - if (included == null) { - included = []; - } - if (_.include(included, this)) { - return []; - } - included = included.concat([this]); - allPatterns = []; - _ref = this.patterns; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - pattern = _ref[_i]; - allPatterns.push.apply(allPatterns, pattern.getIncludedPatterns(baseGrammar, included)); - } - return allPatterns; - }; + getIncludedPatterns(baseGrammar, included) { + if (included == null) { + included = []; + } + if (_.include(included, this)) { + return []; + } + included = included.concat([this]); + let allPatterns = []; + for (let i = 0; i < this.patterns.length; i++) { + let pattern = this.patterns[i]; + allPatterns.push.apply(allPatterns, pattern.getIncludedPatterns(baseGrammar, included)); + } + return allPatterns; + } - Rule.prototype.clearAnchorPosition = function() { - return this.anchorPosition = -1; - }; + clearAnchorPosition() { + return this.anchorPosition = -1; + } - Rule.prototype.getScanner = function(baseGrammar) { - var patterns, scanner; - if (scanner = this.scannersByBaseGrammarName[baseGrammar.name]) { - return scanner; - } - patterns = this.getIncludedPatterns(baseGrammar); - scanner = new Scanner(patterns); - this.scannersByBaseGrammarName[baseGrammar.name] = scanner; + getScanner(baseGrammar) { + let scanner = this.scannersByBaseGrammarName[baseGrammar.name] + if (scanner) { return scanner; - }; + } + let patterns = this.getIncludedPatterns(baseGrammar); + scanner = new Scanner(patterns); + this.scannersByBaseGrammarName[baseGrammar.name] = scanner; + return scanner; + } - Rule.prototype.scanInjections = function(ruleStack, line, position, firstLine) { - var baseGrammar, injections, result, scanner, _i, _len, _ref; - baseGrammar = ruleStack[0].rule.grammar; - if (injections = baseGrammar.injections) { - _ref = injections.getScanners(ruleStack); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - scanner = _ref[_i]; - result = scanner.findNextMatch(line, firstLine, position, this.anchorPosition); - if (result != null) { - return result; - } + scanInjections(ruleStack, line, position, firstLine) { + let baseGrammar = ruleStack[0].rule.grammar; + let injections = baseGrammar.injections; + if (baseGrammar.injections) { + let ref = injections.getScanners(ruleStack); + for (let i = 0; i < ref.length; i++) { + let scanner = ref[i]; + let result = scanner.findNextMatch(line, firstLine, position, this.anchorPosition); + if (result != null) { + return result; } } - }; + } + } - Rule.prototype.normalizeCaptureIndices = function(line, captureIndices) { - var capture, lineLength, _i, _len; - lineLength = line.length; - for (_i = 0, _len = captureIndices.length; _i < _len; _i++) { - capture = captureIndices[_i]; - capture.end = Math.min(capture.end, lineLength); - capture.start = Math.min(capture.start, lineLength); - } - }; + normalizeCaptureIndices(line, captureIndices) { + let lineLength = line.length; + for (let i = 0; i < captureIndices.length; i++) { + let capture = captureIndices[i]; + capture.end = Math.min(capture.end, lineLength); + capture.start = Math.min(capture.start, lineLength); + } + } - Rule.prototype.findNextMatch = function(ruleStack, lineWithNewline, position, firstLine) { - var baseGrammar, injection, injectionGrammar, result, results, scanner, scopes, _i, _j, _len, _len1, _ref, _ref1; - baseGrammar = ruleStack[0].rule.grammar; - results = []; - scanner = this.getScanner(baseGrammar); - if (result = scanner.findNextMatch(lineWithNewline, firstLine, position, this.anchorPosition)) { - results.push(result); - } - if (result = this.scanInjections(ruleStack, lineWithNewline, position, firstLine)) { - _ref = baseGrammar.injections.injections; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - injection = _ref[_i]; - if (injection.scanner === result.scanner) { - if (injection.selector.getPrefix(this.grammar.scopesFromStack(ruleStack)) === 'L') { - results.unshift(result); - } else { - results.push(result); - } + findNextMatch(ruleStack, lineWithNewline, position, firstLine) { + let baseGrammar = ruleStack[0].rule.grammar; + let results = []; + let scanner = this.getScanner(baseGrammar); + if (scanner.findNextMatch(lineWithNewline, firstLine, position, this.anchorPosition)) { + results.push(scanner.findNextMatch(lineWithNewline, firstLine, position, this.anchorPosition)); + } + let result = this.scanInjections(ruleStack, lineWithNewline, position, firstLine); + if (result) { + for (let i = 0; i < baseGrammar.injections.injections.length; i++) { + let injection = baseGrammar.injections.injections[i]; + if (injection.scanner === result.scanner) { + if (injection.selector.getPrefix(this.grammar.scopesFromStack(ruleStack)) === 'L') { + results.unshift(result); + } else { + // TODO: Prefixes can either be L, B, or R. + // R is assumed to mean "right", which is the default (add to end of stack). + // There's no documentation on B, however. + results.push(result); } } } - scopes = null; - _ref1 = this.registry.injectionGrammars; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - injectionGrammar = _ref1[_j]; - if (injectionGrammar === this.grammar) { - continue; - } - if (injectionGrammar === baseGrammar) { - continue; - } - if (scopes == null) { - scopes = this.grammar.scopesFromStack(ruleStack); - } - if (injectionGrammar.injectionSelector.matches(scopes)) { - scanner = injectionGrammar.getInitialRule().getScanner(injectionGrammar, position, firstLine); - if (result = scanner.findNextMatch(lineWithNewline, firstLine, position, this.anchorPosition)) { - if (injectionGrammar.injectionSelector.getPrefix(scopes) === 'L') { - results.unshift(result); - } else { - results.push(result); - } - } - } + } + let scopes = null; + for (let j = 0; j < this.registry.injectionGrammars.length; j++) { + let injectionGrammar = this.registry.injectionGrammars[j]; + if (injectionGrammar === this.grammar) { + continue; } - if (results.length > 1) { - return _.min(results, (function(_this) { - return function(result) { - _this.normalizeCaptureIndices(lineWithNewline, result.captureIndices); - return result.captureIndices[0].start; - }; - })(this)); - } else if (results.length === 1) { - result = results[0]; - this.normalizeCaptureIndices(lineWithNewline, result.captureIndices); - return result; + if (injectionGrammar === baseGrammar) { + continue; } - }; - - Rule.prototype.getNextTags = function(ruleStack, line, lineWithNewline, position, firstLine) { - var captureIndices, endPatternMatch, firstCapture, index, nextTags, result, scanner; - result = this.findNextMatch(ruleStack, lineWithNewline, position, firstLine); - if (result == null) { - return null; + if (scopes == null) { + scopes = this.grammar.scopesFromStack(ruleStack); } - index = result.index, captureIndices = result.captureIndices, scanner = result.scanner; - firstCapture = captureIndices[0]; - endPatternMatch = this.endPattern === scanner.patterns[index]; - if (nextTags = scanner.handleMatch(result, ruleStack, line, this, endPatternMatch)) { - return { - nextTags: nextTags, - tagsStart: firstCapture.start, - tagsEnd: firstCapture.end - }; + if (injectionGrammar.injectionSelector.matches(scopes)) { + scanner = injectionGrammar.getInitialRule().getScanner(injectionGrammar, position, firstLine); + result = scanner.findNextMatch(lineWithNewline, firstLine, position, this.anchorPosition); + if (result) { + if (injectionGrammar.injectionSelector.getPrefix(scopes) === 'L') { + results.unshift(result); + } else { + // TODO: Prefixes can either be L, B, or R. + // R is assumed to mean "right", which is the default (add to end of stack). + // There's no documentation on B, however. + results.push(result); + } + } } - }; + } + if (results.length > 1) { + return _.min(results, (function(_this) { + return function(result) { + _this.normalizeCaptureIndices(lineWithNewline, result.captureIndices); + return result.captureIndices[0].start; + }; + })(this)); + } else if (results.length === 1) { + result = results[0]; + this.normalizeCaptureIndices(lineWithNewline, result.captureIndices); + return result; + } + } - Rule.prototype.getRuleToPush = function(line, beginPatternCaptureIndices) { - var rule; - if (this.endPattern.hasBackReferences) { - rule = this.grammar.createRule({ - scopeName: this.scopeName, - contentScopeName: this.contentScopeName - }); - rule.endPattern = this.endPattern.resolveBackReferences(line, beginPatternCaptureIndices); - rule.patterns = [rule.endPattern].concat(__slice.call(this.patterns)); - return rule; - } else { - return this; - } - }; + getNextTags(ruleStack, line, lineWithNewline, position, firstLine) { + let result = this.findNextMatch(ruleStack, lineWithNewline, position, firstLine); + if (result == null) { + return null; + } + let index = result.index; + let captureIndices = result.captureIndices; + let scanner = result.scanner; + let firstCapture = captureIndices[0]; + let endPatternMatch = this.endPattern === scanner.patterns[index]; + let nextTags = scanner.handleMatch(result, ruleStack, line, this, endPatternMatch); + if (nextTags) { + return { + nextTags: nextTags, + tagsStart: firstCapture.start, + tagsEnd: firstCapture.end + }; + } + } - return Rule; + getRuleToPush(line, beginPatternCaptureIndices) { + if (this.endPattern.hasBackReferences) { + let rule = this.grammar.createRule({ + scopeName: this.scopeName, + contentScopeName: this.contentScopeName + }); + rule.endPattern = this.endPattern.resolveBackReferences(line, beginPatternCaptureIndices); + rule.patterns = [rule.endPattern].concat(__slice.call(this.patterns)); + return rule; + } else { + return this; + } + } - })(); +} -}).call(this); +module.exports = Rule; From 1d0a0d384cccde988dcdc37bd1ef726ae0037080 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Wed, 23 Nov 2022 17:30:42 -0800 Subject: [PATCH 18/25] Decaf `pattern.js` - Add comments --- lib/pattern.js | 601 +++++++++++++++++++++++++------------------------ 1 file changed, 303 insertions(+), 298 deletions(-) diff --git a/lib/pattern.js b/lib/pattern.js index 1eac46f..88c7f9e 100644 --- a/lib/pattern.js +++ b/lib/pattern.js @@ -1,336 +1,341 @@ -(function() { - var AllCustomCaptureIndicesRegex, AllDigitsRegex, DigitRegex, Pattern, _, - __slice = [].slice; +const _ = require("underscore-plus"); +const AllCustomCaptureIndicesRegex = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/g; +const AllDigitsRegex = /\\\d+/g; +const DigitRegex = /\\\d+/; +let __slice = [].slice; - _ = require('underscore-plus'); +class Pattern { + constructor(grammar, registry, options) { + this.grammar = grammar; + this.registry = registry; + if (options == null) { + options = {}; + } + let { patterns, name, contentName, match, begin, end, captures, beginCaptures, endCaptures, applyEndPatternLast } = options; + this.include = options.include; + this.popRule = options.popRule; + this.hasBackReferences = options.hasBackReferences; + this.pushRule = null; + this.backReferences = null; + this.scopeName = name; + this.contentScopeName = contentName; - AllCustomCaptureIndicesRegex = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/g; + if (match) { + if ((end || this.popRule) && (this.hasBackReferences != null ? this.hasBackReferences : this.hasBackReferences = DigitRegex.test(match))) { + this.match = match; + } else { + this.regexSource = match; + } + this.captures = captures; + } else if (begin) { + this.regexSource = begin; + this.captures = beginCaptures != null ? beginCaptures : captures; + let endPattern = this.grammar.createPattern({ + match: end, + captures: endCaptures != null ? endCaptures : captures, + popRule: true + }); + this.pushRule = this.grammar.createRule({ + scopeName: this.scopeName, + contentScopeName: this.contentScopeName, + patterns: patterns, + endPattern: endPattern, + applyEndPatternLast: applyEndPatternLast + }); + } - AllDigitsRegex = /\\\d+/g; + if (this.captures != null) { + for (const group in this.captures) { + let capture = this.captures[group]; + if ((capture.patterns != null ? capture.patterns.length : void 0) > 0 && !capture.rule) { + capture.scopeName = this.scopeName; + capture.rule = this.grammar.createRule(capture); + } + } + } + this.anchored = this.hasAnchor(); + } - DigitRegex = /\\\d+/; + getRegex(firstLine, position, anchorPosition) { + if (this.anchored) { + return this.replaceAnchor(firstLine, position, anchorPosition); + } else { + return this.regexSource; + } + } - module.exports = Pattern = (function() { - function Pattern(grammar, registry, options) { - var applyEndPatternLast, begin, beginCaptures, capture, captures, contentName, end, endCaptures, endPattern, group, match, name, patterns, _ref, _ref1; - this.grammar = grammar; - this.registry = registry; - if (options == null) { - options = {}; + hasAnchor() { + if (!this.regexSource) { + return false; + } + let escape = false; + for (let i = 0; i < this.regexSource.length; i++) { + let character = this.regexSource[i]; + if (escape && (character === 'A' || character === 'G' || character === 'z')) { + return true; } - name = options.name, contentName = options.contentName, match = options.match, begin = options.begin, end = options.end, patterns = options.patterns; - captures = options.captures, beginCaptures = options.beginCaptures, endCaptures = options.endCaptures, applyEndPatternLast = options.applyEndPatternLast; - this.include = options.include, this.popRule = options.popRule, this.hasBackReferences = options.hasBackReferences; - this.pushRule = null; - this.backReferences = null; - this.scopeName = name; - this.contentScopeName = contentName; - if (match) { - if ((end || this.popRule) && (this.hasBackReferences != null ? this.hasBackReferences : this.hasBackReferences = DigitRegex.test(match))) { - this.match = match; - } else { - this.regexSource = match; + escape = !escape && character === '\\'; + } + return false; + } + + replaceAnchor(firstLine, offset, anchor) { + let escaped = []; + let placeholder = '\uFFFF'; + let escape = false; + for (let i = 0; i < this.regexSource.length; i++) { + let character = this.regexSource[i]; + if (escape) { + switch (character) { + case 'A': + if (firstLine) { + escaped.push("\\" + character); + } else { + escaped.push(placeholder); + } + break; + case 'G': + if (offset === anchor) { + escaped.push("\\" + character); + } else { + escaped.push(placeholder); + } + break; + case 'z': + escaped.push('$(?!\n)(? 0 && !capture.rule) { - capture.scopeName = this.scopeName; - capture.rule = this.grammar.createRule(capture); - } - } + } + return escaped.join(''); + } + + resolveBackReferences(line, beginCaptureIndices) { + let beginCaptures = []; + for (let i = 0; i < beginCaptureIndices.length; i++) { + beginCaptures.push(line.substring(beginCaptureIndices[i].start, beginCaptureIndices[i].end)); + } + let resolvedMatch = this.match.replace(AllDigitsRegex, (match) => { + let index = parseInt(match.slice(1)); + if (beginCaptures[index] != null) { + return _.escapeRegExp(beginCaptures[index]); + } else { + return "\\" + index; } - this.anchored = this.hasAnchor(); + }); + return this.grammar.createPattern({ + hasBackReferences: false, + match: resolvedMatch, + captures: this.captures, + popRule: this.popRule + }); + } + + ruleForInclude(baseGrammar, name) { + let hashIndex = name.indexOf("#"); + if (hashIndex === 0) { + return this.grammar.getRepository()[name.slice(1)]; + } else if (hashIndex >= 1) { + let grammarName = name.slice(0, +(hashIndex - 1) + 1 || 9e9); + let ruleName = name.slice(hashIndex + 1); + this.grammar.addIncludedGrammarScope(grammarName); + let _ref = this.registry.grammarForScopeName(grammarName); + return _ref != null ? _ref.getRepository()[ruleName] : void 0; + } else if (name === '$self') { + return this.grammar.getInitialRule(); + } else if (name === '$base') { + return baseGrammar.getInitialRule(); + } else { + this.grammar.addIncludedGrammarScope(name); + let _ref = this.registry.grammarForScopeName(name); + return _ref != null ? _ref.getInitialRule() : void 0; + } + } + + getIncludedPatterns(baseGrammar, included) { + if (this.include) { + let rule = this.ruleForInclude(baseGrammar, this.include); + let _ref = rule != null ? rule.getIncludedPatterns(baseGrammar, included) : void 0; + return _ref != null ? _ref : []; + } else { + return [this]; } + } - Pattern.prototype.getRegex = function(firstLine, position, anchorPosition) { - if (this.anchored) { - return this.replaceAnchor(firstLine, position, anchorPosition); + resolveScopeName(scopeName, line, captureIndices) { + return scopeName.replace(AllCustomCaptureIndicesRegex, (match, index, commandIndex, command) => { + let capture = captureIndices[parseInt(index != null ? index : commandIndex)]; + if (capture != null) { + let replacement = line.substring(capture.start, capture.end); + // Remove leading dots that would make the selector invalid + while(replacement[0] === '.') { + replacement = replacement.substring(1); + } + switch(command) { + case 'downcase': + return replacement.toLowerCase(); + case 'upcase': + return replacement.toUpperCase(); + default: + return replacement; + } } else { - return this.regexSource; + return match; } - }; + }); + } - Pattern.prototype.hasAnchor = function() { - var character, escape, _i, _len, _ref; - if (!this.regexSource) { + handleMatch(stack, line, captureIndices, rule, endPatternMatch) { + let scopeName, contentScopeName; + let tags = []; + let zeroWidthMatch = captureIndices[0].start === captureIndices[0].end; + if (this.popRule) { + // Pushing and popping a rule based on zero width matches at the same index + // leads to an infinite loop. We bail on parsing if we detect that case here. + if (zeroWidthMatch && _.last(stack).zeroWidthMatch && _.last(stack).rule.anchorPosition === captureIndices[0].end) { return false; } - escape = false; - _ref = this.regexSource; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - character = _ref[_i]; - if (escape && (character === 'A' || character === 'G' || character === 'z')) { - return true; - } - escape = !escape && character === '\\'; + contentScopeName = _.last(stack).contentScopeName; + if (contentScopeName) { + tags.push(this.grammar.endIdForScope(contentScopeName)); } - return false; - }; - - Pattern.prototype.replaceAnchor = function(firstLine, offset, anchor) { - var character, escape, escaped, placeholder, _i, _len, _ref; - escaped = []; - placeholder = '\uFFFF'; - escape = false; - _ref = this.regexSource; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - character = _ref[_i]; - if (escape) { - switch (character) { - case 'A': - if (firstLine) { - escaped.push("\\" + character); - } else { - escaped.push(placeholder); - } - break; - case 'G': - if (offset === anchor) { - escaped.push("\\" + character); - } else { - escaped.push(placeholder); - } - break; - case 'z': - escaped.push('$(?!\n)(?= 1) { - grammarName = name.slice(0, +(hashIndex - 1) + 1 || 9e9); - ruleName = name.slice(hashIndex + 1); - this.grammar.addIncludedGrammarScope(grammarName); - return (_ref = this.registry.grammarForScopeName(grammarName)) != null ? _ref.getRepository()[ruleName] : void 0; - } else if (name === '$self') { - return this.grammar.getInitialRule(); - } else if (name === '$base') { - return baseGrammar.getInitialRule(); - } else { - this.grammar.addIncludedGrammarScope(name); - return (_ref1 = this.registry.grammarForScopeName(name)) != null ? _ref1.getInitialRule() : void 0; + } else { + if (this.popRule) { + scopeName = stack.pop().scopeName; } - }; - - Pattern.prototype.getIncludedPatterns = function(baseGrammar, included) { - var rule, _ref; - if (this.include) { - rule = this.ruleForInclude(baseGrammar, this.include); - return (_ref = rule != null ? rule.getIncludedPatterns(baseGrammar, included) : void 0) != null ? _ref : []; - } else { - return [this]; + if (scopeName) { + tags.push(this.grammar.endIdForScope(scopeName)); } - }; + } + return tags; + } - Pattern.prototype.resolveScopeName = function(scopeName, line, captureIndices) { - var resolvedScopeName; - return resolvedScopeName = scopeName.replace(AllCustomCaptureIndicesRegex, function(match, index, commandIndex, command) { - var capture, replacement; - capture = captureIndices[parseInt(index != null ? index : commandIndex)]; - if (capture != null) { - replacement = line.substring(capture.start, capture.end); - while (replacement[0] === '.') { - replacement = replacement.substring(1); - } - switch (command) { - case 'downcase': - return replacement.toLowerCase(); - case 'upcase': - return replacement.toUpperCase(); - default: - return replacement; - } - } else { - return match; - } - }); - }; + tagsForCaptureRule(rule, line, captureStart, captureEnd, stack) { + let captureText = line.substring(captureStart, captureEnd); + let tags = rule.grammar.tokenizeLine(captureText, __slice.call(stack).concat([{ + rule: rule + }]), false, true, false).tags; - Pattern.prototype.handleMatch = function(stack, line, captureIndices, rule, endPatternMatch) { - var contentScopeName, end, ruleToPush, scopeName, start, tags, zeroWidthMatch, _ref; - tags = []; - zeroWidthMatch = captureIndices[0].start === captureIndices[0].end; - if (this.popRule) { - if (zeroWidthMatch && _.last(stack).zeroWidthMatch && _.last(stack).rule.anchorPosition === captureIndices[0].end) { - return false; - } - contentScopeName = _.last(stack).contentScopeName; - if (contentScopeName) { - tags.push(this.grammar.endIdForScope(contentScopeName)); - } - } else if (this.scopeName) { - scopeName = this.resolveScopeName(this.scopeName, line, captureIndices); - tags.push(this.grammar.startIdForScope(scopeName)); - } - if (this.captures) { - tags.push.apply(tags, this.tagsForCaptureIndices(line, captureIndices.slice(), captureIndices, stack)); - } else { - _ref = captureIndices[0], start = _ref.start, end = _ref.end; - if (end !== start) { - tags.push(end - start); - } + // only accept non empty tokens that don't exceed the capture end + let openScopes = []; + let captureTags = []; + let offset = 0; + + for (let i = 0; i < tags.length; i++) { + let tag = tags[i]; + if (!(tag < 0 || (tag > 0 && offset < captureEnd))) { + continue; } - if (this.pushRule) { - ruleToPush = this.pushRule.getRuleToPush(line, captureIndices); - ruleToPush.anchorPosition = captureIndices[0].end; - contentScopeName = ruleToPush.contentScopeName; - if (contentScopeName) { - contentScopeName = this.resolveScopeName(contentScopeName, line, captureIndices); - tags.push(this.grammar.startIdForScope(contentScopeName)); - } - stack.push({ - rule: ruleToPush, - scopeName: scopeName, - contentScopeName: contentScopeName, - zeroWidthMatch: zeroWidthMatch - }); + captureTags.push(tag); + if (tag >= 0) { + offset += tag; } else { - if (this.popRule) { - scopeName = stack.pop().scopeName; - } - if (scopeName) { - tags.push(this.grammar.endIdForScope(scopeName)); - } - } - return tags; - }; - - Pattern.prototype.tagsForCaptureRule = function(rule, line, captureStart, captureEnd, stack) { - var captureTags, captureText, offset, openScopes, tag, tags, _i, _len; - captureText = line.substring(captureStart, captureEnd); - tags = rule.grammar.tokenizeLine(captureText, __slice.call(stack).concat([{ - rule: rule - }]), false, true, false).tags; - openScopes = []; - captureTags = []; - offset = 0; - for (_i = 0, _len = tags.length; _i < _len; _i++) { - tag = tags[_i]; - if (!(tag < 0 || (tag > 0 && offset < captureEnd))) { - continue; - } - captureTags.push(tag); - if (tag >= 0) { - offset += tag; + if (tag % 2 === 0) { + openScopes.pop(); } else { - if (tag % 2 === 0) { - openScopes.pop(); - } else { - openScopes.push(tag); - } + openScopes.push(tag); } } - while (openScopes.length > 0) { - captureTags.push(openScopes.pop() - 1); - } - return captureTags; - }; + } + // close any scopes left open by matching this rule since we don't pass our stack + while (openScopes.length > 0) { + captureTags.push(openScopes.pop() -1); + } + return captureTags; + } - Pattern.prototype.tagsForCaptureIndices = function(line, currentCaptureIndices, allCaptureIndices, stack) { - var captureHasNoScope, captureRule, captureTags, childCapture, emptyCapture, parentCapture, parentCaptureScope, previousChildCaptureEnd, scope, tags, _ref, _ref1; - parentCapture = currentCaptureIndices.shift(); - tags = []; - if (scope = (_ref = this.captures[parentCapture.index]) != null ? _ref.name : void 0) { - parentCaptureScope = this.resolveScopeName(scope, line, allCaptureIndices); - tags.push(this.grammar.startIdForScope(parentCaptureScope)); + // Get the tokens for the capture indices. + // + // line - The string being tokenized. + // currentCaptureIndices - The current array of capture indices being + // processed into tokens. This method is called + // recursively and this array will be modified inside + // this method. + // allCaptureIndices - The array of all capture indices, this array will not + // be modified. + // stack - An array of rules. + // + // Returns a non-null but possibly empty array of tokens. + tagsForCaptureIndices(line, currentCaptureIndices, allCaptureIndices, stack) { + let parentCapture = currentCaptureIndices.shift(); + let tags = []; + let scope = this.captures[parentCapture.index] != null ? this.captures[parentCapture.index].name : void 0; + let captureTags, parentCaptureScope; + if (scope) { + parentCaptureScope = this.resolveScopeName(scope, line, allCaptureIndices); + tags.push(this.grammar.startIdForScope(parentCaptureScope)); + } + let captureRule = this.captures[parentCapture.index] != null ? this.captures[parentCapture.index].rule : void 0; + if (captureRule) { + captureTags = this.tagsForCaptureRule(captureRule, line, parentCapture.start, parentCapture.end, stack); + tags.push.apply(tags, captureTags); + // Consume child captures + while (currentCaptureIndices.length && currentCaptureIndices[0].start < parentCapture.end) { + currentCaptureIndices.shift(); } - if (captureRule = (_ref1 = this.captures[parentCapture.index]) != null ? _ref1.rule : void 0) { - captureTags = this.tagsForCaptureRule(captureRule, line, parentCapture.start, parentCapture.end, stack); - tags.push.apply(tags, captureTags); - while (currentCaptureIndices.length && currentCaptureIndices[0].start < parentCapture.end) { + } else { + let previousChildCaptureEnd = parentCapture.start; + while (currentCaptureIndices.length && currentCaptureIndices[0].start < parentCapture.end) { + let childCapture = currentCaptureIndices[0]; + let emptyCapture = childCapture.end - childCapture.start === 0; + let captureHasNoScope = !this.captures[childCapture.index]; + if (emptyCapture || captureHasNoScope) { currentCaptureIndices.shift(); + continue; } - } else { - previousChildCaptureEnd = parentCapture.start; - while (currentCaptureIndices.length && currentCaptureIndices[0].start < parentCapture.end) { - childCapture = currentCaptureIndices[0]; - emptyCapture = childCapture.end - childCapture.start === 0; - captureHasNoScope = !this.captures[childCapture.index]; - if (emptyCapture || captureHasNoScope) { - currentCaptureIndices.shift(); - continue; - } - if (childCapture.start > previousChildCaptureEnd) { - tags.push(childCapture.start - previousChildCaptureEnd); - } - captureTags = this.tagsForCaptureIndices(line, currentCaptureIndices, allCaptureIndices, stack); - tags.push.apply(tags, captureTags); - previousChildCaptureEnd = childCapture.end; - } - if (parentCapture.end > previousChildCaptureEnd) { - tags.push(parentCapture.end - previousChildCaptureEnd); + if (childCapture.start > previousChildCaptureEnd) { + tags.push(childCapture.start - previousChildCaptureEnd); } + captureTags = this.tagsForCaptureIndices(line, currentCaptureIndices, allCaptureIndices, stack); + tags.push.apply(tags, captureTags); + previousChildCaptureEnd = childCapture.end; } - if (parentCaptureScope) { - if (tags.length > 1) { - tags.push(this.grammar.endIdForScope(parentCaptureScope)); - } else { - tags.pop(); - } + if (parentCapture.end > previousChildCaptureEnd) { + tags.push(parentCapture.end - previousChildCaptureEnd); } - return tags; - }; - - return Pattern; + } + if (parentCaptureScope) { + if (tags.length > 1) { + tags.push(this.grammar.endIdForScope(parentCaptureScope)); + } else { + tags.pop(); + } + } + return tags; + } - })(); +} -}).call(this); +module.exports = Pattern; From 56b7f8f27cdfc6ed542058867c9f45dc9cfe19de Mon Sep 17 00:00:00 2001 From: confused_techie Date: Wed, 23 Nov 2022 21:23:32 -0800 Subject: [PATCH 19/25] Update package.json Co-authored-by: DeeDeeG --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e4ab9e3..58e5fe8 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "TextMate helpers", "main": "./lib/first-mate.js", "scripts": { - "test": "node node_modules/jasmine-focused/bin/jasmine-focused --coffee --captureExceptions spec", + "test": "jasmine-focused --coffee --captureExceptions spec", "benchmark": "node_modules/.bin/coffee benchmark/benchmark.coffee" }, "repository": { From 18661760c2440e7e4b95158f0d388ff6221105c0 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sat, 26 Nov 2022 14:08:39 -0800 Subject: [PATCH 20/25] Added `pegjs` script, updated pegjs output --- lib/scope-selector-parser.js | 1373 ++++++++++++++++++---------------- package-lock.json | 35 +- package.json | 4 +- 3 files changed, 758 insertions(+), 654 deletions(-) diff --git a/lib/scope-selector-parser.js b/lib/scope-selector-parser.js index 74d0f0a..fcda326 100644 --- a/lib/scope-selector-parser.js +++ b/lib/scope-selector-parser.js @@ -1,418 +1,517 @@ -module.exports = (function() { - /* - * Generated by PEG.js 0.8.0. - * - * http://pegjs.majda.cz/ - */ - - function peg$subclass(child, parent) { - function ctor() { this.constructor = child; } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); +/* + * Generated by PEG.js 0.10.0. + * + * http://pegjs.org/ + */ + +"use strict"; + +function peg$subclass(child, parent) { + function ctor() { this.constructor = child; } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); +} + +function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); } +} - function SyntaxError(message, expected, found, offset, line, column) { - this.message = message; - this.expected = expected; - this.found = found; - this.offset = offset; - this.line = line; - this.column = column; +peg$subclass(peg$SyntaxError, Error); - this.name = "SyntaxError"; - } +peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, - peg$subclass(SyntaxError, Error); + "class": function(expectation) { + var escapedParts = "", + i; - function parse(input) { - var options = arguments.length > 1 ? arguments[1] : {}, + for (i = 0; i < expectation.parts.length; i++) { + escapedParts += expectation.parts[i] instanceof Array + ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) + : classEscape(expectation.parts[i]); + } - peg$FAILED = {}, + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, - peg$startRuleFunctions = { start: peg$parsestart }, - peg$startRuleFunction = peg$parsestart, + any: function(expectation) { + return "any character"; + }, - peg$c0 = peg$FAILED, - peg$c1 = function(selector) { - return selector; + end: function(expectation) { + return "end of input"; }, - peg$c2 = [], - peg$c3 = /^[a-zA-Z0-9+_]/, - peg$c4 = { type: "class", value: "[a-zA-Z0-9+_]", description: "[a-zA-Z0-9+_]" }, - peg$c5 = /^[a-zA-Z0-9\-+_]/, - peg$c6 = { type: "class", value: "[a-zA-Z0-9\\-+_]", description: "[a-zA-Z0-9\\-+_]" }, - peg$c7 = function(segment) { - return new matchers.SegmentMatcher(segment); - }, - peg$c8 = /^[*]/, - peg$c9 = { type: "class", value: "[*]", description: "[*]" }, - peg$c10 = function(scopeName) { - return new matchers.TrueMatcher(); - }, - peg$c11 = ".", - peg$c12 = { type: "literal", value: ".", description: "\".\"" }, - peg$c13 = function(first, others) { - return new matchers.ScopeMatcher(first, others); - }, - peg$c14 = null, - peg$c15 = /^[LRB]/, - peg$c16 = { type: "class", value: "[LRB]", description: "[LRB]" }, - peg$c17 = ":", - peg$c18 = { type: "literal", value: ":", description: "\":\"" }, - peg$c19 = function(prefix, first, others) { - return new matchers.PathMatcher(prefix, first, others); - }, - peg$c20 = "(", - peg$c21 = { type: "literal", value: "(", description: "\"(\"" }, - peg$c22 = ")", - peg$c23 = { type: "literal", value: ")", description: "\")\"" }, - peg$c24 = function(prefix, selector) { - return new matchers.GroupMatcher(prefix, selector); - }, - peg$c25 = "-", - peg$c26 = { type: "literal", value: "-", description: "\"-\"" }, - peg$c27 = function(group) { - return new matchers.NegateMatcher(group); - }, - peg$c28 = function(path) { - return new matchers.NegateMatcher(path); - }, - peg$c29 = /^[|&\-]/, - peg$c30 = { type: "class", value: "[|&\\-]", description: "[|&\\-]" }, - peg$c31 = function(left, operator, right) { - return new matchers.CompositeMatcher(left, operator, right); - }, - peg$c32 = ",", - peg$c33 = { type: "literal", value: ",", description: "\",\"" }, - peg$c34 = function(left, right) { - if (right) - return new matchers.OrMatcher(left, right); - else - return left; - }, - peg$c35 = /^[ \t]/, - peg$c36 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, - - peg$currPos = 0, - peg$reportedPos = 0, - peg$cachedPos = 0, - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, - peg$maxFailPos = 0, - peg$maxFailExpected = [], - peg$silentFails = 0, - - peg$result; - - if ("startRule" in options) { - if (!(options.startRule in peg$startRuleFunctions)) { - throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); - } - peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; - } + other: function(expectation) { + return expectation.description; + } + }; - function text() { - return input.substring(peg$reportedPos, peg$currPos); - } + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } - function offset() { - return peg$reportedPos; - } + function literalEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } - function line() { - return peg$computePosDetails(peg$reportedPos).line; - } + function classEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/\]/g, '\\]') + .replace(/\^/g, '\\^') + .replace(/-/g, '\\-') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } - function column() { - return peg$computePosDetails(peg$reportedPos).column; - } + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } - function expected(description) { - throw peg$buildException( - null, - [{ type: "other", description: description }], - peg$reportedPos - ); - } + function describeExpected(expected) { + var descriptions = new Array(expected.length), + i, j; - function error(message) { - throw peg$buildException(message, null, peg$reportedPos); + for (i = 0; i < expected.length; i++) { + descriptions[i] = describeExpectation(expected[i]); } - function peg$computePosDetails(pos) { - function advance(details, startPos, endPos) { - var p, ch; - - for (p = startPos; p < endPos; p++) { - ch = input.charAt(p); - if (ch === "\n") { - if (!details.seenCR) { details.line++; } - details.column = 1; - details.seenCR = false; - } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { - details.line++; - details.column = 1; - details.seenCR = true; - } else { - details.column++; - details.seenCR = false; - } - } - } + descriptions.sort(); - if (peg$cachedPos !== pos) { - if (peg$cachedPos > pos) { - peg$cachedPos = 0; - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; } - advance(peg$cachedPosDetails, peg$cachedPos, pos); - peg$cachedPos = pos; } + descriptions.length = j; + } - return peg$cachedPosDetails; + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; } + } - function peg$fail(expected) { - if (peg$currPos < peg$maxFailPos) { return; } + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } - if (peg$currPos > peg$maxFailPos) { - peg$maxFailPos = peg$currPos; - peg$maxFailExpected = []; - } + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; +}; + +function peg$parse(input, options) { + options = options !== void 0 ? options : {}; + + var peg$FAILED = {}, + + peg$startRuleFunctions = { start: peg$parsestart }, + peg$startRuleFunction = peg$parsestart, + + peg$c0 = function(selector) { + return selector; + }, + peg$c1 = /^[a-zA-Z0-9+_]/, + peg$c2 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "+", "_"], false, false), + peg$c3 = /^[a-zA-Z0-9\-+_]/, + peg$c4 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "-", "+", "_"], false, false), + peg$c5 = function(segment) { + return new matchers.SegmentMatcher(segment); + }, + peg$c6 = /^[*]/, + peg$c7 = peg$classExpectation(["*"], false, false), + peg$c8 = function(scopeName) { + return new matchers.TrueMatcher(); + }, + peg$c9 = ".", + peg$c10 = peg$literalExpectation(".", false), + peg$c11 = function(first, others) { + return new matchers.ScopeMatcher(first, others); + }, + peg$c12 = /^[LRB]/, + peg$c13 = peg$classExpectation(["L", "R", "B"], false, false), + peg$c14 = ":", + peg$c15 = peg$literalExpectation(":", false), + peg$c16 = function(prefix, first, others) { + return new matchers.PathMatcher(prefix, first, others); + }, + peg$c17 = "(", + peg$c18 = peg$literalExpectation("(", false), + peg$c19 = ")", + peg$c20 = peg$literalExpectation(")", false), + peg$c21 = function(prefix, selector) { + return new matchers.GroupMatcher(prefix, selector); + }, + peg$c22 = "-", + peg$c23 = peg$literalExpectation("-", false), + peg$c24 = function(group) { + return new matchers.NegateMatcher(group); + }, + peg$c25 = function(path) { + return new matchers.NegateMatcher(path); + }, + peg$c26 = /^[|&\-]/, + peg$c27 = peg$classExpectation(["|", "&", "-"], false, false), + peg$c28 = function(left, operator, right) { + return new matchers.CompositeMatcher(left, operator, right); + }, + peg$c29 = ",", + peg$c30 = peg$literalExpectation(",", false), + peg$c31 = function(left, right) { + if (right) + return new matchers.OrMatcher(left, right); + else + return left; + }, + peg$c32 = /^[ \t]/, + peg$c33 = peg$classExpectation([" ", "\t"], false, false), + + peg$currPos = 0, + peg$savedPos = 0, + peg$posDetailsCache = [{ line: 1, column: 1 }], + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$silentFails = 0, + + peg$result; - peg$maxFailExpected.push(expected); + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); } - function peg$buildException(message, expected, pos) { - function cleanupExpected(expected) { - var i = 1; + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } - expected.sort(function(a, b) { - if (a.description < b.description) { - return -1; - } else if (a.description > b.description) { - return 1; - } else { - return 0; - } - }); + function text() { + return input.substring(peg$savedPos, peg$currPos); + } - while (i < expected.length) { - if (expected[i - 1] === expected[i]) { - expected.splice(i, 1); - } else { - i++; - } - } - } + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); + } - function buildMessage(expected, found) { - function stringEscape(s) { - function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } - - return s - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\x08/g, '\\b') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\f/g, '\\f') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) - .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) - .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) - .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); - } + function expected(description, location) { + location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) + + throw peg$buildStructuredError( + [peg$otherExpectation(description)], + input.substring(peg$savedPos, peg$currPos), + location + ); + } - var expectedDescs = new Array(expected.length), - expectedDesc, foundDesc, i; + function error(message, location) { + location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) - for (i = 0; i < expected.length; i++) { - expectedDescs[i] = expected[i].description; - } + throw peg$buildSimpleError(message, location); + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: "literal", text: text, ignoreCase: ignoreCase }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + + function peg$anyExpectation() { + return { type: "any" }; + } + + function peg$endExpectation() { + return { type: "end" }; + } - expectedDesc = expected.length > 1 - ? expectedDescs.slice(0, -1).join(", ") - + " or " - + expectedDescs[expected.length - 1] - : expectedDescs[0]; + function peg$otherExpectation(description) { + return { type: "other", description: description }; + } - foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos], p; - return "Expected " + expectedDesc + " but " + foundDesc + " found."; + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; } - var posDetails = peg$computePosDetails(pos), - found = pos < input.length ? input.charAt(pos) : null; + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; - if (expected !== null) { - cleanupExpected(expected); + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; } - return new SyntaxError( - message !== null ? message : buildMessage(expected, found), - expected, - found, - pos, - posDetails.line, - posDetails.column - ); + peg$posDetailsCache[pos] = details; + return details; } + } - function peg$parsestart() { - var s0, s1, s2, s3; + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } - s0 = peg$currPos; - s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - s2 = peg$parseselector(); - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c1(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildSimpleError(message, location) { + return new peg$SyntaxError(message, null, null, location); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parsestart() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$parseselector(); + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s2); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parsesegment() { - var s0, s1, s2, s3, s4, s5; + return s0; + } - s0 = peg$currPos; - s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = []; + function peg$parsesegment() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = []; + if (peg$c1.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c2); } + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + if (peg$c1.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c2); } + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + s4 = []; if (peg$c3.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); + s5 = input.charAt(peg$currPos); peg$currPos++; } else { - s4 = peg$FAILED; + s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c4); } } - if (s4 !== peg$FAILED) { - while (s4 !== peg$FAILED) { - s3.push(s4); - if (peg$c3.test(input.charAt(peg$currPos))) { - s4 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c4); } - } - } - } else { - s3 = peg$c0; - } - if (s3 !== peg$FAILED) { - s4 = []; - if (peg$c5.test(input.charAt(peg$currPos))) { + while (s5 !== peg$FAILED) { + s4.push(s5); + if (peg$c3.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - while (s5 !== peg$FAILED) { - s4.push(s5); - if (peg$c5.test(input.charAt(peg$currPos))) { - s5 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - } - if (s4 !== peg$FAILED) { - s3 = [s3, s4]; - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c0; + if (peg$silentFails === 0) { peg$fail(peg$c4); } } + } + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; } else { peg$currPos = s2; - s2 = peg$c0; + s2 = peg$FAILED; } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c7(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c5(s2); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - if (peg$c8.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c9); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c10(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (peg$c6.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c7); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c8(s2); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - - return s0; } - function peg$parsescope() { - var s0, s1, s2, s3, s4, s5; + return s0; + } - s0 = peg$currPos; - s1 = peg$parsesegment(); - if (s1 !== peg$FAILED) { - s2 = []; + function peg$parsescope() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parsesegment(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s4 = peg$c9; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + if (s4 !== peg$FAILED) { + s5 = peg$parsesegment(); + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); s3 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c11; + s4 = peg$c9; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } + if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s4 !== peg$FAILED) { s5 = peg$parsesegment(); @@ -421,90 +520,84 @@ module.exports = (function() { s3 = s4; } else { peg$currPos = s3; - s3 = peg$c0; + s3 = peg$FAILED; } } else { peg$currPos = s3; - s3 = peg$c0; - } - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c11; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c12); } - } - if (s4 !== peg$FAILED) { - s5 = peg$parsesegment(); - if (s5 !== peg$FAILED) { - s4 = [s4, s5]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$c0; - } - } else { - peg$currPos = s3; - s3 = peg$c0; - } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c13(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; + s3 = peg$FAILED; } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c11(s1, s2); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parsepath() { - var s0, s1, s2, s3, s4, s5, s6; + return s0; + } - s0 = peg$currPos; - s1 = peg$currPos; - if (peg$c15.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); + function peg$parsepath() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + s1 = peg$currPos; + if (peg$c12.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c13); } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c14; peg$currPos++; } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c15); } } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c17; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c18); } - } - if (s3 !== peg$FAILED) { - s2 = [s2, s3]; - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$c0; - } + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; } else { peg$currPos = s1; - s1 = peg$c0; - } - if (s1 === peg$FAILED) { - s1 = peg$c14; + s1 = peg$FAILED; } - if (s1 !== peg$FAILED) { - s2 = peg$parsescope(); - if (s2 !== peg$FAILED) { - s3 = []; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parsescope(); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + s5 = peg$parse_(); + if (s5 !== peg$FAILED) { + s6 = peg$parsescope(); + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); s4 = peg$currPos; s5 = peg$parse_(); if (s5 !== peg$FAILED) { @@ -514,366 +607,354 @@ module.exports = (function() { s4 = s5; } else { peg$currPos = s4; - s4 = peg$c0; + s4 = peg$FAILED; } } else { peg$currPos = s4; - s4 = peg$c0; - } - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$currPos; - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - s6 = peg$parsescope(); - if (s6 !== peg$FAILED) { - s5 = [s5, s6]; - s4 = s5; - } else { - peg$currPos = s4; - s4 = peg$c0; - } - } else { - peg$currPos = s4; - s4 = peg$c0; - } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c19(s1, s2, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; + s4 = peg$FAILED; } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c16(s1, s2, s3); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parsegroup() { - var s0, s1, s2, s3, s4, s5, s6; + return s0; + } - s0 = peg$currPos; - s1 = peg$currPos; - if (peg$c15.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); + function peg$parsegroup() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + s1 = peg$currPos; + if (peg$c12.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c13); } + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s3 = peg$c14; peg$currPos++; } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c16); } + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c15); } } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s3 = peg$c17; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c18); } - } - if (s3 !== peg$FAILED) { - s2 = [s2, s3]; - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$c0; - } + if (s3 !== peg$FAILED) { + s2 = [s2, s3]; + s1 = s2; } else { peg$currPos = s1; - s1 = peg$c0; + s1 = peg$FAILED; } - if (s1 === peg$FAILED) { - s1 = peg$c14; + } else { + peg$currPos = s1; + s1 = peg$FAILED; + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 40) { + s2 = peg$c17; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 40) { - s2 = peg$c20; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c21); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseselector(); - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s6 = peg$c22; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c23); } - } - if (s6 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c24(s1, s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + if (s3 !== peg$FAILED) { + s4 = peg$parseselector(); + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s6 = peg$c19; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c20); } + } + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c21(s1, s4); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; } - function peg$parseexpression() { - var s0, s1, s2, s3, s4; + return s0; + } + + function peg$parseexpression() { + var s0, s1, s2, s3, s4; + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 45) { + s1 = peg$c22; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c23); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parsegroup(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c24(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c25; + s1 = peg$c22; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } + if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); if (s2 !== peg$FAILED) { - s3 = peg$parsegroup(); + s3 = peg$parsepath(); if (s3 !== peg$FAILED) { s4 = peg$parse_(); if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c27(s3); + peg$savedPos = s0; + s1 = peg$c25(s3); s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c25; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parsepath(); - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c28(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } - } else { - peg$currPos = s0; - s0 = peg$c0; - } + s0 = peg$parsegroup(); if (s0 === peg$FAILED) { - s0 = peg$parsegroup(); - if (s0 === peg$FAILED) { - s0 = peg$parsepath(); - } + s0 = peg$parsepath(); } } - - return s0; } - function peg$parsecomposite() { - var s0, s1, s2, s3, s4, s5; + return s0; + } - s0 = peg$currPos; - s1 = peg$parseexpression(); - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - if (peg$c29.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parsecomposite(); - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c31(s1, s3, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + function peg$parsecomposite() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parseexpression(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + if (peg$c26.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c27); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsecomposite(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c28(s1, s3, s5); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parseexpression(); - } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseexpression(); } - function peg$parseselector() { - var s0, s1, s2, s3, s4, s5; + return s0; + } - s0 = peg$currPos; - s1 = peg$parsecomposite(); - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 44) { - s3 = peg$c32; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c33); } - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parseselector(); - if (s5 === peg$FAILED) { - s5 = peg$c14; - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c34(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c0; - } + function peg$parseselector() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + s1 = peg$parsecomposite(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s3 = peg$c29; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c30); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseselector(); + if (s5 === peg$FAILED) { + s5 = null; + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c31(s1, s5); + s0 = s1; } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } } else { peg$currPos = s0; - s0 = peg$c0; + s0 = peg$FAILED; } - if (s0 === peg$FAILED) { - s0 = peg$parsecomposite(); - } - - return s0; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parsecomposite(); } - function peg$parse_() { - var s0, s1; + return s0; + } - s0 = []; - if (peg$c35.test(input.charAt(peg$currPos))) { + function peg$parse_() { + var s0, s1; + + s0 = []; + if (peg$c32.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c33); } + } + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c32.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } - } - while (s1 !== peg$FAILED) { - s0.push(s1); - if (peg$c35.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } - } + if (peg$silentFails === 0) { peg$fail(peg$c33); } } - - return s0; } - var matchers = require('./scope-selector-matchers'); + return s0; + } - peg$result = peg$startRuleFunction(); + var matchers = require('./scope-selector-matchers'); - if (peg$result !== peg$FAILED && peg$currPos === input.length) { - return peg$result; - } else { - if (peg$result !== peg$FAILED && peg$currPos < input.length) { - peg$fail({ type: "end", description: "end of input" }); - } + peg$result = peg$startRuleFunction(); - throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); } + + throw peg$buildStructuredError( + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); } +} - return { - SyntaxError: SyntaxError, - parse: parse - }; -})(); \ No newline at end of file +module.exports = { + SyntaxError: peg$SyntaxError, + parse: peg$parse +}; diff --git a/package-lock.json b/package-lock.json index 3c6ebc5..0cfda47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "grunt-peg": "~1.1.0", "grunt-shell": "~0.2.2", "jasmine-focused": "^1", + "pegjs": "^0.10.0", "rimraf": "~2.1.4" } }, @@ -1005,6 +1006,18 @@ "grunt": "~0.4.1" } }, + "node_modules/grunt-peg/node_modules/pegjs": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.8.0.tgz", + "integrity": "sha512-GtAFD5WLxE0LjyhlpKwAnbi3NLJDrYsOvil95UCUQ6pzxlUtUGP/k0FnKGypTpM1WWdmoclfXb0dmMd5UUDkvA==", + "dev": true, + "bin": { + "pegjs": "bin/pegjs" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/grunt-shell": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/grunt-shell/-/grunt-shell-0.2.2.tgz", @@ -1371,15 +1384,15 @@ } }, "node_modules/pegjs": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.8.0.tgz", - "integrity": "sha1-l28GfaE+XFsVAcAXklZoolOBFWE=", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz", + "integrity": "sha512-qI5+oFNEGi3L5HAxDwN2LA4Gg7irF70Zs25edhjld9QemOgp0CbvMtbFcMvFtEo1OityPrcCzkQFB8JP/hxgow==", "dev": true, "bin": { "pegjs": "bin/pegjs" }, "engines": { - "node": ">= 0.8" + "node": ">=0.10" } }, "node_modules/property-accessors": { @@ -2434,6 +2447,14 @@ "dev": true, "requires": { "pegjs": "~0.8.0" + }, + "dependencies": { + "pegjs": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.8.0.tgz", + "integrity": "sha512-GtAFD5WLxE0LjyhlpKwAnbi3NLJDrYsOvil95UCUQ6pzxlUtUGP/k0FnKGypTpM1WWdmoclfXb0dmMd5UUDkvA==", + "dev": true + } } }, "grunt-shell": { @@ -2667,9 +2688,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "pegjs": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.8.0.tgz", - "integrity": "sha1-l28GfaE+XFsVAcAXklZoolOBFWE=", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz", + "integrity": "sha512-qI5+oFNEGi3L5HAxDwN2LA4Gg7irF70Zs25edhjld9QemOgp0CbvMtbFcMvFtEo1OityPrcCzkQFB8JP/hxgow==", "dev": true }, "property-accessors": { diff --git a/package.json b/package.json index 58e5fe8..a0d0f5c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "./lib/first-mate.js", "scripts": { "test": "jasmine-focused --coffee --captureExceptions spec", - "benchmark": "node_modules/.bin/coffee benchmark/benchmark.coffee" + "benchmark": "node_modules/.bin/coffee benchmark/benchmark.coffee", + "parse": "pegjs -o ./lib/scope-selector-parser.js ./src/scope-selector-parser.pegjs" }, "repository": { "type": "git", @@ -35,6 +36,7 @@ "grunt-peg": "~1.1.0", "grunt-shell": "~0.2.2", "jasmine-focused": "^1", + "pegjs": "^0.10.0", "rimraf": "~2.1.4" } } From 741ca9f0d396a0bd2c72dec4b61465571b53727d Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sat, 26 Nov 2022 14:08:51 -0800 Subject: [PATCH 21/25] Removed old CoffeeScript --- src/first-mate.coffee | 9 - src/grammar-registry.coffee | 252 ------------------------- src/grammar.coffee | 292 ----------------------------- src/injections.coffee | 36 ---- src/null-grammar.coffee | 12 -- src/pattern.coffee | 249 ------------------------ src/rule.coffee | 116 ------------ src/scanner.coffee | 68 ------- src/scope-selector-matchers.coffee | 165 ---------------- src/scope-selector.coffee | 36 ---- 10 files changed, 1235 deletions(-) delete mode 100644 src/first-mate.coffee delete mode 100644 src/grammar-registry.coffee delete mode 100644 src/grammar.coffee delete mode 100644 src/injections.coffee delete mode 100644 src/null-grammar.coffee delete mode 100644 src/pattern.coffee delete mode 100644 src/rule.coffee delete mode 100644 src/scanner.coffee delete mode 100644 src/scope-selector-matchers.coffee delete mode 100644 src/scope-selector.coffee diff --git a/src/first-mate.coffee b/src/first-mate.coffee deleted file mode 100644 index ce2e07a..0000000 --- a/src/first-mate.coffee +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = - ScopeSelector: require './scope-selector' - GrammarRegistry: require './grammar-registry' - Grammar: require './grammar' - -# This allows this file to be processed with `electron-link` -Object.defineProperty(module.exports, 'OnigRegExp', { - get: -> require('oniguruma').OnigRegExp -}) diff --git a/src/grammar-registry.coffee b/src/grammar-registry.coffee deleted file mode 100644 index 264c9ef..0000000 --- a/src/grammar-registry.coffee +++ /dev/null @@ -1,252 +0,0 @@ -_ = require 'underscore-plus' -CSON = require 'season' -{Emitter, Disposable} = require 'event-kit' -Grim = require 'grim' - -Grammar = require './grammar' -NullGrammar = require './null-grammar' - -# Extended: Registry containing one or more grammars. -module.exports = -class GrammarRegistry - constructor: (options={}) -> - @maxTokensPerLine = options.maxTokensPerLine ? Infinity - @maxLineLength = options.maxLineLength ? Infinity - @nullGrammar = new NullGrammar(this) - @clear() - - clear: -> - @emitter = new Emitter - @grammars = [] - @grammarsByScopeName = {} - @injectionGrammars = [] - @grammarOverridesByPath = {} - @scopeIdCounter = -1 - @idsByScope = {} - @scopesById = {} - @addGrammar(@nullGrammar) - - ### - Section: Event Subscription - ### - - # Public: Invoke the given callback when a grammar is added to the registry. - # - # * `callback` {Function} to call when a grammar is added. - # * `grammar` {Grammar} that was added. - # - # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. - onDidAddGrammar: (callback) -> - @emitter.on 'did-add-grammar', callback - - # Public: Invoke the given callback when a grammar is updated due to a grammar - # it depends on being added or removed from the registry. - # - # * `callback` {Function} to call when a grammar is updated. - # * `grammar` {Grammar} that was updated. - # - # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. - onDidUpdateGrammar: (callback) -> - @emitter.on 'did-update-grammar', callback - - # Public: Invoke the given callback when a grammar is removed from the registry. - # - # * `callback` {Function} to call when a grammar is removed. - # * `grammar` {Grammar} that was removed. - # - # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. - onDidRemoveGrammar: (callback) -> - @emitter.on 'did-remove-grammar', callback - - ### - Section: Managing Grammars - ### - - # 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: 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}. - # - # Returns a {Disposable} on which `.dispose()` can be called to remove the - # grammar. - addGrammar: (grammar) -> - @grammars.push(grammar) - @grammarsByScopeName[grammar.scopeName] = grammar - @injectionGrammars.push(grammar) if grammar.injectionSelector? - @grammarUpdated(grammar.scopeName) - @emit 'grammar-added', grammar if Grammar.includeDeprecatedAPIs - @emitter.emit 'did-add-grammar', grammar - new Disposable => @removeGrammar(grammar) - - removeGrammar: (grammar) -> - _.remove(@grammars, grammar) - delete @grammarsByScopeName[grammar.scopeName] - _.remove(@injectionGrammars, grammar) - @grammarUpdated(grammar.scopeName) - @emitter.emit 'did-remove-grammar', grammar - undefined - - # Public: Remove the grammar with the given scope name. - # - # * `scopeName` A {String} such as `"source.js"`. - # - # Returns the removed {Grammar} or undefined. - removeGrammarForScopeName: (scopeName) -> - grammar = @grammarForScopeName(scopeName) - @removeGrammar(grammar) if grammar? - 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) -> - grammar = CSON.readFileSync(grammarPath) ? {} - if typeof grammar.scopeName is 'string' and grammar.scopeName.length > 0 - @createGrammar(grammarPath, grammar) - else - throw new Error("Grammar missing required scopeName property: #{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 read with the following arguments: - # * `error` An {Error}, may be null. - # * `grammar` A {Grammar} or null if an error occured. - # - # Returns undefined. - readGrammar: (grammarPath, callback) -> - CSON.readFile grammarPath, (error, grammar={}) => - if error? - callback?(error) - else - if typeof grammar.scopeName is 'string' and grammar.scopeName.length > 0 - callback?(null, @createGrammar(grammarPath, grammar)) - else - callback?(new Error("Grammar missing required scopeName property: #{grammarPath}")) - - undefined - - # Public: Read a grammar synchronously and add it to this registry. - # - # * `grammarPath` A {String} absolute file path to a grammar file. - # - # Returns a {Grammar}. - loadGrammarSync: (grammarPath) -> - grammar = @readGrammarSync(grammarPath) - @addGrammar(grammar) - grammar - - # Public: Read a grammar asynchronously and add it to the registry. - # - # * `grammarPath` A {String} absolute file path to a grammar file. - # * `callback` A {Function} to call when loaded with the following arguments: - # * `error` An {Error}, may be null. - # * `grammar` A {Grammar} or null if an error occured. - # - # Returns undefined. - loadGrammar: (grammarPath, callback) -> - @readGrammar grammarPath, (error, grammar) => - if error? - callback?(error) - else - @addGrammar(grammar) - callback?(null, grammar) - - undefined - - startIdForScope: (scope) -> - unless id = @idsByScope[scope] - id = @scopeIdCounter - @scopeIdCounter -= 2 - @idsByScope[scope] = id - @scopesById[id] = scope - id - - endIdForScope: (scope) -> - @startIdForScope(scope) - 1 - - scopeForId: (id) -> - if (id % 2) is -1 - @scopesById[id] # start id - else - @scopesById[id + 1] # end id - - grammarUpdated: (scopeName) -> - for grammar in @grammars when grammar.scopeName isnt scopeName - if grammar.grammarUpdated(scopeName) - @emit 'grammar-updated', grammar if Grammar.includeDeprecatedAPIs - @emitter.emit 'did-update-grammar', grammar - return - - createGrammar: (grammarPath, object) -> - object.maxTokensPerLine ?= @maxTokensPerLine - object.maxLineLength ?= @maxLineLength - if object.limitLineLength is false - object.maxLineLength = Infinity - grammar = new Grammar(this, object) - grammar.path = grammarPath - grammar - - decodeTokens: (lineText, tags, scopeTags = [], fn) -> - offset = 0 - scopeNames = scopeTags.map (tag) => @scopeForId(tag) - - tokens = [] - for tag, index in tags - # positive numbers indicate string content with length equaling the number - if tag >= 0 - token = { - value: lineText.substring(offset, offset + tag) - scopes: scopeNames.slice() - } - token = fn(token, index) if fn? - tokens.push(token) - offset += tag - - # odd negative numbers are begin scope tags - else if (tag % 2) is -1 - scopeTags.push(tag) - scopeNames.push(@scopeForId(tag)) - - # even negative numbers are end scope tags - else - scopeTags.pop() - expectedScopeName = @scopeForId(tag + 1) - poppedScopeName = scopeNames.pop() - unless poppedScopeName is expectedScopeName - throw new Error("Expected popped scope to be #{expectedScopeName}, but it was #{poppedScopeName}") - - tokens - -if Grim.includeDeprecatedAPIs - EmitterMixin = require('emissary').Emitter - EmitterMixin.includeInto(GrammarRegistry) - - GrammarRegistry::on = (eventName) -> - switch eventName - when 'grammar-added' - Grim.deprecate("Call GrammarRegistry::onDidAddGrammar instead") - when 'grammar-updated' - Grim.deprecate("Call GrammarRegistry::onDidUpdateGrammar instead") - else - Grim.deprecate("Call explicit event subscription methods instead") - - EmitterMixin::on.apply(this, arguments) diff --git a/src/grammar.coffee b/src/grammar.coffee deleted file mode 100644 index cc11ad2..0000000 --- a/src/grammar.coffee +++ /dev/null @@ -1,292 +0,0 @@ -path = require 'path' - -_ = require 'underscore-plus' -fs = require 'fs-plus' -{OnigRegExp, OnigString} = require 'oniguruma' -{Emitter} = require 'event-kit' -Grim = require 'grim' - -Injections = require './injections' -Pattern = require './pattern' -Rule = require './rule' -ScopeSelector = require './scope-selector' - -# Extended: Grammar that tokenizes lines of text. -# -# This class should not be instantiated directly but instead obtained from -# a {GrammarRegistry} by calling {GrammarRegistry::loadGrammar}. -module.exports = -class Grammar - registration: null - - constructor: (@registry, options={}) -> - {@name, @fileTypes, @scopeName, @foldingStopMarker, @maxTokensPerLine, @maxLineLength} = options - {injections, injectionSelector, patterns, repository, firstLineMatch, contentRegex} = options - - @emitter = new Emitter - @repository = null - @initialRule = null - - if injectionSelector? - @injectionSelector = new ScopeSelector(injectionSelector) - else - @injectionSelector = null - - if firstLineMatch - @firstLineRegex = new OnigRegExp(firstLineMatch) - else - @firstLineRegex = null - - if contentRegex - @contentRegex = new OnigRegExp(contentRegex) - else - @contentRegex = null - - @fileTypes ?= [] - @includedGrammarScopes = [] - - @rawPatterns = patterns - @rawRepository = repository - @rawInjections = injections - - @updateRules() - - ### - Section: Event Subscription - ### - - # Public: Invoke the given callback when this grammar is updated due to a - # grammar it depends on being added or removed from the registry. - # - # * `callback` {Function} to call when this grammar is updated. - # - # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. - onDidUpdate: (callback) -> - @emitter.on 'did-update', callback - - ### - Section: Tokenizing - ### - - # Public: Tokenize all lines in the given text. - # - # * `text` A {String} containing one or more lines. - # - # Returns an {Array} of token arrays for each line tokenized. - tokenizeLines: (text, compatibilityMode=true) -> - lines = text.split('\n') - lastLine = lines.length - 1 - ruleStack = null - - scopes = [] - for line, lineNumber in lines - {tags, ruleStack} = @tokenizeLine(line, ruleStack, lineNumber is 0, compatibilityMode, lineNumber isnt lastLine) - @registry.decodeTokens(line, tags, scopes) - - # Public: Tokenize the line of text. - # - # * `line` A {String} of text to tokenize. - # * `ruleStack` An optional {Array} of rules previously returned from this - # method. This should be null when tokenizing the first line in the file. - # * `firstLine` 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. - # - # Returns an {Object} containing the following properties: - # * `line` The {String} of text that was tokenized. - # * `tags` An {Array} of integer scope ids and strings. Positive ids - # indicate the beginning of a scope, and negative tags indicate the end. - # To resolve ids to scope names, call {GrammarRegistry::scopeForId} with the - # absolute value of the id. - # * `tokens` This is a dynamic property. Invoking it will incur additional - # overhead, but will automatically translate the `tags` into token objects - # with `value` and `scopes` properties. - # * `ruleStack` An {Array} of rules representing the tokenized state at the - # end of the line. These should be passed back into this method when - # tokenizing the next line in the file. - tokenizeLine: (inputLine, ruleStack, firstLine=false, compatibilityMode=true, appendNewLine=true) -> - tags = [] - - truncatedLine = false - if inputLine.length > @maxLineLength - line = inputLine.slice(0, @maxLineLength) - truncatedLine = true - else - line = inputLine - - string = new OnigString(line) - stringWithNewLine = if appendNewLine then new OnigString(line + '\n') else string - - if ruleStack? - ruleStack = ruleStack.slice() - if compatibilityMode - openScopeTags = [] - for {scopeName, contentScopeName} in ruleStack - openScopeTags.push(@registry.startIdForScope(scopeName)) if scopeName - openScopeTags.push(@registry.startIdForScope(contentScopeName)) if contentScopeName - else - openScopeTags = [] if compatibilityMode - {scopeName, contentScopeName} = @initialRule - ruleStack = [{rule: @initialRule, scopeName, contentScopeName}] - tags.push(@startIdForScope(@initialRule.scopeName)) if scopeName - tags.push(@startIdForScope(@initialRule.contentScopeName)) if contentScopeName - - initialRuleStackLength = ruleStack.length - position = 0 - tokenCount = 0 - - loop - previousRuleStackLength = ruleStack.length - previousPosition = position - - break if position > line.length - - if tokenCount >= @getMaxTokensPerLine() - 1 - truncatedLine = true - break - - if match = _.last(ruleStack).rule.getNextTags(ruleStack, string, stringWithNewLine, position, firstLine) - {nextTags, tagsStart, tagsEnd} = match - - # Unmatched text before next tags - if position < tagsStart - tags.push(tagsStart - position) - tokenCount++ - - tags.push(nextTags...) - tokenCount++ for tag in nextTags when tag >= 0 - position = tagsEnd - - else - # Push filler token for unmatched text at end of line - if position < line.length or line.length is 0 - tags.push(line.length - position) - break - - if position is previousPosition - if ruleStack.length is previousRuleStackLength - console.error("Popping rule because it loops at column #{position} of line '#{line}'", _.clone(ruleStack)) - if ruleStack.length > 1 - {scopeName, contentScopeName} = ruleStack.pop() - tags.push(@endIdForScope(contentScopeName)) if contentScopeName - tags.push(@endIdForScope(scopeName)) if scopeName - else - if position < line.length or (line.length is 0 and tags.length is 0) - tags.push(line.length - position) - break - else if ruleStack.length > previousRuleStackLength # Stack size increased with zero length match - [{rule: penultimateRule}, {rule: lastRule}] = ruleStack[-2..] - - # Same exact rule was pushed but position wasn't advanced - if lastRule? and lastRule is penultimateRule - popStack = true - - # Rule with same scope name as previous rule was pushed but position wasn't advanced - if lastRule?.scopeName? and penultimateRule.scopeName is lastRule.scopeName - popStack = true - - if popStack - ruleStack.pop() - lastSymbol = _.last(tags) - if lastSymbol < 0 and lastSymbol is @startIdForScope(lastRule.scopeName) - tags.pop() # also pop the duplicated start scope if it was pushed - tags.push(line.length - position) - break - - 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 - {scopeName, contentScopeName} = ruleStack.pop() - tags.push(@endIdForScope(contentScopeName)) if contentScopeName - tags.push(@endIdForScope(scopeName)) if scopeName - - rule.clearAnchorPosition() for {rule} in ruleStack - - if compatibilityMode - new TokenizeLineResult(inputLine, openScopeTags, tags, ruleStack, @registry) - else - {line: inputLine, tags, ruleStack} - - activate: -> - @registration = @registry.addGrammar(this) - - deactivate: -> - @emitter = new Emitter - @registration?.dispose() - @registration = null - - updateRules: -> - @initialRule = @createRule({@scopeName, patterns: @rawPatterns}) - @repository = @createRepository() - @injections = new Injections(this, @rawInjections) - - getInitialRule: -> @initialRule - - getRepository: -> @repository - - createRepository: -> - repository = {} - for name, data of @rawRepository - data = {patterns: [data], tempName: name} if data.begin? or data.match? - repository[name] = @createRule(data) - repository - - addIncludedGrammarScope: (scope) -> - @includedGrammarScopes.push(scope) unless _.include(@includedGrammarScopes, scope) - - grammarUpdated: (scopeName) -> - return false unless _.include(@includedGrammarScopes, scopeName) - @updateRules() - @registry.grammarUpdated(@scopeName) - @emit 'grammar-updated' if Grim.includeDeprecatedAPIs - @emitter.emit 'did-update' - true - - startIdForScope: (scope) -> @registry.startIdForScope(scope) - - endIdForScope: (scope) -> @registry.endIdForScope(scope) - - scopeForId: (id) -> @registry.scopeForId(id) - - createRule: (options) -> new Rule(this, @registry, options) - - createPattern: (options) -> new Pattern(this, @registry, options) - - getMaxTokensPerLine: -> - @maxTokensPerLine - - scopesFromStack: (stack, rule, endPatternMatch) -> - scopes = [] - for {scopeName, contentScopeName} in stack - scopes.push(scopeName) if scopeName - scopes.push(contentScopeName) if contentScopeName - - # Pop the last content name scope if the end pattern at the top of the stack - # was matched since only text between the begin/end patterns should have the - # content name scope - if endPatternMatch and rule?.contentScopeName and rule is stack[stack.length - 1] - scopes.pop() - - scopes - -if Grim.includeDeprecatedAPIs - EmitterMixin = require('emissary').Emitter - EmitterMixin.includeInto(Grammar) - - Grammar::on = (eventName) -> - if eventName is 'did-update' - Grim.deprecate("Call Grammar::onDidUpdate instead") - else - Grim.deprecate("Call explicit event subscription methods instead") - - EmitterMixin::on.apply(this, arguments) - -class TokenizeLineResult - constructor: (@line, @openScopeTags, @tags, @ruleStack, @registry) -> - - Object.defineProperty @prototype, 'tokens', get: -> - @registry.decodeTokens(@line, @tags, @openScopeTags) diff --git a/src/injections.coffee b/src/injections.coffee deleted file mode 100644 index 763159c..0000000 --- a/src/injections.coffee +++ /dev/null @@ -1,36 +0,0 @@ -_ = require 'underscore-plus' - -Scanner = require './scanner' -ScopeSelector = require './scope-selector' - -module.exports = -class Injections - constructor: (@grammar, injections={}) -> - @injections = [] - @scanners = {} - for selector, values of injections - continue unless values?.patterns?.length > 0 - patterns = [] - for regex in values.patterns - pattern = @grammar.createPattern(regex) - patterns.push(pattern.getIncludedPatterns(@grammar, patterns)...) - @injections.push - selector: new ScopeSelector(selector) - patterns: patterns - - getScanner: (injection) -> - return injection.scanner if injection.scanner? - - scanner = new Scanner(injection.patterns) - injection.scanner = scanner - scanner - - getScanners: (ruleStack) -> - return [] if @injections.length is 0 - - scanners = [] - scopes = @grammar.scopesFromStack(ruleStack) - for injection in @injections when injection.selector.matches(scopes) - scanner = @getScanner(injection) - scanners.push(scanner) - scanners diff --git a/src/null-grammar.coffee b/src/null-grammar.coffee deleted file mode 100644 index e0e401b..0000000 --- a/src/null-grammar.coffee +++ /dev/null @@ -1,12 +0,0 @@ -Grammar = require './grammar' - -# A grammar with no patterns that is always available from a {GrammarRegistry} -# even when it is completely empty. -module.exports = -class NullGrammar extends Grammar - constructor: (registry) -> - name = 'Null Grammar' - scopeName = 'text.plain.null-grammar' - super(registry, {name, scopeName}) - - getScore: -> 0 diff --git a/src/pattern.coffee b/src/pattern.coffee deleted file mode 100644 index 30a2c91..0000000 --- a/src/pattern.coffee +++ /dev/null @@ -1,249 +0,0 @@ -_ = require 'underscore-plus' - -AllCustomCaptureIndicesRegex = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/g -AllDigitsRegex = /\\\d+/g -DigitRegex = /\\\d+/ - -module.exports = -class Pattern - constructor: (@grammar, @registry, options={}) -> - {name, contentName, match, begin, end, patterns} = options - {captures, beginCaptures, endCaptures, applyEndPatternLast} = options - {@include, @popRule, @hasBackReferences} = options - - @pushRule = null - @backReferences = null - @scopeName = name - @contentScopeName = contentName - - if match - if (end or @popRule) and @hasBackReferences ?= DigitRegex.test(match) - @match = match - else - @regexSource = match - @captures = captures - else if begin - @regexSource = begin - @captures = beginCaptures ? captures - endPattern = @grammar.createPattern({match: end, captures: endCaptures ? captures, popRule: true}) - @pushRule = @grammar.createRule({@scopeName, @contentScopeName, patterns, endPattern, applyEndPatternLast}) - - if @captures? - for group, capture of @captures - if capture.patterns?.length > 0 and not capture.rule - capture.scopeName = @scopeName - capture.rule = @grammar.createRule(capture) - - @anchored = @hasAnchor() - - getRegex: (firstLine, position, anchorPosition) -> - if @anchored - @replaceAnchor(firstLine, position, anchorPosition) - else - @regexSource - - hasAnchor: -> - return false unless @regexSource - escape = false - for character in @regexSource - return true if escape and character in ['A', 'G', 'z'] - escape = not escape and character is '\\' - false - - replaceAnchor: (firstLine, offset, anchor) -> - escaped = [] - placeholder = '\uFFFF' - escape = false - for character in @regexSource - if escape - switch character - when 'A' - if firstLine - escaped.push("\\#{character}") - else - escaped.push(placeholder) - when 'G' - if offset is anchor - escaped.push("\\#{character}") - else - escaped.push(placeholder) - when 'z' - escaped.push('$(?!\n)(? - beginCaptures = [] - - for {start, end} in beginCaptureIndices - beginCaptures.push(line.substring(start, end)) - - resolvedMatch = @match.replace AllDigitsRegex, (match) -> - index = parseInt(match[1..]) - if beginCaptures[index]? - _.escapeRegExp(beginCaptures[index]) - else - "\\#{index}" - - @grammar.createPattern({hasBackReferences: false, match: resolvedMatch, @captures, @popRule}) - - ruleForInclude: (baseGrammar, name) -> - hashIndex = name.indexOf('#') - if hashIndex is 0 - @grammar.getRepository()[name[1..]] - else if hashIndex >= 1 - grammarName = name[0..hashIndex-1] - ruleName = name[hashIndex+1..] - @grammar.addIncludedGrammarScope(grammarName) - @registry.grammarForScopeName(grammarName)?.getRepository()[ruleName] - else if name is '$self' - @grammar.getInitialRule() - else if name is '$base' - baseGrammar.getInitialRule() - else - @grammar.addIncludedGrammarScope(name) - @registry.grammarForScopeName(name)?.getInitialRule() - - getIncludedPatterns: (baseGrammar, included) -> - if @include - rule = @ruleForInclude(baseGrammar, @include) - rule?.getIncludedPatterns(baseGrammar, included) ? [] - else - [this] - - resolveScopeName: (scopeName, line, captureIndices) -> - resolvedScopeName = scopeName.replace AllCustomCaptureIndicesRegex, (match, index, commandIndex, command) -> - capture = captureIndices[parseInt(index ? commandIndex)] - if capture? - replacement = line.substring(capture.start, capture.end) - # Remove leading dots that would make the selector invalid - replacement = replacement.substring(1) while replacement[0] is '.' - switch command - when 'downcase' then replacement.toLowerCase() - when 'upcase' then replacement.toUpperCase() - else replacement - else - match - - handleMatch: (stack, line, captureIndices, rule, endPatternMatch) -> - tags = [] - - zeroWidthMatch = captureIndices[0].start is captureIndices[0].end - - if @popRule - # Pushing and popping a rule based on zero width matches at the same index - # leads to an infinite loop. We bail on parsing if we detect that case here. - if zeroWidthMatch and _.last(stack).zeroWidthMatch and _.last(stack).rule.anchorPosition is captureIndices[0].end - return false - - {contentScopeName} = _.last(stack) - tags.push(@grammar.endIdForScope(contentScopeName)) if contentScopeName - else if @scopeName - scopeName = @resolveScopeName(@scopeName, line, captureIndices) - tags.push(@grammar.startIdForScope(scopeName)) - - if @captures - tags.push(@tagsForCaptureIndices(line, captureIndices.slice(), captureIndices, stack)...) - else - {start, end} = captureIndices[0] - tags.push(end - start) unless end is start - - if @pushRule - ruleToPush = @pushRule.getRuleToPush(line, captureIndices) - ruleToPush.anchorPosition = captureIndices[0].end - {contentScopeName} = ruleToPush - if contentScopeName - contentScopeName = @resolveScopeName(contentScopeName, line, captureIndices) - tags.push(@grammar.startIdForScope(contentScopeName)) - stack.push({rule: ruleToPush, scopeName, contentScopeName, zeroWidthMatch}) - else - {scopeName} = stack.pop() if @popRule - tags.push(@grammar.endIdForScope(scopeName)) if scopeName - - tags - - tagsForCaptureRule: (rule, line, captureStart, captureEnd, stack) -> - captureText = line.substring(captureStart, captureEnd) - {tags} = rule.grammar.tokenizeLine(captureText, [stack..., {rule}], false, true, false) - - # only accept non empty tokens that don't exceed the capture end - openScopes = [] - captureTags = [] - offset = 0 - for tag in tags when tag < 0 or (tag > 0 and offset < captureEnd) - captureTags.push(tag) - if tag >= 0 - offset += tag - else - if tag % 2 is 0 - openScopes.pop() - else - openScopes.push(tag) - - # close any scopes left open by matching this rule since we don't pass our stack - while openScopes.length > 0 - captureTags.push(openScopes.pop() - 1) - - captureTags - - # Get the tokens for the capture indices. - # - # line - The string being tokenized. - # currentCaptureIndices - The current array of capture indices being - # processed into tokens. This method is called - # recursively and this array will be modified inside - # this method. - # allCaptureIndices - The array of all capture indices, this array will not - # be modified. - # stack - An array of rules. - # - # Returns a non-null but possibly empty array of tokens - tagsForCaptureIndices: (line, currentCaptureIndices, allCaptureIndices, stack) -> - parentCapture = currentCaptureIndices.shift() - - tags = [] - if scope = @captures[parentCapture.index]?.name - parentCaptureScope = @resolveScopeName(scope, line, allCaptureIndices) - tags.push(@grammar.startIdForScope(parentCaptureScope)) - - if captureRule = @captures[parentCapture.index]?.rule - captureTags = @tagsForCaptureRule(captureRule, line, parentCapture.start, parentCapture.end, stack) - tags.push(captureTags...) - # Consume child captures - while currentCaptureIndices.length and currentCaptureIndices[0].start < parentCapture.end - currentCaptureIndices.shift() - else - previousChildCaptureEnd = parentCapture.start - while currentCaptureIndices.length and currentCaptureIndices[0].start < parentCapture.end - childCapture = currentCaptureIndices[0] - - emptyCapture = childCapture.end - childCapture.start is 0 - captureHasNoScope = not @captures[childCapture.index] - if emptyCapture or captureHasNoScope - currentCaptureIndices.shift() - continue - - if childCapture.start > previousChildCaptureEnd - tags.push(childCapture.start - previousChildCaptureEnd) - - captureTags = @tagsForCaptureIndices(line, currentCaptureIndices, allCaptureIndices, stack) - tags.push(captureTags...) - previousChildCaptureEnd = childCapture.end - - if parentCapture.end > previousChildCaptureEnd - tags.push(parentCapture.end - previousChildCaptureEnd) - - if parentCaptureScope - if tags.length > 1 - tags.push(@grammar.endIdForScope(parentCaptureScope)) - else - tags.pop() - - tags diff --git a/src/rule.coffee b/src/rule.coffee deleted file mode 100644 index 84d7528..0000000 --- a/src/rule.coffee +++ /dev/null @@ -1,116 +0,0 @@ -_ = require 'underscore-plus' - -Scanner = require './scanner' - -module.exports = -class Rule - constructor: (@grammar, @registry, {@scopeName, @contentScopeName, patterns, @endPattern, @applyEndPatternLast}={}) -> - @patterns = [] - for pattern in patterns ? [] - @patterns.push(@grammar.createPattern(pattern)) unless pattern.disabled - - if @endPattern and not @endPattern.hasBackReferences - if @applyEndPatternLast - @patterns.push(@endPattern) - else - @patterns.unshift(@endPattern) - - @scannersByBaseGrammarName = {} - @createEndPattern = null - @anchorPosition = -1 - - getIncludedPatterns: (baseGrammar, included=[]) -> - return [] if _.include(included, this) - - included = included.concat([this]) - allPatterns = [] - for pattern in @patterns - allPatterns.push(pattern.getIncludedPatterns(baseGrammar, included)...) - allPatterns - - clearAnchorPosition: -> @anchorPosition = -1 - - getScanner: (baseGrammar) -> - return scanner if scanner = @scannersByBaseGrammarName[baseGrammar.name] - - patterns = @getIncludedPatterns(baseGrammar) - scanner = new Scanner(patterns) - @scannersByBaseGrammarName[baseGrammar.name] = scanner - scanner - - scanInjections: (ruleStack, line, position, firstLine) -> - baseGrammar = ruleStack[0].rule.grammar - if injections = baseGrammar.injections - for scanner in injections.getScanners(ruleStack) - result = scanner.findNextMatch(line, firstLine, position, @anchorPosition) - return result if result? - - normalizeCaptureIndices: (line, captureIndices) -> - lineLength = line.length - for capture in captureIndices - capture.end = Math.min(capture.end, lineLength) - capture.start = Math.min(capture.start, lineLength) - return - - findNextMatch: (ruleStack, lineWithNewline, position, firstLine) -> - baseGrammar = ruleStack[0].rule.grammar - results = [] - - scanner = @getScanner(baseGrammar) - if result = scanner.findNextMatch(lineWithNewline, firstLine, position, @anchorPosition) - results.push(result) - - if result = @scanInjections(ruleStack, lineWithNewline, position, firstLine) - for injection in baseGrammar.injections.injections - if injection.scanner is result.scanner - if injection.selector.getPrefix(@grammar.scopesFromStack(ruleStack)) is 'L' - results.unshift(result) - else - # TODO: Prefixes can either be L, B, or R. - # R is assumed to mean "right", which is the default (add to end of stack). - # There's no documentation on B, however. - results.push(result) - - scopes = null - for injectionGrammar in @registry.injectionGrammars - continue if injectionGrammar is @grammar - continue if injectionGrammar is baseGrammar - scopes ?= @grammar.scopesFromStack(ruleStack) - if injectionGrammar.injectionSelector.matches(scopes) - scanner = injectionGrammar.getInitialRule().getScanner(injectionGrammar, position, firstLine) - if result = scanner.findNextMatch(lineWithNewline, firstLine, position, @anchorPosition) - if injectionGrammar.injectionSelector.getPrefix(scopes) is 'L' - results.unshift(result) - else - # TODO: Prefixes can either be L, B, or R. - # R is assumed to mean "right", which is the default (add to end of stack). - # There's no documentation on B, however. - results.push(result) - - if results.length > 1 - _.min results, (result) => - @normalizeCaptureIndices(lineWithNewline, result.captureIndices) - result.captureIndices[0].start - else if results.length is 1 - [result] = results - @normalizeCaptureIndices(lineWithNewline, result.captureIndices) - result - - getNextTags: (ruleStack, line, lineWithNewline, position, firstLine) -> - result = @findNextMatch(ruleStack, lineWithNewline, position, firstLine) - return null unless result? - - {index, captureIndices, scanner} = result - [firstCapture] = captureIndices - endPatternMatch = @endPattern is scanner.patterns[index] - if nextTags = scanner.handleMatch(result, ruleStack, line, this, endPatternMatch) - {nextTags, tagsStart: firstCapture.start, tagsEnd: firstCapture.end} - - getRuleToPush: (line, beginPatternCaptureIndices) -> - if @endPattern.hasBackReferences - rule = @grammar.createRule({@scopeName, @contentScopeName}) - rule.endPattern = @endPattern.resolveBackReferences(line, beginPatternCaptureIndices) - rule.patterns = [rule.endPattern, @patterns...] - rule - else - this diff --git a/src/scanner.coffee b/src/scanner.coffee deleted file mode 100644 index 2d3660a..0000000 --- a/src/scanner.coffee +++ /dev/null @@ -1,68 +0,0 @@ -{OnigScanner} = require 'oniguruma' - -# Wrapper class for {OnigScanner} that caches them based on the presence of any -# anchor characters that change based on the current position being scanned. -# -# See {Pattern::replaceAnchor} for more details. -module.exports = -class Scanner - constructor: (@patterns=[]) -> - @anchored = false - for pattern in @patterns when pattern.anchored - @anchored = true - break - - @anchoredScanner = null - @firstLineAnchoredScanner = null - @firstLineScanner = null - @scanner = null - - # Create a new {OnigScanner} with the given options. - createScanner: (firstLine, position, anchorPosition) -> - patterns = @patterns.map (pattern) -> - pattern.getRegex(firstLine, position, anchorPosition) - scanner = new OnigScanner(patterns) - - # Get the {OnigScanner} for the given position and options. - getScanner: (firstLine, position, anchorPosition) -> - unless @anchored - @scanner ?= @createScanner(firstLine, position, anchorPosition) - return @scanner - - if firstLine - if position is anchorPosition - @firstLineAnchoredScanner ?= @createScanner(firstLine, position, anchorPosition) - else - @firstLineScanner ?= @createScanner(firstLine, position, anchorPosition) - else if position is anchorPosition - @anchoredScanner ?= @createScanner(firstLine, position, anchorPosition) - else - @scanner ?= @createScanner(firstLine, position, anchorPosition) - - # Public: Find the next match on the line start at the given position - # - # line - the string being scanned. - # firstLine - true if the first line is being scanned. - # position - numeric position to start scanning at. - # anchorPosition - numeric position of the last anchored match. - # - # Returns an Object with details about the match or null if no match found. - findNextMatch: (line, firstLine, position, anchorPosition) -> - scanner = @getScanner(firstLine, position, anchorPosition) - match = scanner.findNextMatchSync(line, position) - match?.scanner = this - match - - # Public: Handle the given match by calling `handleMatch` on the - # matched {Pattern}. - # - # match - An object returned from a previous call to `findNextMatch`. - # stack - An array of {Rule} objects. - # line - The string being scanned. - # rule - The rule that matched. - # endPatternMatch - true if the rule's end pattern matched. - # - # Returns an array of tokens representing the match. - handleMatch: (match, stack, line, rule, endPatternMatch) -> - pattern = @patterns[match.index] - pattern.handleMatch(stack, line, match.captureIndices, rule, endPatternMatch) diff --git a/src/scope-selector-matchers.coffee b/src/scope-selector-matchers.coffee deleted file mode 100644 index 346cf5a..0000000 --- a/src/scope-selector-matchers.coffee +++ /dev/null @@ -1,165 +0,0 @@ -class SegmentMatcher - constructor: (segments) -> - @segment = segments[0].join('') + segments[1].join('') - - matches: (scope) -> scope is @segment - - getPrefix: (scope) -> - - toCssSelector: -> - @segment.split('.').map((dotFragment) -> - '.' + dotFragment.replace(/\+/g, '\\+') - ).join('') - - toCssSyntaxSelector: -> - @segment.split('.').map((dotFragment) -> - '.syntax--' + dotFragment.replace(/\+/g, '\\+') - ).join('') - -class TrueMatcher - constructor: -> - - matches: -> true - - getPrefix: (scopes) -> - - toCssSelector: -> '*' - - toCssSyntaxSelector: -> '*' - -class ScopeMatcher - constructor: (first, others) -> - @segments = [first] - @segments.push(segment[1]) for segment in others - - matches: (scope) -> - lastDotIndex = 0 - for matcherSegment, matcherSegmentIndex in @segments - break if lastDotIndex > scope.length - - nextDotIndex = scope.indexOf('.', lastDotIndex) - nextDotIndex = scope.length if nextDotIndex is -1 - - scopeSegment = scope.substring(lastDotIndex, nextDotIndex) - return false unless matcherSegment.matches(scopeSegment) - - lastDotIndex = nextDotIndex + 1 - - matcherSegmentIndex is @segments.length - - getPrefix: (scope) -> - scopeSegments = scope.split('.') - return false if scopeSegments.length < @segments.length - - for segment, index in @segments - if segment.matches(scopeSegments[index]) - return segment.prefix if segment.prefix? - - toCssSelector: -> - @segments.map((matcher) -> matcher.toCssSelector()).join('') - - toCssSyntaxSelector: -> - @segments.map((matcher) -> matcher.toCssSyntaxSelector()).join('') - -class GroupMatcher - constructor: (prefix, selector) -> - @prefix = prefix?[0] - @selector = selector - - matches: (scopes) -> @selector.matches(scopes) - - getPrefix: (scopes) -> @prefix if @selector.matches(scopes) - - toCssSelector: -> @selector.toCssSelector() - - toCssSyntaxSelector: -> @selector.toCssSyntaxSelector() - -class PathMatcher - constructor: (prefix, first, others) -> - @prefix = prefix?[0] - @matchers = [first] - @matchers.push(matcher[1]) for matcher in others - - matches: (scopes) -> - index = 0 - matcher = @matchers[index] - for scope in scopes - matcher = @matchers[++index] if matcher.matches(scope) - return true unless matcher? - false - - getPrefix: (scopes) -> @prefix if @matches(scopes) - - toCssSelector: -> - @matchers.map((matcher) -> matcher.toCssSelector()).join(' ') - - toCssSyntaxSelector: -> - @matchers.map((matcher) -> matcher.toCssSyntaxSelector()).join(' ') - -class OrMatcher - constructor: (@left, @right) -> - - matches: (scopes) -> @left.matches(scopes) or @right.matches(scopes) - - getPrefix: (scopes) -> @left.getPrefix(scopes) or @right.getPrefix(scopes) - - toCssSelector: -> "#{@left.toCssSelector()}, #{@right.toCssSelector()}" - - toCssSyntaxSelector: -> "#{@left.toCssSyntaxSelector()}, #{@right.toCssSyntaxSelector()}" - -class AndMatcher - constructor: (@left, @right) -> - - matches: (scopes) -> @left.matches(scopes) and @right.matches(scopes) - - getPrefix: (scopes) -> @left.getPrefix(scopes) if @left.matches(scopes) and @right.matches(scopes) # The right side can't have prefixes - - toCssSelector: -> - if @right instanceof NegateMatcher - "#{@left.toCssSelector()}#{@right.toCssSelector()}" - else - "#{@left.toCssSelector()} #{@right.toCssSelector()}" - - toCssSyntaxSelector: -> - if @right instanceof NegateMatcher - "#{@left.toCssSyntaxSelector()}#{@right.toCssSyntaxSelector()}" - else - "#{@left.toCssSyntaxSelector()} #{@right.toCssSyntaxSelector()}" - -class NegateMatcher - constructor: (@matcher) -> - - matches: (scopes) -> not @matcher.matches(scopes) - - getPrefix: (scopes) -> - - toCssSelector: -> ":not(#{@matcher.toCssSelector()})" - - toCssSyntaxSelector: -> ":not(#{@matcher.toCssSyntaxSelector()})" - -class CompositeMatcher - constructor: (left, operator, right) -> - switch operator - when '|' then @matcher = new OrMatcher(left, right) - when '&' then @matcher = new AndMatcher(left, right) - when '-' then @matcher = new AndMatcher(left, new NegateMatcher(right)) - - matches: (scopes) -> @matcher.matches(scopes) - - getPrefix: (scopes) -> @matcher.getPrefix(scopes) - - toCssSelector: -> @matcher.toCssSelector() - - toCssSyntaxSelector: -> @matcher.toCssSyntaxSelector() - -module.exports = { - AndMatcher - CompositeMatcher - GroupMatcher - NegateMatcher - OrMatcher - PathMatcher - ScopeMatcher - SegmentMatcher - TrueMatcher -} diff --git a/src/scope-selector.coffee b/src/scope-selector.coffee deleted file mode 100644 index 214519d..0000000 --- a/src/scope-selector.coffee +++ /dev/null @@ -1,36 +0,0 @@ -ScopeSelectorParser = require '../lib/scope-selector-parser' - -module.exports = -class ScopeSelector - # Create a new scope selector. - # - # source - A {String} to parse as a scope selector. - constructor: (source) -> @matcher = ScopeSelectorParser.parse(source) - - # Check if this scope selector matches the scopes. - # - # scopes - An {Array} of {String}s or a single {String}. - # - # Returns a {Boolean}. - matches: (scopes) -> - scopes = [scopes] if typeof scopes is 'string' - @matcher.matches(scopes) - - # Gets the prefix of this scope selector. - # - # scopes - An {Array} of {String}s or a single {String}. - # - # Returns a {String} if there is a prefix or undefined otherwise. - getPrefix: (scopes) -> - scopes = [scopes] if typeof scopes is 'string' - @matcher.getPrefix(scopes) - - # Convert this TextMate scope selector to a CSS selector. - # - # Returns a {String}. - toCssSelector: -> @matcher.toCssSelector() - - # Convert this TextMate scope selector to a CSS selector, prefixing scopes with `syntax--`. - # - # Returns a {String}. - toCssSyntaxSelector: -> @matcher.toCssSyntaxSelector() From 7850a8e80969ed335c4fbfaa20fbac8532b17739 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sat, 26 Nov 2022 14:18:50 -0800 Subject: [PATCH 22/25] Decafe GruntFile, only run `atomdoc` add script for ease --- Gruntfile.coffee | 61 ------------------------------------------------ Gruntfile.js | 8 +++++++ package.json | 3 ++- 3 files changed, 10 insertions(+), 62 deletions(-) delete mode 100644 Gruntfile.coffee create mode 100644 Gruntfile.js diff --git a/Gruntfile.coffee b/Gruntfile.coffee deleted file mode 100644 index e8fb1bd..0000000 --- a/Gruntfile.coffee +++ /dev/null @@ -1,61 +0,0 @@ -module.exports = (grunt) -> - grunt.initConfig - pkg: grunt.file.readJSON('package.json') - - coffee: - glob_to_multiple: - expand: true - cwd: 'src' - src: ['*.coffee'] - dest: 'lib' - ext: '.js' - - coffeelint: - options: - no_empty_param_list: - level: 'error' - max_line_length: - level: 'ignore' - - src: ['src/*.coffee'] - test: ['spec/*.coffee'] - gruntfile: ['Gruntfile.coffee'] - benchmark: ['benchmark/*.coffee'] - - peg: - glob_to_multiple: - expand: true - cwd: 'src' - src: ['*.pegjs'] - dest: 'lib' - ext: '.js' - - shell: - test: - command: 'node node_modules/jasmine-focused/bin/jasmine-focused --coffee --captureExceptions spec' - options: - stdout: true - stderr: true - failOnError: true - - 'update-atomdoc': - command: 'npm update grunt-atomdoc' - options: - stdout: true - stderr: true - failOnError: true - - grunt.loadNpmTasks('grunt-contrib-coffee') - grunt.loadNpmTasks('grunt-shell') - grunt.loadNpmTasks('grunt-coffeelint') - grunt.loadNpmTasks('grunt-peg') - grunt.loadNpmTasks('grunt-atomdoc') - - grunt.registerTask 'clean', -> - require('rimraf').sync('lib') - require('rimraf').sync('api.json') - - grunt.registerTask('lint', ['coffeelint']) - grunt.registerTask('default', ['coffee', 'peg', 'lint']) - grunt.registerTask('prepublish', ['clean', 'coffee', 'peg', 'lint', 'shell:update-atomdoc', 'atomdoc']) - grunt.registerTask('test', ['default', 'shell:test']) diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..1b2e9bb --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,8 @@ +module.exports = (grunt) => { + grunt.initConfig({ + pkg: grunt.file.readJSON("package.json") + + }); + + grunt.loadNpmTasks("grunt-atomdoc"); +}; diff --git a/package.json b/package.json index a0d0f5c..78dfbaf 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "test": "jasmine-focused --coffee --captureExceptions spec", "benchmark": "node_modules/.bin/coffee benchmark/benchmark.coffee", - "parse": "pegjs -o ./lib/scope-selector-parser.js ./src/scope-selector-parser.pegjs" + "parse": "pegjs -o ./lib/scope-selector-parser.js ./src/scope-selector-parser.pegjs", + "docs": "grunt atomdoc" }, "repository": { "type": "git", From df9fce9222283e7a319abee1225afb7a07205705 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sat, 26 Nov 2022 14:35:48 -0800 Subject: [PATCH 23/25] Update Deps, Remove Deps, rebrand links --- package-lock.json | 2331 +++++++++++++++++++++++++++++---------------- package.json | 23 +- 2 files changed, 1505 insertions(+), 849 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0cfda47..1516bc5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,26 +9,21 @@ "version": "7.4.3", "license": "MIT", "dependencies": { - "emissary": "^1", - "event-kit": "^2.2.0", + "emissary": "^1.3.3", + "event-kit": "^2.5.3", "fs-plus": "^3.0.0", - "grim": "^2.0.1", + "grim": "^2.0.3", "oniguruma": "^7.2.3", "season": "^6.0.2", "underscore-plus": "^1" }, "devDependencies": { - "coffee-script": "~1.7.0", - "grunt": "~0.4.1", + "grunt": "^1.5.3", "grunt-atomdoc": "^1.0.0", - "grunt-cli": "~0.1.8", - "grunt-coffeelint": "0.0.6", - "grunt-contrib-coffee": "~0.9.0", - "grunt-peg": "~1.1.0", - "grunt-shell": "~0.2.2", + "grunt-cli": "^1.4.3", "jasmine-focused": "^1", "pegjs": "^0.10.0", - "rimraf": "~2.1.4" + "rimraf": "^3.0.2" } }, "node_modules/abbrev": { @@ -55,37 +50,45 @@ } }, "node_modules/ansi-styles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", - "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, "engines": { - "node": ">=0.8.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/argparse": { - "version": "0.1.16", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz", - "integrity": "sha1-z9AeD7uj1srtBJ+9dY1A9lGW9Xw=", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "dependencies": { - "underscore": "~1.7.0", - "underscore.string": "~2.4.0" + "sprintf-js": "~1.0.2" } }, - "node_modules/argparse/node_modules/underscore": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", - "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=", - "dev": true + "node_modules/array-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", + "integrity": "sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "node_modules/argparse/node_modules/underscore.string": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz", - "integrity": "sha1-jN2PusTi0uoefi6Al8QvRCKA+Fs=", + "node_modules/array-slice": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", + "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", "dev": true, "engines": { - "node": "*" + "node": ">=0.10.0" } }, "node_modules/async": { @@ -116,6 +119,18 @@ "concat-map": "0.0.1" } }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/builtins": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/builtins/-/builtins-0.0.4.tgz", @@ -131,29 +146,19 @@ } }, "node_modules/chalk": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", - "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "dependencies": { - "ansi-styles": "~1.0.0", - "has-color": "~0.1.0", - "strip-ansi": "~0.1.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/chalk/node_modules/strip-ansi": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", - "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", - "dev": true, - "bin": { - "strip-ansi": "cli.js" + "node": ">=10" }, - "engines": { - "node": ">=0.8.0" + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, "node_modules/cliui": { @@ -198,112 +203,6 @@ "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", "dev": true }, - "node_modules/coffeelint": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/coffeelint/-/coffeelint-0.5.7.tgz", - "integrity": "sha1-PRJc3emV1kHL2ECwrFNsXN9vaNs=", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "coffee-script": ">=1.6.0", - "glob": ">=3.1.9", - "optimist": ">=0.2.8" - }, - "bin": { - "coffeelint": "bin/coffeelint" - } - }, - "node_modules/coffeelint/node_modules/coffee-script": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.2.tgz", - "integrity": "sha1-/ZyINpweQeMwegoWDXE/IlE8k7M=", - "deprecated": "CoffeeScript on NPM has moved to \"coffeescript\" (no hyphen)", - "dev": true, - "bin": { - "cake": "bin/cake", - "coffee": "bin/coffee" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/coffeelint/node_modules/glob": { - "version": "3.1.14", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.14.tgz", - "integrity": "sha1-+XpzHEHaZpXcg5RLuyF36aKbNj0=", - "dev": true, - "dependencies": { - "graceful-fs": "~1.1.2", - "inherits": "1", - "minimatch": "0.2" - }, - "engines": { - "node": "*" - } - }, - "node_modules/coffeelint/node_modules/glob/node_modules/graceful-fs": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.1.14.tgz", - "integrity": "sha1-BweNtfY3f2Mh/Oqu30l94STclGU=", - "deprecated": "please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/coffeelint/node_modules/glob/node_modules/inherits": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz", - "integrity": "sha1-OOGXUoW/H3upyE2hArsSdxMirEg=", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/coffeelint/node_modules/glob/node_modules/minimatch": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.9.tgz", - "integrity": "sha1-uAr5R+aoOoxo8m5UwNYSW6yfiH8=", - "deprecated": "Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue", - "dev": true, - "dependencies": { - "lru-cache": "~2.0.0", - "sigmund": "~1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/coffeelint/node_modules/glob/node_modules/minimatch/node_modules/lru-cache": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.0.4.tgz", - "integrity": "sha1-uLYa4JhIOF7Gdodg45wSPn45Voo=", - "dev": true - }, - "node_modules/coffeelint/node_modules/glob/node_modules/minimatch/node_modules/sigmund": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz", - "integrity": "sha1-ZqKzp0mui1+4nv1PzAHclPvgIpY=", - "dev": true - }, - "node_modules/coffeelint/node_modules/optimist": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.5.tgz", - "integrity": "sha1-A2VLUkFwMDEtEJ85sVmCW2AwkwQ=", - "dev": true, - "dependencies": { - "wordwrap": "~0.0.2" - } - }, - "node_modules/coffeelint/node_modules/optimist/node_modules/wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/coffeestack": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/coffeestack/-/coffeestack-1.1.2.tgz", @@ -388,10 +287,28 @@ "node": ">=0.8.0" } }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "node_modules/colors": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", - "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha512-ENwblkFQpqqia6b++zLD/KUWafYlVY/UNnAp7oz7LY7E924wmpye416wBOmvv/HMWzl8gL1kJlfvId/1Dg176w==", "dev": true, "engines": { "node": ">=0.1.90" @@ -432,9 +349,9 @@ } }, "node_modules/dateformat": { - "version": "1.0.2-1.2.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz", - "integrity": "sha1-sCIMAt6YYXQztyhRz0fePfLNvuk=", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", "dev": true, "engines": { "node": "*" @@ -448,6 +365,15 @@ "node": ">=0.10.0" } }, + "node_modules/detect-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/donna": { "version": "1.0.16", "resolved": "https://registry.npmjs.org/donna/-/donna-1.0.16.tgz", @@ -487,7 +413,7 @@ "node_modules/emissary": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/emissary/-/emissary-1.3.3.tgz", - "integrity": "sha1-phjZLWgrIy0xER3DYlpd9mF5lgY=", + "integrity": "sha512-pD6FWNBSlEOzSJDCTcSGVLgNnGw5fnCvvGMdQ/TN43efeXZ/QTq8+hZoK3OOEXPRNjMmSJmeOnEJh+bWT5O8rQ==", "dependencies": { "es6-weak-map": "^0.1.2", "mixto": "1.x", @@ -563,16 +489,16 @@ } }, "node_modules/esprima": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", - "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" }, "engines": { - "node": ">=0.4.0" + "node": ">=4" } }, "node_modules/event-kit": { @@ -589,12 +515,30 @@ "node_modules/exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", "dev": true, "engines": { "node": ">= 0.8.0" } }, + "node_modules/expand-tilde": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==", + "dev": true, + "dependencies": { + "homedir-polyfill": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, "node_modules/fileset": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/fileset/-/fileset-0.1.8.tgz", @@ -646,54 +590,90 @@ "node": "*" } }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/findup-sync": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", - "integrity": "sha1-fz56l7gjksZTvwZYm9hRkOk8NoM=", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", + "integrity": "sha512-z8Nrwhi6wzxNMIbxlrTzuUW6KWuKkogZ/7OdDVq+0+kxn77KUH1nipx8iU6suqkHqc4y6n7a9A8IpmxY/pTjWg==", "dev": true, "dependencies": { - "glob": "~3.2.9", - "lodash": "~2.4.1" + "glob": "~5.0.0" }, "engines": { "node": ">= 0.6.0" } }, "node_modules/findup-sync/node_modules/glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==", "dev": true, "dependencies": { + "inflight": "^1.0.4", "inherits": "2", - "minimatch": "0.3" + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { "node": "*" } }, - "node_modules/findup-sync/node_modules/lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", + "node_modules/fined": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fined/-/fined-1.2.0.tgz", + "integrity": "sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==", "dev": true, - "engines": [ - "node", - "rhino" - ] + "dependencies": { + "expand-tilde": "^2.0.2", + "is-plain-object": "^2.0.3", + "object.defaults": "^1.1.0", + "object.pick": "^1.2.0", + "parse-filepath": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" + } }, - "node_modules/findup-sync/node_modules/minimatch": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", - "deprecated": "Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue", + "node_modules/flagged-respawn": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz", + "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/for-own": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", + "integrity": "sha512-0OABksIGrxKK8K4kynWkQ7y1zounQxP+CWnyclVwj81KW3vlLlGUx57DKGcP/LH216GzqnstnPocF16Nxs0Ycg==", "dev": true, "dependencies": { - "lru-cache": "2", - "sigmund": "~1.0.0" + "for-in": "^1.0.1" }, "engines": { - "node": "*" + "node": ">=0.10.0" } }, "node_modules/fs-plus": { @@ -723,6 +703,12 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "node_modules/gaze": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.3.4.tgz", @@ -751,12 +737,12 @@ } }, "node_modules/getobject": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", - "integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/getobject/-/getobject-1.0.2.tgz", + "integrity": "sha512-2zblDBaFcb3rB4rF77XVnuINOE2h2k/OnqXAiy0IrTxUfV1iFp3la33oAQVY9pCpWU268WFYVt2t71hlMuLsOg==", "dev": true, "engines": { - "node": ">= 0.8.0" + "node": ">=10" } }, "node_modules/glob": { @@ -775,53 +761,83 @@ "node": "*" } }, - "node_modules/graceful-fs": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", - "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", - "deprecated": "please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js", + "node_modules/global-modules": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, + "dependencies": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + }, "engines": { - "node": ">=0.4.0" + "node": ">=0.10.0" + } + }, + "node_modules/global-prefix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==", + "dev": true, + "dependencies": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/global-prefix/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" } }, "node_modules/grim": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/grim/-/grim-2.0.2.tgz", - "integrity": "sha512-Qj7hTJRfd87E/gUgfvM0YIH/g2UA2SV6niv6BYXk1o6w4mhgv+QyYM1EjOJQljvzgEj4SqSsRWldXIeKHz3e3Q==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/grim/-/grim-2.0.3.tgz", + "integrity": "sha512-FM20Ump11qYLK9k9DbL8yzVpy+YBieya1JG15OeH8s+KbHq8kL4SdwRtURwIUHniSxb24EoBUpwKfFjGNVi4/Q==", "dependencies": { "event-kit": "^2.0.0" } }, "node_modules/grunt": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-0.4.5.tgz", - "integrity": "sha1-VpN81RlDJK3/bSB2MYMqnWuk5/A=", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.5.3.tgz", + "integrity": "sha512-mKwmo4X2d8/4c/BmcOETHek675uOqw0RuA/zy12jaspWqvTp4+ZeQF1W+OTpcbncnaBsfbQJ6l0l4j+Sn/GmaQ==", "dev": true, "dependencies": { - "async": "~0.1.22", - "coffee-script": "~1.3.3", - "colors": "~0.6.2", - "dateformat": "1.0.2-1.2.3", + "dateformat": "~3.0.3", "eventemitter2": "~0.4.13", - "exit": "~0.1.1", - "findup-sync": "~0.1.2", - "getobject": "~0.1.0", - "glob": "~3.1.21", - "grunt-legacy-log": "~0.1.0", - "grunt-legacy-util": "~0.2.0", - "hooker": "~0.2.3", - "iconv-lite": "~0.2.11", - "js-yaml": "~2.0.5", - "lodash": "~0.9.2", - "minimatch": "~0.2.12", - "nopt": "~1.0.10", - "rimraf": "~2.2.8", - "underscore.string": "~2.2.1", - "which": "~1.0.5" + "exit": "~0.1.2", + "findup-sync": "~0.3.0", + "glob": "~7.1.6", + "grunt-cli": "~1.4.3", + "grunt-known-options": "~2.0.0", + "grunt-legacy-log": "~3.0.0", + "grunt-legacy-util": "~2.0.1", + "iconv-lite": "~0.4.13", + "js-yaml": "~3.14.0", + "minimatch": "~3.0.4", + "mkdirp": "~1.0.4", + "nopt": "~3.0.6", + "rimraf": "~3.0.2" + }, + "bin": { + "grunt": "bin/grunt" }, "engines": { - "node": ">= 0.8.0" + "node": ">=8" } }, "node_modules/grunt-atomdoc": { @@ -838,269 +854,159 @@ } }, "node_modules/grunt-cli": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-0.1.13.tgz", - "integrity": "sha1-6evEBHYx9QEtkidww5N4EzytEPQ=", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.4.3.tgz", + "integrity": "sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==", "dev": true, "dependencies": { - "findup-sync": "~0.1.0", - "nopt": "~1.0.10", - "resolve": "~0.3.1" + "grunt-known-options": "~2.0.0", + "interpret": "~1.1.0", + "liftup": "~3.0.1", + "nopt": "~4.0.1", + "v8flags": "~3.2.0" }, "bin": { "grunt": "bin/grunt" }, "engines": { - "node": ">= 0.8.0" + "node": ">=10" } }, - "node_modules/grunt-coffeelint": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/grunt-coffeelint/-/grunt-coffeelint-0.0.6.tgz", - "integrity": "sha1-/NMBr9Z3XUGYCwDQHKYzG8kDBsw=", + "node_modules/grunt-cli/node_modules/nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", "dev": true, "dependencies": { - "coffeelint": "~0.5" - }, - "engines": { - "node": "*" + "abbrev": "1", + "osenv": "^0.1.4" }, - "peerDependencies": { - "grunt": "~0.4" + "bin": { + "nopt": "bin/nopt.js" } }, - "node_modules/grunt-contrib-coffee": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-coffee/-/grunt-contrib-coffee-0.9.0.tgz", - "integrity": "sha1-UZr1EF2hL+MWO7UOHKeAtslT77A=", + "node_modules/grunt-known-options": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-2.0.0.tgz", + "integrity": "sha512-GD7cTz0I4SAede1/+pAbmJRG44zFLPipVtdL9o3vqx9IEyb7b4/Y3s7r6ofI3CchR5GvYJ+8buCSioDv5dQLiA==", "dev": true, - "dependencies": { - "chalk": "~0.4.0", - "coffee-script": "~1.7.0", - "lodash": "~2.4.1" - }, "engines": { - "node": ">= 0.8.0" - }, - "peerDependencies": { - "grunt": "~0.4.0" + "node": ">=0.10.0" } }, - "node_modules/grunt-contrib-coffee/node_modules/lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "dev": true, - "engines": [ - "node", - "rhino" - ] - }, "node_modules/grunt-legacy-log": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-0.1.3.tgz", - "integrity": "sha1-7ClCboAwIa9ZAp+H0vnNczWgVTE=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-3.0.0.tgz", + "integrity": "sha512-GHZQzZmhyq0u3hr7aHW4qUH0xDzwp2YXldLPZTCjlOeGscAOWWPftZG3XioW8MasGp+OBRIu39LFx14SLjXRcA==", "dev": true, "dependencies": { - "colors": "~0.6.2", - "grunt-legacy-log-utils": "~0.1.1", + "colors": "~1.1.2", + "grunt-legacy-log-utils": "~2.1.0", "hooker": "~0.2.3", - "lodash": "~2.4.1", - "underscore.string": "~2.3.3" + "lodash": "~4.17.19" }, "engines": { - "node": ">= 0.8.0" + "node": ">= 0.10.0" } }, "node_modules/grunt-legacy-log-utils": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-0.1.1.tgz", - "integrity": "sha1-wHBrndkGThFvNvI/5OawSGcsD34=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.1.0.tgz", + "integrity": "sha512-lwquaPXJtKQk0rUM1IQAop5noEpwFqOXasVoedLeNzaibf/OPWjKYvvdqnEHNmU+0T0CaReAXIbGo747ZD+Aaw==", "dev": true, "dependencies": { - "colors": "~0.6.2", - "lodash": "~2.4.1", - "underscore.string": "~2.3.3" + "chalk": "~4.1.0", + "lodash": "~4.17.19" }, "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/grunt-legacy-log-utils/node_modules/lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "dev": true, - "engines": [ - "node", - "rhino" - ] - }, - "node_modules/grunt-legacy-log-utils/node_modules/underscore.string": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", - "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/grunt-legacy-log/node_modules/lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "dev": true, - "engines": [ - "node", - "rhino" - ] - }, - "node_modules/grunt-legacy-log/node_modules/underscore.string": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", - "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=", - "dev": true, - "engines": { - "node": "*" + "node": ">=10" } }, "node_modules/grunt-legacy-util": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-0.2.0.tgz", - "integrity": "sha1-kzJIhNv343qf98Am3/RR2UqeVUs=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-2.0.1.tgz", + "integrity": "sha512-2bQiD4fzXqX8rhNdXkAywCadeqiPiay0oQny77wA2F3WF4grPJXCvAcyoWUJV+po/b15glGkxuSiQCK299UC2w==", "dev": true, "dependencies": { - "async": "~0.1.22", - "exit": "~0.1.1", - "getobject": "~0.1.0", + "async": "~3.2.0", + "exit": "~0.1.2", + "getobject": "~1.0.0", "hooker": "~0.2.3", - "lodash": "~0.9.2", - "underscore.string": "~2.2.1", - "which": "~1.0.5" + "lodash": "~4.17.21", + "underscore.string": "~3.3.5", + "which": "~2.0.2" }, "engines": { - "node": ">= 0.8.0" + "node": ">=10" } }, "node_modules/grunt-legacy-util/node_modules/async": { - "version": "0.1.22", - "resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz", - "integrity": "sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE=", - "dev": true, - "engines": { - "node": "*" - } + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", + "dev": true }, - "node_modules/grunt-peg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/grunt-peg/-/grunt-peg-1.1.0.tgz", - "integrity": "sha1-mXIenObicnRzkHfbh281otBc8qY=", + "node_modules/grunt/node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", "dev": true, "dependencies": { - "pegjs": "~0.8.0" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": ">= 0.8.0" + "node": "*" }, - "peerDependencies": { - "grunt": "~0.4.1" + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/grunt-peg/node_modules/pegjs": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.8.0.tgz", - "integrity": "sha512-GtAFD5WLxE0LjyhlpKwAnbi3NLJDrYsOvil95UCUQ6pzxlUtUGP/k0FnKGypTpM1WWdmoclfXb0dmMd5UUDkvA==", + "node_modules/grunt/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true, "bin": { - "pegjs": "bin/pegjs" + "mkdirp": "bin/cmd.js" }, "engines": { - "node": ">= 0.8" + "node": ">=10" } }, - "node_modules/grunt-shell": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/grunt-shell/-/grunt-shell-0.2.2.tgz", - "integrity": "sha1-f9470zu9SghxY428SGc4n3/ZX+Y=", + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, - "engines": { - "node": ">=0.8.0" + "dependencies": { + "function-bind": "^1.1.1" }, - "peerDependencies": { - "grunt": "~0.4.0" + "engines": { + "node": ">= 0.4.0" } }, - "node_modules/grunt/node_modules/async": { - "version": "0.1.22", - "resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz", - "integrity": "sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE=", + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, "engines": { - "node": "*" - } - }, - "node_modules/grunt/node_modules/coffee-script": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz", - "integrity": "sha1-FQ1rTLUiiUNp7+1qIQHCC8f0pPQ=", - "deprecated": "CoffeeScript on NPM has moved to \"coffeescript\" (no hyphen)", - "dev": true, - "bin": { - "cake": "bin/cake", - "coffee": "bin/coffee" - }, - "engines": { - "node": ">=0.4.0" + "node": ">=8" } }, - "node_modules/grunt/node_modules/glob": { - "version": "3.1.21", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", - "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", + "node_modules/homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", "dev": true, "dependencies": { - "graceful-fs": "~1.2.0", - "inherits": "1", - "minimatch": "~0.2.11" + "parse-passwd": "^1.0.0" }, - "engines": { - "node": "*" - } - }, - "node_modules/grunt/node_modules/inherits": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", - "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", - "dev": true - }, - "node_modules/grunt/node_modules/minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", - "deprecated": "Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue", - "dev": true, - "dependencies": { - "lru-cache": "2", - "sigmund": "~1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/grunt/node_modules/rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", - "dev": true, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/has-color": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", - "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -1108,19 +1014,22 @@ "node_modules/hooker": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", - "integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=", + "integrity": "sha512-t+UerCsQviSymAInD01Pw+Dn/usmz1sRO+3Zk1+lx8eg+WKpD2ulcwWqHHL0+aseRBr+3+vIhiG1K1JTwaIcTA==", "dev": true, "engines": { "node": "*" } }, "node_modules/iconv-lite": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", - "integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg=", + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, "engines": { - "node": ">=0.4.0" + "node": ">=0.10.0" } }, "node_modules/inflight": { @@ -1137,6 +1046,18 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/interpret": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha512-CLM8SNMDu7C5psFCn6Wg/tgpj/bKAg7hc2gWqcuR9OD5Ft9PhBpIu8PLicPeis+xDd6YX2ncI8MCA64I9tftIA==", + "dev": true + }, "node_modules/invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", @@ -1145,6 +1066,40 @@ "node": ">=0.10.0" } }, + "node_modules/is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "dev": true, + "dependencies": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", @@ -1156,6 +1111,87 @@ "node": ">=0.10.0" } }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-relative": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "dev": true, + "dependencies": { + "is-unc-path": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-unc-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "dev": true, + "dependencies": { + "unc-path-regex": "^0.1.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/jasmine-focused": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/jasmine-focused/-/jasmine-focused-1.0.7.tgz", @@ -1217,19 +1253,25 @@ } }, "node_modules/js-yaml": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-2.0.5.tgz", - "integrity": "sha1-olrmUJmZ6X3yeMZxnaEb0Gh3Q6g=", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "dependencies": { - "argparse": "~ 0.1.11", - "esprima": "~ 1.0.2" + "argparse": "^1.0.7", + "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" - }, + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, "engines": { - "node": ">= 0.6.0" + "node": ">=0.10.0" } }, "node_modules/lcid": { @@ -1243,15 +1285,45 @@ "node": ">=0.10.0" } }, - "node_modules/lodash": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz", - "integrity": "sha1-jzSZxSRdNG1oLlsNO0B2fgnxqSw=", + "node_modules/liftup": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/liftup/-/liftup-3.0.1.tgz", + "integrity": "sha512-yRHaiQDizWSzoXk3APcA71eOI/UuhEkNN9DiW2Tt44mhYzX4joFoCZlxsSOF7RyeLlfqzFLQI1ngFq3ggMPhOw==", "dev": true, - "engines": [ - "node", - "rhino" - ] + "dependencies": { + "extend": "^3.0.2", + "findup-sync": "^4.0.0", + "fined": "^1.2.0", + "flagged-respawn": "^1.0.1", + "is-plain-object": "^2.0.4", + "object.map": "^1.0.1", + "rechoir": "^0.7.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/liftup/node_modules/findup-sync": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-4.0.0.tgz", + "integrity": "sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ==", + "dev": true, + "dependencies": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.0", + "micromatch": "^4.0.2", + "resolve-dir": "^1.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true }, "node_modules/lru-cache": { "version": "2.7.3", @@ -1259,6 +1331,27 @@ "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", "dev": true }, + "node_modules/make-iterator": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", + "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/marked": { "version": "0.3.19", "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", @@ -1271,6 +1364,19 @@ "node": ">=0.10.0" } }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -1315,18 +1421,15 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, "node_modules/nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==", "dev": true, "dependencies": { "abbrev": "1" }, "bin": { "nopt": "bin/nopt.js" - }, - "engines": { - "node": "*" } }, "node_modules/number-is-nan": { @@ -1337,6 +1440,46 @@ "node": ">=0.10.0" } }, + "node_modules/object.defaults": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", + "integrity": "sha512-c/K0mw/F11k4dEUBMW8naXUuBuhxRCfG7W+yFy8EcijU/rSmazOUd1XAEEe6bC0OuXY4HUKjTJv7xbxIMqdxrA==", + "dev": true, + "dependencies": { + "array-each": "^1.0.1", + "array-slice": "^1.0.0", + "for-own": "^1.0.0", + "isobject": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object.map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz", + "integrity": "sha512-3+mAJu2PLfnSVGHwIWubpOFLscJANBKuB/6A4CxBstc4aqwQY0FWcsppuy4jU5GSB95yES5JHSI+33AWuS4k6w==", + "dev": true, + "dependencies": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -1364,6 +1507,15 @@ "wordwrap": "~0.0.2" } }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/os-locale": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", @@ -1375,6 +1527,48 @@ "node": ">=0.10.0" } }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "dependencies": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "node_modules/parse-filepath": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", + "integrity": "sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==", + "dev": true, + "dependencies": { + "is-absolute": "^1.0.0", + "map-cache": "^0.2.0", + "path-root": "^0.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -1383,6 +1577,33 @@ "node": ">=0.10.0" } }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-root": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", + "integrity": "sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==", + "dev": true, + "dependencies": { + "path-root-regex": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-root-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", + "integrity": "sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/pegjs": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz", @@ -1395,6 +1616,18 @@ "node": ">=0.10" } }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/property-accessors": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/property-accessors/-/property-accessors-1.1.3.tgz", @@ -1404,6 +1637,18 @@ "mixto": "1.x" } }, + "node_modules/rechoir": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "dev": true, + "dependencies": { + "resolve": "^1.9.0" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/requirejs": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", @@ -1418,24 +1663,60 @@ } }, "node_modules/resolve": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-0.3.1.tgz", - "integrity": "sha1-NMY0R8ZkxwWY0cmxJvxDsqJDEKQ=", - "dev": true + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-dir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==", + "dev": true, + "dependencies": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } }, "node_modules/rimraf": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.1.4.tgz", - "integrity": "sha1-Wm62Lu2gaPUe3lDymz5c0i89m7I=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, - "optionalDependencies": { - "graceful-fs": "~1" + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "node_modules/season": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/season/-/season-6.0.2.tgz", - "integrity": "sha1-naWPsd3SSCTXYhstxjpxI7UCF7Y=", + "integrity": "sha512-5eq1ZKvsIUTkefE/R6PhJyiDDaalPjmdhUPVMuOFh4Yz2n5pBl1COkzNlxQyI8BXEBEIu1nJeJqJPVD0c3vycQ==", "dependencies": { "cson-parser": "^1.3.0", "fs-plus": "^3.0.0", @@ -1463,6 +1744,12 @@ "node": ">=0.8.0" } }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, "node_modules/string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -1487,6 +1774,30 @@ "node": ">=0.10.0" } }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/tello": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/tello/-/tello-1.0.7.tgz", @@ -1507,6 +1818,27 @@ "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", "dev": true }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/underscore": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", @@ -1521,14 +1853,42 @@ } }, "node_modules/underscore.string": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", - "integrity": "sha1-18D6KvXVoaZ/QlPa7pgTLnM/Dxk=", + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.6.tgz", + "integrity": "sha512-VoC83HWXmCrF6rgkyxS9GHv8W9Q5nhMKho+OadDJGzL2oDYbYEppBaCMH6pFlwLeqj2QS+hhkw2kpXkSdD1JxQ==", "dev": true, + "dependencies": { + "sprintf-js": "^1.1.1", + "util-deprecate": "^1.0.2" + }, "engines": { "node": "*" } }, + "node_modules/underscore.string/node_modules/sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", + "dev": true + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/v8flags": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", + "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", + "dev": true, + "dependencies": { + "homedir-polyfill": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/walkdir": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.3.2.tgz", @@ -1539,12 +1899,18 @@ } }, "node_modules/which": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/which/-/which-1.0.9.tgz", - "integrity": "sha1-RgwdoPgQED0DIam2M6+eV15kSG8=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, "bin": { - "which": "bin/which" + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, "node_modules/window-size": { @@ -1633,35 +1999,35 @@ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "ansi-styles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", - "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", - "dev": true + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } }, "argparse": { - "version": "0.1.16", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz", - "integrity": "sha1-z9AeD7uj1srtBJ+9dY1A9lGW9Xw=", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { - "underscore": "~1.7.0", - "underscore.string": "~2.4.0" - }, - "dependencies": { - "underscore": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", - "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=", - "dev": true - }, - "underscore.string": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz", - "integrity": "sha1-jN2PusTi0uoefi6Al8QvRCKA+Fs=", - "dev": true - } + "sprintf-js": "~1.0.2" } }, + "array-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", + "integrity": "sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==", + "dev": true + }, + "array-slice": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", + "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", + "dev": true + }, "async": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", @@ -1690,6 +2056,15 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "builtins": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/builtins/-/builtins-0.0.4.tgz", @@ -1702,22 +2077,13 @@ "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" }, "chalk": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", - "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { - "ansi-styles": "~1.0.0", - "has-color": "~0.1.0", - "strip-ansi": "~0.1.0" - }, - "dependencies": { - "strip-ansi": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", - "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", - "dev": true - } + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" } }, "cliui": { @@ -1752,91 +2118,6 @@ } } }, - "coffeelint": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/coffeelint/-/coffeelint-0.5.7.tgz", - "integrity": "sha1-PRJc3emV1kHL2ECwrFNsXN9vaNs=", - "dev": true, - "requires": { - "coffee-script": ">=1.6.0", - "glob": ">=3.1.9", - "optimist": ">=0.2.8" - }, - "dependencies": { - "coffee-script": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.2.tgz", - "integrity": "sha1-/ZyINpweQeMwegoWDXE/IlE8k7M=", - "dev": true - }, - "glob": { - "version": "3.1.14", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.14.tgz", - "integrity": "sha1-+XpzHEHaZpXcg5RLuyF36aKbNj0=", - "dev": true, - "requires": { - "graceful-fs": "~1.1.2", - "inherits": "1", - "minimatch": "0.2" - }, - "dependencies": { - "graceful-fs": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.1.14.tgz", - "integrity": "sha1-BweNtfY3f2Mh/Oqu30l94STclGU=", - "dev": true - }, - "inherits": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz", - "integrity": "sha1-OOGXUoW/H3upyE2hArsSdxMirEg=", - "dev": true - }, - "minimatch": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.9.tgz", - "integrity": "sha1-uAr5R+aoOoxo8m5UwNYSW6yfiH8=", - "dev": true, - "requires": { - "lru-cache": "~2.0.0", - "sigmund": "~1.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.0.4.tgz", - "integrity": "sha1-uLYa4JhIOF7Gdodg45wSPn45Voo=", - "dev": true - }, - "sigmund": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz", - "integrity": "sha1-ZqKzp0mui1+4nv1PzAHclPvgIpY=", - "dev": true - } - } - } - } - }, - "optimist": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.5.tgz", - "integrity": "sha1-A2VLUkFwMDEtEJ85sVmCW2AwkwQ=", - "dev": true, - "requires": { - "wordwrap": "~0.0.2" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true - } - } - } - } - }, "coffeestack": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/coffeestack/-/coffeestack-1.1.2.tgz", @@ -1906,10 +2187,25 @@ } } }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "colors": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", - "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha512-ENwblkFQpqqia6b++zLD/KUWafYlVY/UNnAp7oz7LY7E924wmpye416wBOmvv/HMWzl8gL1kJlfvId/1Dg176w==", "dev": true }, "concat-map": { @@ -1941,9 +2237,9 @@ } }, "dateformat": { - "version": "1.0.2-1.2.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz", - "integrity": "sha1-sCIMAt6YYXQztyhRz0fePfLNvuk=", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", "dev": true }, "decamelize": { @@ -1951,6 +2247,12 @@ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, + "detect-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==", + "dev": true + }, "donna": { "version": "1.0.16", "resolved": "https://registry.npmjs.org/donna/-/donna-1.0.16.tgz", @@ -1978,7 +2280,7 @@ "emissary": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/emissary/-/emissary-1.3.3.tgz", - "integrity": "sha1-phjZLWgrIy0xER3DYlpd9mF5lgY=", + "integrity": "sha512-pD6FWNBSlEOzSJDCTcSGVLgNnGw5fnCvvGMdQ/TN43efeXZ/QTq8+hZoK3OOEXPRNjMmSJmeOnEJh+bWT5O8rQ==", "requires": { "es6-weak-map": "^0.1.2", "mixto": "1.x", @@ -2056,9 +2358,9 @@ } }, "esprima": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", - "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, "event-kit": { @@ -2075,7 +2377,22 @@ "exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true + }, + "expand-tilde": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, "fileset": { @@ -2122,44 +2439,73 @@ } } }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "findup-sync": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", - "integrity": "sha1-fz56l7gjksZTvwZYm9hRkOk8NoM=", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", + "integrity": "sha512-z8Nrwhi6wzxNMIbxlrTzuUW6KWuKkogZ/7OdDVq+0+kxn77KUH1nipx8iU6suqkHqc4y6n7a9A8IpmxY/pTjWg==", "dev": true, "requires": { - "glob": "~3.2.9", - "lodash": "~2.4.1" + "glob": "~5.0.0" }, "dependencies": { "glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==", "dev": true, "requires": { + "inflight": "^1.0.4", "inherits": "2", - "minimatch": "0.3" - } - }, - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "dev": true - }, - "minimatch": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", - "dev": true, - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } } } }, + "fined": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fined/-/fined-1.2.0.tgz", + "integrity": "sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==", + "dev": true, + "requires": { + "expand-tilde": "^2.0.2", + "is-plain-object": "^2.0.3", + "object.defaults": "^1.1.0", + "object.pick": "^1.2.0", + "parse-filepath": "^1.0.1" + } + }, + "flagged-respawn": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz", + "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==", + "dev": true + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==", + "dev": true + }, + "for-own": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", + "integrity": "sha512-0OABksIGrxKK8K4kynWkQ7y1zounQxP+CWnyclVwj81KW3vlLlGUx57DKGcP/LH216GzqnstnPocF16Nxs0Ycg==", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + }, "fs-plus": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/fs-plus/-/fs-plus-3.1.1.tgz", @@ -2186,6 +2532,12 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "gaze": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.3.4.tgz", @@ -2209,9 +2561,9 @@ } }, "getobject": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", - "integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/getobject/-/getobject-1.0.2.tgz", + "integrity": "sha512-2zblDBaFcb3rB4rF77XVnuINOE2h2k/OnqXAiy0IrTxUfV1iFp3la33oAQVY9pCpWU268WFYVt2t71hlMuLsOg==", "dev": true }, "glob": { @@ -2227,91 +2579,90 @@ "path-is-absolute": "^1.0.0" } }, - "graceful-fs": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", - "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", - "dev": true + "global-modules": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "dev": true, + "requires": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + } + }, + "global-prefix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==", + "dev": true, + "requires": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } }, "grim": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/grim/-/grim-2.0.2.tgz", - "integrity": "sha512-Qj7hTJRfd87E/gUgfvM0YIH/g2UA2SV6niv6BYXk1o6w4mhgv+QyYM1EjOJQljvzgEj4SqSsRWldXIeKHz3e3Q==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/grim/-/grim-2.0.3.tgz", + "integrity": "sha512-FM20Ump11qYLK9k9DbL8yzVpy+YBieya1JG15OeH8s+KbHq8kL4SdwRtURwIUHniSxb24EoBUpwKfFjGNVi4/Q==", "requires": { "event-kit": "^2.0.0" } }, "grunt": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-0.4.5.tgz", - "integrity": "sha1-VpN81RlDJK3/bSB2MYMqnWuk5/A=", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.5.3.tgz", + "integrity": "sha512-mKwmo4X2d8/4c/BmcOETHek675uOqw0RuA/zy12jaspWqvTp4+ZeQF1W+OTpcbncnaBsfbQJ6l0l4j+Sn/GmaQ==", "dev": true, "requires": { - "async": "~0.1.22", - "coffee-script": "~1.3.3", - "colors": "~0.6.2", - "dateformat": "1.0.2-1.2.3", + "dateformat": "~3.0.3", "eventemitter2": "~0.4.13", - "exit": "~0.1.1", - "findup-sync": "~0.1.2", - "getobject": "~0.1.0", - "glob": "~3.1.21", - "grunt-legacy-log": "~0.1.0", - "grunt-legacy-util": "~0.2.0", - "hooker": "~0.2.3", - "iconv-lite": "~0.2.11", - "js-yaml": "~2.0.5", - "lodash": "~0.9.2", - "minimatch": "~0.2.12", - "nopt": "~1.0.10", - "rimraf": "~2.2.8", - "underscore.string": "~2.2.1", - "which": "~1.0.5" + "exit": "~0.1.2", + "findup-sync": "~0.3.0", + "glob": "~7.1.6", + "grunt-cli": "~1.4.3", + "grunt-known-options": "~2.0.0", + "grunt-legacy-log": "~3.0.0", + "grunt-legacy-util": "~2.0.1", + "iconv-lite": "~0.4.13", + "js-yaml": "~3.14.0", + "minimatch": "~3.0.4", + "mkdirp": "~1.0.4", + "nopt": "~3.0.6", + "rimraf": "~3.0.2" }, "dependencies": { - "async": { - "version": "0.1.22", - "resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz", - "integrity": "sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE=", - "dev": true - }, - "coffee-script": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz", - "integrity": "sha1-FQ1rTLUiiUNp7+1qIQHCC8f0pPQ=", - "dev": true - }, "glob": { - "version": "3.1.21", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", - "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", - "dev": true, - "requires": { - "graceful-fs": "~1.2.0", - "inherits": "1", - "minimatch": "~0.2.11" - } - }, - "inherits": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", - "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", - "dev": true - }, - "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", "dev": true, "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true } } @@ -2327,160 +2678,119 @@ } }, "grunt-cli": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-0.1.13.tgz", - "integrity": "sha1-6evEBHYx9QEtkidww5N4EzytEPQ=", - "dev": true, - "requires": { - "findup-sync": "~0.1.0", - "nopt": "~1.0.10", - "resolve": "~0.3.1" - } - }, - "grunt-coffeelint": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/grunt-coffeelint/-/grunt-coffeelint-0.0.6.tgz", - "integrity": "sha1-/NMBr9Z3XUGYCwDQHKYzG8kDBsw=", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.4.3.tgz", + "integrity": "sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==", "dev": true, "requires": { - "coffeelint": "~0.5" - } - }, - "grunt-contrib-coffee": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-coffee/-/grunt-contrib-coffee-0.9.0.tgz", - "integrity": "sha1-UZr1EF2hL+MWO7UOHKeAtslT77A=", - "dev": true, - "requires": { - "chalk": "~0.4.0", - "coffee-script": "~1.7.0", - "lodash": "~2.4.1" + "grunt-known-options": "~2.0.0", + "interpret": "~1.1.0", + "liftup": "~3.0.1", + "nopt": "~4.0.1", + "v8flags": "~3.2.0" }, "dependencies": { - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "dev": true + "nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "dev": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } } } }, + "grunt-known-options": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-2.0.0.tgz", + "integrity": "sha512-GD7cTz0I4SAede1/+pAbmJRG44zFLPipVtdL9o3vqx9IEyb7b4/Y3s7r6ofI3CchR5GvYJ+8buCSioDv5dQLiA==", + "dev": true + }, "grunt-legacy-log": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-0.1.3.tgz", - "integrity": "sha1-7ClCboAwIa9ZAp+H0vnNczWgVTE=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-3.0.0.tgz", + "integrity": "sha512-GHZQzZmhyq0u3hr7aHW4qUH0xDzwp2YXldLPZTCjlOeGscAOWWPftZG3XioW8MasGp+OBRIu39LFx14SLjXRcA==", "dev": true, "requires": { - "colors": "~0.6.2", - "grunt-legacy-log-utils": "~0.1.1", + "colors": "~1.1.2", + "grunt-legacy-log-utils": "~2.1.0", "hooker": "~0.2.3", - "lodash": "~2.4.1", - "underscore.string": "~2.3.3" - }, - "dependencies": { - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "dev": true - }, - "underscore.string": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", - "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=", - "dev": true - } + "lodash": "~4.17.19" } }, "grunt-legacy-log-utils": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-0.1.1.tgz", - "integrity": "sha1-wHBrndkGThFvNvI/5OawSGcsD34=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.1.0.tgz", + "integrity": "sha512-lwquaPXJtKQk0rUM1IQAop5noEpwFqOXasVoedLeNzaibf/OPWjKYvvdqnEHNmU+0T0CaReAXIbGo747ZD+Aaw==", "dev": true, "requires": { - "colors": "~0.6.2", - "lodash": "~2.4.1", - "underscore.string": "~2.3.3" - }, - "dependencies": { - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=", - "dev": true - }, - "underscore.string": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", - "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=", - "dev": true - } + "chalk": "~4.1.0", + "lodash": "~4.17.19" } }, "grunt-legacy-util": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-0.2.0.tgz", - "integrity": "sha1-kzJIhNv343qf98Am3/RR2UqeVUs=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-2.0.1.tgz", + "integrity": "sha512-2bQiD4fzXqX8rhNdXkAywCadeqiPiay0oQny77wA2F3WF4grPJXCvAcyoWUJV+po/b15glGkxuSiQCK299UC2w==", "dev": true, "requires": { - "async": "~0.1.22", - "exit": "~0.1.1", - "getobject": "~0.1.0", + "async": "~3.2.0", + "exit": "~0.1.2", + "getobject": "~1.0.0", "hooker": "~0.2.3", - "lodash": "~0.9.2", - "underscore.string": "~2.2.1", - "which": "~1.0.5" + "lodash": "~4.17.21", + "underscore.string": "~3.3.5", + "which": "~2.0.2" }, "dependencies": { "async": { - "version": "0.1.22", - "resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz", - "integrity": "sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE=", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", "dev": true } } }, - "grunt-peg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/grunt-peg/-/grunt-peg-1.1.0.tgz", - "integrity": "sha1-mXIenObicnRzkHfbh281otBc8qY=", + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, "requires": { - "pegjs": "~0.8.0" - }, - "dependencies": { - "pegjs": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.8.0.tgz", - "integrity": "sha512-GtAFD5WLxE0LjyhlpKwAnbi3NLJDrYsOvil95UCUQ6pzxlUtUGP/k0FnKGypTpM1WWdmoclfXb0dmMd5UUDkvA==", - "dev": true - } + "function-bind": "^1.1.1" } }, - "grunt-shell": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/grunt-shell/-/grunt-shell-0.2.2.tgz", - "integrity": "sha1-f9470zu9SghxY428SGc4n3/ZX+Y=", - "dev": true, - "requires": {} - }, - "has-color": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", - "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "dev": true, + "requires": { + "parse-passwd": "^1.0.0" + } + }, "hooker": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", - "integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=", + "integrity": "sha512-t+UerCsQviSymAInD01Pw+Dn/usmz1sRO+3Zk1+lx8eg+WKpD2ulcwWqHHL0+aseRBr+3+vIhiG1K1JTwaIcTA==", "dev": true }, "iconv-lite": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", - "integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg=", - "dev": true + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } }, "inflight": { "version": "1.0.6", @@ -2496,11 +2806,48 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "interpret": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha512-CLM8SNMDu7C5psFCn6Wg/tgpj/bKAg7hc2gWqcuR9OD5Ft9PhBpIu8PLicPeis+xDd6YX2ncI8MCA64I9tftIA==", + "dev": true + }, "invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" }, + "is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "dev": true, + "requires": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + } + }, + "is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", @@ -2509,6 +2856,66 @@ "number-is-nan": "^1.0.0" } }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-relative": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "dev": true, + "requires": { + "is-unc-path": "^1.0.0" + } + }, + "is-unc-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "dev": true, + "requires": { + "unc-path-regex": "^0.1.2" + } + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true + }, "jasmine-focused": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/jasmine-focused/-/jasmine-focused-1.0.7.tgz", @@ -2563,15 +2970,21 @@ } }, "js-yaml": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-2.0.5.tgz", - "integrity": "sha1-olrmUJmZ6X3yeMZxnaEb0Gh3Q6g=", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { - "argparse": "~ 0.1.11", - "esprima": "~ 1.0.2" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", @@ -2580,10 +2993,40 @@ "invert-kv": "^1.0.0" } }, + "liftup": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/liftup/-/liftup-3.0.1.tgz", + "integrity": "sha512-yRHaiQDizWSzoXk3APcA71eOI/UuhEkNN9DiW2Tt44mhYzX4joFoCZlxsSOF7RyeLlfqzFLQI1ngFq3ggMPhOw==", + "dev": true, + "requires": { + "extend": "^3.0.2", + "findup-sync": "^4.0.0", + "fined": "^1.2.0", + "flagged-respawn": "^1.0.1", + "is-plain-object": "^2.0.4", + "object.map": "^1.0.1", + "rechoir": "^0.7.0", + "resolve": "^1.19.0" + }, + "dependencies": { + "findup-sync": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-4.0.0.tgz", + "integrity": "sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ==", + "dev": true, + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.0", + "micromatch": "^4.0.2", + "resolve-dir": "^1.0.1" + } + } + } + }, "lodash": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz", - "integrity": "sha1-jzSZxSRdNG1oLlsNO0B2fgnxqSw=", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, "lru-cache": { @@ -2592,12 +3035,37 @@ "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", "dev": true }, + "make-iterator": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", + "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", + "dev": true, + "requires": { + "kind-of": "^6.0.2" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==", + "dev": true + }, "marked": { "version": "0.3.19", "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", "dev": true }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -2635,9 +3103,9 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, "nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==", "dev": true, "requires": { "abbrev": "1" @@ -2648,6 +3116,37 @@ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, + "object.defaults": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", + "integrity": "sha512-c/K0mw/F11k4dEUBMW8naXUuBuhxRCfG7W+yFy8EcijU/rSmazOUd1XAEEe6bC0OuXY4HUKjTJv7xbxIMqdxrA==", + "dev": true, + "requires": { + "array-each": "^1.0.1", + "array-slice": "^1.0.0", + "for-own": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "object.map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz", + "integrity": "sha512-3+mAJu2PLfnSVGHwIWubpOFLscJANBKuB/6A4CxBstc4aqwQY0FWcsppuy4jU5GSB95yES5JHSI+33AWuS4k6w==", + "dev": true, + "requires": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -2674,6 +3173,12 @@ "wordwrap": "~0.0.2" } }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==", + "dev": true + }, "os-locale": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", @@ -2682,17 +3187,77 @@ "lcid": "^1.0.0" } }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "parse-filepath": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", + "integrity": "sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==", + "dev": true, + "requires": { + "is-absolute": "^1.0.0", + "map-cache": "^0.2.0", + "path-root": "^0.1.1" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-root": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", + "integrity": "sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==", + "dev": true, + "requires": { + "path-root-regex": "^0.1.0" + } + }, + "path-root-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", + "integrity": "sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==", + "dev": true + }, "pegjs": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz", "integrity": "sha512-qI5+oFNEGi3L5HAxDwN2LA4Gg7irF70Zs25edhjld9QemOgp0CbvMtbFcMvFtEo1OityPrcCzkQFB8JP/hxgow==", "dev": true }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, "property-accessors": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/property-accessors/-/property-accessors-1.1.3.tgz", @@ -2702,6 +3267,15 @@ "mixto": "1.x" } }, + "rechoir": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "dev": true, + "requires": { + "resolve": "^1.9.0" + } + }, "requirejs": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", @@ -2709,24 +3283,45 @@ "dev": true }, "resolve": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-0.3.1.tgz", - "integrity": "sha1-NMY0R8ZkxwWY0cmxJvxDsqJDEKQ=", - "dev": true + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-dir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==", + "dev": true, + "requires": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + } }, "rimraf": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.1.4.tgz", - "integrity": "sha1-Wm62Lu2gaPUe3lDymz5c0i89m7I=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "requires": { - "graceful-fs": "~1" + "glob": "^7.1.3" } }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "season": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/season/-/season-6.0.2.tgz", - "integrity": "sha1-naWPsd3SSCTXYhstxjpxI7UCF7Y=", + "integrity": "sha512-5eq1ZKvsIUTkefE/R6PhJyiDDaalPjmdhUPVMuOFh4Yz2n5pBl1COkzNlxQyI8BXEBEIu1nJeJqJPVD0c3vycQ==", "requires": { "cson-parser": "^1.3.0", "fs-plus": "^3.0.0", @@ -2748,6 +3343,12 @@ "amdefine": ">=0.0.4" } }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -2766,6 +3367,21 @@ "ansi-regex": "^2.0.0" } }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "tello": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/tello/-/tello-1.0.7.tgz", @@ -2785,6 +3401,21 @@ } } }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==", + "dev": true + }, "underscore": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", @@ -2799,11 +3430,38 @@ } }, "underscore.string": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", - "integrity": "sha1-18D6KvXVoaZ/QlPa7pgTLnM/Dxk=", + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.6.tgz", + "integrity": "sha512-VoC83HWXmCrF6rgkyxS9GHv8W9Q5nhMKho+OadDJGzL2oDYbYEppBaCMH6pFlwLeqj2QS+hhkw2kpXkSdD1JxQ==", + "dev": true, + "requires": { + "sprintf-js": "^1.1.1", + "util-deprecate": "^1.0.2" + }, + "dependencies": { + "sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", + "dev": true + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, + "v8flags": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", + "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, "walkdir": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.3.2.tgz", @@ -2811,10 +3469,13 @@ "dev": true }, "which": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/which/-/which-1.0.9.tgz", - "integrity": "sha1-RgwdoPgQED0DIam2M6+eV15kSG8=", - "dev": true + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } }, "window-size": { "version": "0.1.4", diff --git a/package.json b/package.json index 78dfbaf..dc2e3b5 100644 --- a/package.json +++ b/package.json @@ -11,33 +11,28 @@ }, "repository": { "type": "git", - "url": "https://github.com/atom/first-mate" + "url": "https://github.com/pulsar-edit/first-mate" }, "bugs": { - "url": "https://github.com/atom/first-mate/issues" + "url": "https://github.com/pulsar-edit/first-mate/issues" }, "license": "MIT", - "homepage": "http://atom.github.io/first-mate", + "homepage": "http://github.com/pulsar-edit/first-mate", "dependencies": { - "emissary": "^1", - "event-kit": "^2.2.0", + "emissary": "^1.3.3", + "event-kit": "^2.5.3", "fs-plus": "^3.0.0", - "grim": "^2.0.1", + "grim": "^2.0.3", "oniguruma": "^7.2.3", "season": "^6.0.2", "underscore-plus": "^1" }, "devDependencies": { - "coffee-script": "~1.7.0", - "grunt": "~0.4.1", + "grunt": "^1.5.3", "grunt-atomdoc": "^1.0.0", - "grunt-cli": "~0.1.8", - "grunt-coffeelint": "0.0.6", - "grunt-contrib-coffee": "~0.9.0", - "grunt-peg": "~1.1.0", - "grunt-shell": "~0.2.2", + "grunt-cli": "^1.4.3", "jasmine-focused": "^1", "pegjs": "^0.10.0", - "rimraf": "~2.1.4" + "rimraf": "^3.0.2" } } From fc582d7037aeb3bfe57da1fcaac299dd706596ff Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sat, 26 Nov 2022 14:43:36 -0800 Subject: [PATCH 24/25] Revert `grunt` upgrade, as it's a peer dep to `grunt-atomdoc` - Removed `rimraf` dep --- package-lock.json | 774 +++++++++++++++++++--------------------------- package.json | 7 +- 2 files changed, 318 insertions(+), 463 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1516bc5..a9d129e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,12 +18,11 @@ "underscore-plus": "^1" }, "devDependencies": { - "grunt": "^1.5.3", - "grunt-atomdoc": "^1.0.0", + "grunt": "^0.4.0", + "grunt-atomdoc": "^1.0.1", "grunt-cli": "^1.4.3", "jasmine-focused": "^1", - "pegjs": "^0.10.0", - "rimraf": "^3.0.2" + "pegjs": "^0.10.0" } }, "node_modules/abbrev": { @@ -49,28 +48,29 @@ "node": ">=0.10.0" } }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "node_modules/argparse": { + "version": "0.1.16", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz", + "integrity": "sha512-LjmC2dNpdn2L4UzyoaIr11ELYoLn37ZFy9zObrQFHsSuOepeUEMKnM8w5KL4Tnrp2gy88rRuQt6Ky8Bjml+Baw==", "dev": true, "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "underscore": "~1.7.0", + "underscore.string": "~2.4.0" } }, - "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "node_modules/argparse/node_modules/underscore": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", + "integrity": "sha512-cp0oQQyZhUM1kpJDLdGO1jPZHgS/MpzoWYfe9+CM2h/QGDZlqwT2T3YGukuBdaNJ/CAPoeyAZRRHz8JFo176vA==", + "dev": true + }, + "node_modules/argparse/node_modules/underscore.string": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz", + "integrity": "sha512-yxkabuCaIBnzfIvX3kBxQqCs0ar/bfJwDnFEHJUm/ZrRVhT3IItdRF5cZjARLzEnyQYtIUhsZ2LG2j3HidFOFQ==", "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" + "engines": { + "node": "*" } }, "node_modules/array-each": { @@ -145,22 +145,6 @@ "node": ">=0.10.0" } }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -287,28 +271,10 @@ "node": ">=0.8.0" } }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha512-ENwblkFQpqqia6b++zLD/KUWafYlVY/UNnAp7oz7LY7E924wmpye416wBOmvv/HMWzl8gL1kJlfvId/1Dg176w==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", + "integrity": "sha512-OsSVtHK8Ir8r3+Fxw/b4jS1ZLPXkV6ZxDRJQzeD7qo0SqMXWrHDM71DgYzPMHY8SFJ0Ao+nNU2p1MmwdzKqPrw==", "dev": true, "engines": { "node": ">=0.1.90" @@ -349,9 +315,9 @@ } }, "node_modules/dateformat": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", - "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "version": "1.0.2-1.2.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz", + "integrity": "sha512-AXvW8g7tO4ilk5HgOWeDmPi/ZPaCnMJ+9Cg1I3p19w6mcvAAXBuuGEXAxybC+Djj1PSZUiHUcyoYu7WneCX8gQ==", "dev": true, "engines": { "node": "*" @@ -488,19 +454,6 @@ "es6-symbol": "~2.0.1" } }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/event-kit": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/event-kit/-/event-kit-2.5.3.tgz", @@ -512,15 +465,6 @@ "integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=", "dev": true }, - "node_modules/exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/expand-tilde": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", @@ -603,28 +547,50 @@ } }, "node_modules/findup-sync": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", - "integrity": "sha512-z8Nrwhi6wzxNMIbxlrTzuUW6KWuKkogZ/7OdDVq+0+kxn77KUH1nipx8iU6suqkHqc4y6n7a9A8IpmxY/pTjWg==", + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", + "integrity": "sha512-yjftfYnF4ThYEvKEV/kEFR15dmtyXTAh3vQnzpJUoc7Naj5y1P0Ck7Zs1+Vroa00E3KT3IYsk756S+8WA5dNLw==", "dev": true, "dependencies": { - "glob": "~5.0.0" + "glob": "~3.2.9", + "lodash": "~2.4.1" }, "engines": { "node": ">= 0.6.0" } }, "node_modules/findup-sync/node_modules/glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==", + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", + "integrity": "sha512-hVb0zwEZwC1FXSKRPFTeOtN7AArJcJlI6ULGLtrstaswKNlrTJqAA+1lYlSUop4vjA423xlBzqfVS3iWGlqJ+g==", "dev": true, "dependencies": { - "inflight": "^1.0.4", "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "minimatch": "0.3" + }, + "engines": { + "node": "*" + } + }, + "node_modules/findup-sync/node_modules/lodash": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "integrity": "sha512-Kak1hi6/hYHGVPmdyiZijoQyz5x2iGVzs6w9GYB/HiXEtylY7tIoYEROMjvM1d9nXJqPOrG2MNPMn01bJ+S0Rw==", + "dev": true, + "engines": [ + "node", + "rhino" + ] + }, + "node_modules/findup-sync/node_modules/minimatch": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", + "integrity": "sha512-WFX1jI1AaxNTZVOHLBVazwTWKaQjoykSzCBNXB72vDTCzopQGtyP91tKdFK5cv1+qMwPyiTu1HqUriqplI8pcA==", + "deprecated": "Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue", + "dev": true, + "dependencies": { + "lru-cache": "2", + "sigmund": "~1.0.0" }, "engines": { "node": "*" @@ -736,15 +702,6 @@ "node": "*" } }, - "node_modules/getobject": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/getobject/-/getobject-1.0.2.tgz", - "integrity": "sha512-2zblDBaFcb3rB4rF77XVnuINOE2h2k/OnqXAiy0IrTxUfV1iFp3la33oAQVY9pCpWU268WFYVt2t71hlMuLsOg==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", @@ -803,6 +760,17 @@ "which": "bin/which" } }, + "node_modules/graceful-fs": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.1.14.tgz", + "integrity": "sha512-JUrvoFoQbLZpOZilKTXZX2e1EV0DTnuG5vsRFNFv4mPf/mnYbwNAFw/5x0rxeyaJslIdObGSgTTsMnM/acRaVw==", + "deprecated": "please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/grim": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/grim/-/grim-2.0.3.tgz", @@ -812,32 +780,30 @@ } }, "node_modules/grunt": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.5.3.tgz", - "integrity": "sha512-mKwmo4X2d8/4c/BmcOETHek675uOqw0RuA/zy12jaspWqvTp4+ZeQF1W+OTpcbncnaBsfbQJ6l0l4j+Sn/GmaQ==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-0.4.0.tgz", + "integrity": "sha512-dUrSRfUjz625nRf0/GJ90QEsTNAUlXNg1/G+W+J9BPNrCgXeTWO8Slj2YEG8MgnBdAHkR+96NupiFAat6tpY0g==", "dev": true, "dependencies": { - "dateformat": "~3.0.3", - "eventemitter2": "~0.4.13", - "exit": "~0.1.2", - "findup-sync": "~0.3.0", - "glob": "~7.1.6", - "grunt-cli": "~1.4.3", - "grunt-known-options": "~2.0.0", - "grunt-legacy-log": "~3.0.0", - "grunt-legacy-util": "~2.0.1", - "iconv-lite": "~0.4.13", - "js-yaml": "~3.14.0", - "minimatch": "~3.0.4", - "mkdirp": "~1.0.4", - "nopt": "~3.0.6", - "rimraf": "~3.0.2" - }, - "bin": { - "grunt": "bin/grunt" + "async": "~0.1.22", + "coffee-script": "~1.3.3", + "colors": "~0.6.0-1", + "dateformat": "1.0.2-1.2.3", + "eventemitter2": "~0.4.9", + "findup-sync": "~0.1.0", + "glob": "~3.1.17", + "hooker": "~0.2.3", + "iconv-lite": "~0.2.5", + "js-yaml": "~1.0.1", + "lodash": "~0.9.0", + "minimatch": "~0.2.6", + "nopt": "~1.0.10", + "rimraf": "~2.0.2", + "underscore.string": "~2.2.0rc", + "which": "~1.0.5" }, "engines": { - "node": ">=8" + "node": ">= 0.8.0" } }, "node_modules/grunt-atomdoc": { @@ -894,88 +860,80 @@ "node": ">=0.10.0" } }, - "node_modules/grunt-legacy-log": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-3.0.0.tgz", - "integrity": "sha512-GHZQzZmhyq0u3hr7aHW4qUH0xDzwp2YXldLPZTCjlOeGscAOWWPftZG3XioW8MasGp+OBRIu39LFx14SLjXRcA==", + "node_modules/grunt/node_modules/async": { + "version": "0.1.22", + "resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz", + "integrity": "sha512-2tEzliJmf5fHNafNwQLJXUasGzQCVctvsNkXmnlELHwypU0p08/rHohYvkqKIjyXpx+0rkrYv6QbhJ+UF4QkBg==", "dev": true, - "dependencies": { - "colors": "~1.1.2", - "grunt-legacy-log-utils": "~2.1.0", - "hooker": "~0.2.3", - "lodash": "~4.17.19" - }, "engines": { - "node": ">= 0.10.0" + "node": "*" } }, - "node_modules/grunt-legacy-log-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.1.0.tgz", - "integrity": "sha512-lwquaPXJtKQk0rUM1IQAop5noEpwFqOXasVoedLeNzaibf/OPWjKYvvdqnEHNmU+0T0CaReAXIbGo747ZD+Aaw==", + "node_modules/grunt/node_modules/coffee-script": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz", + "integrity": "sha512-QjQ1T4BqyHv19k6XSfdhy/QLlIOhywz0ekBUCa9h71zYMJlfDTGan/Z1JXzYkZ6v8R+GhvL/p4FZPbPW8WNXlg==", + "deprecated": "CoffeeScript on NPM has moved to \"coffeescript\" (no hyphen)", "dev": true, - "dependencies": { - "chalk": "~4.1.0", - "lodash": "~4.17.19" + "bin": { + "cake": "bin/cake", + "coffee": "bin/coffee" }, "engines": { - "node": ">=10" + "node": ">=0.4.0" } }, - "node_modules/grunt-legacy-util": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-2.0.1.tgz", - "integrity": "sha512-2bQiD4fzXqX8rhNdXkAywCadeqiPiay0oQny77wA2F3WF4grPJXCvAcyoWUJV+po/b15glGkxuSiQCK299UC2w==", + "node_modules/grunt/node_modules/glob": { + "version": "3.1.21", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", + "integrity": "sha512-ANhy2V2+tFpRajE3wN4DhkNQ08KDr0Ir1qL12/cUe5+a7STEK8jkW4onUYuY8/06qAFuT5je7mjAqzx0eKI2tQ==", "dev": true, "dependencies": { - "async": "~3.2.0", - "exit": "~0.1.2", - "getobject": "~1.0.0", - "hooker": "~0.2.3", - "lodash": "~4.17.21", - "underscore.string": "~3.3.5", - "which": "~2.0.2" + "graceful-fs": "~1.2.0", + "inherits": "1", + "minimatch": "~0.2.11" }, "engines": { - "node": ">=10" + "node": "*" } }, - "node_modules/grunt-legacy-util/node_modules/async": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", - "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", + "node_modules/grunt/node_modules/graceful-fs": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", + "integrity": "sha512-iiTUZ5vZ+2ZV+h71XAgwCSu6+NAizhFU3Yw8aC/hH5SQ3SnISqEqAek40imAFGtDcwJKNhXvSY+hzIolnLwcdQ==", + "deprecated": "please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/grunt/node_modules/inherits": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", + "integrity": "sha512-Al67oatbRSo3RV5hRqIoln6Y5yMVbJSIn4jEJNL7VCImzq/kLr7vvb6sFRJXqr8rpHc/2kJOM+y0sPKN47VdzA==", "dev": true }, - "node_modules/grunt/node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "node_modules/grunt/node_modules/minimatch": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", + "integrity": "sha512-zZ+Jy8lVWlvqqeM8iZB7w7KmQkoJn8djM585z88rywrEbzoqawVa9FR5p2hwD+y74nfuKOjmNvi9gtWJNLqHvA==", + "deprecated": "Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue", "dev": true, "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "lru-cache": "2", + "sigmund": "~1.0.0" }, "engines": { "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/grunt/node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "node_modules/grunt/node_modules/underscore.string": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", + "integrity": "sha512-3FVmhXqelrj6gfgp3Bn6tOavJvW0dNH2T+heTD38JRxIrAbiuzbqjknszoOYj3DyFB1nWiLj208Qt2no/L4cIA==", "dev": true, - "bin": { - "mkdirp": "bin/cmd.js" - }, "engines": { - "node": ">=10" + "node": "*" } }, "node_modules/has": { @@ -990,15 +948,6 @@ "node": ">= 0.4.0" } }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/homedir-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", @@ -1021,15 +970,12 @@ } }, "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", + "integrity": "sha512-KhmFWgaQZY83Cbhi+ADInoUQ8Etn6BG5fikM9syeOjQltvR45h7cRKJ/9uvQEuD61I3Uju77yYce0/LhKVClQw==", "dev": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, "engines": { - "node": ">=0.10.0" + "node": ">=0.4.0" } }, "node_modules/inflight": { @@ -1253,16 +1199,18 @@ } }, "node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-1.0.3.tgz", + "integrity": "sha512-UqzDrK8526iLQnHaXZDBiAwn+ubNakeOViDTn/jK/PvoV8Zbib1ldAgvEopGIH4JqolR3zKPIMmxi9c5RpZ+EA==", "dev": true, "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "~ 0.1.3" }, "bin": { "js-yaml": "bin/js-yaml.js" + }, + "engines": { + "node": ">= 0.6.0" } }, "node_modules/kind-of": { @@ -1320,10 +1268,14 @@ } }, "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz", + "integrity": "sha512-LVbt/rjK62gSbhehDVKL0vlaime4Y1IBixL+bKeNfoY4L2zab/jGrxU6Ka05tMA/zBxkTk5t3ivtphdyYupczw==", + "dev": true, + "engines": [ + "node", + "rhino" + ] }, "node_modules/lru-cache": { "version": "2.7.3", @@ -1421,15 +1373,18 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, "node_modules/nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", "dev": true, "dependencies": { "abbrev": "1" }, "bin": { "nopt": "bin/nopt.js" + }, + "engines": { + "node": "*" } }, "node_modules/number-is-nan": { @@ -1693,26 +1648,14 @@ } }, "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.0.3.tgz", + "integrity": "sha512-uR09PSoW2+1hW0hquRqxb+Ae2h6R5ls3OAy2oNekQFtqbSJkltkhKRa+OhZKoxWsN9195Gp1vg7sELDRoJ8a3w==", "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "optionalDependencies": { + "graceful-fs": "~1.1" } }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, "node_modules/season": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/season/-/season-6.0.2.tgz", @@ -1744,12 +1687,6 @@ "node": ">=0.8.0" } }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true - }, "node_modules/string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -1774,18 +1711,6 @@ "node": ">=0.10.0" } }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -1899,18 +1824,12 @@ } }, "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/which/-/which-1.0.9.tgz", + "integrity": "sha512-E87fdQ/eRJr9W1X4wTPejNy9zTW3FI2vpCZSJ/HAY+TkjKVC0TUm1jk6vn2Z7qay0DQy0+RBGdXxj+RmmiGZKQ==", "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" + "which": "bin/which" } }, "node_modules/window-size": { @@ -1998,22 +1917,28 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "version": "0.1.16", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz", + "integrity": "sha512-LjmC2dNpdn2L4UzyoaIr11ELYoLn37ZFy9zObrQFHsSuOepeUEMKnM8w5KL4Tnrp2gy88rRuQt6Ky8Bjml+Baw==", "dev": true, "requires": { - "sprintf-js": "~1.0.2" + "underscore": "~1.7.0", + "underscore.string": "~2.4.0" + }, + "dependencies": { + "underscore": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", + "integrity": "sha512-cp0oQQyZhUM1kpJDLdGO1jPZHgS/MpzoWYfe9+CM2h/QGDZlqwT2T3YGukuBdaNJ/CAPoeyAZRRHz8JFo176vA==", + "dev": true + }, + "underscore.string": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz", + "integrity": "sha512-yxkabuCaIBnzfIvX3kBxQqCs0ar/bfJwDnFEHJUm/ZrRVhT3IItdRF5cZjARLzEnyQYtIUhsZ2LG2j3HidFOFQ==", + "dev": true + } } }, "array-each": { @@ -2076,16 +2001,6 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, "cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -2187,25 +2102,10 @@ } } }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha512-ENwblkFQpqqia6b++zLD/KUWafYlVY/UNnAp7oz7LY7E924wmpye416wBOmvv/HMWzl8gL1kJlfvId/1Dg176w==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", + "integrity": "sha512-OsSVtHK8Ir8r3+Fxw/b4jS1ZLPXkV6ZxDRJQzeD7qo0SqMXWrHDM71DgYzPMHY8SFJ0Ao+nNU2p1MmwdzKqPrw==", "dev": true }, "concat-map": { @@ -2237,9 +2137,9 @@ } }, "dateformat": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", - "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "version": "1.0.2-1.2.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz", + "integrity": "sha512-AXvW8g7tO4ilk5HgOWeDmPi/ZPaCnMJ+9Cg1I3p19w6mcvAAXBuuGEXAxybC+Djj1PSZUiHUcyoYu7WneCX8gQ==", "dev": true }, "decamelize": { @@ -2357,12 +2257,6 @@ "es6-symbol": "~2.0.1" } }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, "event-kit": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/event-kit/-/event-kit-2.5.3.tgz", @@ -2374,12 +2268,6 @@ "integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=", "dev": true }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", - "dev": true - }, "expand-tilde": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", @@ -2449,25 +2337,39 @@ } }, "findup-sync": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", - "integrity": "sha512-z8Nrwhi6wzxNMIbxlrTzuUW6KWuKkogZ/7OdDVq+0+kxn77KUH1nipx8iU6suqkHqc4y6n7a9A8IpmxY/pTjWg==", + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", + "integrity": "sha512-yjftfYnF4ThYEvKEV/kEFR15dmtyXTAh3vQnzpJUoc7Naj5y1P0Ck7Zs1+Vroa00E3KT3IYsk756S+8WA5dNLw==", "dev": true, "requires": { - "glob": "~5.0.0" + "glob": "~3.2.9", + "lodash": "~2.4.1" }, "dependencies": { "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==", + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", + "integrity": "sha512-hVb0zwEZwC1FXSKRPFTeOtN7AArJcJlI6ULGLtrstaswKNlrTJqAA+1lYlSUop4vjA423xlBzqfVS3iWGlqJ+g==", "dev": true, "requires": { - "inflight": "^1.0.4", "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "minimatch": "0.3" + } + }, + "lodash": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", + "integrity": "sha512-Kak1hi6/hYHGVPmdyiZijoQyz5x2iGVzs6w9GYB/HiXEtylY7tIoYEROMjvM1d9nXJqPOrG2MNPMn01bJ+S0Rw==", + "dev": true + }, + "minimatch": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", + "integrity": "sha512-WFX1jI1AaxNTZVOHLBVazwTWKaQjoykSzCBNXB72vDTCzopQGtyP91tKdFK5cv1+qMwPyiTu1HqUriqplI8pcA==", + "dev": true, + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" } } } @@ -2560,12 +2462,6 @@ } } }, - "getobject": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/getobject/-/getobject-1.0.2.tgz", - "integrity": "sha512-2zblDBaFcb3rB4rF77XVnuINOE2h2k/OnqXAiy0IrTxUfV1iFp3la33oAQVY9pCpWU268WFYVt2t71hlMuLsOg==", - "dev": true - }, "glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", @@ -2614,6 +2510,13 @@ } } }, + "graceful-fs": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.1.14.tgz", + "integrity": "sha512-JUrvoFoQbLZpOZilKTXZX2e1EV0DTnuG5vsRFNFv4mPf/mnYbwNAFw/5x0rxeyaJslIdObGSgTTsMnM/acRaVw==", + "dev": true, + "optional": true + }, "grim": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/grim/-/grim-2.0.3.tgz", @@ -2623,46 +2526,78 @@ } }, "grunt": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.5.3.tgz", - "integrity": "sha512-mKwmo4X2d8/4c/BmcOETHek675uOqw0RuA/zy12jaspWqvTp4+ZeQF1W+OTpcbncnaBsfbQJ6l0l4j+Sn/GmaQ==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-0.4.0.tgz", + "integrity": "sha512-dUrSRfUjz625nRf0/GJ90QEsTNAUlXNg1/G+W+J9BPNrCgXeTWO8Slj2YEG8MgnBdAHkR+96NupiFAat6tpY0g==", "dev": true, "requires": { - "dateformat": "~3.0.3", - "eventemitter2": "~0.4.13", - "exit": "~0.1.2", - "findup-sync": "~0.3.0", - "glob": "~7.1.6", - "grunt-cli": "~1.4.3", - "grunt-known-options": "~2.0.0", - "grunt-legacy-log": "~3.0.0", - "grunt-legacy-util": "~2.0.1", - "iconv-lite": "~0.4.13", - "js-yaml": "~3.14.0", - "minimatch": "~3.0.4", - "mkdirp": "~1.0.4", - "nopt": "~3.0.6", - "rimraf": "~3.0.2" + "async": "~0.1.22", + "coffee-script": "~1.3.3", + "colors": "~0.6.0-1", + "dateformat": "1.0.2-1.2.3", + "eventemitter2": "~0.4.9", + "findup-sync": "~0.1.0", + "glob": "~3.1.17", + "hooker": "~0.2.3", + "iconv-lite": "~0.2.5", + "js-yaml": "~1.0.1", + "lodash": "~0.9.0", + "minimatch": "~0.2.6", + "nopt": "~1.0.10", + "rimraf": "~2.0.2", + "underscore.string": "~2.2.0rc", + "which": "~1.0.5" }, "dependencies": { + "async": { + "version": "0.1.22", + "resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz", + "integrity": "sha512-2tEzliJmf5fHNafNwQLJXUasGzQCVctvsNkXmnlELHwypU0p08/rHohYvkqKIjyXpx+0rkrYv6QbhJ+UF4QkBg==", + "dev": true + }, + "coffee-script": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz", + "integrity": "sha512-QjQ1T4BqyHv19k6XSfdhy/QLlIOhywz0ekBUCa9h71zYMJlfDTGan/Z1JXzYkZ6v8R+GhvL/p4FZPbPW8WNXlg==", + "dev": true + }, "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "version": "3.1.21", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", + "integrity": "sha512-ANhy2V2+tFpRajE3wN4DhkNQ08KDr0Ir1qL12/cUe5+a7STEK8jkW4onUYuY8/06qAFuT5je7mjAqzx0eKI2tQ==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "graceful-fs": "~1.2.0", + "inherits": "1", + "minimatch": "~0.2.11" } }, - "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "graceful-fs": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", + "integrity": "sha512-iiTUZ5vZ+2ZV+h71XAgwCSu6+NAizhFU3Yw8aC/hH5SQ3SnISqEqAek40imAFGtDcwJKNhXvSY+hzIolnLwcdQ==", + "dev": true + }, + "inherits": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", + "integrity": "sha512-Al67oatbRSo3RV5hRqIoln6Y5yMVbJSIn4jEJNL7VCImzq/kLr7vvb6sFRJXqr8rpHc/2kJOM+y0sPKN47VdzA==", + "dev": true + }, + "minimatch": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", + "integrity": "sha512-zZ+Jy8lVWlvqqeM8iZB7w7KmQkoJn8djM585z88rywrEbzoqawVa9FR5p2hwD+y74nfuKOjmNvi9gtWJNLqHvA==", + "dev": true, + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + }, + "underscore.string": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", + "integrity": "sha512-3FVmhXqelrj6gfgp3Bn6tOavJvW0dNH2T+heTD38JRxIrAbiuzbqjknszoOYj3DyFB1nWiLj208Qt2no/L4cIA==", "dev": true } } @@ -2708,51 +2643,6 @@ "integrity": "sha512-GD7cTz0I4SAede1/+pAbmJRG44zFLPipVtdL9o3vqx9IEyb7b4/Y3s7r6ofI3CchR5GvYJ+8buCSioDv5dQLiA==", "dev": true }, - "grunt-legacy-log": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-3.0.0.tgz", - "integrity": "sha512-GHZQzZmhyq0u3hr7aHW4qUH0xDzwp2YXldLPZTCjlOeGscAOWWPftZG3XioW8MasGp+OBRIu39LFx14SLjXRcA==", - "dev": true, - "requires": { - "colors": "~1.1.2", - "grunt-legacy-log-utils": "~2.1.0", - "hooker": "~0.2.3", - "lodash": "~4.17.19" - } - }, - "grunt-legacy-log-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.1.0.tgz", - "integrity": "sha512-lwquaPXJtKQk0rUM1IQAop5noEpwFqOXasVoedLeNzaibf/OPWjKYvvdqnEHNmU+0T0CaReAXIbGo747ZD+Aaw==", - "dev": true, - "requires": { - "chalk": "~4.1.0", - "lodash": "~4.17.19" - } - }, - "grunt-legacy-util": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-2.0.1.tgz", - "integrity": "sha512-2bQiD4fzXqX8rhNdXkAywCadeqiPiay0oQny77wA2F3WF4grPJXCvAcyoWUJV+po/b15glGkxuSiQCK299UC2w==", - "dev": true, - "requires": { - "async": "~3.2.0", - "exit": "~0.1.2", - "getobject": "~1.0.0", - "hooker": "~0.2.3", - "lodash": "~4.17.21", - "underscore.string": "~3.3.5", - "which": "~2.0.2" - }, - "dependencies": { - "async": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", - "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", - "dev": true - } - } - }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -2762,12 +2652,6 @@ "function-bind": "^1.1.1" } }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, "homedir-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", @@ -2784,13 +2668,10 @@ "dev": true }, "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", + "integrity": "sha512-KhmFWgaQZY83Cbhi+ADInoUQ8Etn6BG5fikM9syeOjQltvR45h7cRKJ/9uvQEuD61I3Uju77yYce0/LhKVClQw==", + "dev": true }, "inflight": { "version": "1.0.6", @@ -2970,13 +2851,12 @@ } }, "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-1.0.3.tgz", + "integrity": "sha512-UqzDrK8526iLQnHaXZDBiAwn+ubNakeOViDTn/jK/PvoV8Zbib1ldAgvEopGIH4JqolR3zKPIMmxi9c5RpZ+EA==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "~ 0.1.3" } }, "kind-of": { @@ -3024,9 +2904,9 @@ } }, "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz", + "integrity": "sha512-LVbt/rjK62gSbhehDVKL0vlaime4Y1IBixL+bKeNfoY4L2zab/jGrxU6Ka05tMA/zBxkTk5t3ivtphdyYupczw==", "dev": true }, "lru-cache": { @@ -3103,9 +2983,9 @@ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", "dev": true, "requires": { "abbrev": "1" @@ -3304,20 +3184,14 @@ } }, "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.0.3.tgz", + "integrity": "sha512-uR09PSoW2+1hW0hquRqxb+Ae2h6R5ls3OAy2oNekQFtqbSJkltkhKRa+OhZKoxWsN9195Gp1vg7sELDRoJ8a3w==", "dev": true, "requires": { - "glob": "^7.1.3" + "graceful-fs": "~1.1" } }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, "season": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/season/-/season-6.0.2.tgz", @@ -3343,12 +3217,6 @@ "amdefine": ">=0.0.4" } }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true - }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -3367,15 +3235,6 @@ "ansi-regex": "^2.0.0" } }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, "supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -3469,13 +3328,10 @@ "dev": true }, "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/which/-/which-1.0.9.tgz", + "integrity": "sha512-E87fdQ/eRJr9W1X4wTPejNy9zTW3FI2vpCZSJ/HAY+TkjKVC0TUm1jk6vn2Z7qay0DQy0+RBGdXxj+RmmiGZKQ==", + "dev": true }, "window-size": { "version": "0.1.4", diff --git a/package.json b/package.json index dc2e3b5..b57666b 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,10 @@ "underscore-plus": "^1" }, "devDependencies": { - "grunt": "^1.5.3", - "grunt-atomdoc": "^1.0.0", + "grunt": "^0.4.0", + "grunt-atomdoc": "^1.0.1", "grunt-cli": "^1.4.3", "jasmine-focused": "^1", - "pegjs": "^0.10.0", - "rimraf": "^3.0.2" + "pegjs": "^0.10.0" } } From 8dec1ec9385146cf72730328fa5602f5565e4772 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Sat, 26 Nov 2022 14:45:19 -0800 Subject: [PATCH 25/25] Updated ReadMe for `parse` script --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0f331f9..b2a8187 100644 --- a/README.md +++ b/README.md @@ -120,3 +120,4 @@ lines and a `tags` key, pointing to an array of tags arrays described above. * Run `npm test` to run the specs * Run `npm run benchmark` to benchmark fully tokenizing jQuery 2.0.3 and the CSS for Twitter Bootstrap 3.1.1 + * If you make changes to `./src/scope-selector-parser.pegjs` ensure to run `npm run parse` to generate the JS form of PegJS.