Browse Source

Fix g2384/VHDLFormatter#21

Modify regex to not add spaces between >/< if they are repeated
master
Vinrobot 5 years ago
parent
commit
70aa6cb673
No known key found for this signature in database GPG Key ID: 20207D962D63DD48
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      VHDLFormatter.js
  2. +1
    -1
      VHDLFormatter.ts

+ 1
- 1
VHDLFormatter.js View File

@ -235,7 +235,7 @@ function beautify(input, settings) {
input = arr.join("\r\n");
}
input = input.replace(/([a-zA-Z0-9\); ])\);(@@comments[0-9]+)?@@end/g, '$1\r\n);$2@@end');
input = input.replace(/[ ]?([&=:\-<>\+|\*])[ ]?/g, ' $1 ');
input = input.replace(/[ ]?([&=:\-\+|\*]|[<>]+)[ ]?/g, ' $1 ');
input = input.replace(/(\d+e) +([+\-]) +(\d+)/g, '$1$2$3'); // fix exponential notation format broken by previous step
input = input.replace(/[ ]?([,])[ ]?/g, '$1 ');
input = input.replace(/[ ]?(['"])(THEN)/g, '$1 $2');


+ 1
- 1
VHDLFormatter.ts View File

@ -291,7 +291,7 @@ export function beautify(input: string, settings: BeautifierSettings) {
}
input = input.replace(/([a-zA-Z0-9\); ])\);(@@comments[0-9]+)?@@end/g, '$1\r\n);$2@@end');
input = input.replace(/[ ]?([&=:\-<>\+|\*])[ ]?/g, ' $1 ');
input = input.replace(/[ ]?([&=:\-\+|\*]|[<>]+)[ ]?/g, ' $1 ');
input = input.replace(/(\d+e) +([+\-]) +(\d+)/g, '$1$2$3');// fix exponential notation format broken by previous step
input = input.replace(/[ ]?([,])[ ]?/g, '$1 ');
input = input.replace(/[ ]?(['"])(THEN)/g, '$1 $2');


Loading…
Cancel
Save