Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IParser<Result>

The streaming parser.

template

type of the result returned by IParser.write and IParser.parse methods.

Type parameters

  • Result

Hierarchy

  • IParser

Index

Methods

Methods

parse

  • parse(source?: string): Result
  • Parses the source. If there's a leftover in the internal buffer after the last write call it is also used for parsing. Parser is reset after parsing is completed.

    Parameters

    • Optional source: string

      The source to parse. If omitted then content of the internal buffer is parsed.

    Returns Result

reset

  • reset(): void
  • Clears the internal buffer and resets the parser state.

    Returns void

write

  • write(sourceChunk: string): Result
  • Tries to parse a given source chunk. If there's an ambiguity during parsing then the parser is paused until the next write or parse invocation. The part of chunk that wasn't parsed is appended to an internal buffer.

    Parameters

    • sourceChunk: string

      The source chunk to parse.

    Returns Result

Generated using TypeDoc