Exemplo n.º 1
0
    public override void finish_array()
    {
        Debug.Assert(stack.Count > 0);
        Debug.Assert(label_stack.Count == stack.Count);
        JSONValue item = stack[stack.Count - 1];

        Debug.Assert(item.kind() == JSONValue.Kind.JVK_ARRAY);
        label = label_stack[label_stack.Count - 1];
        stack.RemoveAt(stack.Count - 1);
        label_stack.RemoveAt(label_stack.Count - 1);
        handle_value(item);
    }
Exemplo n.º 2
0
 private void handle_value(JSONValue item)
 {
     if (stack.Count == 0)
     {
         result = item;
         new_value(result);
         handle_result(result);
     }
     else
     {
         JSONValue top = stack[stack.Count - 1];
         if (top.kind() == JSONValue.Kind.JVK_ARRAY)
         {
             ((JSONArrayValue)top).appendComponent(item);
         }
         else
         {
             Debug.Assert(top.kind() == JSONValue.Kind.JVK_OBJECT);
             ((JSONObjectValue)top).appendPair(label, item);
         }
     }
 }