nadesiko3 3.3.51 → 3.3.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/batch/command.txt +2 -0
- package/batch/command_nakopad.txt +2 -0
- package/core/.editorconfig +6 -0
- package/core/.eslintrc.cjs +33 -0
- package/core/.github/dependabot.yml +7 -0
- package/core/.github/workflows/nodejs.yml +37 -0
- package/core/.github/workflows/super-linter.yml +61 -0
- package/core/.github/workflows/textlint.yml +199 -0
- package/core/README.md +4 -0
- package/core/doc/README.md +67 -0
- package/core/index.mjs +2 -2
- package/core/index.mts +21 -0
- package/core/package.json +1 -1
- package/core/src/nako3.mjs +76 -50
- package/core/src/nako3.mts +79 -50
- package/core/src/nako_core_version.mjs +2 -2
- package/core/src/nako_core_version.mts +2 -2
- package/core/src/nako_errors.mjs +1 -8
- package/core/src/nako_errors.mts +2 -8
- package/core/src/nako_gen.mjs +4 -2
- package/core/src/nako_gen.mts +4 -2
- package/core/src/nako_global.mjs +7 -4
- package/core/src/nako_global.mts +9 -4
- package/core/src/nako_lexer.mjs +4 -4
- package/core/src/nako_lexer.mts +4 -4
- package/core/src/nako_parser3.mjs +6 -4
- package/core/src/nako_parser3.mts +6 -4
- package/core/src/nako_parser_base.mjs +2 -1
- package/core/src/nako_parser_base.mts +3 -1
- package/core/src/nako_types.mjs +0 -12
- package/core/src/nako_types.mts +1 -8
- package/core/test/array_test.mjs +34 -0
- package/core/test/basic_test.mjs +344 -0
- package/core/test/calc_test.mjs +140 -0
- package/core/test/core_module_test.mjs +23 -0
- package/core/test/debug_test.mjs +16 -0
- package/core/test/dncl_test.mjs +94 -0
- package/core/test/error_message_test.mjs +210 -0
- package/core/test/error_test.mjs +16 -0
- package/core/test/flow_test.mjs +373 -0
- package/core/test/func_call.mjs +163 -0
- package/core/test/func_test.mjs +149 -0
- package/core/test/indent_test.mjs +364 -0
- package/core/test/lex_test.mjs +168 -0
- package/core/test/literal_test.mjs +73 -0
- package/core/test/nako_lexer_test.mjs +35 -0
- package/core/test/nako_logger_test.mjs +76 -0
- package/core/test/plugin_csv_test.mjs +38 -0
- package/core/test/plugin_promise_test.mjs +18 -0
- package/core/test/plugin_system_test.mjs +630 -0
- package/core/test/prepare_test.mjs +96 -0
- package/core/test/re_test.mjs +22 -0
- package/core/test/side_effects_test.mjs +98 -0
- package/core/test/variable_scope_test.mjs +149 -0
- package/core/tsconfig.json +101 -0
- package/demo/nako3/test.js +22 -0
- package/demo/nako3/test.mjs +16 -0
- package/doc/plugins.md +35 -0
- package/package.json +13 -12
- package/release/_hash.txt +28 -28
- package/release/_script-tags.txt +14 -14
- package/release/command.json +1 -1
- package/release/command.json.js +1 -1
- package/release/command_cnako3.json +1 -1
- package/release/command_list.json +1 -1
- package/release/editor.js +1 -1
- package/release/nako_gen_async.js +1 -1
- package/release/plugin_webworker.js +1 -1
- package/release/stats.json +1 -1
- package/release/version.js +1 -1
- package/release/wnako3.js +1 -1
- package/release/wnako3webworker.js +1 -1
- package/src/cnako3mod.mjs +20 -50
- package/src/cnako3mod.mts +20 -48
- package/src/nako_version.mjs +2 -2
- package/src/nako_version.mts +2 -2
- package/src/plugin_browser_in_worker.mjs +0 -1
- package/src/plugin_webworker.mjs +4 -2
- package/src/wnako3_editor.mjs +4 -20
- package/src/wnako3_editor.mts +13 -30
- package/src/wnako3mod.mjs +155 -115
- package/src/wnako3mod.mts +145 -111
- package/src/wnako3webworker.mjs +3 -4
- package/test/ace_editor/{karma.config.js → karma.config.cjs} +7 -4
- package/test/browser/{karma.config.js → karma.config.cjs} +11 -10
- package/test/browser/test/compare_util.js +3 -1
- package/test/browser/test/plugin_browser_test_ajax.js +2 -1
- package/test/browser/test/plugin_browser_test_color.js +1 -1
- package/test/browser/test/plugin_browser_test_dialog.js +1 -1
- package/test/browser/test/plugin_browser_test_dom_event.js +1 -1
- package/test/browser/test/plugin_browser_test_dom_parts.js +1 -1
- package/test/browser/test/plugin_browser_test_system.js +1 -2
- package/test/browser/test/plugin_webworker_test.js +1 -1
- package/test/browser/test/require_test.js +1 -1
- package/test/bundled/{karma.config.js → karma.config.cjs} +0 -0
- package/test/{karma.config.js → karma.config.cjs} +0 -0
- package/test/node/node_test.mjs +2 -2
- package/tools/nako3server/index.mjs +3 -0
- package/batch/.DS_Store +0 -0
- package/demo/.DS_Store +0 -0
- package/demo/extlib/.DS_Store +0 -0
- package/src/.DS_Store +0 -0
- package/test/.DS_Store +0 -0
- package/test/browser/.DS_Store +0 -0
- package/test/bundled/.DS_Store +0 -0
- package/test/bundled/test_base/.DS_Store +0 -0
- package/test/common/.DS_Store +0 -0
- package/test/node/.DS_Store +0 -0
- package/tools/.DS_Store +0 -0
- package/tools/nako3edit/.DS_Store +0 -0
- package/tools/nako3edit/html/.DS_Store +0 -0
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
「なでしこ3」とは、日本語のプログラミング言語です。HTML5/JavaScript(TypeScript)をベースとしているので、PC/スマホ/タブレットなど、さまざまな環境で動作させることができます。日本語プログラミング言語は、読みやすく理解しやすいのが特徴で、初めてでも楽しくプログラミングを覚えることができます。また、バッチ処理や定型処理などを手軽に記述できます。
|
|
37
37
|
|
|
38
38
|
- [なでしこのWebサイト](https://nadesi.com/)
|
|
39
|
-
- [なでしこ3のGitHub Pages
|
|
39
|
+
- [なでしこ3のGitHub Pages](https://kujirahand.github.io/nadesiko3/)
|
|
40
40
|
- [マニュアル](https://nadesi.com/v3/doc/)
|
|
41
41
|
|
|
42
42
|
## 対応機器/ブラウザ
|
package/batch/command.txt
CHANGED
|
@@ -1033,6 +1033,7 @@
|
|
|
1033
1033
|
■plugin_php(基本プラグイン,phpnako)
|
|
1034
1034
|
●PHP定数
|
|
1035
1035
|
| 定数 | PHPバージョン | | phpversion() | PHPばーじょん | https://github.com/kujirahand/nadesiko3php/blob/master/src/plugin_php.php#L90
|
|
1036
|
+
| 定数 | PLUGIN_PHPバージョン | | '0.0.1' | PLUGIN_PHPばーじょん | https://github.com/kujirahand/nadesiko3php/blob/master/src/plugin_php.php#L90
|
|
1036
1037
|
●PHPシステム
|
|
1037
1038
|
| 関数 | PHP取込 | FILEを/FILEの/FILEから | PHPファイルを取り込む。 | PHPとりこむ | https://github.com/kujirahand/nadesiko3php/blob/master/src/plugin_php.php#L90
|
|
1038
1039
|
| 関数 | セッション開始 | | PHPセッションを開始する。 | せっしょんかいし | https://github.com/kujirahand/nadesiko3php/blob/master/src/plugin_php.php#L90
|
|
@@ -1042,6 +1043,7 @@
|
|
|
1042
1043
|
| 関数 | クッキーオプション設定 | Vを/Vへ/Vに | cookieのオプションを辞書型で設定する | くっきーおぷしょんせってい | https://github.com/kujirahand/nadesiko3php/blob/master/src/plugin_php.php#L90
|
|
1043
1044
|
| 定数 | GET | | [] | GET | https://github.com/kujirahand/nadesiko3php/blob/master/src/plugin_php.php#L90
|
|
1044
1045
|
| 定数 | POST | | [] | POST | https://github.com/kujirahand/nadesiko3php/blob/master/src/plugin_php.php#L90
|
|
1046
|
+
| 定数 | SERVER | | [] | SERVER | https://github.com/kujirahand/nadesiko3php/blob/master/src/plugin_php.php#L90
|
|
1045
1047
|
| 定数 | FILES | | [] | FILES | https://github.com/kujirahand/nadesiko3php/blob/master/src/plugin_php.php#L90
|
|
1046
1048
|
| 定数 | SESSION | | [] | SESSION | https://github.com/kujirahand/nadesiko3php/blob/master/src/plugin_php.php#L90
|
|
1047
1049
|
| 関数 | GET取得 | KEYをDEFで/DEFにて | GETパラメータのKEYを、省略値DEFで取得する | GETしゅとく | https://github.com/kujirahand/nadesiko3php/blob/master/src/plugin_php.php#L90
|
|
@@ -981,6 +981,7 @@
|
|
|
981
981
|
+ plugin_php(��{�v���O�C��,phpnako)
|
|
982
982
|
- PHP�萔
|
|
983
983
|
|PHP�o�[�W����,"","phpversion()",0,,�ϐ�,PHP�[�����
|
|
984
|
+
|PLUGIN_PHP�o�[�W����,"","'0.0.1'",0,,�ϐ�,PLUGIN_PHP�[�����
|
|
984
985
|
- PHP�V�X�e��
|
|
985
986
|
|PHP�捞,"FILE��|FILE��|FILE����","PHP�t�@�C������荞�ށB",0,,����,PHP�Ƃ肱��
|
|
986
987
|
|�Z�b�V�����J�n,"","PHP�Z�b�V�������J�n����B",0,,����,�����������
|
|
@@ -990,6 +991,7 @@
|
|
|
990
991
|
|�N�b�L�[�I�v�V�����ݒ�,"V��|V��|V��","cookie�̃I�v�V�����������^�Őݒ肷��",0,,����,�������[���Ղ�����Ă�
|
|
991
992
|
|GET,"","[]",0,,�ϐ�,GET
|
|
992
993
|
|POST,"","[]",0,,�ϐ�,POST
|
|
994
|
+
|SERVER,"","[]",0,,�ϐ�,SERVER
|
|
993
995
|
|FILES,"","[]",0,,�ϐ�,FILES
|
|
994
996
|
|SESSION,"","[]",0,,�ϐ�,SESSION
|
|
995
997
|
|GET�擾,"KEY��DEF��|DEF�ɂ�","GET�p�����[�^��KEY���A�ȗ��lDEF�Ŏ擾����",0,,����,GET����Ƃ�
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"commonjs": false,
|
|
5
|
+
"es2021": true
|
|
6
|
+
},
|
|
7
|
+
"extends": [
|
|
8
|
+
"standard",
|
|
9
|
+
"standard-with-typescript",
|
|
10
|
+
"eslint:recommended",
|
|
11
|
+
"plugin:@typescript-eslint/recommended"
|
|
12
|
+
],
|
|
13
|
+
"parserOptions": {
|
|
14
|
+
"ecmaVersion": "latest",
|
|
15
|
+
"sourceType": "module",
|
|
16
|
+
"project": "./tsconfig.json",
|
|
17
|
+
"extraFileExtensions": [".mts", ".mjs"]
|
|
18
|
+
},
|
|
19
|
+
"rules": {
|
|
20
|
+
"quote-props": "off", // 重要
|
|
21
|
+
"@typescript-eslint/no-explicit-any": "off", // any型を認めないをオフ
|
|
22
|
+
"@typescript-eslint/explicit-module-boundary-types": "off", // 型の指定に関する警告をオフ
|
|
23
|
+
"@typescript-eslint/ban-ts-comment": "off", // @ts-nocheck を許さないをオフ
|
|
24
|
+
//"@typescript-eslint/no-unused-vars": 0,
|
|
25
|
+
//"@typescript-eslint/no-empty-function": 0,
|
|
26
|
+
// "no-unused-vars":0,
|
|
27
|
+
// "no-undef": 0
|
|
28
|
+
},
|
|
29
|
+
"plugins": [
|
|
30
|
+
"@typescript-eslint"
|
|
31
|
+
],
|
|
32
|
+
"root": true
|
|
33
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
+
|
|
4
|
+
# (memo)
|
|
5
|
+
# GitHubで頻繁にブラウザテストが失敗するので
|
|
6
|
+
# コミット時のテストを簡易化しています。
|
|
7
|
+
# ただし、リリース前には必ず全テスト実行するように
|
|
8
|
+
# publish用のスクリプトを追加してミスを防ぎます。
|
|
9
|
+
# [詳細] https://github.com/kujirahand/nadesiko3/issues/1037
|
|
10
|
+
|
|
11
|
+
name: Node.js CI
|
|
12
|
+
|
|
13
|
+
on:
|
|
14
|
+
push:
|
|
15
|
+
branches: [ master ]
|
|
16
|
+
pull_request:
|
|
17
|
+
branches: [ master ]
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
build:
|
|
21
|
+
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
|
|
24
|
+
strategy:
|
|
25
|
+
matrix:
|
|
26
|
+
node-version: [16.x, 14.x, 12.x]
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v2
|
|
30
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
31
|
+
uses: actions/setup-node@v1
|
|
32
|
+
with:
|
|
33
|
+
node-version: ${{ matrix.node-version }}
|
|
34
|
+
- run: npm install
|
|
35
|
+
- run: npm run build
|
|
36
|
+
- run: npm run test
|
|
37
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
###########################
|
|
2
|
+
###########################
|
|
3
|
+
## Linter GitHub Actions ##
|
|
4
|
+
###########################
|
|
5
|
+
###########################
|
|
6
|
+
name: Lint Code Base
|
|
7
|
+
|
|
8
|
+
#
|
|
9
|
+
# Documentation:
|
|
10
|
+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
|
11
|
+
#
|
|
12
|
+
|
|
13
|
+
#############################
|
|
14
|
+
# Start the job on all push #
|
|
15
|
+
#############################
|
|
16
|
+
on:
|
|
17
|
+
push:
|
|
18
|
+
branches:
|
|
19
|
+
- master
|
|
20
|
+
pull_request:
|
|
21
|
+
|
|
22
|
+
###############
|
|
23
|
+
# Set the Job #
|
|
24
|
+
###############
|
|
25
|
+
jobs:
|
|
26
|
+
build:
|
|
27
|
+
# Name the Job
|
|
28
|
+
name: Lint Code Base
|
|
29
|
+
# Set the agent to run on
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
|
|
32
|
+
##################
|
|
33
|
+
# Load all steps #
|
|
34
|
+
##################
|
|
35
|
+
steps:
|
|
36
|
+
##########################
|
|
37
|
+
# Checkout the code base #
|
|
38
|
+
##########################
|
|
39
|
+
- name: Checkout Code
|
|
40
|
+
uses: actions/checkout@v2
|
|
41
|
+
with:
|
|
42
|
+
# Full git history is needed to get a proper list of changed files within `super-linter`
|
|
43
|
+
fetch-depth: 0
|
|
44
|
+
|
|
45
|
+
################################
|
|
46
|
+
# Run Linter against code base #
|
|
47
|
+
################################
|
|
48
|
+
- name: Lint Code Base
|
|
49
|
+
uses: github/super-linter@v4.5.1
|
|
50
|
+
env:
|
|
51
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
52
|
+
# 本質でないバリデータを排除(余力があればtrueにして直す)
|
|
53
|
+
VALIDATE_EDITORCONFIG: true
|
|
54
|
+
VALIDATE_JAVASCRIPT_STANDARD: true
|
|
55
|
+
VALIDATE_MARKDOWN: true
|
|
56
|
+
VALIDATE_CSS: false
|
|
57
|
+
VALIDATE_BASH: false
|
|
58
|
+
VALIDATE_HTML: false
|
|
59
|
+
VALIDATE_JSCPD: false
|
|
60
|
+
VALIDATE_JSON: false
|
|
61
|
+
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
name: textlint CI
|
|
2
|
+
|
|
3
|
+
# pull_requestで何かあった時に起動する
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
# textlintをかけ、結果をPRにコメントとして表示する。
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
node-version: [ 16.x ]
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
+
uses: actions/setup-node@v1.4.4
|
|
21
|
+
with:
|
|
22
|
+
node-version: ${{ matrix.node-version }}
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: |
|
|
25
|
+
yarn install -D
|
|
26
|
+
# lintする
|
|
27
|
+
- name: Lint files
|
|
28
|
+
id: lint
|
|
29
|
+
run: |
|
|
30
|
+
result="$(yarn run textlint 2>&1)" || true
|
|
31
|
+
echo "$result"
|
|
32
|
+
result="${result//'%'/'%25'}"
|
|
33
|
+
result="${result//$'\n'/'%0A'}"
|
|
34
|
+
result="${result//$'\r'/'%0D'}"
|
|
35
|
+
echo "::set-output name=result::$result"
|
|
36
|
+
true
|
|
37
|
+
continue-on-error: true
|
|
38
|
+
# lint結果をコメントに残す
|
|
39
|
+
- name: Lint Comment
|
|
40
|
+
if: github.event.pull_request.head.repo.full_name == github.repository && steps.lint.outputs.result != ''
|
|
41
|
+
uses: actions/github-script@v3
|
|
42
|
+
with:
|
|
43
|
+
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
44
|
+
script: |
|
|
45
|
+
const issues_listComments_params = {
|
|
46
|
+
issue_number: context.issue.number,
|
|
47
|
+
owner: context.repo.owner,
|
|
48
|
+
repo: context.repo.repo
|
|
49
|
+
}
|
|
50
|
+
console.log("call issues.listComments:", issues_listComments_params)
|
|
51
|
+
const issue_comments = (await github.paginate(github.issues.listComments, issues_listComments_params)).filter(
|
|
52
|
+
issue_comment => issue_comment.user.id==41898282 && issue_comment.body.startsWith('日本語の')
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
for (const issue_comment of issue_comments) {
|
|
56
|
+
const issues_deleteComment_params = {
|
|
57
|
+
comment_id: issue_comment.id,
|
|
58
|
+
owner: context.repo.owner,
|
|
59
|
+
repo: context.repo.repo
|
|
60
|
+
}
|
|
61
|
+
console.log("call issues.deleteComment:", issues_deleteComment_params)
|
|
62
|
+
await github.issues.deleteComment(issues_deleteComment_params)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const result = `${{steps.lint.outputs.result}}`
|
|
66
|
+
const issues_createComment_params = {
|
|
67
|
+
issue_number: context.issue.number,
|
|
68
|
+
owner: context.repo.owner,
|
|
69
|
+
repo: context.repo.repo,
|
|
70
|
+
body: "日本語のLint結果\n```\n"+result+"\n```"
|
|
71
|
+
}
|
|
72
|
+
console.log("call issues.createComment:", issues_createComment_params)
|
|
73
|
+
await github.issues.createComment(issues_createComment_params)
|
|
74
|
+
- name: Exit
|
|
75
|
+
if: github.event.pull_request.head.repo.full_name != github.repository && steps.lint.outcome == 'failure'
|
|
76
|
+
run: exit 1
|
|
77
|
+
|
|
78
|
+
# PRが来たらtextlintをかけてみて、差分があればPRを作って、エラーで落ちるjob
|
|
79
|
+
format:
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
82
|
+
strategy:
|
|
83
|
+
matrix:
|
|
84
|
+
node-version: [ 16.x ]
|
|
85
|
+
|
|
86
|
+
steps:
|
|
87
|
+
- uses: actions/checkout@v2
|
|
88
|
+
with:
|
|
89
|
+
fetch-depth: 0
|
|
90
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
91
|
+
uses: actions/setup-node@v1.4.4
|
|
92
|
+
with:
|
|
93
|
+
node-version: ${{ matrix.node-version }}
|
|
94
|
+
- name: Install dependencies
|
|
95
|
+
run: |
|
|
96
|
+
yarn install -D
|
|
97
|
+
# textlintでformatする
|
|
98
|
+
- name: Format files
|
|
99
|
+
id: format
|
|
100
|
+
run: |
|
|
101
|
+
yarn run textlint:fix
|
|
102
|
+
continue-on-error: true
|
|
103
|
+
# 差分があったときは差分を出力する
|
|
104
|
+
- name: Show diff
|
|
105
|
+
id: show_diff
|
|
106
|
+
run: |
|
|
107
|
+
echo "::set-output name=diff::$(git diff)"
|
|
108
|
+
# 差分があったときは、コミットを作りpushする
|
|
109
|
+
- name: Push
|
|
110
|
+
if: steps.show_diff.outputs.diff != ''
|
|
111
|
+
run: |
|
|
112
|
+
git config user.name "textlint CI"
|
|
113
|
+
git config user.email "textlint_ci@example.com"
|
|
114
|
+
git add -u
|
|
115
|
+
git commit -m "日本語修正"
|
|
116
|
+
git push -f https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:refs/heads/fix-text-${{github.event.pull_request.head.ref}}
|
|
117
|
+
- name: Get PullRequests
|
|
118
|
+
uses: actions/github-script@v3
|
|
119
|
+
if: steps.show_diff.outputs.diff != ''
|
|
120
|
+
id: get_pull_requests
|
|
121
|
+
with:
|
|
122
|
+
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
123
|
+
script: |
|
|
124
|
+
const pulls_list_params = {
|
|
125
|
+
owner: context.repo.owner,
|
|
126
|
+
repo: context.repo.repo,
|
|
127
|
+
head: "kujirahand:fix-text-${{github.event.pull_request.head.ref}}",
|
|
128
|
+
base: "${{github.event.pull_request.head.ref}}",
|
|
129
|
+
state: "open"
|
|
130
|
+
}
|
|
131
|
+
console.log("call pulls.list:", pulls_list_params)
|
|
132
|
+
const pulls = await github.paginate(github.pulls.list, pulls_list_params)
|
|
133
|
+
return pulls.length
|
|
134
|
+
# pushしたブランチでPRを作る
|
|
135
|
+
- name: Create PullRequest
|
|
136
|
+
uses: actions/github-script@v3
|
|
137
|
+
if: steps.show_diff.outputs.diff != '' && steps.get_pull_requests.outputs.result == 0
|
|
138
|
+
with:
|
|
139
|
+
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
140
|
+
script: |
|
|
141
|
+
const common_params = {
|
|
142
|
+
owner: context.repo.owner,
|
|
143
|
+
repo: context.repo.repo
|
|
144
|
+
}
|
|
145
|
+
const pulls_create_params = {
|
|
146
|
+
head: "kujirahand:fix-text-${{github.event.pull_request.head.ref}}",
|
|
147
|
+
base: "${{github.event.pull_request.head.ref}}",
|
|
148
|
+
title: "日本語修正 (修正する場合はPRをマージしてください) #${{github.event.pull_request.number}}",
|
|
149
|
+
body: "日本語を修正しました。本PRをマージすると #${{github.event.pull_request.number}} に修正が適用されます。",
|
|
150
|
+
...common_params
|
|
151
|
+
}
|
|
152
|
+
console.log("call pulls.create:", pulls_create_params)
|
|
153
|
+
const create_pull_res = (await github.pulls.create(pulls_create_params)).data
|
|
154
|
+
const issues_add_assignees_params = {
|
|
155
|
+
issue_number: create_pull_res.number,
|
|
156
|
+
assignees: ["${{github.event.pull_request.user.login}}"],
|
|
157
|
+
...common_params
|
|
158
|
+
}
|
|
159
|
+
console.log("call issues.addAssignees:", issues_add_assignees_params)
|
|
160
|
+
await github.issues.addAssignees(issues_add_assignees_params)
|
|
161
|
+
# 既にformat修正のPRがある状態で、手動でformatを修正した場合、format修正のPRを閉じる
|
|
162
|
+
- name: Close PullRequest
|
|
163
|
+
uses: actions/github-script@v3
|
|
164
|
+
if: steps.show_diff.outputs.diff == ''
|
|
165
|
+
with:
|
|
166
|
+
github-token: ${{secrets.GITHUB_TOKEN}}
|
|
167
|
+
script: |
|
|
168
|
+
const head_name = "fix-text-${{github.event.pull_request.head.ref}}"
|
|
169
|
+
const common_params = {
|
|
170
|
+
owner: context.repo.owner,
|
|
171
|
+
repo: context.repo.repo
|
|
172
|
+
}
|
|
173
|
+
const pulls_list_params = {
|
|
174
|
+
head: "kujirahand:" + head_name,
|
|
175
|
+
base: "${{github.event.pull_request.head.ref}}",
|
|
176
|
+
state: "open",
|
|
177
|
+
...common_params
|
|
178
|
+
}
|
|
179
|
+
console.log("call pulls.list:", pulls_list_params)
|
|
180
|
+
const pulls = await github.paginate(github.pulls.list,pulls_list_params)
|
|
181
|
+
|
|
182
|
+
for (const pull of pulls) {
|
|
183
|
+
const pulls_update_params = {
|
|
184
|
+
pull_number: pull.number,
|
|
185
|
+
state: "closed",
|
|
186
|
+
...common_params
|
|
187
|
+
}
|
|
188
|
+
console.log("call pulls.update:", pulls_update_params)
|
|
189
|
+
await github.pulls.update(pulls_update_params)
|
|
190
|
+
const git_deleteRef_params = {
|
|
191
|
+
ref: "heads/" + head_name,
|
|
192
|
+
...common_params
|
|
193
|
+
}
|
|
194
|
+
console.log("call git.deleteRef:", git_deleteRef_params)
|
|
195
|
+
await github.git.deleteRef(git_deleteRef_params)
|
|
196
|
+
}
|
|
197
|
+
- name: Exit
|
|
198
|
+
if: steps.show_diff.outputs.diff != ''
|
|
199
|
+
run: exit 1
|
package/core/README.md
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# 日本語プログラミング言語「なでしこ3」 内部構造について
|
|
2
|
+
|
|
3
|
+
なでしこ3は、altJSと呼ばれる仕組みを採用しており、なでしこのプログラムが最終的にJavaScriptに変換されて実行されます。
|
|
4
|
+
|
|
5
|
+
大きく言って次の仕組みで実行されます。
|
|
6
|
+
|
|
7
|
+
- 1.[字句解析](/src/nako_lexer.mts)
|
|
8
|
+
- 2.[構文解析](/src/nako_parser3.mts)
|
|
9
|
+
- 3.[コード生成](/src/nako_gen.mts)
|
|
10
|
+
- 4.[実行](/src/nako3.mts)
|
|
11
|
+
|
|
12
|
+
## 字句解析
|
|
13
|
+
|
|
14
|
+
[字句解析](/src/nako_lexer.mts)では、なでしこのソースコードをトークンと呼ばれる、最小の字句要素に分割します。以下のtokenizeメソッドで分割します。
|
|
15
|
+
|
|
16
|
+
- [tokenizeメソッド](https://github.com/kujirahand/nadesiko3core/blob/7db54415b74815739fdb64aa05df7da9e5ab1bdf/src/nako_lexer.mts#L404)
|
|
17
|
+
|
|
18
|
+
なお、トークンを分割するのに複数のルールを利用します。ルールは、配列形式で記述されており、上から順にソースコードにマッチするかを順に確認していきます。
|
|
19
|
+
|
|
20
|
+
- [rules配列](https://github.com/kujirahand/nadesiko3core/blob/7db54415b74815739fdb64aa05df7da9e5ab1bdf/src/nako_lex_rules.mts#L32)
|
|
21
|
+
|
|
22
|
+
### 字句解析前の細かな処理
|
|
23
|
+
|
|
24
|
+
ただし、実際には、字句解析を行う前に、全角半角を揃えたり、特殊な記法を一般的な記法に置き換えたりと前置処理が行われます。
|
|
25
|
+
|
|
26
|
+
- [前置処理](/src/nako_prepare.mts)
|
|
27
|
+
|
|
28
|
+
また、なでしこ3では、インデント構文やDNCLモードなどをサポートしており、これは、なでしこの文法を劇的に置換する特殊モードで、字句解析の前に置換処理がおこなれます。
|
|
29
|
+
|
|
30
|
+
- [インデント構文](/src/nako_indent.mts)
|
|
31
|
+
- [DNCLモード](/src/nako_from_dncl.mjs)
|
|
32
|
+
|
|
33
|
+
## 構文解析
|
|
34
|
+
|
|
35
|
+
[構文解析](/src/nako_parser3.mts)では、なでしこの文法に沿った記述があるかどうかを一つずつ確認して、ソースコードを構文木に変換します。
|
|
36
|
+
なでしこの構文木は、複数のノードを木構造でつなげたものです。
|
|
37
|
+
|
|
38
|
+
- [構文木のノード(Ast)](https://github.com/kujirahand/nadesiko3core/blob/7db54415b74815739fdb64aa05df7da9e5ab1bdf/src/nako_types.mts#L72)
|
|
39
|
+
|
|
40
|
+
この構文木は、[本家(nadesiko3)](https://github.com/kujirahand/nadesiko3)のcnako3コマンドで、--ast オプションを付けると確認できます。
|
|
41
|
+
例えば、「2+3を表示」というプログラムは、次のような構文木に変換されます。
|
|
42
|
+
|
|
43
|
+
- block:
|
|
44
|
+
- func (表示):
|
|
45
|
+
- args:
|
|
46
|
+
- op(+)
|
|
47
|
+
- left:
|
|
48
|
+
- number (2)
|
|
49
|
+
- right:
|
|
50
|
+
- number (3)
|
|
51
|
+
|
|
52
|
+
## コード生成
|
|
53
|
+
|
|
54
|
+
[コード生成](/src/nako_gen.mts)の処理では、構文解析で作成した構文木のコードを、JavaScriptのコードに変換します。
|
|
55
|
+
構文木の各要素を一つずつJavaScriptに変換します。
|
|
56
|
+
|
|
57
|
+
コード変換を実際に行うのが、[_codeGenメソッド](https://github.com/kujirahand/nadesiko3core/blob/7db54415b74815739fdb64aa05df7da9e5ab1bdf/src/nako_gen.mts#L418)です。このメソッドでは、Astのtypeプロパティを調べて、各要素を一つずつ変換していきます。
|
|
58
|
+
|
|
59
|
+
- 例えば、構文木の種類が[number](https://github.com/kujirahand/nadesiko3core/blob/7db54415b74815739fdb64aa05df7da9e5ab1bdf/src/nako_gen.mts#L460)であれば、数値なのでそのまま数値を返します。
|
|
60
|
+
- [演算子(op)](https://github.com/kujirahand/nadesiko3core/blob/7db54415b74815739fdb64aa05df7da9e5ab1bdf/src/nako_gen.mts#L1388)の時は計算を行うJavaScriptのコードを生成します。
|
|
61
|
+
- [繰り返す文(for)](https://github.com/kujirahand/nadesiko3core/blob/7db54415b74815739fdb64aa05df7da9e5ab1bdf/src/nako_gen.mts#L909)であれば、必要なパラメータを取得しつつJavaScriptのfor文を生成します。
|
|
62
|
+
|
|
63
|
+
## 実行
|
|
64
|
+
|
|
65
|
+
[実行](/src/nako3.mts)は、JavaScriptのコードを評価する[evalJS](https://github.com/kujirahand/nadesiko3core/blob/7db54415b74815739fdb64aa05df7da9e5ab1bdf/src/nako3.mts#L749)メソッドで行います。
|
|
66
|
+
JavaScriptの`new Function(code)`を使ってJavaScriptのコードを実行します。
|
|
67
|
+
|
package/core/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import coreVersion from './src/nako_core_version.mjs';
|
|
2
2
|
import { NakoCompiler } from './src/nako3.mjs';
|
|
3
3
|
import { NakoLogger } from './src/nako_logger.mjs';
|
|
4
4
|
import { NakoError, NakoRuntimeError, NakoImportError } from './src/nako_errors.mjs';
|
|
@@ -6,7 +6,7 @@ import { NakoParser } from './src/nako_parser3.mjs';
|
|
|
6
6
|
import { NakoPrepare } from './src/nako_prepare.mjs';
|
|
7
7
|
export default {
|
|
8
8
|
// version
|
|
9
|
-
version,
|
|
9
|
+
version: coreVersion,
|
|
10
10
|
// compiler
|
|
11
11
|
NakoCompiler,
|
|
12
12
|
// loggger
|
package/core/index.mts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import coreVersion from './src/nako_core_version.mjs'
|
|
2
|
+
import { NakoCompiler } from './src/nako3.mjs'
|
|
3
|
+
import { NakoLogger } from './src/nako_logger.mjs'
|
|
4
|
+
import { NakoError, NakoRuntimeError, NakoImportError } from './src/nako_errors.mjs'
|
|
5
|
+
import { NakoParser } from './src/nako_parser3.mjs'
|
|
6
|
+
import { NakoPrepare } from './src/nako_prepare.mjs'
|
|
7
|
+
export default {
|
|
8
|
+
// version
|
|
9
|
+
version: coreVersion,
|
|
10
|
+
// compiler
|
|
11
|
+
NakoCompiler,
|
|
12
|
+
// loggger
|
|
13
|
+
NakoLogger,
|
|
14
|
+
// error
|
|
15
|
+
NakoError,
|
|
16
|
+
NakoRuntimeError,
|
|
17
|
+
NakoImportError,
|
|
18
|
+
// tools etc..
|
|
19
|
+
NakoParser,
|
|
20
|
+
NakoPrepare
|
|
21
|
+
}
|