functionalscript 0.1.607 → 0.1.609
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/CHANGELOG.md +10 -0
- package/Cargo.lock +4 -0
- package/Cargo.toml +4 -2
- package/README.md +1 -1
- package/com/rust/nanocom/src/cobject.rs +1 -1
- package/com/test/rust/src/lib.rs +4 -4
- package/dev/module.mjs +10 -33
- package/dev/test/module.f.mjs +1 -1
- package/djs/parser/module.f.d.mts +51 -31
- package/djs/parser/module.f.mjs +275 -122
- package/djs/parser/test.f.d.mts +4 -0
- package/djs/parser/test.f.mjs +179 -63
- package/djs/tokenizer/module.f.d.mts +1 -1
- package/djs/tokenizer/module.f.mjs +3 -1
- package/djs/tokenizer/test.f.mjs +1 -1
- package/doc/LANGUAGE.md +17 -16
- package/doc/README.md +14 -50
- package/fsc/README.md +0 -3
- package/fsm/README.md +1 -1
- package/html/README.md +24 -0
- package/issues/01-test-debug.md +3 -0
- package/issues/{publish.md → 05-publish.md} +8 -8
- package/issues/17-djs-extension.md +6 -0
- package/issues/README.md +20 -13
- package/issues/lang/1000-json.md +38 -0
- package/issues/lang/2110-default-export.md +2 -2
- package/issues/lang/2310-undefined.md +1 -1
- package/issues/lang/2330-property-accessor.md +225 -0
- package/issues/lang/2360-built-in.md +54 -47
- package/issues/lang/3240-export.md +44 -0
- package/issues/lang/README.md +64 -22
- package/issues/test.f.d.mts +16 -0
- package/issues/test.f.mjs +57 -0
- package/js/tokenizer/module.f.d.mts +8 -2
- package/js/tokenizer/module.f.mjs +29 -3
- package/js/tokenizer/test.f.mjs +9 -6
- package/json/tokenizer/module.f.mjs +2 -1
- package/jsr.json +1 -1
- package/nanvm-lib/Cargo.toml +6 -0
- package/nanvm-lib/src/extension.rs +119 -0
- package/nanvm-lib/src/interface.rs +136 -0
- package/nanvm-lib/src/lib.rs +7 -0
- package/nanvm-lib/src/naive.rs +229 -0
- package/nanvm-lib/src/nanenum.rs +230 -0
- package/nanvm-lib/src/nullish.rs +7 -0
- package/nanvm-lib/src/sign.rs +5 -0
- package/nanvm-lib/src/simple.rs +32 -0
- package/nanvm-lib/tests/test.f.d.mts +36 -0
- package/nanvm-lib/tests/test.f.mjs +79 -0
- package/nanvm-lib/tests/test.rs +108 -0
- package/package.json +1 -2
- package/text/README.md +2 -2
- package/index.f.d.mts +0 -83
- package/index.f.mjs +0 -83
- package/issues/lang/2351-property-accessor.md +0 -44
- package/issues/lang/2352-property-call.md +0 -43
- package/issues/lang/2353-property-at.md +0 -19
- package/issues/test-debug.md +0 -12
- /package/issues/{esm.md → 02-esm.md} +0 -0
- /package/issues/{djs.md → 03-djs.md} +0 -0
- /package/issues/{fs-load.md → 11-fs-load.md} +0 -0
- /package/issues/lang/{2330-grouping.md → 2350-grouping.md} +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## Unreleased
|
|
9
|
+
|
|
10
|
+
## 0.1.608
|
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/functionalscript)
|
|
4
4
|
[](https://jsr.io/@functionalscript/functionalscript)
|
|
5
5
|
|
|
6
|
-
FunctionalScript is a purely functional programming language and a strict subset of
|
|
6
|
+
FunctionalScript is a safe, purely functional programming language and a strict subset of
|
|
7
7
|
[ECMAScript](https://en.wikipedia.org/wiki/ECMAScript)/[JavaScript](https://en.wikipedia.org/wiki/JavaScript). It's inspired by
|
|
8
8
|
|
|
9
9
|
- [JSON](https://en.wikipedia.org/wiki/JSON) and [JSON5](https://json5.org/) as subsets of JavaScript.
|
package/com/test/rust/src/lib.rs
CHANGED
|
@@ -28,19 +28,19 @@ impl _result::IMy::Ex for nanocom::CObject<My> {
|
|
|
28
28
|
todo!()
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
fn SetUnsafe(&self,
|
|
31
|
+
fn SetUnsafe(&self, _p: *const _result::Slice, _size: u32) {
|
|
32
32
|
todo!()
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
fn Some(&self,
|
|
35
|
+
fn Some(&self, _p: &_result::IMy::Object) -> bool {
|
|
36
36
|
todo!()
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
fn GetIMy(&self,
|
|
39
|
+
fn GetIMy(&self, _a: u16, _b: i16) -> _result::IMy::Ref {
|
|
40
40
|
todo!()
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
fn SetManagedStruct(&self,
|
|
43
|
+
fn SetManagedStruct(&self, _a: _result::ManagedStruct) {
|
|
44
44
|
todo!()
|
|
45
45
|
}
|
|
46
46
|
}
|
package/dev/module.mjs
CHANGED
|
@@ -86,7 +86,7 @@ export const loadModuleMap = async () => {
|
|
|
86
86
|
const file = `${p}/${name}`
|
|
87
87
|
if (i.isDirectory()) {
|
|
88
88
|
await f(file)
|
|
89
|
-
} else if (name.endsWith('.f.
|
|
89
|
+
} else if (name.endsWith('.f.mjs') || name.endsWith('.f.js')) {
|
|
90
90
|
const source = await import(`../${file}`)
|
|
91
91
|
map.push([file, source.default])
|
|
92
92
|
}
|
|
@@ -179,36 +179,13 @@ const codeAdd = i => p => m => {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
export const index = async () => {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
jj,
|
|
192
|
-
JSON.stringify({ ...jsr_json, exports }, null, 2))
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
//
|
|
196
|
-
/** @type {FolderMap} */
|
|
197
|
-
let m = {}
|
|
198
|
-
for (const k in await loadModuleMap()) {
|
|
199
|
-
const [, ...s] = k.split('/')
|
|
200
|
-
switch (s[s.length - 1]) {
|
|
201
|
-
case 'module.f.cjs': case 'module.f.mjs': case 'module.f.js':
|
|
202
|
-
m = folderMapAdd(m)(s)
|
|
203
|
-
break
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
const [e, i] = codeAdd(indent)('')(m)
|
|
207
|
-
let s =
|
|
208
|
-
'// Generated file.\n' +
|
|
209
|
-
i +
|
|
210
|
-
'export default {\n' +
|
|
211
|
-
e +
|
|
212
|
-
'}\n'
|
|
213
|
-
await writeFile('index.f.mjs', s)
|
|
182
|
+
const jj = './jsr.json'
|
|
183
|
+
const n = '/module.f.mjs'
|
|
184
|
+
const jsr_json = JSON.parse(await readFile(jj, { encoding: 'utf8' }))
|
|
185
|
+
const list = Object.keys(await loadModuleMap()).filter(v => v.endsWith(n))
|
|
186
|
+
const exportsA = list.map(v => [v.replace(n, ''), v])
|
|
187
|
+
const exports = Object.fromEntries(exportsA)
|
|
188
|
+
await writeFile(
|
|
189
|
+
jj,
|
|
190
|
+
JSON.stringify({ ...jsr_json, exports }, null, 2))
|
|
214
191
|
}
|
package/dev/test/module.f.mjs
CHANGED
|
@@ -47,7 +47,7 @@ import * as Result from '../../types/result/module.f.mjs'
|
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
49
|
/** @type {(s: string) => boolean} */
|
|
50
|
-
const isTest = s => s.endsWith('test.f.
|
|
50
|
+
const isTest = s => s.endsWith('test.f.mjs') || s.endsWith('test.f.js')
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* @typedef {{
|
|
@@ -2,39 +2,59 @@ declare namespace _default {
|
|
|
2
2
|
export { parse };
|
|
3
3
|
}
|
|
4
4
|
export default _default;
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
export type
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export type
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
};
|
|
20
|
-
export type
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
readonly
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
readonly
|
|
5
|
+
export type DjsModule = [readonly string[], readonly DjsConst[]];
|
|
6
|
+
export type DjsConst = boolean | string | number | null | bigint | DjsModuleRef | DjsArray | DjsObject;
|
|
7
|
+
export type DjsModuleRef = ["aref" | "cref", number];
|
|
8
|
+
export type DjsArray = ["array", readonly DjsConst[]];
|
|
9
|
+
export type DjsObject = { readonly [k in string]: DjsConst; };
|
|
10
|
+
export type DjsStackArray = ["array", List.List<DjsConst>];
|
|
11
|
+
export type DjsStackObject = ["object", Map.Map<DjsConst>, string];
|
|
12
|
+
export type DjsStackElement = DjsStackArray | DjsStackObject;
|
|
13
|
+
export type DjsStack = List.List<DjsStackElement>;
|
|
14
|
+
export type ParserState = InitialState | NewLineRequiredState | ImportState | ConstState | ExportState | ParseValueState | ResultState | ErrorState;
|
|
15
|
+
export type ModuleState = {
|
|
16
|
+
readonly refs: Map.Map<DjsModuleRef>;
|
|
17
|
+
readonly modules: List.List<string>;
|
|
18
|
+
readonly consts: List.List<DjsConst>;
|
|
19
|
+
};
|
|
20
|
+
export type InitialState = {
|
|
21
|
+
readonly state: "";
|
|
22
|
+
readonly module: ModuleState;
|
|
23
|
+
};
|
|
24
|
+
export type NewLineRequiredState = {
|
|
25
|
+
readonly state: "nl";
|
|
26
|
+
readonly module: ModuleState;
|
|
27
|
+
};
|
|
28
|
+
export type ImportState = {
|
|
29
|
+
readonly state: "import" | "import+name" | "import+from";
|
|
30
|
+
readonly module: ModuleState;
|
|
31
|
+
};
|
|
32
|
+
export type ConstState = {
|
|
33
|
+
readonly state: "const" | "const+name";
|
|
34
|
+
readonly module: ModuleState;
|
|
35
|
+
};
|
|
36
|
+
export type ExportState = {
|
|
37
|
+
readonly state: "export";
|
|
38
|
+
readonly module: ModuleState;
|
|
39
|
+
};
|
|
40
|
+
export type ParseValueState = {
|
|
41
|
+
readonly state: "constValue" | "exportValue";
|
|
42
|
+
readonly module: ModuleState;
|
|
43
|
+
readonly valueState: "" | "[" | "[v" | "[," | "{" | "{k" | "{:" | "{v" | "{,";
|
|
44
|
+
readonly top: DjsStackElement | null;
|
|
45
|
+
readonly stack: DjsStack;
|
|
46
|
+
};
|
|
47
|
+
export type ResultState = {
|
|
48
|
+
readonly state: "result";
|
|
49
|
+
readonly module: ModuleState;
|
|
50
|
+
};
|
|
51
|
+
export type ErrorState = {
|
|
52
|
+
readonly state: "error";
|
|
31
53
|
readonly message: string;
|
|
32
54
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
declare const parse: (tokenList: List.List<tokenizerT.DjsToken>) => Result.Result<Djs.Unknown, string>;
|
|
36
|
-
import * as Map from '../../types/map/module.f.mjs';
|
|
37
|
-
import * as Djs from '../module.f.mjs';
|
|
55
|
+
/** @type {(tokenList: List.List<tokenizerT.DjsToken>) => Result.Result<DjsModule, string>} */
|
|
56
|
+
declare const parse: (tokenList: List.List<tokenizerT.DjsToken>) => Result.Result<DjsModule, string>;
|
|
38
57
|
import * as List from '../../types/list/module.f.mjs';
|
|
58
|
+
import * as Map from '../../types/map/module.f.mjs';
|
|
39
59
|
import * as tokenizerT from '../tokenizer/module.f.mjs';
|
|
40
60
|
import * as Result from '../../types/result/module.f.mjs';
|