Skip to content

Commit 63feb21

Browse files
committed
toke.c: minor adjustment of #ifdef to stop confusing code editors
Before this change, the two separate `while` statements would upset the code folding as parsed by tree-sitter-c (and likely many others, I haven't tested), into thinking this was two nested loops. Having failed to find the end of both of them before the end of the function, various confusions result, usually ending up in the entire rest of the file (and it's a long file) getting folded into one giant region. This likely causes various static analysis tools similarly to not see any of the subsequent functions in the file. By adjusting the code so that just the condition part is conditional on the `#ifdef`, it means that code parsing tools have a much easier time working out the high-level structure of this file.
1 parent dde110a commit 63feb21

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

toke.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9394,11 +9394,11 @@ yyl_try(pTHX_ char *s)
93949394
}
93959395
if (PL_expect == XBLOCK) {
93969396
const char *t = s;
9397-
#ifdef PERL_STRICT_CR
9398-
while (SPACE_OR_TAB(*t))
9399-
#else
9400-
while (SPACE_OR_TAB(*t) || *t == '\r')
9397+
while (SPACE_OR_TAB(*t)
9398+
#ifndef PERL_STRICT_CR
9399+
|| *t == '\r'
94019400
#endif
9401+
)
94029402
t++;
94039403
if (*t == '\n' || *t == '#') {
94049404
ENTER_with_name("lex_format");

0 commit comments

Comments
 (0)