Beispiel #1
0
 private static IParser <ServiceEnumValueInfo> EnumValueParser(Context context) =>
 from comments1 in CommentOrWhiteSpaceParser.Many()
 from attributes in AttributeParser(context).Delimited(",").Bracketed("[", "]").Many()
 from comments2 in CommentOrWhiteSpaceParser.Many()
 from name in NameParser.Named("value name")
 select new ServiceEnumValueInfo(name.Value, attributes.SelectMany(x => x),
                                 BuildSummary(comments1, comments2),
                                 context.GetPart(ServicePartKind.Name, name));
Beispiel #2
0
 private static IParser <ServiceErrorSetInfo> ErrorSetParser(Context context) =>
 from comments1 in CommentOrWhiteSpaceParser.Many()
 from attributes in AttributeParser(context).Delimited(",").Bracketed("[", "]").Many()
 from comments2 in CommentOrWhiteSpaceParser.Many()
 from keyword in KeywordParser("errors")
 from name in NameParser.Named("errors name")
 from errors in ErrorParser(context).DelimitedAllowTrailing(",").Bracketed("{", "}")
 select new ServiceErrorSetInfo(name.Value, errors,
                                attributes.SelectMany(x => x),
                                BuildSummary(comments1, comments2),
                                context.GetRemarksSection(name.Value)?.Lines,
                                context.GetPart(ServicePartKind.Keyword, keyword),
                                context.GetPart(ServicePartKind.Name, name));
Beispiel #3
0
 private static IParser <ServiceDtoInfo> DtoParser(Context context) =>
 from comments1 in CommentOrWhiteSpaceParser.Many()
 from attributes in AttributeParser(context).Delimited(",").Bracketed("[", "]").Many()
 from comments2 in CommentOrWhiteSpaceParser.Many()
 from keyword in KeywordParser("data")
 from name in NameParser.Named("data name")
 from fields in FieldParser(context).Many().Bracketed("{", "}")
 select new ServiceDtoInfo(name.Value, fields,
                           attributes.SelectMany(x => x),
                           BuildSummary(comments1, comments2),
                           context.GetRemarksSection(name.Value)?.Lines,
                           context.GetPart(ServicePartKind.Keyword, keyword),
                           context.GetPart(ServicePartKind.Name, name));
Beispiel #4
0
 private static IParser <ServiceFieldInfo> FieldParser(Context context) =>
 from comments1 in CommentOrWhiteSpaceParser.Many()
 from attributes in AttributeParser(context).Delimited(",").Bracketed("[", "]").Many()
 from comments2 in CommentOrWhiteSpaceParser.Many()
 from name in NameParser.Named("field name")
 from colon in PunctuationParser(":")
 from typeName in TypeParser.Named("field type name")
 from semicolon in PunctuationParser(";")
 select new ServiceFieldInfo(name.Value, typeName.Value,
                             attributes.SelectMany(x => x),
                             BuildSummary(comments1, comments2),
                             context.GetPart(ServicePartKind.Name, name),
                             context.GetPart(ServicePartKind.TypeName, typeName));
Beispiel #5
0
 private static IParser <ServiceMethodInfo> MethodParser(Context context) =>
 from comments1 in CommentOrWhiteSpaceParser.Many()
 from attributes in AttributeParser(context).Delimited(",").Bracketed("[", "]").Many()
 from comments2 in CommentOrWhiteSpaceParser.Many()
 from keyword in KeywordParser("method")
 from name in NameParser.Named("method name")
 from requestFields in FieldParser(context).Many().Bracketed("{", "}")
 from colon in PunctuationParser(":")
 from responseFields in FieldParser(context).Many().Bracketed("{", "}")
 select new ServiceMethodInfo(name.Value, requestFields, responseFields,
                              attributes.SelectMany(x => x),
                              BuildSummary(comments1, comments2),
                              context.GetRemarksSection(name.Value)?.Lines,
                              context.GetPart(ServicePartKind.Keyword, keyword),
                              context.GetPart(ServicePartKind.Name, name));
Beispiel #6
0
 private static IParser <ServiceInfo> ServiceParser(Context context) =>
 from comments1 in CommentOrWhiteSpaceParser.Many()
 from attributes in AttributeParser(context).Delimited(",").Bracketed("[", "]").Many()
 from comments2 in CommentOrWhiteSpaceParser.Many()
 from keyword in KeywordParser("service")
 from name in NameParser.Named("service name")
 from start in PunctuationParser("{").OrDefault()
 from items in ServiceItemParser(context).AtLeast(start != null ? 0 : 1)
 from end in start != null?PunctuationParser("}") : Parser.Success("").Positioned()
     select new ServiceInfo(name.Value, items,
                            attributes.SelectMany(x => x),
                            BuildSummary(comments1, comments2),
                            context.GetRemarksSection(name.Value)?.Lines,
                            context.GetPart(ServicePartKind.Keyword, keyword),
                            context.GetPart(ServicePartKind.Name, name),
                            context.GetPart(ServicePartKind.End, end));
Beispiel #7
0
 private static IParser <ServiceInfo> DefinitionParser(Context context) =>
 from service in ServiceParser(context).FollowedBy(CommentOrWhiteSpaceParser.Many())
 from end in Parser.Success(true).End().Named("end")
 select service;