Example #1
0
 private static IParser <ServiceAttributeParameterInfo> AttributeParameterParser(Context context) =>
 from name in NameParser.Named("parameter name")
 from colon in PunctuationParser(":")
 from value in AttributeParameterValueParser.Named("parameter value").Positioned()
 select new ServiceAttributeParameterInfo(name.Value, TryParseAttributeParameterValue(value.Value),
                                          context.GetPart(ServicePartKind.Name, name),
                                          context.GetPart(ServicePartKind.Value, value));
Example #2
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));
Example #3
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));
Example #4
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));
Example #5
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));
Example #6
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));
Example #7
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));
Example #8
0
 private static IParser <ServiceAttributeInfo> AttributeParser(Context context) =>
 from name in NameParser.Named("attribute name")
 from parameters in AttributeParameterParser(context).Delimited(",").Bracketed("(", ")").OrDefault()
 select new ServiceAttributeInfo(name.Value, parameters,
                                 context.GetPart(ServicePartKind.Name, name));