Beispiel #1
0
    [ImplicitConsts] public static P6any from_jsync(Constants c, string inp)
    {
        JsyncReader j = new JsyncReader()
        {
            setting = c.setting
        };

        j.from = inp;
        j.SkipWhite(true);
        Variable top = j.GetTopLevel();

        foreach (KeyValuePair <string, List <Variable> > da in j.anchorrefs)
        {
            P6any r;
            if (!j.anchors.TryGetValue(da.Key, out r))
            {
                j.Err("Undefined anchor " + da.Key);
            }
            foreach (Variable to in da.Value)
            {
                to.Store(r);
            }
        }

        j.SkipWhite(false);
        if (j.ix != inp.Length)
        {
            j.Err("Trailing garbage after object");
        }

        return(top.Fetch());
    }
Beispiel #2
0
    // TODO GetTopLevel

    public static P6any FromJson(string inp)
    {
        JsyncReader j = new JsyncReader();

        j.from = inp;
        j.SkipWhite(true);
        Variable top = j.GetFromJson(true);

        j.SkipWhite(false);
        if (j.ix != inp.Length)
        {
            j.Err("Trailing garbage after object");
        }

        return(top.Fetch());
    }
Beispiel #3
0
    [ImplicitConsts] public static P6any from_json(Constants c, string inp)
    {
        JsyncReader j = new JsyncReader()
        {
            setting = c.setting
        };

        j.from = inp;
        j.SkipWhite(true);
        Variable top = j.GetFromJson(true);

        j.SkipWhite(false);
        if (j.ix != inp.Length)
        {
            j.Err("Trailing garbage after object");
        }

        return(top.Fetch());
    }