script: Do not allow a delimiter between function name and block start

Currently the following is valid syntax but should be a syntax error:

  grub> function f; { echo HERE; }
  grub> f
  HERE

This fix is not backward compatible, but current syntax is not documented
either and has no functional value. So any scripts with this unintended
syntax are technically syntactically incorrect and should not be relying
on this behavior.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Glenn Washburn 2020-07-31 09:33:22 -05:00 committed by Daniel Kiper
parent c30f378e00
commit ac301e4dd0
1 changed files with 1 additions and 1 deletions

View File

@ -279,7 +279,7 @@ function: "function" "name"
$<scripts>$ = state->scripts;
state->scripts = 0;
}
delimiters0 "{" commands1 delimiters1 "}"
newlines0 "{" commands1 delimiters1 "}"
{
struct grub_script *script;
state->func_mem = grub_script_mem_record_stop (state,