fix error messages on bash 'function'

This commit is contained in:
zawz 2021-05-19 16:56:46 +02:00
parent 86a4d4a118
commit 064c37b4ee
2 changed files with 3 additions and 2 deletions

View file

@ -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;#()&"

View file

@ -1849,10 +1849,10 @@ std::pair<block*, parse_context> 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;