Skip to content

Commit a825a47

Browse files
authored
Merge pull request #150 from AlWoSp/awa/snake-case-extension
Allow digits directly following underscore in snake case
2 parents ba47275 + 6257c2b commit a825a47

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CodeFormatCore/src/Diagnostic/NameStyle/NameStyleRuleMatcher.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ bool NameStyleRuleMatcher::SnakeCase(std::string_view source) {
8888
break;
8989
}
9090
case ParseState::Underscore: {
91-
if (::islower(ch)) {
91+
if (::islower(ch) || ::isdigit(ch)) {// after the first underscore, sections might also begin with digits
9292
state = ParseState::Letter;
9393
} else {
9494
return false;
@@ -135,7 +135,7 @@ bool NameStyleRuleMatcher::UpperSnakeCase(std::string_view text) {
135135
break;
136136
}
137137
case ParseState::Underscore: {
138-
if (::isupper(ch)) {
138+
if (::isupper(ch) || ::isdigit(ch)) {// after the first underscore, sections might also begin with digits
139139
state = ParseState::Letter;
140140
} else {
141141
return false;

0 commit comments

Comments
 (0)