Skip to content

Commit

Permalink
syntax: change context after "time ;" and "! ;" for Bash 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Feb 20, 2021
1 parent 64b55b7 commit 4628370
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/core-syntax.sh
Expand Up @@ -3676,8 +3676,9 @@ function ble/syntax:bash/ctx-command/.check-delimiter-or-redirect {
((_ble_syntax_attr[i++]=ATTR_DEL,ctx=CTX_CMDXD))
return 0
elif ((ctx==CTX_CMDXT)); then
# time ; 及び ! ; に限っては、エラーにならずに直後に CTX_CMDXE になる (#D0592)
((_ble_syntax_attr[i++]=ATTR_DEL,ctx=CTX_CMDXE))
# Note #D0592: time ; 及び ! ; に限っては、エラーにならずに直後に CTX_CMDXE になる
# Note #D1477: Bash 4.4 で振る舞いが変わる。
((_ble_syntax_attr[i++]=ATTR_DEL,ctx=_ble_bash>=40400?CTX_CMDX:CTX_CMDXE))
return 0
fi
fi
Expand Down
3 changes: 2 additions & 1 deletion memo/ChangeLog.md
Expand Up @@ -15,7 +15,7 @@
- canvas, edit: support `bleopt info_display` (suggested by 0neGuyDev) `#D1458` 69228fa
- canvas (panel): always call `panel::render` to update height `#D1472` 51d2c05
- prompt: support `bleopt prompt_status_{line,align}` and `face prompt_status_line` `#D1462` cca1cbc
- syntax: properly support case patterns `#D1474` `#D1475` `#D1476` 0000000
- syntax: properly support case patterns `#D1474` `#D1475` `#D1476` 64b55b7

## Changes

Expand All @@ -31,6 +31,7 @@
- complete: support `bleopt complete_timeout_compvar` to time out pathname expansions for `COMP_WORDS` / `COMP_LINE` `#D1457` cc2881a
- prompt: rename `bleopt prompt_{status_line => term_status}` `#D1462` cca1cbc
- edit (`ble/builtin/read`): cancel by <kbd>C-d</kbd> on an empty line `#D1473` ecb8888
- syntax: change syntax context after `time ;` and `! ;` for Bash 4.4 `#D1477` 0000000

## Fixes

Expand Down
3 changes: 3 additions & 0 deletions memo/done.txt
Expand Up @@ -35502,6 +35502,9 @@

どうやら !, time 直後の ; の後は CTX_CMDXE になっている様だ。

2021-02-18 Note (#D1477): bash 4.4 で振る舞いが変更された。
4.4 以降では time ; や ! ; の後は通常のコマンドも来る事ができる。

もう少し調べる。

$ time & # Error
Expand Down
14 changes: 14 additions & 0 deletions note.txt
Expand Up @@ -3728,6 +3728,20 @@ bash_tips
Done (実装ログ)
-------------------------------------------------------------------------------

2021-02-18

* syntax: !; 及び time; の後の文脈 [#D1477]

!; 及び time; の後の文脈で } fi done esac を要求しているが実際は任意のコマ
ンドの筈である。少なくともそうなっている様に見える。問題の部分では #D0592
を参照しているが、これは大きな書き換えなので特にこの部分で何故この様にした
のかは謎。コメントには明示的に CTX_CMDXE と書かれている。そんな事はない筈な
のに不思議である。

よく #D0592 を見てみたら "time ; echo" でエラーになると書かれている。
うーん。bash の version かと思って試したらそうだった。bash 4.3 以前は
"time ; echo" がエラーになるのであった。一方で 4.4 以降は OK

2021-02-15

* 2017-10-01 syntax: case $x in (a b) : ;; esac のパターン "a b" はエラー [#D1476]
Expand Down

0 comments on commit 4628370

Please sign in to comment.