@kawaijs/ast 0.1.0
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/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/ir.d.ts +81 -0
- package/dist/ir.d.ts.map +1 -0
- package/dist/ir.js +2 -0
- package/dist/ir.js.map +1 -0
- package/dist/nodes.d.ts +96 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +2 -0
- package/dist/nodes.js.map +1 -0
- package/dist/source.d.ts +25 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +13 -0
- package/dist/source.js.map +1 -0
- package/package.json +35 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
package/dist/ir.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { SourceLocation } from './source.js';
|
|
2
|
+
export interface CharacterDefinition {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly color?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ChoiceOption {
|
|
8
|
+
readonly text: string;
|
|
9
|
+
readonly targetLabel: string;
|
|
10
|
+
readonly condition?: string;
|
|
11
|
+
}
|
|
12
|
+
export type Instruction = {
|
|
13
|
+
readonly type: 'scene';
|
|
14
|
+
readonly background: string;
|
|
15
|
+
readonly transition?: string;
|
|
16
|
+
readonly loc?: SourceLocation;
|
|
17
|
+
} | {
|
|
18
|
+
readonly type: 'show';
|
|
19
|
+
readonly character: string;
|
|
20
|
+
readonly expression?: string;
|
|
21
|
+
readonly position?: string;
|
|
22
|
+
readonly transition?: string;
|
|
23
|
+
readonly loc?: SourceLocation;
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: 'hide';
|
|
26
|
+
readonly character: string;
|
|
27
|
+
readonly transition?: string;
|
|
28
|
+
readonly loc?: SourceLocation;
|
|
29
|
+
} | {
|
|
30
|
+
readonly type: 'dialogue';
|
|
31
|
+
readonly speaker?: string;
|
|
32
|
+
readonly text: string;
|
|
33
|
+
readonly loc?: SourceLocation;
|
|
34
|
+
} | {
|
|
35
|
+
readonly type: 'choice';
|
|
36
|
+
readonly prompt?: string;
|
|
37
|
+
readonly choices: readonly ChoiceOption[];
|
|
38
|
+
readonly loc?: SourceLocation;
|
|
39
|
+
} | {
|
|
40
|
+
readonly type: 'jump';
|
|
41
|
+
readonly targetLabel: string;
|
|
42
|
+
readonly loc?: SourceLocation;
|
|
43
|
+
} | {
|
|
44
|
+
readonly type: 'set';
|
|
45
|
+
readonly variable: string;
|
|
46
|
+
readonly value: unknown;
|
|
47
|
+
readonly loc?: SourceLocation;
|
|
48
|
+
} | {
|
|
49
|
+
readonly type: 'branch';
|
|
50
|
+
readonly condition: string;
|
|
51
|
+
readonly thenLabel: string;
|
|
52
|
+
readonly elseLabel?: string;
|
|
53
|
+
readonly loc?: SourceLocation;
|
|
54
|
+
} | {
|
|
55
|
+
readonly type: 'play_audio';
|
|
56
|
+
readonly channel: 'music' | 'sound' | 'voice';
|
|
57
|
+
readonly track: string;
|
|
58
|
+
readonly fade?: number;
|
|
59
|
+
readonly loop?: boolean;
|
|
60
|
+
readonly loc?: SourceLocation;
|
|
61
|
+
} | {
|
|
62
|
+
readonly type: 'stop_audio';
|
|
63
|
+
readonly channel: 'music' | 'sound' | 'voice';
|
|
64
|
+
readonly fade?: number;
|
|
65
|
+
readonly loc?: SourceLocation;
|
|
66
|
+
} | {
|
|
67
|
+
readonly type: 'return';
|
|
68
|
+
readonly loc?: SourceLocation;
|
|
69
|
+
};
|
|
70
|
+
export interface StoryMeta {
|
|
71
|
+
readonly title?: string;
|
|
72
|
+
readonly version?: string;
|
|
73
|
+
readonly author?: string;
|
|
74
|
+
readonly startLabel?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface StoryPackage {
|
|
77
|
+
readonly meta: StoryMeta;
|
|
78
|
+
readonly characters: Record<string, CharacterDefinition>;
|
|
79
|
+
readonly labels: Record<string, readonly Instruction[]>;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=ir.d.ts.map
|
package/dist/ir.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../src/ir.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,cAAc,CAAA;CAAE,GACpH;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAA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,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,CAAC;CACzD"}
|
package/dist/ir.js
ADDED
package/dist/ir.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.js","sourceRoot":"","sources":["../src/ir.ts"],"names":[],"mappings":""}
|
package/dist/nodes.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { SourceLocation } from './source.js';
|
|
2
|
+
export type ASTNodeType = 'Program' | 'CharacterDecl' | 'LabelDecl' | 'SceneStmt' | 'ShowStmt' | 'HideStmt' | 'DialogueStmt' | 'MenuStmt' | 'ChoiceItem' | 'JumpStmt' | 'ReturnStmt' | 'SetStmt' | 'IfStmt' | 'ElifBranch' | 'ElseBranch' | 'PlayStmt' | 'StopStmt';
|
|
3
|
+
export interface BaseNode {
|
|
4
|
+
readonly type: ASTNodeType;
|
|
5
|
+
readonly loc?: SourceLocation;
|
|
6
|
+
}
|
|
7
|
+
export interface ProgramNode extends BaseNode {
|
|
8
|
+
readonly type: 'Program';
|
|
9
|
+
readonly statements: StatementNode[];
|
|
10
|
+
}
|
|
11
|
+
export type StatementNode = CharacterDeclNode | LabelDeclNode | SceneStmtNode | ShowStmtNode | HideStmtNode | DialogueStmtNode | MenuStmtNode | JumpStmtNode | ReturnStmtNode | SetStmtNode | IfStmtNode | PlayStmtNode | StopStmtNode;
|
|
12
|
+
export interface CharacterDeclNode extends BaseNode {
|
|
13
|
+
readonly type: 'CharacterDecl';
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly displayName: string;
|
|
16
|
+
readonly color?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface LabelDeclNode extends BaseNode {
|
|
19
|
+
readonly type: 'LabelDecl';
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly body: StatementNode[];
|
|
22
|
+
}
|
|
23
|
+
export interface SceneStmtNode extends BaseNode {
|
|
24
|
+
readonly type: 'SceneStmt';
|
|
25
|
+
readonly background: string;
|
|
26
|
+
readonly transition?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ShowStmtNode extends BaseNode {
|
|
29
|
+
readonly type: 'ShowStmt';
|
|
30
|
+
readonly character: string;
|
|
31
|
+
readonly expression?: string;
|
|
32
|
+
readonly position?: string;
|
|
33
|
+
readonly transition?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface HideStmtNode extends BaseNode {
|
|
36
|
+
readonly type: 'HideStmt';
|
|
37
|
+
readonly character: string;
|
|
38
|
+
readonly transition?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface DialogueStmtNode extends BaseNode {
|
|
41
|
+
readonly type: 'DialogueStmt';
|
|
42
|
+
readonly speaker?: string;
|
|
43
|
+
readonly text: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ChoiceItemNode extends BaseNode {
|
|
46
|
+
readonly type: 'ChoiceItem';
|
|
47
|
+
readonly text: string;
|
|
48
|
+
readonly condition?: string;
|
|
49
|
+
readonly body: StatementNode[];
|
|
50
|
+
}
|
|
51
|
+
export interface MenuStmtNode extends BaseNode {
|
|
52
|
+
readonly type: 'MenuStmt';
|
|
53
|
+
readonly prompt?: string;
|
|
54
|
+
readonly choices: ChoiceItemNode[];
|
|
55
|
+
}
|
|
56
|
+
export interface JumpStmtNode extends BaseNode {
|
|
57
|
+
readonly type: 'JumpStmt';
|
|
58
|
+
readonly targetLabel: string;
|
|
59
|
+
}
|
|
60
|
+
export interface ReturnStmtNode extends BaseNode {
|
|
61
|
+
readonly type: 'ReturnStmt';
|
|
62
|
+
}
|
|
63
|
+
export interface SetStmtNode extends BaseNode {
|
|
64
|
+
readonly type: 'SetStmt';
|
|
65
|
+
readonly variable: string;
|
|
66
|
+
readonly value: unknown;
|
|
67
|
+
}
|
|
68
|
+
export interface ElifBranchNode extends BaseNode {
|
|
69
|
+
readonly type: 'ElifBranch';
|
|
70
|
+
readonly condition: string;
|
|
71
|
+
readonly body: StatementNode[];
|
|
72
|
+
}
|
|
73
|
+
export interface ElseBranchNode extends BaseNode {
|
|
74
|
+
readonly type: 'ElseBranch';
|
|
75
|
+
readonly body: StatementNode[];
|
|
76
|
+
}
|
|
77
|
+
export interface IfStmtNode extends BaseNode {
|
|
78
|
+
readonly type: 'IfStmt';
|
|
79
|
+
readonly condition: string;
|
|
80
|
+
readonly thenBranch: StatementNode[];
|
|
81
|
+
readonly elifBranches: ElifBranchNode[];
|
|
82
|
+
readonly elseBranch?: ElseBranchNode;
|
|
83
|
+
}
|
|
84
|
+
export interface PlayStmtNode extends BaseNode {
|
|
85
|
+
readonly type: 'PlayStmt';
|
|
86
|
+
readonly channel: 'music' | 'sound' | 'voice';
|
|
87
|
+
readonly track: string;
|
|
88
|
+
readonly fade?: number;
|
|
89
|
+
readonly loop?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface StopStmtNode extends BaseNode {
|
|
92
|
+
readonly type: 'StopStmt';
|
|
93
|
+
readonly channel: 'music' | 'sound' | 'voice';
|
|
94
|
+
readonly fade?: number;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,eAAe,GACf,WAAW,GACX,WAAW,GACX,UAAU,GACV,UAAU,GACV,cAAc,GACd,UAAU,GACV,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,UAAU,CAAC;AAEf,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC;CAC/B;AAED,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3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AAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,UAAW,SAAQ,QAAQ;IAC1C,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,aAAa,EAAE,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,cAAc,EAAE,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;CACtC;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC9C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
package/dist/nodes.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":""}
|
package/dist/source.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a position within a source file (1-indexed line and column).
|
|
3
|
+
*/
|
|
4
|
+
export interface SourcePosition {
|
|
5
|
+
readonly line: number;
|
|
6
|
+
readonly column: number;
|
|
7
|
+
readonly offset: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Represents a range spanning across source locations.
|
|
11
|
+
*/
|
|
12
|
+
export interface SourceLocation {
|
|
13
|
+
readonly file: string;
|
|
14
|
+
readonly start: SourcePosition;
|
|
15
|
+
readonly end: SourcePosition;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a standard SourcePosition.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createPosition(line: number, column: number, offset: number): SourcePosition;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a standard SourceLocation.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createLocation(file: string, start: SourcePosition, end: SourcePosition): SourceLocation;
|
|
25
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAE3F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,cAAc,EACrB,GAAG,EAAE,cAAc,GAClB,cAAc,CAEhB"}
|
package/dist/source.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a standard SourcePosition.
|
|
3
|
+
*/
|
|
4
|
+
export function createPosition(line, column, offset) {
|
|
5
|
+
return { line, column, offset };
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Creates a standard SourceLocation.
|
|
9
|
+
*/
|
|
10
|
+
export function createLocation(file, start, end) {
|
|
11
|
+
return { file, start, end };
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAkBA;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,MAAc,EAAE,MAAc;IACzE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,KAAqB,EACrB,GAAmB;IAEnB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AAC9B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kawaijs/ast",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Abstract Syntax Tree and Story Intermediate Representation definitions for Kawaijs",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/biagio-scaglia/KawaiJS.git",
|
|
17
|
+
"directory": "packages/ast"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/biagio-scaglia/KawaiJS/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/biagio-scaglia/KawaiJS#readme",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc",
|
|
25
|
+
"typecheck": "tsc --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"kawaijs",
|
|
29
|
+
"ast",
|
|
30
|
+
"visual-novel",
|
|
31
|
+
"renpy"
|
|
32
|
+
],
|
|
33
|
+
"author": "Biagio Scaglia",
|
|
34
|
+
"license": "MIT"
|
|
35
|
+
}
|