@forthic/interp 0.2.0 → 0.3.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/cjs/forthic/errors.d.ts +70 -0
- package/dist/cjs/forthic/errors.js +174 -0
- package/dist/cjs/forthic/errors.js.map +1 -0
- package/dist/cjs/forthic/global_module/map_word.js +2 -2
- package/dist/cjs/forthic/global_module/map_word.js.map +1 -1
- package/dist/cjs/forthic/global_module.d.ts +2 -1
- package/dist/cjs/forthic/global_module.js +30 -23
- package/dist/cjs/forthic/global_module.js.map +1 -1
- package/dist/cjs/forthic/interpreter.d.ts +11 -1
- package/dist/cjs/forthic/interpreter.js +60 -45
- package/dist/cjs/forthic/interpreter.js.map +1 -1
- package/dist/cjs/forthic/module.js +2 -4
- package/dist/cjs/forthic/module.js.map +1 -1
- package/dist/cjs/forthic/tokenizer.d.ts +21 -2
- package/dist/cjs/forthic/tokenizer.js +57 -21
- package/dist/cjs/forthic/tokenizer.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/forthic/errors.d.ts +70 -0
- package/dist/esm/forthic/errors.js +174 -0
- package/dist/esm/forthic/errors.js.map +1 -0
- package/dist/esm/forthic/global_module/map_word.js +2 -2
- package/dist/esm/forthic/global_module/map_word.js.map +1 -1
- package/dist/esm/forthic/global_module.d.ts +2 -1
- package/dist/esm/forthic/global_module.js +30 -23
- package/dist/esm/forthic/global_module.js.map +1 -1
- package/dist/esm/forthic/interpreter.d.ts +11 -1
- package/dist/esm/forthic/interpreter.js +60 -45
- package/dist/esm/forthic/interpreter.js.map +1 -1
- package/dist/esm/forthic/module.js +2 -4
- package/dist/esm/forthic/module.js.map +1 -1
- package/dist/esm/forthic/tokenizer.d.ts +21 -2
- package/dist/esm/forthic/tokenizer.js +57 -21
- package/dist/esm/forthic/tokenizer.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -4
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { CodeLocation } from "./tokenizer";
|
|
2
|
+
declare class ForthicError extends Error {
|
|
3
|
+
private note;
|
|
4
|
+
private location?;
|
|
5
|
+
constructor(note: string, location?: CodeLocation);
|
|
6
|
+
getLocation(): CodeLocation;
|
|
7
|
+
getNote(): string;
|
|
8
|
+
getMessage(): string;
|
|
9
|
+
}
|
|
10
|
+
export declare class UnknownWordError extends ForthicError {
|
|
11
|
+
private word;
|
|
12
|
+
constructor(word: string, location?: CodeLocation);
|
|
13
|
+
getWord(): string;
|
|
14
|
+
}
|
|
15
|
+
export declare class InvalidVariableNameError extends ForthicError {
|
|
16
|
+
private var_name;
|
|
17
|
+
private addl_note;
|
|
18
|
+
constructor(var_name: string, addl_note: string, location?: CodeLocation);
|
|
19
|
+
getVarName(): string;
|
|
20
|
+
getAddlNote(): string;
|
|
21
|
+
}
|
|
22
|
+
export declare class UnknownScreenError extends ForthicError {
|
|
23
|
+
private screen_name;
|
|
24
|
+
constructor(screen_name: string, location?: CodeLocation);
|
|
25
|
+
getScreenName(): string;
|
|
26
|
+
}
|
|
27
|
+
export declare class UnknownModuleError extends ForthicError {
|
|
28
|
+
private module_name;
|
|
29
|
+
constructor(module_name: string, location?: CodeLocation);
|
|
30
|
+
getModuleName(): string;
|
|
31
|
+
}
|
|
32
|
+
export declare class TooManyAttemptsError extends ForthicError {
|
|
33
|
+
private num_attempts;
|
|
34
|
+
private max_attempts;
|
|
35
|
+
constructor(num_attempts: number, max_attempts: number, location?: CodeLocation);
|
|
36
|
+
getNumAttempts(): number;
|
|
37
|
+
getMaxAttempts(): number;
|
|
38
|
+
}
|
|
39
|
+
export declare class WordExecutionError extends ForthicError {
|
|
40
|
+
private word_name;
|
|
41
|
+
private error;
|
|
42
|
+
constructor(word_name: string, error: Error, location?: CodeLocation);
|
|
43
|
+
getWordName(): string;
|
|
44
|
+
getError(): Error;
|
|
45
|
+
}
|
|
46
|
+
export declare class ModuleError extends ForthicError {
|
|
47
|
+
private module_name;
|
|
48
|
+
private error;
|
|
49
|
+
constructor(module_name: string, error: Error, location?: CodeLocation);
|
|
50
|
+
getModuleName(): string;
|
|
51
|
+
getError(): Error;
|
|
52
|
+
}
|
|
53
|
+
export declare class StackUnderflowError extends ForthicError {
|
|
54
|
+
constructor(location?: CodeLocation);
|
|
55
|
+
}
|
|
56
|
+
export declare class UnknownTokenError extends ForthicError {
|
|
57
|
+
private token;
|
|
58
|
+
constructor(token: string, location?: CodeLocation);
|
|
59
|
+
getToken(): string;
|
|
60
|
+
}
|
|
61
|
+
export declare class MissingSemicolonError extends ForthicError {
|
|
62
|
+
constructor(location?: CodeLocation);
|
|
63
|
+
}
|
|
64
|
+
export declare class ExtraSemicolonError extends ForthicError {
|
|
65
|
+
constructor(location?: CodeLocation);
|
|
66
|
+
}
|
|
67
|
+
export declare class IntentionalStopError extends Error {
|
|
68
|
+
constructor(message: string);
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IntentionalStopError = exports.ExtraSemicolonError = exports.MissingSemicolonError = exports.UnknownTokenError = exports.StackUnderflowError = exports.ModuleError = exports.WordExecutionError = exports.TooManyAttemptsError = exports.UnknownModuleError = exports.UnknownScreenError = exports.InvalidVariableNameError = exports.UnknownWordError = void 0;
|
|
4
|
+
class ForthicError extends Error {
|
|
5
|
+
constructor(note, location) {
|
|
6
|
+
const location_note = location ? ` at ${location.screen_name}:${location.line}:${location.column}` : "";
|
|
7
|
+
const message = `${note}${location_note}`;
|
|
8
|
+
super(message);
|
|
9
|
+
this.note = note;
|
|
10
|
+
this.location = location;
|
|
11
|
+
}
|
|
12
|
+
getLocation() {
|
|
13
|
+
return this.location;
|
|
14
|
+
}
|
|
15
|
+
getNote() {
|
|
16
|
+
return this.note;
|
|
17
|
+
}
|
|
18
|
+
getMessage() {
|
|
19
|
+
return this.message;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// ============================================================
|
|
23
|
+
// Interpreter errors
|
|
24
|
+
// Interpreter couldn't find word in dictionaries
|
|
25
|
+
class UnknownWordError extends ForthicError {
|
|
26
|
+
constructor(word, location) {
|
|
27
|
+
const note = `Unknown word: ${word}`;
|
|
28
|
+
super(note, location);
|
|
29
|
+
this.word = word;
|
|
30
|
+
this.name = "UnknownWordError";
|
|
31
|
+
}
|
|
32
|
+
getWord() {
|
|
33
|
+
return this.word;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.UnknownWordError = UnknownWordError;
|
|
37
|
+
// Variable name is not allowed
|
|
38
|
+
class InvalidVariableNameError extends ForthicError {
|
|
39
|
+
constructor(var_name, addl_note, location) {
|
|
40
|
+
const note = `Invalid variable name: ${var_name}(${addl_note})`;
|
|
41
|
+
super(note, location);
|
|
42
|
+
this.var_name = var_name;
|
|
43
|
+
this.addl_note = addl_note;
|
|
44
|
+
this.name = "InvalidVariableNameError";
|
|
45
|
+
}
|
|
46
|
+
getVarName() {
|
|
47
|
+
return this.var_name;
|
|
48
|
+
}
|
|
49
|
+
getAddlNote() {
|
|
50
|
+
return this.addl_note;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.InvalidVariableNameError = InvalidVariableNameError;
|
|
54
|
+
// Interpreter couldn't find screen
|
|
55
|
+
class UnknownScreenError extends ForthicError {
|
|
56
|
+
constructor(screen_name, location) {
|
|
57
|
+
const note = `Unknown screen: ${screen_name}`;
|
|
58
|
+
super(note, location);
|
|
59
|
+
this.screen_name = screen_name;
|
|
60
|
+
this.name = "UnknownScreenError";
|
|
61
|
+
}
|
|
62
|
+
getScreenName() {
|
|
63
|
+
return this.screen_name;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.UnknownScreenError = UnknownScreenError;
|
|
67
|
+
// Interpreter couldn't find module
|
|
68
|
+
class UnknownModuleError extends ForthicError {
|
|
69
|
+
constructor(module_name, location) {
|
|
70
|
+
const note = `Unknown module: ${module_name}`;
|
|
71
|
+
super(note, location);
|
|
72
|
+
this.module_name = module_name;
|
|
73
|
+
this.name = "UnknownModuleError";
|
|
74
|
+
}
|
|
75
|
+
getModuleName() {
|
|
76
|
+
return this.module_name;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.UnknownModuleError = UnknownModuleError;
|
|
80
|
+
class TooManyAttemptsError extends ForthicError {
|
|
81
|
+
constructor(num_attempts, max_attempts, location) {
|
|
82
|
+
const note = `Too many recovery attempts: ${num_attempts} of ${max_attempts}`;
|
|
83
|
+
super(note, location);
|
|
84
|
+
this.num_attempts = num_attempts;
|
|
85
|
+
this.max_attempts = max_attempts;
|
|
86
|
+
this.name = "TooManyAttemptsError";
|
|
87
|
+
}
|
|
88
|
+
getNumAttempts() {
|
|
89
|
+
return this.num_attempts;
|
|
90
|
+
}
|
|
91
|
+
getMaxAttempts() {
|
|
92
|
+
return this.max_attempts;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.TooManyAttemptsError = TooManyAttemptsError;
|
|
96
|
+
class WordExecutionError extends ForthicError {
|
|
97
|
+
constructor(word_name, error, location) {
|
|
98
|
+
const note = `Error executing word: ${word_name}`;
|
|
99
|
+
super(note, location);
|
|
100
|
+
this.word_name = word_name;
|
|
101
|
+
this.error = error;
|
|
102
|
+
this.name = "WordExecutionError";
|
|
103
|
+
}
|
|
104
|
+
getWordName() {
|
|
105
|
+
return this.word_name;
|
|
106
|
+
}
|
|
107
|
+
getError() {
|
|
108
|
+
return this.error;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.WordExecutionError = WordExecutionError;
|
|
112
|
+
class ModuleError extends ForthicError {
|
|
113
|
+
constructor(module_name, error, location) {
|
|
114
|
+
const note = `Error in module ${module_name}`;
|
|
115
|
+
super(note, location);
|
|
116
|
+
this.module_name = module_name;
|
|
117
|
+
this.error = error;
|
|
118
|
+
this.name = "ModuleError";
|
|
119
|
+
}
|
|
120
|
+
getModuleName() {
|
|
121
|
+
return this.module_name;
|
|
122
|
+
}
|
|
123
|
+
getError() {
|
|
124
|
+
return this.error;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.ModuleError = ModuleError;
|
|
128
|
+
class StackUnderflowError extends ForthicError {
|
|
129
|
+
constructor(location) {
|
|
130
|
+
const note = `Stack underflow`;
|
|
131
|
+
super(note, location);
|
|
132
|
+
this.name = "StackUnderflowError";
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.StackUnderflowError = StackUnderflowError;
|
|
136
|
+
class UnknownTokenError extends ForthicError {
|
|
137
|
+
constructor(token, location) {
|
|
138
|
+
const note = `(Should never happen) Unknown type of token: ${token}`;
|
|
139
|
+
super(note, location);
|
|
140
|
+
this.token = token;
|
|
141
|
+
this.name = "UnknownTokenError";
|
|
142
|
+
}
|
|
143
|
+
getToken() {
|
|
144
|
+
return this.token;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.UnknownTokenError = UnknownTokenError;
|
|
148
|
+
class MissingSemicolonError extends ForthicError {
|
|
149
|
+
constructor(location) {
|
|
150
|
+
const note = `Missing semicolon -- new definition started before previous one was complete`;
|
|
151
|
+
super(note, location);
|
|
152
|
+
this.name = "MissingSemicolonError";
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.MissingSemicolonError = MissingSemicolonError;
|
|
156
|
+
class ExtraSemicolonError extends ForthicError {
|
|
157
|
+
constructor(location) {
|
|
158
|
+
const note = `Extra semicolon -- no definition in progress`;
|
|
159
|
+
super(note, location);
|
|
160
|
+
this.name = "ExtraSemicolonError";
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.ExtraSemicolonError = ExtraSemicolonError;
|
|
164
|
+
// ============================================================
|
|
165
|
+
// Misc errors
|
|
166
|
+
// Error indicating intentional stop
|
|
167
|
+
class IntentionalStopError extends Error {
|
|
168
|
+
constructor(message) {
|
|
169
|
+
super(message);
|
|
170
|
+
this.name = "IntentionalStopError";
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.IntentionalStopError = IntentionalStopError;
|
|
174
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/forthic/errors.ts"],"names":[],"mappings":";;;AAEA,MAAM,YAAa,SAAQ,KAAK;IAC5B,YAAoB,IAAY,EAAU,QAAuB;QAC7D,MAAM,aAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxG,MAAM,OAAO,GAAG,GAAG,IAAI,GAAG,aAAa,EAAE,CAAC;QAE1C,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,SAAI,GAAJ,IAAI,CAAQ;QAAU,aAAQ,GAAR,QAAQ,CAAe;IAKjE,CAAC;IAED,WAAW;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,OAAO;QACH,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CACJ;AAED,+DAA+D;AAC/D,qBAAqB;AAErB,iDAAiD;AACjD,MAAa,gBAAiB,SAAQ,YAAY;IAChD,YAAoB,IAAY,EAAE,QAAuB;QACvD,MAAM,IAAI,GAAG,iBAAiB,IAAI,EAAE,CAAC;QACrC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAFJ,SAAI,GAAJ,IAAI,CAAQ;QAG9B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,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B,CAAC;IACrC,CAAC;CACF;AALD,oDAKC"}
|
|
@@ -93,7 +93,7 @@ class MapWord {
|
|
|
93
93
|
let error = null;
|
|
94
94
|
try {
|
|
95
95
|
// If this runs successfully, it would have pushed the result onto the stack
|
|
96
|
-
await interp.run(forthic, forthic_location);
|
|
96
|
+
await interp.run(forthic, { reference_location: forthic_location });
|
|
97
97
|
}
|
|
98
98
|
catch (e) {
|
|
99
99
|
// Since this didn't run successfully, push null onto the stack
|
|
@@ -103,7 +103,7 @@ class MapWord {
|
|
|
103
103
|
errors.push(error);
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
|
-
await interp.run(forthic, forthic_location);
|
|
106
|
+
await interp.run(forthic, { reference_location: forthic_location });
|
|
107
107
|
}
|
|
108
108
|
return interp.stack_pop();
|
|
109
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map_word.js","sourceRoot":"","sources":["../../../../src/forthic/global_module/map_word.ts"],"names":[],"mappings":";;;AAAA,gDAAiD;AAUjD,6BAA6B;AAC7B,MAAa,OAAO;IAgBlB,YACE,KAAY,EACZ,OAAY,EACZ,gBAAqB,EACrB,KAAmB;QAEnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,YAAY;QACZ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAE/B,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,EA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CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,MAAM,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QAC1D,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,CAAC;CACF;AA/MD,0BA+MC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Module, Word } from "./module";
|
|
2
|
-
import type
|
|
2
|
+
import { type Interpreter } from "./interpreter";
|
|
3
3
|
export declare class GlobalModule extends Module {
|
|
4
4
|
module_id: string;
|
|
5
5
|
literal_handlers: Array<(value: any) => any>;
|
|
@@ -163,5 +163,6 @@ export declare class GlobalModule extends Module {
|
|
|
163
163
|
word_JSON_to(interp: Interpreter): void;
|
|
164
164
|
word_LOAD_SCREEN(interp: Interpreter): Promise<void>;
|
|
165
165
|
word_dot_s(interp: Interpreter): void;
|
|
166
|
+
word_dot_S(interp: Interpreter): void;
|
|
166
167
|
word_minus(interp: Interpreter): void;
|
|
167
168
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GlobalModule = void 0;
|
|
4
4
|
const module_1 = require("./module");
|
|
5
|
-
const ForthicError_1 = require("./ForthicError");
|
|
6
5
|
const utils_1 = require("./utils");
|
|
7
6
|
const map_word_1 = require("./global_module/map_word");
|
|
8
7
|
const tokenizer_1 = require("./tokenizer");
|
|
8
|
+
const errors_1 = require("./errors");
|
|
9
9
|
const DLE = String.fromCharCode(16); // ASCII char for "Data Link Escape" used as an untypeable quote
|
|
10
10
|
class GlobalModule extends module_1.Module {
|
|
11
11
|
constructor(interp) {
|
|
@@ -119,6 +119,7 @@ class GlobalModule extends module_1.Module {
|
|
|
119
119
|
this.add_module_word("JSON>", this.word_JSON_to);
|
|
120
120
|
this.add_module_word("LOAD-SCREEN", this.word_LOAD_SCREEN);
|
|
121
121
|
this.add_module_word(".s", this.word_dot_s);
|
|
122
|
+
this.add_module_word(".S", this.word_dot_S);
|
|
122
123
|
// --------------------
|
|
123
124
|
// Date/time words
|
|
124
125
|
this.add_module_word("AM", this.word_AM);
|
|
@@ -291,7 +292,7 @@ class GlobalModule extends module_1.Module {
|
|
|
291
292
|
const module = interp.cur_module();
|
|
292
293
|
varnames.forEach((v) => {
|
|
293
294
|
if (v.match(/__.*/)) {
|
|
294
|
-
throw new
|
|
295
|
+
throw new errors_1.InvalidVariableNameError(v, "Variable names cannot begin with '__'", interp.get_string_location());
|
|
295
296
|
}
|
|
296
297
|
module.add_variable(v);
|
|
297
298
|
});
|
|
@@ -319,7 +320,7 @@ class GlobalModule extends module_1.Module {
|
|
|
319
320
|
const string = interp.stack_pop();
|
|
320
321
|
const string_location = interp.get_string_location();
|
|
321
322
|
if (string)
|
|
322
|
-
await interp.run(string, string_location);
|
|
323
|
+
await interp.run(string, { reference_location: string_location });
|
|
323
324
|
}
|
|
324
325
|
// ( names -- )
|
|
325
326
|
word_EXPORT(interp) {
|
|
@@ -573,7 +574,7 @@ class GlobalModule extends module_1.Module {
|
|
|
573
574
|
if (flags.with_key)
|
|
574
575
|
interp.stack_push(key);
|
|
575
576
|
interp.stack_push(value);
|
|
576
|
-
await interp.run(forthic, string_location);
|
|
577
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
577
578
|
const group = interp.stack_pop();
|
|
578
579
|
if (!result[group])
|
|
579
580
|
result[group] = [];
|
|
@@ -630,7 +631,7 @@ class GlobalModule extends module_1.Module {
|
|
|
630
631
|
for (let i = 0; i < items.length; i++) {
|
|
631
632
|
const item = items[i];
|
|
632
633
|
interp.stack_push(item);
|
|
633
|
-
await interp.run(forthic, string_location);
|
|
634
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
634
635
|
const keys = interp.stack_pop();
|
|
635
636
|
keys.forEach((k) => {
|
|
636
637
|
const lowercased_key = k.toLowerCase();
|
|
@@ -669,7 +670,7 @@ class GlobalModule extends module_1.Module {
|
|
|
669
670
|
if (flags.push_error)
|
|
670
671
|
errors.push(await execute_returning_error(interp, forthic, string_location));
|
|
671
672
|
else
|
|
672
|
-
await interp.run(forthic, string_location);
|
|
673
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
673
674
|
}
|
|
674
675
|
}
|
|
675
676
|
else {
|
|
@@ -683,7 +684,7 @@ class GlobalModule extends module_1.Module {
|
|
|
683
684
|
if (flags.push_error)
|
|
684
685
|
errors.push(await execute_returning_error(interp, forthic, string_location));
|
|
685
686
|
else
|
|
686
|
-
await interp.run(forthic, string_location);
|
|
687
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
687
688
|
}
|
|
688
689
|
}
|
|
689
690
|
if (flags.push_error)
|
|
@@ -752,7 +753,7 @@ class GlobalModule extends module_1.Module {
|
|
|
752
753
|
value2 = container2[i];
|
|
753
754
|
interp.stack_push(container1[i]);
|
|
754
755
|
interp.stack_push(value2);
|
|
755
|
-
await interp.run(forthic, string_location);
|
|
756
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
756
757
|
const res = interp.stack_pop();
|
|
757
758
|
result.push(res);
|
|
758
759
|
}
|
|
@@ -764,7 +765,7 @@ class GlobalModule extends module_1.Module {
|
|
|
764
765
|
const k = keys[i];
|
|
765
766
|
interp.stack_push(container1[k]);
|
|
766
767
|
interp.stack_push(container2[k]);
|
|
767
|
-
await interp.run(forthic, string_location);
|
|
768
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
768
769
|
const res = interp.stack_pop();
|
|
769
770
|
result[k] = res;
|
|
770
771
|
}
|
|
@@ -836,7 +837,7 @@ class GlobalModule extends module_1.Module {
|
|
|
836
837
|
const item = array[index];
|
|
837
838
|
if (!start_found) {
|
|
838
839
|
interp.stack_push(item);
|
|
839
|
-
await interp.run(fstart, fstart_string_location);
|
|
840
|
+
await interp.run(fstart, { reference_location: fstart_string_location });
|
|
840
841
|
start_found = interp.stack_pop();
|
|
841
842
|
if (start_found) {
|
|
842
843
|
start_index = index;
|
|
@@ -844,7 +845,7 @@ class GlobalModule extends module_1.Module {
|
|
|
844
845
|
}
|
|
845
846
|
if (start_found && !end_found) {
|
|
846
847
|
interp.stack_push(item);
|
|
847
|
-
await interp.run(fend, fend_string_location);
|
|
848
|
+
await interp.run(fend, { reference_location: fend_string_location });
|
|
848
849
|
end_found = interp.stack_pop();
|
|
849
850
|
if (end_found) {
|
|
850
851
|
end_index = index;
|
|
@@ -1029,7 +1030,7 @@ class GlobalModule extends module_1.Module {
|
|
|
1029
1030
|
if (flags.with_key)
|
|
1030
1031
|
interp.stack_push(i);
|
|
1031
1032
|
interp.stack_push(item);
|
|
1032
|
-
await interp.run(forthic, string_location);
|
|
1033
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
1033
1034
|
const should_select = interp.stack_pop();
|
|
1034
1035
|
if (should_select)
|
|
1035
1036
|
result.push(item);
|
|
@@ -1044,7 +1045,7 @@ class GlobalModule extends module_1.Module {
|
|
|
1044
1045
|
if (flags.with_key)
|
|
1045
1046
|
interp.stack_push(k);
|
|
1046
1047
|
interp.stack_push(v);
|
|
1047
|
-
await interp.run(forthic, string_location);
|
|
1048
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
1048
1049
|
const should_select = interp.stack_pop();
|
|
1049
1050
|
if (should_select)
|
|
1050
1051
|
result[k] = v;
|
|
@@ -1199,7 +1200,7 @@ class GlobalModule extends module_1.Module {
|
|
|
1199
1200
|
for (let i = 0; i < vals.length; i++) {
|
|
1200
1201
|
const val = vals[i];
|
|
1201
1202
|
interp.stack_push(val);
|
|
1202
|
-
await interp.run(forthic, flag_string_position);
|
|
1203
|
+
await interp.run(forthic, { reference_location: flag_string_position });
|
|
1203
1204
|
const aug_val = interp.stack_pop();
|
|
1204
1205
|
res.push([val, aug_val]);
|
|
1205
1206
|
}
|
|
@@ -1417,7 +1418,7 @@ class GlobalModule extends module_1.Module {
|
|
|
1417
1418
|
interp.stack_push(initial);
|
|
1418
1419
|
container.forEach(async (item) => {
|
|
1419
1420
|
interp.stack_push(item);
|
|
1420
|
-
await interp.run(forthic, string_location);
|
|
1421
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
1421
1422
|
});
|
|
1422
1423
|
result = interp.stack_pop();
|
|
1423
1424
|
}
|
|
@@ -1426,7 +1427,7 @@ class GlobalModule extends module_1.Module {
|
|
|
1426
1427
|
Object.keys(container).forEach(async (k) => {
|
|
1427
1428
|
const v = container[k];
|
|
1428
1429
|
interp.stack_push(v);
|
|
1429
|
-
await interp.run(forthic, string_location);
|
|
1430
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
1430
1431
|
});
|
|
1431
1432
|
result = interp.stack_pop();
|
|
1432
1433
|
}
|
|
@@ -2138,7 +2139,7 @@ class GlobalModule extends module_1.Module {
|
|
|
2138
2139
|
}
|
|
2139
2140
|
for (const item of items) {
|
|
2140
2141
|
interp.stack_push(item);
|
|
2141
|
-
await interp.run(fvalue, string_location);
|
|
2142
|
+
await interp.run(fvalue, { reference_location: string_location });
|
|
2142
2143
|
const value = interp.stack_pop();
|
|
2143
2144
|
let bucket = "BEFORE";
|
|
2144
2145
|
for (const range_start of start_ranges) {
|
|
@@ -2298,7 +2299,7 @@ class GlobalModule extends module_1.Module {
|
|
|
2298
2299
|
const string_location = interp.get_string_location();
|
|
2299
2300
|
let value = interp.stack_pop();
|
|
2300
2301
|
if (value === undefined || value === null || value === "") {
|
|
2301
|
-
await interp.run(default_forthic, string_location);
|
|
2302
|
+
await interp.run(default_forthic, { reference_location: string_location });
|
|
2302
2303
|
value = interp.stack_pop();
|
|
2303
2304
|
}
|
|
2304
2305
|
interp.stack_push(value);
|
|
@@ -2325,7 +2326,7 @@ class GlobalModule extends module_1.Module {
|
|
|
2325
2326
|
// Store item so we can push it back later
|
|
2326
2327
|
const item = interp.stack_pop();
|
|
2327
2328
|
interp.stack_push(item);
|
|
2328
|
-
await interp.run(forthic, string_location);
|
|
2329
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
2329
2330
|
const res = interp.stack_pop();
|
|
2330
2331
|
// Push original item and result
|
|
2331
2332
|
interp.stack_push(item);
|
|
@@ -2371,18 +2372,24 @@ class GlobalModule extends module_1.Module {
|
|
|
2371
2372
|
const screen_forthic = interp.get_screen_forthic(name);
|
|
2372
2373
|
const location = new tokenizer_1.CodeLocation({ screen_name: name });
|
|
2373
2374
|
// await interp.run(screen_forthic, location);
|
|
2374
|
-
await interp.run(screen_forthic, location);
|
|
2375
|
+
await interp.run(screen_forthic, { reference_location: location });
|
|
2375
2376
|
}
|
|
2376
2377
|
// ( -- )
|
|
2377
2378
|
word_dot_s(interp) {
|
|
2378
|
-
const stack = interp.
|
|
2379
|
+
const stack = interp.get_stack();
|
|
2379
2380
|
if (stack.length > 0) {
|
|
2380
2381
|
console.log(stack[stack.length - 1]);
|
|
2381
2382
|
}
|
|
2382
2383
|
else {
|
|
2383
2384
|
console.log("<STACK EMPTY>");
|
|
2384
2385
|
}
|
|
2385
|
-
|
|
2386
|
+
throw new errors_1.IntentionalStopError(".s");
|
|
2387
|
+
}
|
|
2388
|
+
// ( -- )
|
|
2389
|
+
word_dot_S(interp) {
|
|
2390
|
+
const stack = interp.get_stack();
|
|
2391
|
+
console.log(JSON.stringify(stack, null, 2));
|
|
2392
|
+
throw new errors_1.IntentionalStopError(".S");
|
|
2386
2393
|
}
|
|
2387
2394
|
// ( a b -- a - b )
|
|
2388
2395
|
word_minus(interp) {
|
|
@@ -2408,7 +2415,7 @@ function drill_for_value(record, fields) {
|
|
|
2408
2415
|
async function execute_returning_error(interp, forthic, string_location) {
|
|
2409
2416
|
let result = null;
|
|
2410
2417
|
try {
|
|
2411
|
-
await interp.run(forthic, string_location);
|
|
2418
|
+
await interp.run(forthic, { reference_location: string_location });
|
|
2412
2419
|
}
|
|
2413
2420
|
catch (e) {
|
|
2414
2421
|
result = e;
|