public FmtToken Format()
 {
     return(FmtToken.Concat(ImmutableArray.Create(new object[9]
     {
         "MyType {f1 = ",
         F1,
         ", f2 = ",
         F2,
         ", f3 = ",
         F3,
         ", f4 = ",
         F4,
         "}"
     }), new string[9]
     {
         "",
         "f1",
         "",
         "f2",
         "",
         "f3",
         "",
         "f4",
         ""
     }));
 }
Esempio n. 2
0
        public FmtToken Format()
        {
            var b = FmtToken.Concat(
                this.IsParams ? "params " : "",
                this.Name,
                ": ",
                this.Type
                )
                    .WithTokenNames("isParams", "name", "", "type");

            if (this.HasDefaultValue)
            {
                string def;
                if (this.DefaultValue == null)
                {
                    def = this.Type.IsReferenceType == true ? "null" : "default";
                }
                else
                {
                    def = this.DefaultValue.ToString();
                }

                b = FmtToken.Concat(b, " = ", def).WithTokenNames(null, "hasDefaultValue", "defaultValue");
            }
            return(b);
        }
Esempio n. 3
0
 public FmtToken Format()
 {
     return(FmtToken.Concat(ImmutableArray.Create((object)"a {}"), new string[1]
     {
         ""
     }));
 }
Esempio n. 4
0
 public override FmtToken Format(FmtToken directives) =>
 FmtToken.Concat(
     directives,
     "{",
     FmtToken.Block(Fields.Select(f => FmtToken.Concat(f.Format(), ",")))
     .WithIntegerTokenMap(),
     "}"
     ).WithTokenNames(null, "", "core", "");
 public FmtToken Format()
 {
     return(FmtToken.Concat(ImmutableArray.Create((object)"a {a = ", (object)A2, (object)"}"), new string[3]
     {
         "",
         "a",
         ""
     }));
 }
 public FmtToken Format()
 {
     return(FmtToken.Concat(ImmutableArray.Create((object)"CustomValidatorTest {f1 = ", (object)F1, (object)"}"), new string[3]
     {
         "",
         "f1",
         ""
     }));
 }
 public FmtToken Format()
 {
     return(FmtToken.Concat(ImmutableArray.Create((object)"B {propB = ", (object)PropB, (object)"}"), new string[3]
     {
         "",
         "propB",
         ""
     }));
 }
 public FmtToken Format()
 {
     return(FmtToken.Concat(ImmutableArray.Create((object)"a {h = ", (object)FmtToken.FormatArray(H), (object)"}"), new string[3]
     {
         "",
         "h",
         ""
     }));
 }
Esempio n. 9
0
 public override FmtToken Format(FmtToken directives) =>
 FmtToken.Concat(
     Implements.Length > 0 ? FmtToken.Concat(" implements ", FmtToken.Concat(Implements.Select(f => FmtToken.Concat(f, " "))).WithIntegerTokenMap())
                               : "",
     directives,
     "{",
     FmtToken.Block(Fields.Select(f => FmtToken.Concat(f, ",")))
     .WithIntegerTokenMap(),
     "}"
     )
 .WithTokenNames("core.implements", null, "", "core.fields", "");
Esempio n. 10
0
        public FmtToken Format(string rootType)
        {
            if (Entities.Length >= 0 && Types.Any(t => t.Name == rootType))
            {
                throw new InvalidOperationException($"Type with name '{rootType}' already exists in the schema so it can't be root type.");
            }

            return(FmtToken.Block(
                       FmtToken.Block(Types).WithIntegerTokenMap(),
                       Entities.Length == 0 && rootType != null ? "" :
                       FmtToken.Concat("type ", rootType, "{", FmtToken.Block(Entities).WithIntegerTokenMap(), "}")
                       )
                   .WithTokenNames(
                       "types",
                       "entities"
                       ));
        }
 public FmtToken Format()
 {
     return(FmtToken.Concat(ImmutableArray.Create(new object[5]
     {
         "A {propA = ",
         PropA,
         ", propAX = ",
         PropAX,
         "}"
     }), new string[5]
     {
         "",
         "propA",
         "",
         "propAX",
         ""
     }));
 }
Esempio n. 12
0
 public FmtToken Format()
 {
     return(FmtToken.Concat(ImmutableArray.Create(new object[5]
     {
         "T {a = ",
         A,
         ", b = ",
         FmtToken.FormatArray(B),
         "}"
     }), new string[5]
     {
         "",
         "a",
         "",
         "b",
         ""
     }));
 }
Esempio n. 13
0
 public FmtToken Format()
 {
     return(FmtToken.Concat(ImmutableArray.Create(new object[5]
     {
         "a {h = ",
         H,
         ", H = ",
         H2,
         "}"
     }), new string[5]
     {
         "",
         "h",
         "",
         "H",
         ""
     }));
 }
Esempio n. 14
0
 public FmtToken Format()
 {
     return(FmtToken.Concat(ImmutableArray.Create(new object[5]
     {
         "Test123 {Field543 = ",
         FmtToken.FormatArray(Field543),
         ", abcSS = ",
         AbcSS,
         "}"
     }), new string[5]
     {
         "",
         "Field543",
         "",
         "abcSS",
         ""
     }));
 }
 public FmtToken Format()
 {
     return(FmtToken.Concat(ImmutableArray.Create(new object[15]
     {
         "Composite123 {StringF = ",
         StringF,
         ", NullableStringF = ",
         NullableStringF,
         ", NullableIntF = ",
         NullableIntF,
         ", IntF = ",
         IntF,
         ", FloatF = ",
         FloatF,
         ", NullListF = ",
         FmtToken.FormatArray(NullListF),
         ", ThisF = ",
         ThisF,
         "}"
     }), new string[15]
     {
         "",
         "StringF",
         "",
         "NullableStringF",
         "",
         "NullableIntF",
         "",
         "IntF",
         "",
         "FloatF",
         "",
         "NullListF",
         "",
         "ThisF",
         ""
     }));
 }
Esempio n. 16
0
 private FmtToken FormatDirectives() => FmtToken.Concat(Directives.Select(d => FmtToken.Concat(" ", d)))
 .WithIntegerTokenMap();
Esempio n. 17
0
 public FmtToken Format() => FmtToken.Concat(Name, ": ", Type, FormatDirectives())
 .WithTokenNames("name", "", "type", "directives");
Esempio n. 18
0
 public override FmtToken Format(FmtToken directives) =>
 FmtToken.Concat(
     directives,
     "= ",
     FmtToken.Join(" | ", Options, FmtToken.IntegerTokenMap())
     ).WithTokenNames(null, "", "core.options");
Esempio n. 19
0
 public override FmtToken Format(FmtToken directives) => directives;
Esempio n. 20
0
 public abstract FmtToken Format(FmtToken directives);
Esempio n. 21
0
 public override FmtToken Format() => FmtToken.Single(TypeName, "typeName");
Esempio n. 22
0
 public FmtToken Format() => FmtToken.Concat(Name, "(id: ID): ", Type, "?", FormatDirectives());
Esempio n. 23
0
 public override FmtToken Format() =>
 FmtToken.Concat(
     ImmutableArray.Create <object>("[", Type, "]"),
     new [] { "", "type", "" }
     );
Esempio n. 24
0
 public FmtToken Format() =>
 Args.Count == 0 ? FmtToken.Concat("@", Name) :
 FmtToken.Concat("@", Name, "(", FormatArgs(), ")")
 .WithTokenNames("", "name", "", "args", "");
Esempio n. 25
0
 private FmtToken FormatArgs() => FmtToken.Join(", ", Args.Properties().Select(p => FmtToken.Concat(p.Name, ": ", FormatArg(p.Value))), FmtToken.IntegerTokenMap());
Esempio n. 26
0
 public FmtToken Format() =>
 this.TypeArguments.IsEmpty
         ? FmtToken.Single(this.Type, "type")
         : FmtToken.Concat(this.Type, FmtToken.FormatArray(this.TypeArguments, "<", ">"))
 .WithTokenNames("type", "genericParameters");
Esempio n. 27
0
 FmtToken FormatDirectives() =>
 FmtToken.Concat(Directives.Select(d => FmtToken.Concat(d, " ")))
 .WithIntegerTokenMap()
 .Name("directives");
Esempio n. 28
0
 public FmtToken Format() =>
 FmtToken.Concat(this.Type, "[" + new string(',', this.Dimensions - 1) + "]")
 .WithTokenNames(new [] { "type", "" });
Esempio n. 29
0
 public FmtToken Format() => FmtToken.Concat(Keyword(), " ", Name, " ", Core.Format(FormatDirectives()))
 .WithTokenNames("core", "", "name", "", null);
Esempio n. 30
0
 FmtToken FormatDirectives() => FmtToken.Concat(Directives.Select(d => FmtToken.Concat(" ", d.Format())));