From: dv Date: Thu, 28 Apr 2022 21:04:24 +0000 (+0000) Subject: btrace(8): fix lexer to allow whitespace after filters. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3a7894169cadeecbd627ae421538c469e712196d;p=openbsd btrace(8): fix lexer to allow whitespace after filters. Whitespace is allowed after the closing slash of a filter and before the opening brace of an action. This makes the lexer scan ahead and collect any whitespace and newlines into the end of filter token. ok mpi@ --- diff --git a/usr.sbin/btrace/bt_parse.y b/usr.sbin/btrace/bt_parse.y index dd4b0c40456..b8d0b68e0c0 100644 --- a/usr.sbin/btrace/bt_parse.y +++ b/usr.sbin/btrace/bt_parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: bt_parse.y,v 1.45 2021/11/12 16:57:24 claudio Exp $ */ +/* $OpenBSD: bt_parse.y,v 1.46 2022/04/28 21:04:24 dv Exp $ */ /* * Copyright (c) 2019-2021 Martin Pieuchot @@ -839,9 +839,14 @@ again: } return c; case '/': - if (peek() == '{' || peek() == '/' || peek() == '\n') { - return ENDFILT; + while (isspace(peek())) { + if (lgetc() == '\n') { + yylval.lineno++; + yylval.colno = 0; + } } + if (peek() == '{' || peek() == '/' || peek() == '\n') + return ENDFILT; /* FALLTHROUGH */ case ',': case '(':