diff options
author | Dave Voutila <dv@cvs.openbsd.org> | 2022-04-28 21:04:25 +0000 |
---|---|---|
committer | Dave Voutila <dv@cvs.openbsd.org> | 2022-04-28 21:04:25 +0000 |
commit | f1f17487c551c3a32a7416be3fa6564089f8fc64 (patch) | |
tree | 49c6b8f536531473c49d6e58ece66d714eeca09a /usr.sbin | |
parent | ed8d320ec76ca261d0f5496bc1af150d240e6e33 (diff) |
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@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/btrace/bt_parse.y | 11 |
1 files changed, 8 insertions, 3 deletions
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 <mpi@openbsd.org> @@ -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 '(': |