indent(1): bug fix after r336333

The bug was that isalnum() is not exactly equivalent to previous code which
also allowed characters "$" and "_", so check for those explicitly.

Reported by:	tuexen@
This commit is contained in:
pstef 2018-08-15 18:19:45 +00:00
parent ac707f043f
commit 7f7e2e6abd
3 changed files with 4 additions and 1 deletions

View File

@ -193,6 +193,7 @@ lexi(struct parser_state *state)
/* Scan an alphanumeric token */ /* Scan an alphanumeric token */
if (isalnum((unsigned char)*buf_ptr) || if (isalnum((unsigned char)*buf_ptr) ||
*buf_ptr == '_' || *buf_ptr == '$' ||
(buf_ptr[0] == '.' && isdigit((unsigned char)buf_ptr[1]))) { (buf_ptr[0] == '.' && isdigit((unsigned char)buf_ptr[1]))) {
/* /*
* we have a character or number * we have a character or number
@ -222,7 +223,7 @@ lexi(struct parser_state *state)
else else
while (isalnum((unsigned char)*buf_ptr) || while (isalnum((unsigned char)*buf_ptr) ||
*buf_ptr == BACKSLASH || *buf_ptr == BACKSLASH ||
*buf_ptr == '_') { *buf_ptr == '_' || *buf_ptr == '$') {
/* fill_buffer() terminates buffer with newline */ /* fill_buffer() terminates buffer with newline */
if (*buf_ptr == BACKSLASH) { if (*buf_ptr == BACKSLASH) {
if (*(buf_ptr + 1) == '\n') { if (*(buf_ptr + 1) == '\n') {

View File

@ -4,4 +4,5 @@ void t(void) {
double y[] = {0x1P+9F, 0.3, .1, 1.2f, 0xa.p01f, 3.14f, 2.L}; double y[] = {0x1P+9F, 0.3, .1, 1.2f, 0xa.p01f, 3.14f, 2.L};
int z = 0b0101; int z = 0b0101;
DO_NOTHING; DO_NOTHING;
x._y = 5;
} }

View File

@ -6,4 +6,5 @@ t(void)
double y[] = {0x1P+9F, 0.3, .1, 1.2f, 0xa.p01f, 3.14f, 2.L}; double y[] = {0x1P+9F, 0.3, .1, 1.2f, 0xa.p01f, 3.14f, 2.L};
int z = 0b0101; int z = 0b0101;
DO_NOTHING; DO_NOTHING;
x._y = 5;
} }