diff --git a/spec/FileParserSpec.ts b/spec/FileParserSpec.ts index 7302efc..4eb5902 100644 --- a/spec/FileParserSpec.ts +++ b/spec/FileParserSpec.ts @@ -139,7 +139,7 @@ describe("FileParser", function () { expect(file.namespaces.length).toBe(1, "namespaces length"); expect(file.namespaces[0].classes.length).toBe(1, "namespace classes length"); - expect(file.namespaces[0].classes[0].properties.length).toBe(1, "namespace class properties length"); + expect(file.namespaces[0].classes[0].properties.length).toBe(2, "namespace class properties length"); expect(file.namespaces[0].classes[0].attributes.length).toBe(2, "namespace class attributes length"); expect(file.namespaces[0].classes[0].fields.length).toBe(2, "namespace class fields length"); expect(file.namespaces[0].classes[0].methods.length).toBe(0, "namespace class methods length"); @@ -154,6 +154,9 @@ describe("FileParser", function () { expect(file.namespaces[0].classes[0].properties[0].type.name).toBe("Array<>", "namespace class property type name"); expect(file.namespaces[0].classes[0].properties[0].type.genericParameters[0].name).toBe("string", "namespace class property type generic parameter name"); + expect(file.namespaces[0].classes[0].properties[1].name).toBe("EscapedName", "namespace class escaped property name"); + expect(file.namespaces[0].classes[0].properties[1].type.name).toBe("bool", "namespace class escaped property type name"); + expect(file.namespaces[0].classes[0].fields[0].name).toBe("someField", "namespace class field name"); expect(file.namespaces[0].classes[0].fields[0].isPublic).toBe(true, "namespace class field public"); expect(file.namespaces[0].classes[0].fields[0].type.name).toBe("int", "namespace class field type name"); @@ -368,7 +371,7 @@ describe("FileParser", function () { expect(file.namespaces.length).toBe(1); expect(file.namespaces[0].interfaces.length).toBe(1); - expect(file.namespaces[0].interfaces[0].properties.length).toBe(1); + expect(file.namespaces[0].interfaces[0].properties.length).toBe(2); expect(file.namespaces[0].interfaces[0].methods.length).toBe(1); expect(file.namespaces[0].interfaces[0].attributes.length).toBe(1); @@ -378,6 +381,9 @@ describe("FileParser", function () { expect(file.namespaces[0].interfaces[0].properties[0].type.name).toBe("Array<>"); expect(file.namespaces[0].interfaces[0].properties[0].type.genericParameters[0].name).toBe("string"); + expect(file.namespaces[0].interfaces[0].properties[1].name).toBe("EscapedName"); + expect(file.namespaces[0].interfaces[0].properties[1].type.name).toBe("bool"); + expect(file.namespaces[0].interfaces[0].methods[0].name).toBe("SomeMethod"); expect(file.namespaces[0].interfaces[0].methods[0].returnType.name).toBe("Int32"); expect(file.namespaces[0].interfaces[0].methods[0].returnType.fullName).toBe("System.Int32"); diff --git a/spec/csharp/ClassInsideNamespace.cs b/spec/csharp/ClassInsideNamespace.cs index cad9c70..f768606 100644 --- a/spec/csharp/ClassInsideNamespace.cs +++ b/spec/csharp/ClassInsideNamespace.cs @@ -8,6 +8,8 @@ namespace MyNamespace { public string[] Name { get; set; } + public bool @EscapedName { get; set; } + public int? someField; public List someField2 = new List(); diff --git a/spec/csharp/InterfaceInsideNamespace.cs b/spec/csharp/InterfaceInsideNamespace.cs index c1ab44a..4efd3be 100644 --- a/spec/csharp/InterfaceInsideNamespace.cs +++ b/spec/csharp/InterfaceInsideNamespace.cs @@ -7,6 +7,8 @@ public interface MyPoco { string[] Name { get; set; } + bool @EscapedName { get; set; } + System.Int32 SomeMethod(); } } \ No newline at end of file diff --git a/src/RegExHelper.ts b/src/RegExHelper.ts index 016addb..95028ae 100644 --- a/src/RegExHelper.ts +++ b/src/RegExHelper.ts @@ -189,6 +189,7 @@ result += this.getAttributesRegex(captureAttributes); result += this.getModifiersRegex(captureModifiers); result += this.getGenericTypeNameRegex(captureReturnType, false, false, false, false); + result += "[@]?"; result += this.getNameRegex(captureName); result += this.wrapInGroup(captureOpeningMethod, true, this.wrapInGroup(false, false, "{") + "|" +