src/vs/editor/contrib/snippet/snippetParser.ts/SnippetParser/parse
class SnippetParser:	parse(value: string, insertFinalTabstop?: boolean, enforceFinalTabstop?: boolean): TextmateSnippet {

		this._scanner.text(value);
		this._token = this._scanner.next();

		const snippet = new TextmateSnippet();
		while (this._parse(snippet)) {
			// nothing
		}

		// fill in values for placeholders. the first placeholder of an index
		// that has a value defines the value for all placeholders with that index
		const placeholderDefaultValues = new Map<number, Marker[] | undefined>();
		const incompletePlaceholders: Placeholder[] = [];
		let placeholderCount = 0;
		snippet.walk(marker => {
			if (marker instanceof Placeholder) {
				placeholderCount += 1;
				if (marker.isFinalTabstop) {
					placeholderDefaultValues.set(0, undefined);
				} else if (!placeholderDefaultValues.has(marker.index) && marker.children.length > 0) {
					placeholderDefaultValues.set(marker.index, marker.children);
				} else {
					incompletePlaceholders.push(marker);
				}
			}
			return true;
		});
		for (const placeholder of incompletePlaceholders) {
			const defaultValues = placeholderDefaultValues.get(placeholder.index);
			if (defaultValues) {
				const clone = new Placeholder(placeholder.index);
				clone.transform = placeholder.transform;
				for (const child of defaultValues) {
					clone.appendChild(child.clone());
				}
				snippet.replace(placeholder, [clone]);
			}
		}

		if (!enforceFinalTabstop) {
			enforceFinalTabstop = placeholderCount > 0 && insertFinalTabstop;
		}

		if (!placeholderDefaultValues.has(0) && enforceFinalTabstop) {
			// the snippet uses placeholders but has no
			// final tabstop defined -> insert at the end
			snippet.appendChild(new Placeholder(0));
		}

		return snippet;
	}