在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):graphql-dotnet/parser开源软件地址(OpenSource Url):https://github.com/graphql-dotnet/parser开源编程语言(OpenSource Language):C# 100.0%开源软件介绍(OpenSource Introduction):GraphQL.NET ParserThis library contains a lexer and parser as well as the complete GraphQL AST model that allows you to work with GraphQL documents compatible with the October 2021 spec. The parser from this library is used by the GraphQL.NET project and was verified by many test data sets. Preview versions of this package are available on GitHub Packages. 1. LexerGenerates token based on input text. Lexer takes advantage of Usagevar token = Lexer.Lex("\"str\""); Lex method always returns the first token it finds. In this case case the result would look like following. 2. ParserParses provided GraphQL expression into AST (abstract syntax tree). Parser also takes advantage of
Usagevar ast1 = Parser.Parse(@"
{
field
}");
var ast2 = Parser.Parse(@"
{
field
}", new ParserOptions { Ignore = IgnoreOptions.Comments }); By default 3. ASTVisitor
For printing SDL from AST, you can use You can also find a query a { name age } After
Usagepublic static async Task Print(string text)
{
using var document = Parser.Parse(text);
var writer = new StringWriter();
var printer = new SDLPrinter()
await printer.PrintAsync(document, writer);
var rendered = writer.ToString();
Console.WriteLine(rendered);
} |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论