Minor formatting changes to suit current preferences
This commit is contained in:
parent
6db8b386af
commit
b0209ad609
1 changed files with 17 additions and 16 deletions
27
src/main.cpp
27
src/main.cpp
|
|
@ -149,15 +149,15 @@ void printWarnErr(std::vector<TabSpaceCount> counts) {
|
||||||
if(lastTag != token.tag) {
|
if(lastTag != token.tag) {
|
||||||
lastTag = token.tag;
|
lastTag = token.tag;
|
||||||
switch(lastTag) {
|
switch(lastTag) {
|
||||||
case NONE:
|
case NONE: {
|
||||||
printf("\e[0m");
|
printf("\e[0m");
|
||||||
break;
|
} break;
|
||||||
case WARNING:
|
case WARNING: {
|
||||||
printf("\e[33;1m");
|
printf("\e[33;1m");
|
||||||
break;
|
} break;
|
||||||
case ERROR:
|
case ERROR: {
|
||||||
printf("\e[31;1m");
|
printf("\e[31;1m");
|
||||||
break;
|
}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(token.type == TAB) {
|
if(token.type == TAB) {
|
||||||
|
|
@ -179,7 +179,8 @@ bool checkTrailingWhitespace(TabSpaceCount& count) {
|
||||||
count.tokens[i].tag = ERROR;
|
count.tokens[i].tag = ERROR;
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
else if (count.tokens[i].type == NEWLINE) {}
|
else if (count.tokens[i].type == NEWLINE)
|
||||||
|
{}
|
||||||
else {
|
else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -213,18 +214,18 @@ int main(int argc, char** argv)
|
||||||
TabSpaceCount lastCount = {};
|
TabSpaceCount lastCount = {};
|
||||||
for(Token token : tokens) {
|
for(Token token : tokens) {
|
||||||
switch(token.type) {
|
switch(token.type) {
|
||||||
case TAB:
|
case TAB: {
|
||||||
if(recording) lastCount.tabs += 1;
|
if(recording) lastCount.tabs += 1;
|
||||||
lastCount.tokens.push_back(token);
|
lastCount.tokens.push_back(token);
|
||||||
break;
|
} break;
|
||||||
case SPACE:
|
case SPACE: {
|
||||||
if(recording) lastCount.spaces += 1;
|
if(recording) lastCount.spaces += 1;
|
||||||
lastCount.tokens.push_back(token);
|
lastCount.tokens.push_back(token);
|
||||||
break;
|
} break;
|
||||||
case UNKNOWN:
|
case UNKNOWN: {
|
||||||
recording = false;
|
recording = false;
|
||||||
lastCount.tokens.push_back(token);
|
lastCount.tokens.push_back(token);
|
||||||
break;
|
} break;
|
||||||
case NEWLINE: {
|
case NEWLINE: {
|
||||||
lastCount.tokens.push_back(token);
|
lastCount.tokens.push_back(token);
|
||||||
counts.push_back(lastCount);
|
counts.push_back(lastCount);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue