public static JsonParser jsonParserFromString(string input)
 {
     var inputStream = new ANTLRStringStream(input);
     var lexer = new JsonLexer(inputStream);
     var tokens = new CommonTokenStream(lexer);
     var parser = new JsonParser(tokens);
     return parser;
 }
Пример #2
0
        private static JsonObject ParseANTLRStream(ANTLRStringStream inputStream)
        {
            var lexer     = new JsonLexer(inputStream);
            var tokens    = new CommonTokenStream(lexer);
            var parser    = new JsonParser(tokens);
            var parseTree = parser.@object().Tree;
            var stream    = new CommonTreeNodeStream(parseTree);
            var tree      = new JsonTree(stream);

            var @object = tree.@object();

            Contract.Assume(@object != null);
            return(new JsonObject(JsonValueTypes.Interpret(@object)));
        }
Пример #3
0
        public static JsonArray Parse(string s)
        {
            var inputStream = new ANTLRStringStream(s);
            var lexer       = new JsonLexer(inputStream);
            var tokens      = new CommonTokenStream(lexer);
            var parser      = new JsonParser(tokens);
            var parseTree   = parser.array().Tree;
            var stream      = new CommonTreeNodeStream(parseTree);
            var tree        = new JsonTree(stream);

            var @object = tree.array();

            Contract.Assume(@object != null);
            return(new JsonArray(JsonValueTypes.Interpret(@object)));
        }
      private static JsonObject ParseANTLRStream(ANTLRStringStream inputStream)
      {
         var lexer = new JsonLexer(inputStream);
         var tokens = new CommonTokenStream(lexer);
         var parser = new JsonParser(tokens);
         var parseTree = parser.@object().Tree;
         var stream = new CommonTreeNodeStream(parseTree);
         var tree = new JsonTree(stream);

         var @object = tree.@object();
         Contract.Assume(@object != null);
         return new JsonObject(JsonValueTypes.Interpret(@object));
      }
      public static JsonArray Parse(string s)
      {
         var inputStream = new ANTLRStringStream(s);
         var lexer = new JsonLexer(inputStream);
         var tokens = new CommonTokenStream(lexer);
         var parser = new JsonParser(tokens);
         var parseTree = parser.array().Tree;
         var stream = new CommonTreeNodeStream(parseTree);
         var tree = new JsonTree(stream);

         var @object = tree.array();

         Contract.Assume(@object != null);
         return new JsonArray(JsonValueTypes.Interpret(@object));
      }