@unisnips/ultisnips
Version:
Utilities for converting ultisnips in unisnips project
33 lines (32 loc) • 1.25 kB
TypeScript
import { SnippetDefinition } from '@unisnips/core';
import { TextPosition } from '../util/position';
import { TokenClass, Token } from './tokenizer';
import { Marker, MarkerClass, TransformableMarker } from '../marker';
declare type ResultPair = {
parent: Marker;
token: Token;
marker: Marker | TransformableMarker;
};
/**
* Turns 'text' into a stream of tokens and creates the text objects from
* those tokens that are mentioned in 'tokenMarkerMap' assuming the
* current 'indent'
*
* The 'allowedTokensInText' define which tokens will be recognized
* in 'text' while 'allowedTokensInTabstops' are the tokens that
* will be recognized in TabStop placeholder text.
*/
export declare function tokenizeSnippetText(snippetInstance: Marker, text: string, indent: TextPosition, allowedTokensInText: TokenClass[], allowedTokensInTabstops: TokenClass[], tokenMarkerMap?: Map<TokenClass, MarkerClass>): {
pairs: ResultPair[];
seenTabstops: any;
};
/**
* WIP: won't need ultisnips text objects by now
* @private
*/
export declare function parseUltiSnips(snip: SnippetDefinition): {
pairs: ResultPair[];
seenTabstops: any;
};
export declare function parseUltiSnipsTokens(snip: SnippetDefinition): Token[];
export {};