Skip to content

Commit 8fe209f

Browse files
committed
eval.jax: Update Vim 8.2.4987 translate and fix interpolated-string
1 parent 96b3cc6 commit 8fe209f

File tree

1 file changed

+38
-31
lines changed

1 file changed

+38
-31
lines changed

doc/eval.jax

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim バージョン 8.2. Last change: 2022 Apr 17
1+
*eval.txt* For Vim バージョン 8.2. Last change: 2022 May 13
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -504,7 +504,7 @@ Blob の場合、一度に 1 バイトが使われる。
504504
キーは必ず文字列である。数値を使うこともできるが、自動的に文字列に変換される。
505505
よって文字列 '4' のキーと数値4のキーは同一の要素を参照する。
506506
Note 文字列 '04' と数値04は異なることに注意。なぜなら数値04は文字列 '4' に変換
507-
されるからである。空文字列もまたキーとして使用できる。
507+
され、先頭の0は脱落するからである。空文字列もまたキーとして使用できる。
508508

509509
|Vim9| script では、キーが英数字、アンダースコア、ダッシュで構成されている場
510510
合、リテラルキーが使える。|vim9-literal-dict| を参照。
@@ -516,7 +516,8 @@ Note 文字列 '04' と数値04は異なることに注意。なぜなら数値0
516516
:let mydict = #{zero: 0, one_key: 1, two-key: 2, 333: 3}
517517
Note ここでは 333 は 文字列 "333" であることに注意。空のキーは #{} を使うこと
518518
ができない。
519-
|Vim9| script では #{} 形式は使用できない。
519+
|Vim9| script では #{} 形式は使用できない、なぜならコメントの開始と紛らわしい
520+
ためである。
520521

521522
値はどんな式でもよい。辞書を値にすると、ネストした辞書ができる: >
522523
:let nestdict = {1: {11: 'a', 12: 'b'}, 2: {21: 'c'}}
@@ -1481,24 +1482,31 @@ Note シングルクォートが使われていることに注意。
14811482
if a =~ '\s*'
14821483
14831484
1484-
interpolated-string *interp-string* *E256*
1485+
文字列補間 *interp-string* *E256*
14851486
--------------------
1486-
$"string" interpolated string constant *expr-$quote*
1487-
$'string' interpolated literal string constant *expr-$'*
1487+
$"string" 補間された文字列定数 *expr-$quote*
1488+
$'string' 補間されたリテラル文字列定数 *expr-$'*
1489+
1490+
文字列補間は文字列 |string| およびリテラル文字列 |literal-string| の拡張であ
1491+
り、Vim スクリプトの式(|expr1| を参照)を含むことができる。波括弧にくくられた値
1492+
を返す任意の式を含むことを許す。値は文字列に変換される。すべてのテキストと式の
1493+
結果は結合され新しい文字列を作る。
1494+
*E1278*
1495+
開き波括弧 '{' あるいは閉じ波括弧 '}' を文字列として入れる場合は二重にする。ダ
1496+
ブルクォートの文字列はバックスラッシュを使うこともできる。単一の閉じ波括弧 '}'
1497+
はエラーになる。
14881498

1489-
Interpolated strings are an extension of the |string| and |literal-string|,
1490-
allowing the inclusion of Vim script expressions (see |expr1|). Any
1491-
expression returning a value can be enclosed between curly braces. The value
1492-
is converted to a string. All the text and results of the expressions
1493-
are concatenated to make a new string.
1494-
1495-
To include an opening brace '{' or closing brace '}' in the string content
1496-
double it.
1497-
1498-
Examples: >
1499+
例: >
14991500
let your_name = input("What's your name? ")
1501+
< What's your name? Peter ~
1502+
>
1503+
echo
15001504
echo $"Hello, {your_name}!"
1501-
echo $"The square root of 9 is {sqrt(9)}"
1505+
< Hello, Peter! ~
1506+
>
1507+
echo $"The square root of {{9}} is {sqrt(9)}"
1508+
< The square root of {9} is 3.0 ~
1509+
15021510

15031511
オプション *expr-option* *E112* *E113*
15041512
---------
@@ -2863,7 +2871,7 @@ script の場合は、関数がエクスポートされていないことが原
28632871

28642872
自動コマンドを使う方法 ~
28652873

2866-
これはユーザーマニュアルのセクション|41.14|で説明されている。
2874+
これはユーザーマニュアルのセクション |51.4| で説明されている。
28672875

28682876
自動コマンドは、長いVim scriptファイルのプラグインに対して有用である。自動コマ
28692877
ンドを定義し、すぐに `:finish` でそのスクリプトを抜ける。こうするとVimの起動が
@@ -2881,7 +2889,7 @@ FuncUndefinedを使う。例: >
28812889

28822890
オートロードスクリプトの使い方 ~
28832891
*autoload* *E746*
2884-
これはユーザーマニュアルのセクション|41.15|で説明されている。
2892+
これはユーザーマニュアルのセクション |51.5| で説明されている。
28852893

28862894
"autoload" ディレクトリのスクリプトを使う方法はより簡単である。しかし完全に正
28872895
しいファイル名を使う必要がある。オートロードされる関数は次のような名前を持つ: >
@@ -3155,20 +3163,19 @@ text...
31553163
空白を含んではならない。
31563164

31573165
"eval" が指定されていない場合、テキストの各行は
3158-
|literal-string| として扱われる。"eval" が指定されてい
3159-
る場合、任意のVimの式が ``={expr}`` として入ることで評
3160-
価されその結果で置き換える。
3166+
|literal-string| として扱われるが、シングルクォートは
3167+
除外され二重にする必要はない。
3168+
"eval" が指定されている場合、任意のVimの式を {expr}
3169+
して入ることでそれが評価され結果で置き換えられる。
31613170
例として $HOME を展開する: >
31623171
let lines =<< trim eval END
31633172
some text
3164-
See the file `=$HOME`/.vimrc
3173+
See the file {$HOME}/.vimrc
31653174
more text
31663175
END
31673176
< 1行に複数のVimの式は許容されるが、複数行に跨る式は許容
31683177
されない。どれかの式の評価が失敗する場合、変数への割り
31693178
当てに失敗する。
3170-
"`=" が見付かったら式とバッククォートが続くく必要があ
3171-
る。{expr} は空にはできない。
31723179

31733180
{endmarker} は小文字で始めることができない。
31743181
最後の行は {endmarker} 文字列だけで終わり、他の文字は
@@ -3218,10 +3225,10 @@ text...
32183225
DATA
32193226
32203227
let code =<< trim eval CODE
3221-
let v = `=10 + 20`
3222-
let h = "`=$HOME`"
3223-
let s = "`=Str1()` abc `=Str2()`"
3224-
let n = `=MyFunc(3, 4)`
3228+
let v = {10 + 20}
3229+
let h = "{$HOME}"
3230+
let s = "{Str1()} abc {Str2()}"
3231+
let n = {MyFunc(3, 4)}
32253232
CODE
32263233
<
32273234
*E121*
@@ -3432,8 +3439,8 @@ text...
34323439
:for {var} in {object} *:for* *E690* *E732*
34333440
:endfo[r] *:endfo* *:endfor*
34343441
{object}の各要素に対し、`:for``:endfor` の間のコマ
3435-
ンドを繰り返す。{object}はリスト |List| または |Blob|
3436-
である。 *E1177*
3442+
ンドを繰り返す。{object}はリスト |List||Blob|、また
3443+
は文字列 |String| である。 *E1177*
34373444

34383445
変数{var}に各要素の値がセットされる。
34393446
|Vim9| script ではループ変数がグローバル/ウィンドウ/タ

0 commit comments

Comments
 (0)