diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-09-28 16:35:22 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-09-28 16:35:22 -0700 |
| commit | 907101b42159c3d2a8ee74540fb8e9259b36db7e (patch) | |
| tree | 7f988fd069c4eb445ea89d191dc551086c1fce71 /utils.c | |
| parent | 5049bd7cad8478ecb3f16f8aa7b9b741825922d7 (diff) | |
Fixes for captures and backrefs, and added block comments
Diffstat (limited to 'utils.c')
| -rw-r--r-- | utils.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -9,6 +9,7 @@ */ const char *after_spaces(const char *str) { + int block_comment_depth = 0; // Skip whitespace and comments: skip_whitespace: switch (*str) { @@ -17,7 +18,20 @@ const char *after_spaces(const char *str) goto skip_whitespace; } case '#': { - while (*str && *str != '\n') ++str; + if (str[1] == '(') { + ++block_comment_depth; + for (str += 2; *str && block_comment_depth > 0; ++str) { + if (str[0] == '#' && str[1] == '(') { + ++block_comment_depth; + ++str; + } else if (str[0] == ')' && str[1] == '#') { + --block_comment_depth; + ++str; + } + } + } else { + while (*str && *str != '\n') ++str; + } goto skip_whitespace; } } |
