Skip to content

TJSONScanner

JSON lexical scanner

Declaration

Source position: jsonscanner.pp line 75

type

  TJSONScanner = class
  public
    constructor Create(Source: TStream; AUseUTF8: Boolean=True); overload;
    constructor Create(Source: TStream; AOptions: TJSONOptions); overload;
    constructor Create(const aSource: RawByteString; AUseUTF8: Boolean=True); overload;
    constructor Create(const aSource: RawByteString; AOptions: TJSONOptions); overload;
    function FetchToken : TJSONToken;
    property CurLine: Ansistring; {r}
    property CurRow: Integer; {r}
    property CurColumn: Integer; {r}
    property AbsolutePos: Integer; {r}
    property CurToken: TJSONToken; {r}
    property CurTokenString: Ansistring; {r}
    property Strict: Boolean; {rw}
    property UseUTF8: Boolean; {rw}
    property Options: TJSONOptions; {rw}
  end;

Description

Lexical scanner class that tokenizes JSON text input. Breaks JSON source into discrete tokens for subsequent parsing by higher-level parsers. Supports various scanning options through TJSONOptions.

Properties

Member Visibility Description
AbsolutePos read only public Absolute character position
CurColumn read only public Current column number
CurLine read only public Current line content
CurRow read only public Current row number
CurToken read only public Current token type
CurTokenString read only public Current token string value
Options public Scanner options set
Strict public Strict JSON parsing mode
UseUTF8 public UTF-8 encoding mode

Methods

Member Visibility Description
Create public Create JSON scanner instance
FetchToken public Fetch next token from input

Errors

Raises EScannerError when encountering invalid JSON syntax or characters.

See also

Name Description
TJSONToken JSON token types
TJSONOptions Set of JSON scanner options
EScannerError JSON scanner exception