diff options
Diffstat (limited to '1')
| -rw-r--r-- | 1/24.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -16,16 +16,15 @@ int main(int argc, char *argv[]) { parens = bracks = braces = 0; for (i = 0; i < MAXLEN - 1 && (c = getchar()) != EOF; i++) { - if (!comment && !quote && (c == '/' || c == '*') && p == '/') { - comment = c == '/' ? INLINE : MULTILINE; - } else if (!comment && !quote && c == '"') { - quote = TRUE; - } else if (comment == INLINE && c == '\n') { + if (!comment && !quote) { + if ((c == '/' || c == '*') && p == '/') + comment = c == '/' ? INLINE : MULTILINE; + else if (c == '"') + quote = TRUE; + } else if ((comment == INLINE && c == '\n') || + (comment == MULTILINE && c == '/' && p == '*')) { comment = FALSE; - } else if (comment == MULTILINE && c == '/' && p == '*') { - comment = FALSE; - } - if (!comment && quote && c == '"' && p != '\\') { + } else if (!comment && quote && c == '"' && p != '\\') { quote = FALSE; } else if (!comment && !quote) { if (c == '{') |
