private void ParseJson(string input) { AntlrInputStream stream = new AntlrInputStream(input); ITokenSource lexer = new JSONLexer(stream); ITokenStream tokens = new CommonTokenStream(lexer); JSONParser parser = new JSONParser(tokens); parser.BuildParseTree = true; JSONParser.JsonContext tree = parser.json(); if (tree != null) { var builder = new TreeBuilder(parser, tree, treeModel); builder.Build(); } }
/// <summary> /// Exit a parse tree produced by <see cref="JSONParser.json"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitJson([NotNull] JSONParser.JsonContext context) { }
/// <summary> /// Visit a parse tree produced by <see cref="JSONParser.json"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitJson([NotNull] JSONParser.JsonContext context) { return(VisitChildren(context)); }
private static SyntaxNode Main(JSONParser.JsonContext json, Func <ParserRuleContext, Scope, SyntaxNode> continuation, Scope scope) { return(ParsePairs(json.pair(), continuation, scope)); }
public DataItem VisitJson(JSONParser.JsonContext context) { return(VisitComplex_value(context.complex_value())); }
public override ParserNode VisitJson(JSONParser.JsonContext context) => GetNode(context, DOC, context.item());