From 064c37b4ee1022f1dd2b540d7e579e4e5d0af6a4 Mon Sep 17 00:00:00 2001 From: zawz Date: Wed, 19 May 2021 16:56:46 +0200 Subject: [PATCH] fix error messages on bash 'function' --- include/parse.hpp | 1 + src/parse.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/parse.hpp b/include/parse.hpp index 6a46538..95575d4 100644 --- a/include/parse.hpp +++ b/include/parse.hpp @@ -12,6 +12,7 @@ #define ARG_END " \t\n;#()&|<>" #define VARNAME_END " \t\n;#()&|=\"'\\{}/-+" #define BLOCK_TOKEN_END " \t\n;#()&|=\"'\\" +#define BASH_BLOCK_END " \t\n;#()&|=\"'\\{}" #define COMMAND_SEPARATOR "\n;" #define CONTROL_END "#)" #define PIPELINE_END "\n;#()&" diff --git a/src/parse.cpp b/src/parse.cpp index f6150ef..5521550 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -1849,10 +1849,10 @@ std::pair parse_block(parse_context ctx) newct.has_errored=true; } newct.i = skip_unread(newct); - auto wp2=get_word(newct, VARNAME_END); + auto wp2=get_word(newct, BASH_BLOCK_END); if(!valid_name(wp2.first)) { - parse_error( strf("Bad function name: '%s'", word.c_str()), newct ); + parse_error( strf("Bad function name: '%s'", wp2.first.c_str()), newct ); } newct.i = wp2.second;