commit 4706a62a7aaf9f91fe0f92a8e01505ebfb4d566f
parent 635da0525dd864c33582b8ba469d0179c8475faf
Author: Ed van Bruggen <edvb@uw.edu>
Date: Mon, 10 Jun 2019 00:46:32 -0700
Keep skipping whitespace and comments until code
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tisp.c b/tisp.c
@@ -141,9 +141,11 @@ isdelim(int c)
void
skip_ws(Str str)
{
- str->d += strspn(str->d, " \t\n"); /* skip white space */
- for (; *str->d == ';'; str->d++) /* skip comments until newline */
- str->d += strcspn(str->d, "\n");
+ while (*str->d && strchr(" \t\n;", *str->d) != 0) {
+ str->d += strspn(str->d, " \t\n"); /* skip white space */
+ for (; *str->d == ';'; str->d++) /* skip comments until newline */
+ str->d += strcspn(str->d, "\n");
+ }
}
/* count number of parenthesis */