Class: Mistri::PartialJson::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/mistri/partial_json.rb

Overview

Recursive descent over the prefix. Truncation trips @partial, and every frame unwinds keeping the structure built so far.

Constant Summary collapse

NOTHING =
Object.new
LITERALS =
{ "true" => true, "false" => false, "null" => nil }.freeze
MAX_DEPTH =

Nesting past this is treated as truncated: a model's real tool arguments never nest this deep, and the cap keeps a pathological input from overflowing the stack.

256

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Parser

Returns a new instance of Parser.



32
33
34
35
36
37
38
# File 'lib/mistri/partial_json.rb', line 32

def initialize(source)
  @s = source
  @n = source.length
  @i = 0
  @partial = false
  @depth = 0
end

Instance Method Details

#parseObject



40
# File 'lib/mistri/partial_json.rb', line 40

def parse = value