create-tokenizer.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. * Parser.
  12. * @param {InitialConstruct} initialize
  13. * Construct.
  14. * @param {Omit<Point, '_bufferIndex' | '_index'> | undefined} [from]
  15. * Point (optional).
  16. * @returns {TokenizeContext}
  17. * Context.
  18. */
  19. export function createTokenizer(parser: ParseContext, initialize: InitialConstruct, from?: Omit<Point, "_bufferIndex" | "_index"> | undefined): TokenizeContext;
  20. /**
  21. * Restore the state.
  22. */
  23. export type Restore = () => undefined;
  24. /**
  25. * Info.
  26. */
  27. export type Info = {
  28. /**
  29. * Restore.
  30. */
  31. restore: Restore;
  32. /**
  33. * From.
  34. */
  35. from: number;
  36. };
  37. /**
  38. * Handle a successful run.
  39. */
  40. export type ReturnHandle = (construct: Construct, info: Info) => undefined;
  41. import type { ParseContext } from 'micromark-util-types';
  42. import type { InitialConstruct } from 'micromark-util-types';
  43. import type { Point } from 'micromark-util-types';
  44. import type { TokenizeContext } from 'micromark-util-types';
  45. import type { Construct } from 'micromark-util-types';
  46. //# sourceMappingURL=create-tokenizer.d.ts.map