Skip to content

Commit

Permalink
1378-Update regex to match multiple parameters
Browse files Browse the repository at this point in the history
removing node version changes
  • Loading branch information
jgreywolf committed Jun 9, 2020
1 parent 47b5d7a commit 9091d68
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"he": "^1.2.0",
"minify": "^4.1.1",
"moment-mini": "^2.22.1",
"node": "^14.3.0",
"scope-css": "^1.2.1"
},
"devDependencies": {
Expand Down
9 changes: 5 additions & 4 deletions src/diagrams/class/svgDraw.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,14 @@ export const drawClass = function(elem, classDef, conf) {
};

export const parseMember = function(text) {
const fieldRegEx = /^(\+|-|~|#)?(\w+)(~\w+~|\[\])?\s+(\w+)/;
const methodRegEx = /^(\+|-|~|#)?(\w+)\((.*)\)(\*|\$)?\s?(.*)?/;
const fieldRegEx = /^(\+|-|~|#)?(\w+)(~\w+~|\[\])?\s+(\w+)$/;
const methodRegEx = /(\+|-|~|#)?(\w+)\((.*)\)(\*|\$)? *(.*)?/;
///^(\+|-|~|#)?(\w+)\((.*)\)(\*|\$)?[ ]*(.*)?$/;

let fieldMatch = text.match(fieldRegEx);
let methodMatch = text.match(methodRegEx);

if (fieldMatch) {
if (fieldMatch && !methodMatch) {
return buildFieldDisplay(fieldMatch);
} else if (methodMatch) {
return buildMethodDisplay(methodMatch);
Expand All @@ -299,7 +300,7 @@ const buildFieldDisplay = function(parsedText) {
try {
let visibility = parsedText[1] ? parsedText[1].trim() : '';
let fieldType = parsedText[2] ? parseGenericTypes(parsedText[2]) : '';
let fieldName = parsedText[3] ? parsedText[3].trim() : '';
let fieldName = parsedText[4] ? parsedText[4].trim() : '';

displayText = visibility + fieldType + ' ' + fieldName;
} catch (err) {
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7548,11 +7548,6 @@ no-case@^2.2.0:
dependencies:
lower-case "^1.1.1"

node-bin-setup@^1.0.0:
version "1.0.6"
resolved "https://registry.yarnpkg.com/node-bin-setup/-/node-bin-setup-1.0.6.tgz#4b5c9bb937ece702d7069b36ca78af4684677528"
integrity sha512-uPIxXNis1CRbv1DwqAxkgBk5NFV3s7cMN/Gf556jSw6jBvV7ca4F9lRL/8cALcZecRibeqU+5dFYqFFmzv5a0Q==

node-forge@0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579"
Expand Down

0 comments on commit 9091d68

Please sign in to comment.