The scanner object, representing a JSON scanner at a position in the input string.

interface JSONScanner {
    getPosition(): number;
    getToken(): SyntaxKind;
    getTokenError(): ScanError;
    getTokenLength(): number;
    getTokenOffset(): number;
    getTokenStartCharacter(): number;
    getTokenStartLine(): number;
    getTokenValue(): string;
    scan(): SyntaxKind;
    setPosition(pos: number): void;
}

Methods

  • Returns the zero-based current scan position, which is after the last read token.

    Returns number

  • The length of the last read token.

    Returns number

  • The zero-based start offset of the last read token.

    Returns number

  • The zero-based start character (column) of the last read token.

    Returns number

  • The zero-based start line number of the last read token.

    Returns number

  • Returns the last read token value. The value for strings is the decoded string content. For numbers it's of type number, for boolean it's true or false.

    Returns string

  • Sets the scan position to a new offset. A call to 'scan' is needed to get the first token.

    Parameters

    • pos: number

    Returns void