Socket
Socket
Sign inDemoInstall

@fluffy-spoon/csharp-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.135.0 to 1.137.0

8

dist/spec/FileParserSpec.js

@@ -29,2 +29,3 @@ "use strict";

expect(file.classes[0].properties[0].type.name).toBe("string");
expect(file.classes[0].properties[0].initialValue).toBe(undefined);
expect(file.classes[0].properties[1].name).toBe("ReadOnlyProperty");

@@ -34,5 +35,7 @@ expect(file.classes[0].properties[1].isReadOnly).toBe(true);

expect(file.classes[0].properties[1].type.name).toBe("string");
expect(file.classes[0].properties[1].initialValue).toBe(undefined);
expect(file.classes[0].properties[2].name).toBe("GetSetProperty");
expect(file.classes[0].properties[2].isReadOnly).toBe(false);
expect(file.classes[0].properties[2].type.name).toBe("string");
expect(file.classes[0].properties[2].initialValue).toBe(undefined);
expect(file.classes[0].properties[3].name).toBe("MyPublicVirtualProperty");

@@ -42,2 +45,3 @@ expect(file.classes[0].properties[3].isReadOnly).toBe(false);

expect(file.classes[0].properties[3].type.name).toBe("string");
expect(file.classes[0].properties[3].initialValue).toBe('"barfoo"');
expect(file.classes[0].properties[4].name).toBe("ReadOnlyShortProperty");

@@ -47,4 +51,6 @@ expect(file.classes[0].properties[4].isReadOnly).toBe(true);

expect(file.classes[0].properties[4].type.name).toBe("string");
expect(file.classes[0].properties[4].initialValue).toBe(undefined);
expect(file.classes[0].properties[5].name).toBe("TupleReturningProperty");
expect(file.classes[0].properties[5].type.name).toBe("ValueTuple<,>");
expect(file.classes[0].properties[5].initialValue).toBe(undefined);
expect(file.classes[0].properties[5].type.genericParameters[1].name).toBe("Func<,>");

@@ -58,5 +64,7 @@ expect(file.classes[0].properties[5].type.genericParameters[1].genericParameters[0].name).toBe("int");

expect(file.classes[0].properties[6].type.genericParameters[1].genericParameters[1].name).toBe("string");
expect(file.classes[0].properties[6].initialValue).toBe(undefined);
expect(file.classes[0].properties[7].name).toBe("List");
expect(file.classes[0].properties[7].type.name).toBe("IList<>");
expect(file.classes[0].properties[7].type.genericParameters[0].name).toBe("string");
expect(file.classes[0].properties[7].initialValue).toBe(undefined);
}));

@@ -63,0 +71,0 @@ describe("comments:", function () {

1

dist/src/Models.d.ts

@@ -177,2 +177,3 @@ export declare class CSharpType implements CSharpGenericParameterContainer {

isVirtual: boolean;
initialValue?: string;
private _isPublic;

@@ -179,0 +180,0 @@ constructor(name: string);

@@ -41,2 +41,6 @@ "use strict";

if (openingType === "{") {
var initialValueMatches = this.regexHelper.getMatches(scope.suffix, new RegExp("^" + this.regexHelper.getPropertyInitialValueRegex(true), "g"));
if (initialValueMatches.length > 0) {
property.initialValue = initialValueMatches[0][0];
}
var subScopes = this.scopeHelper.getCurlyScopes(scope.content);

@@ -43,0 +47,0 @@ for (var _c = 0, subScopes_1 = subScopes; _c < subScopes_1.length; _c++) {

@@ -19,2 +19,3 @@ export declare class RegExHelper {

getPropertyRegex(capture: boolean, captureAttributes: boolean, captureModifiers: boolean, captureReturnType: boolean, captureName: boolean, captureOpeningMethod: boolean): string;
getPropertyInitialValueRegex(capture: boolean): string;
getKeywordRegex(capture: boolean): string;

@@ -21,0 +22,0 @@ getModifierRegex(capture: boolean): string;

@@ -124,2 +124,10 @@ "use strict";

};
RegExHelper.prototype.getPropertyInitialValueRegex = function (capture) {
var result = "";
result += this.wrapInGroup(false, true, "}");
result += this.wrapInGroup(false, false, "=");
result += this.wrapInGroup(capture, true, "[^;]+?");
result += this.wrapInGroup(false, false, ";");
return this.wrapInGroup(false, false, result);
};
RegExHelper.prototype.getKeywordRegex = function (capture) {

@@ -126,0 +134,0 @@ var validKeywords = [

2

package.json
{
"name": "@fluffy-spoon/csharp-parser",
"version": "1.135.0",
"version": "1.137.0",
"description": "Parses C# code as well as possible into TypeScript objects.",

@@ -5,0 +5,0 @@ "main": "./dist/src/Index",

@@ -34,2 +34,3 @@ import { FileParser } from '../src/FileParser';

expect(file.classes[0].properties[0].type.name).toBe("string");
expect(file.classes[0].properties[0].initialValue).toBe(undefined);

@@ -40,2 +41,3 @@ expect(file.classes[0].properties[1].name).toBe("ReadOnlyProperty");

expect(file.classes[0].properties[1].type.name).toBe("string");
expect(file.classes[0].properties[1].initialValue).toBe(undefined);

@@ -45,2 +47,3 @@ expect(file.classes[0].properties[2].name).toBe("GetSetProperty");

expect(file.classes[0].properties[2].type.name).toBe("string");
expect(file.classes[0].properties[2].initialValue).toBe(undefined);

@@ -51,2 +54,3 @@ expect(file.classes[0].properties[3].name).toBe("MyPublicVirtualProperty");

expect(file.classes[0].properties[3].type.name).toBe("string");
expect(file.classes[0].properties[3].initialValue).toBe('"barfoo"');

@@ -57,5 +61,7 @@ expect(file.classes[0].properties[4].name).toBe("ReadOnlyShortProperty");

expect(file.classes[0].properties[4].type.name).toBe("string");
expect(file.classes[0].properties[4].initialValue).toBe(undefined);
expect(file.classes[0].properties[5].name).toBe("TupleReturningProperty");
expect(file.classes[0].properties[5].type.name).toBe("ValueTuple<,>");
expect(file.classes[0].properties[5].initialValue).toBe(undefined);

@@ -71,2 +77,3 @@ expect(file.classes[0].properties[5].type.genericParameters[1].name).toBe("Func<,>");

expect(file.classes[0].properties[6].type.genericParameters[1].genericParameters[1].name).toBe("string");
expect(file.classes[0].properties[6].initialValue).toBe(undefined);

@@ -76,2 +83,3 @@ expect(file.classes[0].properties[7].name).toBe("List");

expect(file.classes[0].properties[7].type.genericParameters[0].name).toBe("string");
expect(file.classes[0].properties[7].initialValue).toBe(undefined);
}));

@@ -78,0 +86,0 @@

@@ -448,2 +448,4 @@ export class CSharpType implements CSharpGenericParameterContainer {

initialValue?: string;
private _isPublic: boolean;

@@ -450,0 +452,0 @@

@@ -53,2 +53,9 @@ import {

if(openingType === "{") {
var initialValueMatches = this.regexHelper.getMatches(
scope.suffix,
new RegExp("^" + this.regexHelper.getPropertyInitialValueRegex(true), "g"));
if(initialValueMatches.length > 0) {
property.initialValue = initialValueMatches[0][0];
}
var subScopes = this.scopeHelper.getCurlyScopes(scope.content);

@@ -55,0 +62,0 @@ for (var subScope of subScopes) {

@@ -195,3 +195,14 @@ export class RegExHelper {

}
public getPropertyInitialValueRegex(capture: boolean) {
var result = "";
result += this.wrapInGroup(false, true, "}");
result += this.wrapInGroup(false, false, "=");
result += this.wrapInGroup(capture, true, "[^;]+?");
result += this.wrapInGroup(false, false, ";");
return this.wrapInGroup(false, false, result);
}
public getKeywordRegex(capture: boolean) {

@@ -198,0 +209,0 @@ var validKeywords = [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc