holo_json/parser

Source   Edit  

Types

JsonValueKind = enum
  JsonInvalid, JsonObject, JsonArray, JsonString, JsonNumber, JsonRawNan,
  JsonRawInf, JsonRawNegInf, JsonTrue, JsonFalse, JsonNull
Source   Edit  
RawJsonValue = object
  kind*: JsonValueKind
  raw*: RawJson
Source   Edit  

Procs

proc parseByteEscape(reader: JsonReaderArg): byte {.
    ...raises: [Exception, JsonParseError], tags: [RootEffect], forbids: [].}
Source   Edit  
proc parseError(reader: JsonReaderArg; msg: string) {.inline,
    ...raises: [JsonParseError], tags: [], forbids: [].}
Shortcut to raise an exception. Source   Edit  
proc parseHexInt[I](reader: JsonReaderArg; a: array[I, char]): int {.inline.}
Source   Edit  
proc parseString(format: JsonReadFormat; reader: JsonReaderArg;
                 quoteSkipped = false): string {.
    ...raises: [Exception, JsonParseError, Exception, JsonParseError],
    tags: [RootEffect], forbids: [].}
Source   Edit  
proc parseUnicodeEscape(format: JsonReadFormat; reader: JsonReaderArg): int {.
    ...raises: [Exception, JsonParseError], tags: [RootEffect], forbids: [].}
Source   Edit  
proc peekRawKind(format: JsonReadFormat; reader: JsonReaderArg): JsonValueKind {.
    ...raises: [Exception, JsonParseError], tags: [RootEffect], forbids: [].}
guesses which kind the next object is, assumes spaces are skipped not guaranteed to be accurate, all numbers are assumed float Source   Edit  
proc peekRawKindSkipSpace(format: JsonReadFormat; reader: JsonReaderArg): JsonValueKind {.
    inline, ...raises: [Exception, JsonParseError], tags: [RootEffect], forbids: [].}
guesses which kind the next object is, skips spaces not guaranteed to be accurate, all numbers are assumed float Source   Edit  
proc peekRawValueSkipSpace(format: JsonReadFormat; reader: JsonReaderArg): RawJsonValue {.
    ...raises: [Exception, JsonParseError], tags: [RootEffect], forbids: [].}
reads a full raw json value, relatively inefficient and mostly meant for errors Source   Edit  
proc readRawValue(format: JsonReadFormat; reader: JsonReaderArg): RawJsonValue {.
    ...raises: [Exception, JsonParseError], tags: [RootEffect], forbids: [].}
Source   Edit  
proc skipBlockComment(reader: JsonReaderArg) {.
    ...raises: [Exception, JsonParseError], tags: [RootEffect], forbids: [].}
Source   Edit  
proc skipChar(reader: JsonReaderArg; c: char) {.inline,
    ...raises: [Exception, JsonParseError], tags: [RootEffect], forbids: [].}
Will consume space before and then the character c. Will raise a parsing error if c is not found. Source   Edit  
proc skipLineComment(reader: JsonReaderArg) {....raises: [Exception],
    tags: [RootEffect], forbids: [].}
Source   Edit  
proc skipNumber(format: JsonReadFormat; reader: JsonReaderArg): int {.
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
returns start position in buffer Source   Edit  
proc skipSpace(reader: JsonReaderArg) {.inline, ...raises: [Exception],
                                        tags: [RootEffect], forbids: [].}
Will consume whitespace. and comments if -d:holoJsonCommentSupport is enabled Source   Edit  
proc skipValue(format: JsonReadFormat; reader: JsonReaderArg): int {.
    ...raises: [Exception, JsonParseError], tags: [RootEffect], forbids: [].}
Used to skip values of extra fields, or wrongly typed values for errors. returns start position in buffer Source   Edit  
proc validRune(reader: JsonReaderArg; rune: var Rune; start: char): int {.
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
Source   Edit