Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
b444057
Str:encode_uri
salano-ym Mar 30, 2024
d4a5cc7
Str:encode_uri_component
salano-ym Mar 30, 2024
0cfbaf7
Str:decode_uri
salano-ym Mar 30, 2024
bbecdf6
Str:decode_uri_component
salano-ym Mar 30, 2024
d599f8f
Update CHANGELOG.md
salano-ym Mar 30, 2024
1d094fd
docの書式が間違っているのを修正
salano-ym Mar 30, 2024
7458adc
encode系のdocを修正
salano-ym Mar 31, 2024
ab686d4
encode系関数の名前空間をStr:からUri:に移動
salano-ym Mar 31, 2024
3deebcf
Uri:encode系の関数名を変更
salano-ym Mar 31, 2024
f7face7
docを修正(Uri:decode_full)
salano-ym Mar 31, 2024
67f393e
arr.splice
salano-ym Apr 11, 2024
3761bf1
doc修正(arr.splice)
salano-ym Apr 11, 2024
3bd6c25
doc修正 (arr.splice)
salano-ym Apr 11, 2024
a1e98cf
fix lint
salano-ym Apr 11, 2024
84437df
arr.flat
salano-ym Apr 11, 2024
19d3d9f
arr.flat_mapを追加
salano-ym Apr 11, 2024
de79a95
doc修正(arr.splice)
salano-ym Apr 11, 2024
35d7e7f
doc修正(arr.flat)
salano-ym Apr 11, 2024
5db3408
Merge branch 'master' into arr-splice
salano-ym Apr 23, 2024
eccc492
Merge branch 'master' into arr-flat
salano-ym Apr 23, 2024
491de8b
arr.sortで行われる分割された各ソートを非同期処理に変更
salano-ym Apr 23, 2024
2b1fd0c
update CHANGELOG
salano-ym Apr 23, 2024
652d67d
Merge branch 'master' into async-mergesort
salano-ym Apr 23, 2024
2924a1a
Merge branch 'aiscript-dev:master' into async-mergesort
salano-ym Apr 25, 2024
32a8d66
fix CHANGELOG.md
salano-ym Apr 25, 2024
c354411
Merge branch 'aiscript-dev:master' into arr-splice
salano-ym Apr 25, 2024
c7a5a04
fix indent
salano-ym Apr 25, 2024
492f6b8
fix indent
salano-ym Apr 25, 2024
5540737
Merge branch 'aiscript-dev:master' into arr-flat
salano-ym Apr 25, 2024
a402ab4
fix CHANGELOG.md
salano-ym Apr 25, 2024
2cf197d
Merge branch 'master' into encode-uri
salano-ym Apr 25, 2024
c48c3ed
fix CHANGELOG.md
salano-ym Apr 25, 2024
c982c39
Bump actions/checkout from 4.1.3 to 4.1.4 in the gh-actions group
dependabot[bot] Apr 25, 2024
17f0c85
Merge pull request #634 from aiscript-dev/dependabot/github_actions/g…
salano-ym May 2, 2024
ef71160
add test Date:
salano-ym May 3, 2024
769764a
replace || -> ??
salano-ym May 3, 2024
19225bb
update CHAGELOG.md
salano-ym May 3, 2024
fb6101f
Merge pull request #645 from salano-ym/fix-falsy
salano-ym May 4, 2024
5c88552
fix: 位置情報を修正 (#648)
uzmoi May 6, 2024
dc7bfa3
二項演算子にLocを追加 (#647)
uzmoi May 6, 2024
5e135c7
Bump actions/checkout from 4.1.4 to 4.1.5 in the gh-actions group
dependabot[bot] May 6, 2024
1e67f13
str.starts_withを追加
salano-ym May 9, 2024
32c6a40
str.ends_withを追加
salano-ym May 9, 2024
11e5f01
fix docs/primitive-props.md
salano-ym May 9, 2024
ab8dc7c
Merge branch 'master' into encode-uri
salano-ym May 9, 2024
3c137a6
Merge branch 'master' into arr-flat
salano-ym May 9, 2024
ea19fc1
Merge branch 'master' into arr-splice
salano-ym May 9, 2024
98b532d
Merge branch 'master' into async-mergesort
salano-ym May 9, 2024
427a6d8
str.pad_startを追加
salano-ym May 9, 2024
e1b3a22
str.pad_endを追加
salano-ym May 9, 2024
4a18c33
arr.insertを追加
salano-ym May 9, 2024
86fe815
fix test
salano-ym May 9, 2024
f6993b2
arr.removeを追加
salano-ym May 9, 2024
863a192
Merge pull request #650 from aiscript-dev/dependabot/github_actions/g…
salano-ym May 9, 2024
5c7f11f
空の配列を初期値なしでreduceする時エラーを出すように (#600)
FineArchs May 10, 2024
f586319
Merge branch 'master' into encode-uri
salano-ym May 11, 2024
a971bda
Merge branch 'master' into str-padstart-padend
salano-ym May 11, 2024
2dcb3fe
Merge pull request #653 from salano-ym/str-padstart-padend
salano-ym May 12, 2024
481c4e4
Merge branch 'master' into arr-insert-remove
salano-ym May 12, 2024
f96693a
Merge pull request #654 from salano-ym/arr-insert-remove
salano-ym May 12, 2024
20fb010
Merge branch 'master' into async-mergesort
salano-ym May 12, 2024
884bfeb
Merge pull request #633 from salano-ym/async-mergesort
salano-ym May 12, 2024
571934a
Merge branch 'master' into encode-uri
salano-ym May 12, 2024
30ed94c
Merge branch 'master' into arr-flat
salano-ym May 12, 2024
44a9e4c
Merge pull request #622 from salano-ym/arr-flat
salano-ym May 12, 2024
ddae30e
Merge branch 'master' into encode-uri
salano-ym May 12, 2024
5281d04
Merge pull request #608 from salano-ym/encode-uri
salano-ym May 12, 2024
b1d9d22
Merge branch 'master' into str-startswith-endswith
salano-ym May 12, 2024
c90a098
Merge pull request #652 from salano-ym/str-startswith-endswith
salano-ym May 12, 2024
ba6cdba
Merge branch 'master' into arr-splice
salano-ym May 12, 2024
324fddd
remove spaces index.ts
salano-ym May 12, 2024
9e61804
Merge pull request #621 from salano-ym/arr-splice
salano-ym May 12, 2024
4cb7919
improve test: Math:gen_rng
salano-ym May 13, 2024
e758cef
Math:gen_rngのテストにコメントを追加
salano-ym May 13, 2024
f4f8603
refactor index.ts
salano-ym May 13, 2024
38f36ef
関数の省略された引数にNULLを格納するように (#639)
FineArchs May 14, 2024
43ff2a9
Merge pull request #660 from salano-ym/fix-test-genrng
salano-ym May 16, 2024
f72da1b
CHANGELOGの更新をunreleasedフォルダ内で行うようにする (#666)
FineArchs May 17, 2024
dcf3693
Merge remote-tracking branch 'upstream/master' into aiscript-next
FineArchs May 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4.1.3
uses: actions/checkout@v4.1.5

- name: Setup Node.js
uses: actions/setup-node@v4.0.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4.1.3
uses: actions/checkout@v4.1.5

- name: Setup Node.js
uses: actions/setup-node@v4.0.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4.1.3
uses: actions/checkout@v4.1.5

- name: Setup Node.js
uses: actions/setup-node@v4.0.2
Expand Down
56 changes: 0 additions & 56 deletions .github/workflows/publish-nightly-next.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish nightly (dev)
name: Publish nightly

on:
schedule:
Expand All @@ -8,16 +8,22 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- branch: master
tag: dev
- branch: aiscript-next
tag: next
env:
NPM_SECRET: ${{ secrets.NPM_SECRET }}
BRANCH: master
TAG: dev

steps:
- name: Checkout
uses: actions/checkout@v4.1.3
- name: Checkout ${{ matrix.branch }}
uses: actions/checkout@v4.1.5
with:
ref: ${{ env.BRANCH }}
ref: ${{ matrix.branch }}

- name: Setup Node.js
uses: actions/setup-node@v4.0.2
Expand All @@ -34,23 +40,23 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Set Version
run: |
CURRENT_VER=$(npm view 'file:.' version)
TIME_STAMP=$( date +'%Y%m%d' )
VERSION_SUFFIX=-$TAG.$TIME_STAMP
vim package.json '+/"version"' '+s/:\s*".*\zs\ze"/'$VERSION_SUFFIX/ '+wq'
echo 'NEWVERSION='$CURRENT_VER-${{ matrix.tag }}.$TIME_STAMP >> $GITHUB_ENV

- name: Check Commits
run: |
echo 'LAST_COMMITS='$( git log --since '24 hours ago' | wc -c ) >> $GITHUB_ENV

- name: Prepare Publish
run: npm run pre-release

- name: Publish
uses: JS-DevTools/npm-publish@v3
if: ${{ env.NPM_SECRET != '' && env.LAST_COMMITS != 0 }}
with:
token: ${{ env.NPM_SECRET }}
tag: ${{ env.TAG }}
tag: ${{ matrix.tag }}
access: public
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4.1.3
uses: actions/checkout@v4.1.5

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4.0.2
Expand Down
20 changes: 1 addition & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
[Read translated version (en)](./translations/en/CHANGELOG.md)

# Next
- 新しいAiScriptパーサーを実装
- スペースの厳密さが緩和
- **Breaking Change** 改行トークンを導入。改行の扱いが今までより厳密になりました。改行することができる部分以外では文法エラーになります。
- 文字列リテラルやテンプレートで、`\`とそれに続く1文字は全てエスケープシーケンスとして扱われるように
- 文法エラーの表示を改善。理由を詳細に表示するように。
- 複数行のコメントがある時に文法エラーの表示行数がずれる問題を解消しました。
- 実行時エラーの発生位置が表示されるように。
- **Breaking Change** パースの都合によりmatch文の構文を変更。パターンの前に`case`キーワードが必要となり、`*`は`default`に変更。
- **Breaking Change** 多くの予約語を追加。これまで変数名等に使えていた名前に影響が出る可能性があります。
- **Breaking Change** 配列及び関数の引数において、空白区切りが使用できなくなりました。`,`または改行が必要です。
- **Breaking Change** 関数同士の比較の実装
- **Breaking Change** `+`や`!`などの演算子の優先順位に変更があります。新しい順序は[syntax.md](docs/syntax.md#%E6%BC%94%E7%AE%97%E5%AD%90)を参照して下さい。
- **Breaking Change** 組み込み関数`Num:to_hex`は組み込みプロパティ`num#to_hex`に移動しました。
- **Breaking Change** `arr.sort`を安定ソートに変更

# 未リリース分

# 0.18.0
- `Core:abort`でプログラムを緊急停止できるように
- `index_of`の配列版を追加
Expand Down Expand Up @@ -143,4 +125,4 @@
- 空の関数を定義できない問題を修正
- 空のスクリプトが許可されていない問題を修正
- ネームスペース付き変数のインクリメント、デクリメントを修正
- ネームスペース付き変数への代入ができない問題を修正
- ネームスペース付き変数への代入ができない問題を修正
57 changes: 56 additions & 1 deletion docs/primitive-props.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ Core:range(0,2).push(4) //[0,1,2,4]
### @(_v_: str).incl(_keyword_: str): bool
文字列中に _keyword_ が含まれていれば`true`、なければ`false`を返します。

### @(_v_: str).starts_with(_prefix_: str, _start\_index_?: num): bool
文字列が _prefix_ で始まっていれば`true`、そうでなければ`false`を返します。\
_prefix_ が空文字列の場合は常に`true`を返します。\
_start\_index_ が指定されている場合、そのインデックスから始めます。\
_start\_index_ が`v.len`より大きいか`-v.len`より小さい場合は`false`を返します。\
_start\_index_ が負の場合は末尾から数えます。

### @(_v_: str).ends_with(_suffix_: str, _end\_index_?: num): bool
文字列が _suffix_ で終わっていれば`true`、そうでなければ`false`を返します。\
_suffix_ が空文字列の場合は常に`true`を返します。\
_end\_index_ が指定されている場合、そのインデックスの直前を末尾とします。(省略時は`v.len`)\
_end\_index_ が`v.len`より大きいか`-v.len`より小さい場合は`false`を返します。\
_end\_index_ が負の場合は末尾から数えます。

### @(_v_: str).slice(_begin_: num, _end_: num): str
文字列の _begin_ 番目から _end_ 番目の直前までの部分を取得します。

Expand All @@ -80,6 +94,16 @@ _fromIndex_が指定されていれば、その位置から検索を開始しま
_fromIndex_が負値の時は末尾からの位置(文字列の長さ+_fromIndex_)が使用されます。
該当が無ければ-1を返します。

### @(_v_: str).pad_start(_width_: num, _pad_?: str): str
文字列の長さがが _width_ になるように、先頭を _pad_ の繰り返しで埋めた新しい文字列を返します。\
_pad_ を省略した場合、空白`' '`で埋められます。\
_pad_ が長すぎる場合、_pad_ の末尾が切り捨てられます。

### @(_v_: str).pad_end(_width_: num, _pad_?: str): str
文字列の長さがが _width_ になるように、末尾を _pad_ の繰り返しで埋めた新しい文字列を返します。\
_pad_ を省略した場合、空白`' '`で埋められます。\
_pad_ が長すぎる場合、_pad_ の末尾が切り捨てられます。

### @(_v_: str).trim(): str
文字列の前後の空白を取り除いたものを返します。

Expand Down Expand Up @@ -142,11 +166,13 @@ _i_ 番目の文字が存在しない場合は null が返されます。
配列の要素のうち _func_ が true を返すようなもののみを抜き出して返します。
順序は維持されます。

### @(_v_: arr).reduce(_func_: @(_acm_: value, _item_: value, _index_: num) { value }, _initial_: value): value
### @(_v_: arr).reduce(_func_: Callback, _initial_: value): value
`Callback`: @(_acm_: value, _item_: value, _index_: num): value
配列の各要素に対し _func_ を順番に呼び出します。
各呼び出しでは、前回の結果が第1引数 _acm_ として渡されます。
_initial_ が指定された場合は初回呼び出しの引数が(_initial_, _v_\[0], 0)、
指定されなかった場合は(_v_\[0], _v_\[1], 1)となります。
配列が空配列であり、かつ _initial_ が指定されていない場合はエラーになります。従って基本的には _initial_ を指定しておくことが推奨されています。

### @(_v_: arr).find(_func_: @(_item_: value, _index_: num) { bool }): value
配列から _func_ が true を返すような要素を探し、その値を返します。
Expand Down Expand Up @@ -187,6 +213,35 @@ _fromIndex_ および _toIndex_ に関する挙動は`arr.slice`に準拠しま
`arr.copy`同様シャローコピーであり、配列やオブジェクトの参照は維持されます。
_times_ には0以上の整数値を指定します。それ以外ではエラーになります。

### @(_v_: arr).splice(_index_: num, _remove_count_?: num, _items_?: arr\<value>): arr\<value>
**【この操作は配列を書き換えます】**
配列の _index_ から _remove_count_ 個の要素を取り除き、その位置に _items_ の要素を挿入します。
返り値として、取り除いた要素の配列を返します。\
_index_ が負の場合は末尾から数えます。\
_index_ が最後の要素より後の場合は要素を取り除かず、挿入は末尾に追加します。\
_remove_count_ を省略した場合、末尾まで取り除きます。\
_items_ を省略した場合、何も挿入しません。

### @(_v_: arr).flat(_depth_?: num): arr
配列に含まれる配列を _depth_ で指定した深さの階層まで結合した新しい配列を作成します。
_depth_ には0以上の整数値を指定します。省略時は1になります。

### @(_v_: arr).flat_map(_func_: @(_item_: value, _index_: num) { value }): arr
配列の各要素を _func_ の返り値で置き換えた後、1階層平坦化した新しい配列を作成します。
_func_ は非同期的に呼び出されます。

### @(_v_: arr).insert(_index_: num, _item_: value): null
**【この操作は配列を書き換えます】**
配列の _index_ の位置に _item_ を挿入します。\
_index_ が負の場合は末尾から数えます。\
_index_ が最後の要素より後の場合は末尾に追加します。

### @(_v_: arr).remove(_index_: num): value | null
**【この操作は配列を書き換えます】**
配列から _index_ の位置の要素を取り除き、その要素を返します。\
_index_ が負の場合は末尾から数えます。\
_index_ が最後の要素より後の場合は取り除かず、`null`を返します。

### @(_v_: arr).every(_func_: @(_item_: value, _index_: num) { bool }): bool
配列の全ての要素に対して _func_ が true を返す時のみ true 返します。空配列には常に true を返します。

Expand Down
27 changes: 22 additions & 5 deletions docs/std.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,27 +113,44 @@ _time_offset_ を渡していない場合はローカルのものを参照しま
型: `str`
改行コード(LF)です。

### #Str:lt(a: str, b: str): num
### @Str:lt(a: str, b: str): num
a < b ならば -1、a == b ならば 0、a > b ならば 1 を返します。
arr.sortの比較関数として使用できます。

### #Str:gt(a: str, b: str): num
### @Str:gt(a: str, b: str): num
a > b ならば -1、a == b ならば 0、a < b ならば 1 を返します。
arr.sortの比較関数として使用できます。

### #Str:from_codepoint(codepoint: num): str
### @Str:from_codepoint(codepoint: num): str
Unicodeのコードポイントから文字を生成します。

_codepoint_ は 0 以上、10FFFF<sub>16</sub> 以下である必要があります。

### #Str:from_unicode_codepoints(_codePoints_: `arr<num>`): str
### @Str:from_unicode_codepoints(_codePoints_: `arr<num>`): str
Unicodeのコードポイント列を表す数値の配列から文字を生成します。
_codePoints_の各要素は 0 以上、10FFFF<sub>16</sub> 以下である必要があります。

### #Str:from_utf8_bytes(_bytes_: `arr<num>`): str
### @Str:from_utf8_bytes(_bytes_: `arr<num>`): str
UTF-8のバイト列を表す数値の配列から文字を生成します。
_bytes_の各要素は 0 以上、255 以下である必要があります。

## :: Uri
### @Uri:encode_full(uri: str): str
uri をURIとしてエンコードした文字列を返します。以下の文字はエンコードされません。
`A-Z a-z 0-9 - _ . ! ~ * ' ( ) ; , / ? : @ & = + $ #`

### @Uri:encode_component(text: str): str
text をURI構成要素としてエンコードした文字列を返します。以下の文字はエンコードされません。
`A-Z a-z 0-9 - _ . ! ~ * ' ( )`

### @Uri:decode_full(encoded_uri: str): str
encoded_uri をエンコードされたURIとしてデコードした文字列を返します。
以下の文字に対応するエスケープシーケンスはデコードされません。
`; , / ? : @ & = + $ #`

### @Uri:decode_component(encoded_text: str): str
encoded_text をエンコードされたURI構成要素としてデコードした文字列を返します。

## :: Arr
### @Arr:create(_length_: num, _initial_?: value): arr
長さが`length`の配列を作成します。
Expand Down
2 changes: 2 additions & 0 deletions etc/aiscript.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ type And = NodeBase & {
type: 'and';
left: Expression;
right: Expression;
operatorLoc: Loc;
};

// @public (undocumented)
Expand Down Expand Up @@ -479,6 +480,7 @@ type Or = NodeBase & {
type: 'or';
left: Expression;
right: Expression;
operatorLoc: Loc;
};

// @public (undocumented)
Expand Down
Loading