Getting rid of that ugly switch statement
modified: src/nms.c
This commit is contained in:
parent
72bf59301a
commit
420987a544
17
src/nms.c
17
src/nms.c
@ -29,20 +29,12 @@ int main(void) {
|
||||
int c, x = 1, y = 1;
|
||||
bool first = true;
|
||||
while ((c = getchar()) != EOF) {
|
||||
switch (c) {
|
||||
case '\n':
|
||||
if (c == NEWLINE) {
|
||||
++y;
|
||||
x = 1;
|
||||
break;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\f':
|
||||
case '\r':
|
||||
case '\v':
|
||||
} else if (isspace(c)) {
|
||||
++x;
|
||||
break;
|
||||
default:
|
||||
if (first) {
|
||||
} else if (first) {
|
||||
start.source = c;
|
||||
start.row = y;
|
||||
start.col = x;
|
||||
@ -64,9 +56,6 @@ int main(void) {
|
||||
|
||||
++x;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
clearTermWindow(termSizeRows, termSizeCols);
|
||||
|
Loading…
Reference in New Issue
Block a user