This commit is contained in:
Alex Dima 2015-11-25 17:32:44 +01:00
Родитель fbfbf78af3
Коммит e901b07f10
5 изменённых файлов: 4163 добавлений и 31 удалений

30
.vscode/launch.json поставляемый
Просмотреть файл

@ -1,46 +1,22 @@
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
"configurations": [
{
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Launch test.js",
// Type of configuration.
"name": "Launch tests",
"type": "node",
// Request type of configuration. Can be "launch" or "attach".
"request": "launch",
// Workspace relative or absolute path to the program.
"program": "./test.js",
// Automatically stop program after launch.
"program": "./node_modules/gulp/bin/gulp.js",
"stopOnEntry": false,
// Command line arguments passed to the program.
"args": [],
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
"args": [ "test" ],
"cwd": ".",
// Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
"runtimeExecutable": null,
// Optional arguments passed to the runtime executable.
"runtimeArgs": ["--nolazy"],
// Environment variables passed to the program.
"env": {
"NODE_ENV": "development"
},
// Launch debug target in external console.
"externalConsole": false,
// Use JavaScript source maps (if they exist).
"sourceMaps": false,
// If JavaScript source maps are enabled, the generated code is expected in this directory.
"outDir": null
},
{
"name": "Attach",
"type": "node",
"request": "attach",
// TCP/IP address. Default is "localhost".
"address": "localhost",
// Port to attach to.
"port": 5858,
"sourceMaps": false
}
]
}

Просмотреть файл

@ -376,7 +376,8 @@ var __extends = (this && this.__extends) || function (d, b) {
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var utils_1 = require('./utils');
var BACK_REFERENCING_END = /\\(\d+)/;
var HAS_BACK_REFERENCES = /\\(\d+)/;
var BACK_REFERENCING_END = /\\(\d+)/g;
var Rule = (function () {
function Rule(id, name, contentName) {
this.id = id;
@ -429,7 +430,7 @@ var RegExpSource = (function () {
this._anchorCache = this._buildAnchorCache();
}
this.ruleId = ruleId;
this.hasBackReferences = BACK_REFERENCING_END.test(this.source);
this.hasBackReferences = HAS_BACK_REFERENCES.test(this.source);
// console.log('input: ' + regExpSource + ' => ' + this.source + ', ' + this.hasAnchor);
}
RegExpSource.prototype.clone = function () {
@ -484,6 +485,7 @@ var RegExpSource = (function () {
var capturedValues = captureIndices.map(function (capture) {
return lineText.substring(capture.start, capture.end);
});
BACK_REFERENCING_END.lastIndex = 0;
return this.source.replace(BACK_REFERENCING_END, function (match, g1) {
return escapeRegExpCharacters(capturedValues[parseInt(g1, 10)] || '');
});

Просмотреть файл

@ -7,7 +7,8 @@ import {RegexSource, mergeObjects} from './utils';
import {IRawGrammar, IRawRepository, IRawRule, IRawCaptures} from './types';
import {OnigScanner, IOnigCaptureIndex} from 'oniguruma';
const BACK_REFERENCING_END = /\\(\d+)/;
const HAS_BACK_REFERENCES = /\\(\d+)/;
const BACK_REFERENCING_END = /\\(\d+)/g;
export interface IRuleRegistry {
getRule(patternId:number): Rule;
@ -110,7 +111,7 @@ export class RegExpSource {
}
this.ruleId = ruleId;
this.hasBackReferences = BACK_REFERENCING_END.test(this.source);
this.hasBackReferences = HAS_BACK_REFERENCES.test(this.source);
// console.log('input: ' + regExpSource + ' => ' + this.source + ', ' + this.hasAnchor);
}
@ -176,6 +177,7 @@ export class RegExpSource {
let capturedValues = captureIndices.map((capture) => {
return lineText.substring(capture.start, capture.end);
});
BACK_REFERENCING_END.lastIndex = 0;
return this.source.replace(BACK_REFERENCING_END, (match, g1) => {
return escapeRegExpCharacters(capturedValues[parseInt(g1, 10)] || '');
});

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -542,5 +542,67 @@
]
}
]
},
{
"grammars": [
"fixtures/Ruby.plist"
],
"grammarPath": "fixtures/Ruby.plist",
"desc": "Ruby",
"lines": [
{
"line": " %r{^/Developer} === prefix",
"tokens": [
{
"value": " ",
"scopes": [
"source.ruby"
]
},
{
"value": "%r{",
"scopes": [
"source.ruby",
"string.regexp.percent.ruby",
"punctuation.definition.string.begin.ruby"
]
},
{
"value": "^/Developer",
"scopes": [
"source.ruby",
"string.regexp.percent.ruby"
]
},
{
"value": "}",
"scopes": [
"source.ruby",
"string.regexp.percent.ruby",
"punctuation.definition.string.end.ruby"
]
},
{
"value": " ",
"scopes": [
"source.ruby"
]
},
{
"value": "===",
"scopes": [
"source.ruby",
"keyword.operator.comparison.ruby"
]
},
{
"value": " prefix",
"scopes": [
"source.ruby"
]
}
]
}
]
}
]