json_serialization/lexer

Source   Edit  

Types

JsonErrorKind = enum
  errNone = "no error",
  errHexCharExpected = "hex char expected (part of escape sequence)",
  errStringExpected = "string expected", errColonExpected = "\':\' expected",
  errCommaExpected = "\',\' expected", errBracketRiExpected = "\']\' expected",
  errCurlyRiExpected = "\'}\' expected",
  errBracketLeExpected = "\'[\' expected",
  errCurlyLeExpected = "\'{\' expected",
  errQuoteExpected = "\'\"\' or \"\'\" expected",
  errNumberExpected = "number expected",
  errExponentTooLarge = "exponent too large",
  errUnexpectedEof = "unexpected end of file",
  errCommentExpected = "comment expected",
  errBoolExpected = "boolean value expected",
  errNullExpected = "null value expected", errCommentNotAllowed = "comment not allowed, please set \'allowComments\' flag", errTrailingComma = "trailing comma not allowed, please set \'trailingComma\' flag", errOrphanSurrogate = "unicode surrogates must be followed by another unicode character",
  errNonPortableInt = "number is outside the range of portable values",
  errCustomIntExpected = "not a customised integer",
  errCustomBlobExpected = "not a customised quoted blob",
  errLeadingZero = "leading zero is not allowed in integer",
  errU64Overflow = "uint64 overflow detected",
  errIntDigitLimit = "max number of integer digits reached",
  errFracDigitLimit = "max number of fraction digits reached",
  errExpDigitLimit = "max number of exponent digits reached",
  errInvalidBool = "invalid boolean value",
  errInvalidNull = "invalid null value", errStringLengthLimit = "max number of string chars reached, please set `stringLengthLimit` to overrride",
  errEscapeHex = "please set `escapeHex` flag to allow \\xHH escape mode", errRelaxedEscape = "unsupported escape char, set `relaxedEscape` flag to override", errLeadingFraction = "fraction number must be preceded by number, set `leadingFraction` to override",
  errUnknownChar = "unknown character", errNestedDepthLimit = "max depth of nested structure reached, please set `nestedDepthLimit` to override", errArrayElementsLimit = "max number of array elements reached, please set `arrayElementsLimit` to override", errObjectMembersLimit = "max number of object members reached, please set `objectMembersLimit` to override",
  errMissingFirstElement = "first array/table element missing", errEmptyFraction = "fraction number should have at least one fractional digit", errIntPosSign = "integer with positive sign is not allowed, please set `integerPositiveSign` to override",
  errValueExpected = "json value expected, got comma",
  errEscapeControlChar = "control character x00-x1F must be escaped",
  errInvalidInt = "invalid integer value"
Source   Edit  
JsonLexer = object
  stream*: InputStream
  err*: JsonErrorKind
  flags*: JsonReaderFlags
  conf*: JsonReaderConf
  line*: int
Source   Edit  

Procs

proc col(lex: JsonLexer): int {....raises: [], gcsafe, tags: [], forbids: [].}
Source   Edit  
proc init(T: type JsonLexer; stream: InputStream;
          flags: JsonReaderFlags = defaultJsonReaderFlags;
          conf: JsonReaderConf = defaultJsonReaderConf): T:type {....raises: [],
    gcsafe.}
Source   Edit  
func isErr(lex: JsonLexer): bool {....raises: [], gcsafe, tags: [], forbids: [].}
Source   Edit  
proc nonws(lex: var JsonLexer): char {....gcsafe, raises: [IOError], raises: [],
                                       gcsafe, tags: [RootEffect], forbids: [].}
Source   Edit  
proc scanArray[T](lex: var JsonLexer; val: var T) {....gcsafe, raises: [IOError],
    raises: [], gcsafe.}
Source   Edit  
proc scanBool(lex: var JsonLexer): bool {....gcsafe, raises: [IOError], raises: [],
    gcsafe, tags: [RootEffect], forbids: [].}
Source   Edit  
proc scanNull(lex: var JsonLexer) {....gcsafe, raises: [IOError], raises: [],
                                    gcsafe, tags: [RootEffect], forbids: [].}
Source   Edit  
proc scanNumber[T](lex: var JsonLexer; val: var T) {....gcsafe, raises: [IOError],
    raises: [], gcsafe.}
Source   Edit  
proc scanObject[T](lex: var JsonLexer; val: var T) {....gcsafe, raises: [IOError],
    raises: [], gcsafe.}
Source   Edit  
proc scanString[T](lex: var JsonLexer; val: var T; limit: int) {....gcsafe,
    raises: [IOError], raises: [], gcsafe.}
scanInt only accepts string or JsonVoid If all goes ok, parsed-value is returned. If exceeds string length limit, lex.err = errStringLengthLimit. Source   Edit  
proc scanValue[T](lex: var JsonLexer; val: var T) {....gcsafe, raises: [IOError],
    raises: [], gcsafe.}
Source   Edit  
proc tokenStartCol(lex: JsonLexer): int {....raises: [], gcsafe, tags: [],
    forbids: [].}
Source   Edit  
proc tokKind(lex: var JsonLexer): JsonValueKind {....gcsafe, raises: [IOError],
    raises: [], gcsafe, tags: [RootEffect], forbids: [].}
Source   Edit  

Templates

template parseArrayImpl(lex: JsonLexer; numElem: untyped;
                        actionInitial: untyped; actionClosing: untyped;
                        actionComma: untyped; actionValue: untyped;
                        actionError: untyped) {..}
Source   Edit  
template parseObjectImpl(lex: JsonLexer; skipNullFields: static[bool];
                         actionInitial: untyped; actionClosing: untyped;
                         actionComma: untyped; actionKey: untyped;
                         actionValue: untyped; actionError: untyped) {..}
Source   Edit