greybel-interpreter 0.6.8 → 0.6.9

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.
Files changed (83) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +2 -2
  3. package/dist/context.d.ts +98 -98
  4. package/dist/context.js +456 -456
  5. package/dist/cps.d.ts +17 -17
  6. package/dist/cps.js +871 -871
  7. package/dist/custom-types/boolean.d.ts +12 -12
  8. package/dist/custom-types/boolean.js +47 -47
  9. package/dist/custom-types/list.d.ts +26 -26
  10. package/dist/custom-types/list.js +236 -236
  11. package/dist/custom-types/map.d.ts +26 -26
  12. package/dist/custom-types/map.js +245 -245
  13. package/dist/custom-types/nil.d.ts +10 -10
  14. package/dist/custom-types/nil.js +44 -44
  15. package/dist/custom-types/number.d.ts +12 -12
  16. package/dist/custom-types/number.js +47 -47
  17. package/dist/custom-types/string.d.ts +25 -25
  18. package/dist/custom-types/string.js +172 -172
  19. package/dist/expressions/assign.d.ts +13 -13
  20. package/dist/expressions/assign.js +174 -174
  21. package/dist/expressions/binary-negated-expression.d.ts +18 -18
  22. package/dist/expressions/binary-negated-expression.js +127 -127
  23. package/dist/expressions/call.d.ts +14 -14
  24. package/dist/expressions/call.js +208 -208
  25. package/dist/expressions/import.d.ts +14 -14
  26. package/dist/expressions/import.js +155 -155
  27. package/dist/expressions/include.d.ts +13 -13
  28. package/dist/expressions/include.js +132 -132
  29. package/dist/expressions/list.d.ts +14 -14
  30. package/dist/expressions/list.js +134 -134
  31. package/dist/expressions/logical-and-binary.d.ts +22 -22
  32. package/dist/expressions/logical-and-binary.js +222 -222
  33. package/dist/expressions/map.d.ts +19 -19
  34. package/dist/expressions/map.js +197 -197
  35. package/dist/expressions/path.d.ts +31 -31
  36. package/dist/expressions/path.js +383 -383
  37. package/dist/index.d.ts +36 -36
  38. package/dist/index.js +89 -89
  39. package/dist/interpreter.d.ts +29 -29
  40. package/dist/interpreter.js +210 -210
  41. package/dist/operations/argument.d.ts +8 -8
  42. package/dist/operations/argument.js +145 -145
  43. package/dist/operations/body.d.ts +8 -8
  44. package/dist/operations/body.js +140 -140
  45. package/dist/operations/break.d.ts +7 -7
  46. package/dist/operations/break.js +34 -34
  47. package/dist/operations/continue.d.ts +7 -7
  48. package/dist/operations/continue.js +34 -34
  49. package/dist/operations/debugger.d.ts +7 -7
  50. package/dist/operations/debugger.js +32 -32
  51. package/dist/operations/else-if.d.ts +12 -12
  52. package/dist/operations/else-if.js +31 -31
  53. package/dist/operations/else.d.ts +10 -10
  54. package/dist/operations/else.js +30 -30
  55. package/dist/operations/for.d.ts +16 -16
  56. package/dist/operations/for.js +143 -143
  57. package/dist/operations/function.d.ts +26 -24
  58. package/dist/operations/function.js +145 -142
  59. package/dist/operations/if-statement.d.ts +8 -8
  60. package/dist/operations/if-statement.js +169 -169
  61. package/dist/operations/if.d.ts +12 -12
  62. package/dist/operations/if.js +31 -31
  63. package/dist/operations/new.d.ts +11 -11
  64. package/dist/operations/new.js +96 -96
  65. package/dist/operations/not.d.ts +11 -11
  66. package/dist/operations/not.js +95 -95
  67. package/dist/operations/reference.d.ts +11 -11
  68. package/dist/operations/reference.js +102 -102
  69. package/dist/operations/return.d.ts +11 -11
  70. package/dist/operations/return.js +106 -106
  71. package/dist/operations/while.d.ts +14 -14
  72. package/dist/operations/while.js +133 -133
  73. package/dist/resource.d.ts +9 -9
  74. package/dist/resource.js +29 -29
  75. package/dist/typer.d.ts +6 -6
  76. package/dist/typer.js +95 -95
  77. package/dist/types/custom-type.d.ts +22 -22
  78. package/dist/types/custom-type.js +67 -67
  79. package/dist/types/expression.d.ts +7 -7
  80. package/dist/types/expression.js +9 -9
  81. package/dist/types/operation.d.ts +10 -10
  82. package/dist/types/operation.js +38 -38
  83. package/package.json +44 -45
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 swe
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2021 swe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # greybel-interpreter
2
-
1
+ # greybel-interpreter
2
+
3
3
  [![greybel-interpreter](https://circleci.com/gh/ayecue/greybel-interpreter.svg?style=svg)](https://circleci.com/gh/ayecue/greybel-interpreter)
package/dist/context.d.ts CHANGED
@@ -1,98 +1,98 @@
1
- import CustomMap from './custom-types/map';
2
- import { Operation } from './types/operation';
3
- import { Expression } from './types/expression';
4
- import { Callable } from './types/custom-type';
5
- import { ASTBase } from 'greybel-core';
6
- import CPS from './cps';
7
- export declare enum ContextType {
8
- API = "API",
9
- GLOBAL = "GLOBAL",
10
- FUNCTION = "FUNCTION",
11
- EXTERNAL = "EXTERNAL",
12
- LOOP = "LOOP",
13
- MAP = "MAP",
14
- CALL = "CALL"
15
- }
16
- export declare enum ContextState {
17
- TEMPORARY = "TEMPORARY",
18
- DEFAULT = "DEFAULT"
19
- }
20
- export declare class Scope extends CustomMap {
21
- context: OperationContext;
22
- constructor(context: OperationContext);
23
- get(path: string[]): Promise<any>;
24
- getCallable(path: string[]): Promise<Callable>;
25
- }
26
- export declare class Debugger {
27
- breakpoint: boolean;
28
- nextStep: boolean;
29
- lastContext: OperationContext | null;
30
- constructor();
31
- raise(message: string, ...args: any[]): void;
32
- debug(message: string, ...args: any[]): void;
33
- setBreakpoint(state: boolean): Debugger;
34
- getBreakpoint(operationContext: OperationContext): boolean;
35
- next(): Debugger;
36
- resume(): Promise<void>;
37
- interact(operationContext: OperationContext, item: ASTBase, entity: Operation | Expression): void;
38
- }
39
- export interface OperationContextProcessState {
40
- exit: boolean;
41
- pending: boolean;
42
- last: OperationContext | null;
43
- }
44
- export interface OperationContextOptions {
45
- target?: string;
46
- isProtected?: boolean;
47
- injected?: boolean;
48
- type?: ContextType;
49
- state?: ContextState;
50
- previous?: OperationContext;
51
- debugger?: Debugger;
52
- cps?: CPS;
53
- processState?: OperationContextProcessState;
54
- }
55
- export interface OperationContextForkOptions {
56
- type: ContextType;
57
- state: ContextState;
58
- target?: string;
59
- injected?: boolean;
60
- }
61
- export declare class OperationContext {
62
- target: string;
63
- stackItem: ASTBase | null;
64
- debugger: Debugger;
65
- previous: OperationContext | null;
66
- type: ContextType;
67
- state: ContextState;
68
- scope: Scope;
69
- memory: Map<string, any>;
70
- cps: CPS | null;
71
- processState: OperationContextProcessState;
72
- isProtected: boolean;
73
- injected: boolean;
74
- api: OperationContext | null;
75
- locals: OperationContext | null;
76
- globals: OperationContext | null;
77
- constructor(options: OperationContextOptions);
78
- step(entity: Operation | Expression): Promise<void>;
79
- setLastActive(opc: OperationContext): OperationContext;
80
- getLastActive(): OperationContext | null;
81
- isExit(): boolean;
82
- exit(): Promise<OperationContext>;
83
- isPending(): boolean;
84
- setPending(pending: boolean): OperationContext;
85
- lookupAllOfType(validate: (type: ContextType) => boolean): OperationContext[];
86
- lookupType(validate: (type: ContextType) => boolean): OperationContext;
87
- lookupAllScopes(): OperationContext[];
88
- lookupAPI(): OperationContext;
89
- lookupGlobals(): OperationContext;
90
- lookupLocals(): OperationContext;
91
- extend(map: Map<string, any>): OperationContext;
92
- set(path: any[], value: any): Promise<void>;
93
- get(path: any[]): Promise<any>;
94
- getCallable(path: string[]): Promise<Callable>;
95
- setMemory(key: string, value: any): OperationContext;
96
- getMemory(key: string): any;
97
- fork({ type, state, target, injected }: OperationContextForkOptions): OperationContext;
98
- }
1
+ import CustomMap from './custom-types/map';
2
+ import { Operation } from './types/operation';
3
+ import { Expression } from './types/expression';
4
+ import { Callable } from './types/custom-type';
5
+ import { ASTBase } from 'greybel-core';
6
+ import CPS from './cps';
7
+ export declare enum ContextType {
8
+ API = "API",
9
+ GLOBAL = "GLOBAL",
10
+ FUNCTION = "FUNCTION",
11
+ EXTERNAL = "EXTERNAL",
12
+ LOOP = "LOOP",
13
+ MAP = "MAP",
14
+ CALL = "CALL"
15
+ }
16
+ export declare enum ContextState {
17
+ TEMPORARY = "TEMPORARY",
18
+ DEFAULT = "DEFAULT"
19
+ }
20
+ export declare class Scope extends CustomMap {
21
+ context: OperationContext;
22
+ constructor(context: OperationContext);
23
+ get(path: string[]): Promise<any>;
24
+ getCallable(path: string[]): Promise<Callable>;
25
+ }
26
+ export declare class Debugger {
27
+ breakpoint: boolean;
28
+ nextStep: boolean;
29
+ lastContext: OperationContext | null;
30
+ constructor();
31
+ raise(message: string, ...args: any[]): void;
32
+ debug(message: string, ...args: any[]): void;
33
+ setBreakpoint(state: boolean): Debugger;
34
+ getBreakpoint(operationContext: OperationContext): boolean;
35
+ next(): Debugger;
36
+ resume(): Promise<void>;
37
+ interact(operationContext: OperationContext, item: ASTBase, entity: Operation | Expression): void;
38
+ }
39
+ export interface OperationContextProcessState {
40
+ exit: boolean;
41
+ pending: boolean;
42
+ last: OperationContext | null;
43
+ }
44
+ export interface OperationContextOptions {
45
+ target?: string;
46
+ isProtected?: boolean;
47
+ injected?: boolean;
48
+ type?: ContextType;
49
+ state?: ContextState;
50
+ previous?: OperationContext;
51
+ debugger?: Debugger;
52
+ cps?: CPS;
53
+ processState?: OperationContextProcessState;
54
+ }
55
+ export interface OperationContextForkOptions {
56
+ type: ContextType;
57
+ state: ContextState;
58
+ target?: string;
59
+ injected?: boolean;
60
+ }
61
+ export declare class OperationContext {
62
+ target: string;
63
+ stackItem: ASTBase | null;
64
+ debugger: Debugger;
65
+ previous: OperationContext | null;
66
+ type: ContextType;
67
+ state: ContextState;
68
+ scope: Scope;
69
+ memory: Map<string, any>;
70
+ cps: CPS | null;
71
+ processState: OperationContextProcessState;
72
+ isProtected: boolean;
73
+ injected: boolean;
74
+ api: OperationContext | null;
75
+ locals: OperationContext | null;
76
+ globals: OperationContext | null;
77
+ constructor(options: OperationContextOptions);
78
+ step(entity: Operation | Expression): Promise<void>;
79
+ setLastActive(opc: OperationContext): OperationContext;
80
+ getLastActive(): OperationContext | null;
81
+ isExit(): boolean;
82
+ exit(): Promise<OperationContext>;
83
+ isPending(): boolean;
84
+ setPending(pending: boolean): OperationContext;
85
+ lookupAllOfType(validate: (type: ContextType) => boolean): OperationContext[];
86
+ lookupType(validate: (type: ContextType) => boolean): OperationContext;
87
+ lookupAllScopes(): OperationContext[];
88
+ lookupAPI(): OperationContext;
89
+ lookupGlobals(): OperationContext;
90
+ lookupLocals(): OperationContext;
91
+ extend(map: Map<string, any>): OperationContext;
92
+ set(path: any[], value: any): Promise<void>;
93
+ get(path: any[]): Promise<any>;
94
+ getCallable(path: string[]): Promise<Callable>;
95
+ setMemory(key: string, value: any): OperationContext;
96
+ getMemory(key: string): any;
97
+ fork({ type, state, target, injected }: OperationContextForkOptions): OperationContext;
98
+ }