Skip to content

Commit

Permalink
syntax: fix a bug that "eval() { :; }" is not parsed as a function de…
Browse files Browse the repository at this point in the history
…finition
  • Loading branch information
akinomyoga committed Jul 28, 2022
1 parent a6ac121 commit a4cda9c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/core-syntax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2507,9 +2507,6 @@ function ble-syntax:bash/ctx-command/check-word-end {
fi ;;
('then'|'elif'|'else'|'do') ((ctx=CTX_CMDX1)) ; processed=middle ;;
('}'|'done'|'fi'|'esac') ((ctx=CTX_CMDXE)) ; processed=end ;;
('declare'|'readonly'|'typeset'|'local'|'export'|'alias')
((ctx=CTX_ARGVX))
processed=builtin ;;
('function')
((ctx=CTX_ARGX))
local isfuncsymx=$'\t\n'' "$&'\''();<>\`|' rex_space=$'[ \t]' rex
Expand Down Expand Up @@ -2586,6 +2583,13 @@ function ble-syntax:bash/ctx-command/check-word-end {
((_ble_syntax_attr[i]=CTX_ARGX,i+=${#rematch1}))
fi
fi

# 引数の取り扱いが特別な builtin
case $word in
('declare'|'readonly'|'typeset'|'local'|'export'|'alias')
((ctx=CTX_ARGVX)) ;;
esac

return 0
fi

Expand Down

0 comments on commit a4cda9c

Please sign in to comment.