diff options
| author | Christoph Schlosser <christoph@linux.com> | 2018-03-02 19:31:09 +0100 |
|---|---|---|
| committer | Christoph Schlosser <christophschlosser@users.noreply.github.com> | 2018-03-02 20:24:28 +0100 |
| commit | 23ae26f33b60244ce19e8a49d43c022bc41fd719 (patch) | |
| tree | 1625184af33b12e77c316d886c4911575d4d22dc | |
| parent | a1d28f42d7cef234c0ead363f1f8f657e15be0b9 (diff) | |
| download | doxdocgen-23ae26f33b60244ce19e8a49d43c022bc41fd719.tar.gz | |
Improve detection of snake and UPPER case
| -rw-r--r-- | src/Lang/Cpp/CppParser.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Lang/Cpp/CppParser.ts b/src/Lang/Cpp/CppParser.ts index 263f984..743b842 100644 --- a/src/Lang/Cpp/CppParser.ts +++ b/src/Lang/Cpp/CppParser.ts @@ -738,7 +738,7 @@ export default class CppParser implements ICodeParser { methodCasing = containsUnderscores ? CasingType.snake : CasingType.camel; } - if (validateFrom > 0) { + if (validateFrom > 0 && methodCasing !== CasingType.uncertain) { // validate after switch (methodCasing) { case CasingType.SCREAMING_SNAKE: { @@ -752,10 +752,13 @@ export default class CppParser implements ICodeParser { } case CasingType.snake: { // Take the leading _ after removing the characters into consideration - const testCasing = this.checkCasing(name.substr(validateFrom + 1), 0); + const textCheck = name.substr(validateFrom + 1); + const testCasing = this.checkCasing(textCheck, 0); // snake if (testCasing !== CasingType.snake) { - methodCasing = CasingType.uncertain; + if (textCheck.match("([a-z\\d]+)") === null) { + methodCasing = CasingType.uncertain; + } } break; } @@ -771,12 +774,11 @@ export default class CppParser implements ICodeParser { case CasingType.UPPER: { const testCasing = this.checkCasing(name.substr(validateFrom), 0); // upper - if (testCasing !== CasingType.UPPER) { + if (name.substr(validateFrom).match("([A-Z\\d]+)") === null) { methodCasing = CasingType.uncertain; } break; } - case CasingType.uncertain: default: { break; // No op } |