vscode-textmate
Advanced tools
Comparing version 1.0.8 to 1.0.9
{ | ||
"name": "vscode-textmate", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "VSCode TextMate grammar helpers", | ||
@@ -23,3 +23,3 @@ "author": { | ||
"dependencies": { | ||
"oniguruma": "^5.1.1", | ||
"alexandrudima-oniguruma": "^6.0.0", | ||
"sax": "^1.1.1" | ||
@@ -26,0 +26,0 @@ }, |
@@ -561,11 +561,42 @@ /*--------------------------------------------------------- | ||
exports.RegExpSource = RegExpSource; | ||
var createOnigScanner = (function () { | ||
var USE_NEW_ONE = true; | ||
var getOnigModule = (function () { | ||
var onigurumaModule = null; | ||
return function createOnigScanner(sources) { | ||
return function () { | ||
if (!onigurumaModule) { | ||
onigurumaModule = require('oniguruma'); | ||
if (USE_NEW_ONE) { | ||
onigurumaModule = require('alexandrudima-oniguruma'); | ||
} | ||
else { | ||
onigurumaModule = require('oniguruma'); | ||
} | ||
} | ||
return new onigurumaModule.OnigScanner(sources); | ||
return onigurumaModule; | ||
}; | ||
})(); | ||
function createOnigScanner(sources) { | ||
var onigurumaModule = getOnigModule(); | ||
return new onigurumaModule.OnigScanner(sources); | ||
} | ||
function createOnigString(sources) { | ||
if (USE_NEW_ONE) { | ||
var onigurumaModule = getOnigModule(); | ||
var r = new onigurumaModule.OnigString(sources); | ||
r.$str = sources; | ||
return r; | ||
} | ||
else { | ||
return sources; | ||
} | ||
} | ||
exports.createOnigString = createOnigString; | ||
function getString(str) { | ||
if (USE_NEW_ONE) { | ||
return str.$str; | ||
} | ||
else { | ||
return str; | ||
} | ||
} | ||
exports.getString = getString; | ||
var RegExpSourceList = (function () { | ||
@@ -1050,5 +1081,6 @@ function RegExpSourceList() { | ||
lineText = lineText + '\n'; | ||
var lineLength = lineText.length; | ||
var onigLineText = rule_1.createOnigString(lineText); | ||
var lineLength = rule_1.getString(onigLineText).length; | ||
var lineTokens = new LineTokens(); | ||
_tokenizeString(this, lineText, isFirstLine, 0, prevState, lineTokens); | ||
_tokenizeString(this, onigLineText, isFirstLine, 0, prevState, lineTokens); | ||
var _produced = lineTokens.getResult(prevState, lineLength); | ||
@@ -1102,8 +1134,8 @@ return { | ||
var stackClone = stack.map(function (el) { return el.clone(); }); | ||
stackClone.push(new StackElement(captureRule.retokenizeCapturedWithRuleId, captureIndex.start, null, captureRule.getName(lineText, captureIndices), captureRule.getContentName(lineText, captureIndices))); | ||
_tokenizeString(grammar, lineText.substring(0, captureIndex.end), (isFirstLine && captureIndex.start === 0), captureIndex.start, stackClone, lineTokens); | ||
stackClone.push(new StackElement(captureRule.retokenizeCapturedWithRuleId, captureIndex.start, null, captureRule.getName(rule_1.getString(lineText), captureIndices), captureRule.getContentName(rule_1.getString(lineText), captureIndices))); | ||
_tokenizeString(grammar, rule_1.createOnigString(rule_1.getString(lineText).substring(0, captureIndex.end)), (isFirstLine && captureIndex.start === 0), captureIndex.start, stackClone, lineTokens); | ||
continue; | ||
} | ||
// push | ||
localStack.push(new LocalStackElement(captureRule.getName(lineText, captureIndices), captureIndex.end)); | ||
localStack.push(new LocalStackElement(captureRule.getName(rule_1.getString(lineText), captureIndices), captureIndex.end)); | ||
} | ||
@@ -1191,3 +1223,3 @@ while (localStack.length > 0) { | ||
function _tokenizeString(grammar, lineText, isFirstLine, linePos, stack, lineTokens) { | ||
var lineLength = lineText.length; | ||
var lineLength = rule_1.getString(lineText).length; | ||
var anchorPosition = -1; | ||
@@ -1231,3 +1263,3 @@ while (linePos < lineLength) { | ||
// push it on the stack rule | ||
stack.push(new StackElement(matchedRuleId, linePos, null, _rule.getName(lineText, captureIndices), null)); | ||
stack.push(new StackElement(matchedRuleId, linePos, null, _rule.getName(rule_1.getString(lineText), captureIndices), null)); | ||
if (_rule instanceof rule_1.BeginEndRule) { | ||
@@ -1238,5 +1270,5 @@ var pushedRule = _rule; | ||
anchorPosition = captureIndices[0].end; | ||
stack[stack.length - 1].contentName = pushedRule.getContentName(lineText, captureIndices); | ||
stack[stack.length - 1].contentName = pushedRule.getContentName(rule_1.getString(lineText), captureIndices); | ||
if (pushedRule.endHasBackReferences) { | ||
stack[stack.length - 1].endRule = pushedRule.getEndWithResolvedBackReferences(lineText, captureIndices); | ||
stack[stack.length - 1].endRule = pushedRule.getEndWithResolvedBackReferences(rule_1.getString(lineText), captureIndices); | ||
} | ||
@@ -1243,0 +1275,0 @@ if (!hasAdvanced && stackElement.ruleId === stack[stack.length - 1].ruleId) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
487898
6
1573
+ Addedalexandrudima-oniguruma@6.0.3(transitive)
- Removedoniguruma@^5.1.1
- Removedoniguruma@5.1.2(transitive)