create-tokenizer.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Create a tokenizer.
  3. * Tokenizers deal with one type of data (e.g., containers, flow, text).
  4. * The parser is the object dealing with it all.
  5. * `initialize` works like other constructs, except that only its `tokenize`
  6. * function is used, in which case it doesn’t receive an `ok` or `nok`.
  7. * `from` can be given to set the point before the first character, although
  8. * when further lines are indented, they must be set with `defineSkip`.
  9. *
  10. * @param {ParseContext} parser
  11. * @param {InitialConstruct} initialize
  12. * @param {Omit<Point, '_bufferIndex' | '_index'> | undefined} [from]
  13. * @returns {TokenizeContext}
  14. */
  15. export function createTokenizer(
  16. parser: ParseContext,
  17. initialize: InitialConstruct,
  18. from?: Omit<Point, '_bufferIndex' | '_index'> | undefined
  19. ): TokenizeContext
  20. export type Chunk = import('micromark-util-types').Chunk
  21. export type Code = import('micromark-util-types').Code
  22. export type Construct = import('micromark-util-types').Construct
  23. export type ConstructRecord = import('micromark-util-types').ConstructRecord
  24. export type Effects = import('micromark-util-types').Effects
  25. export type InitialConstruct = import('micromark-util-types').InitialConstruct
  26. export type ParseContext = import('micromark-util-types').ParseContext
  27. export type Point = import('micromark-util-types').Point
  28. export type State = import('micromark-util-types').State
  29. export type Token = import('micromark-util-types').Token
  30. export type TokenType = import('micromark-util-types').TokenType
  31. export type TokenizeContext = import('micromark-util-types').TokenizeContext
  32. export type Restore = () => undefined
  33. export type Info = {
  34. restore: Restore
  35. from: number
  36. }
  37. /**
  38. * Handle a successful run.
  39. */
  40. export type ReturnHandle = (construct: Construct, info: Info) => undefined