src/vs/workbench/contrib/files/common/explorerFileNestingTrie.ts/SubstitutionString/constructor
class SubstitutionString:	constructor(pattern: string) {
		substitutionStringTokenizer.lastIndex = 0;
		let token;
		let lastIndex = 0;
		while (token = substitutionStringTokenizer.exec(pattern)) {
			const prefix = pattern.slice(lastIndex, token.index);
			this.tokens.push(prefix);

			const type = token[1];
			switch (type) {
				case SubstitutionType.basename:
				case SubstitutionType.dirname:
				case SubstitutionType.extname:
				case SubstitutionType.capture:
					this.tokens.push({ capture: type });
					break;
				default: throw Error('unknown substitution type: ' + type);
			}
			lastIndex = token.index + token[0].length;
		}

		if (lastIndex !== pattern.length) {
			const suffix = pattern.slice(lastIndex, pattern.length);
			this.tokens.push(suffix);
		}
	}