Class: Mistri::PartialJson::Parser
- Inherits:
-
Object
- Object
- Mistri::PartialJson::Parser
- 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
-
#initialize(source) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
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
#parse ⇒ Object
40 |
# File 'lib/mistri/partial_json.rb', line 40 def parse = value |