@forthic/interp 0.3.0 → 0.5.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.
Files changed (31) hide show
  1. package/dist/cjs/forthic/errors.d.ts +17 -14
  2. package/dist/cjs/forthic/errors.js +56 -29
  3. package/dist/cjs/forthic/errors.js.map +1 -1
  4. package/dist/cjs/forthic/global_module/map_word.js +2 -2
  5. package/dist/cjs/forthic/global_module/map_word.js.map +1 -1
  6. package/dist/cjs/forthic/global_module.js +21 -21
  7. package/dist/cjs/forthic/global_module.js.map +1 -1
  8. package/dist/cjs/forthic/interpreter.d.ts +12 -8
  9. package/dist/cjs/forthic/interpreter.js +55 -25
  10. package/dist/cjs/forthic/interpreter.js.map +1 -1
  11. package/dist/cjs/forthic/module.js +13 -2
  12. package/dist/cjs/forthic/module.js.map +1 -1
  13. package/dist/cjs/forthic/tokenizer.d.ts +1 -0
  14. package/dist/cjs/forthic/tokenizer.js +3 -0
  15. package/dist/cjs/forthic/tokenizer.js.map +1 -1
  16. package/dist/esm/forthic/errors.d.ts +17 -14
  17. package/dist/esm/forthic/errors.js +56 -29
  18. package/dist/esm/forthic/errors.js.map +1 -1
  19. package/dist/esm/forthic/global_module/map_word.js +2 -2
  20. package/dist/esm/forthic/global_module/map_word.js.map +1 -1
  21. package/dist/esm/forthic/global_module.js +21 -21
  22. package/dist/esm/forthic/global_module.js.map +1 -1
  23. package/dist/esm/forthic/interpreter.d.ts +12 -8
  24. package/dist/esm/forthic/interpreter.js +55 -25
  25. package/dist/esm/forthic/interpreter.js.map +1 -1
  26. package/dist/esm/forthic/module.js +13 -2
  27. package/dist/esm/forthic/module.js.map +1 -1
  28. package/dist/esm/forthic/tokenizer.d.ts +1 -0
  29. package/dist/esm/forthic/tokenizer.js +3 -0
  30. package/dist/esm/forthic/tokenizer.js.map +1 -1
  31. package/package.json +1 -1
@@ -1,70 +1,73 @@
1
1
  import { CodeLocation } from "./tokenizer";
2
- declare class ForthicError extends Error {
2
+ export declare class ForthicError extends Error {
3
+ private forthic;
3
4
  private note;
4
5
  private location?;
5
- constructor(note: string, location?: CodeLocation);
6
+ constructor(forthic: string, note: string, location?: CodeLocation);
7
+ getDescription(): string;
6
8
  getLocation(): CodeLocation;
9
+ getForthic(): string;
7
10
  getNote(): string;
8
11
  getMessage(): string;
9
12
  }
10
13
  export declare class UnknownWordError extends ForthicError {
11
14
  private word;
12
- constructor(word: string, location?: CodeLocation);
15
+ constructor(forthic: string, word: string, location?: CodeLocation);
13
16
  getWord(): string;
14
17
  }
15
18
  export declare class InvalidVariableNameError extends ForthicError {
16
19
  private var_name;
17
20
  private addl_note;
18
- constructor(var_name: string, addl_note: string, location?: CodeLocation);
21
+ constructor(forthic: string, var_name: string, addl_note: string, location?: CodeLocation);
19
22
  getVarName(): string;
20
23
  getAddlNote(): string;
21
24
  }
22
25
  export declare class UnknownScreenError extends ForthicError {
23
26
  private screen_name;
24
- constructor(screen_name: string, location?: CodeLocation);
27
+ constructor(forthic: string, screen_name: string, location?: CodeLocation);
25
28
  getScreenName(): string;
26
29
  }
27
30
  export declare class UnknownModuleError extends ForthicError {
28
31
  private module_name;
29
- constructor(module_name: string, location?: CodeLocation);
32
+ constructor(forthic: string, module_name: string, location?: CodeLocation);
30
33
  getModuleName(): string;
31
34
  }
32
35
  export declare class TooManyAttemptsError extends ForthicError {
33
36
  private num_attempts;
34
37
  private max_attempts;
35
- constructor(num_attempts: number, max_attempts: number, location?: CodeLocation);
38
+ constructor(forthic: string, num_attempts: number, max_attempts: number, location?: CodeLocation);
36
39
  getNumAttempts(): number;
37
40
  getMaxAttempts(): number;
38
41
  }
39
42
  export declare class WordExecutionError extends ForthicError {
40
43
  private word_name;
41
44
  private error;
42
- constructor(word_name: string, error: Error, location?: CodeLocation);
45
+ constructor(forthic: string, word_name: string, error: Error, location?: CodeLocation);
43
46
  getWordName(): string;
44
47
  getError(): Error;
45
48
  }
46
49
  export declare class ModuleError extends ForthicError {
47
50
  private module_name;
48
51
  private error;
49
- constructor(module_name: string, error: Error, location?: CodeLocation);
52
+ constructor(forthic: string, module_name: string, error: Error, location?: CodeLocation);
50
53
  getModuleName(): string;
51
54
  getError(): Error;
52
55
  }
53
56
  export declare class StackUnderflowError extends ForthicError {
54
- constructor(location?: CodeLocation);
57
+ constructor(forthic: string, location?: CodeLocation);
55
58
  }
56
59
  export declare class UnknownTokenError extends ForthicError {
57
60
  private token;
58
- constructor(token: string, location?: CodeLocation);
61
+ constructor(forthic: string, token: string, location?: CodeLocation);
59
62
  getToken(): string;
60
63
  }
61
64
  export declare class MissingSemicolonError extends ForthicError {
62
- constructor(location?: CodeLocation);
65
+ constructor(forthic: string, location?: CodeLocation);
63
66
  }
64
67
  export declare class ExtraSemicolonError extends ForthicError {
65
- constructor(location?: CodeLocation);
68
+ constructor(forthic: string, location?: CodeLocation);
66
69
  }
67
70
  export declare class IntentionalStopError extends Error {
68
71
  constructor(message: string);
69
72
  }
70
- export {};
73
+ export declare function get_error_description(forthic: string, forthicError: ForthicError): string;
@@ -1,17 +1,24 @@
1
1
  "use strict";
2
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;
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 = exports.ForthicError = void 0;
4
+ exports.get_error_description = get_error_description;
4
5
  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}`;
6
+ constructor(forthic, note, location) {
7
+ const message = `${note}`;
8
8
  super(message);
9
+ this.forthic = forthic;
9
10
  this.note = note;
10
11
  this.location = location;
11
12
  }
13
+ getDescription() {
14
+ return get_error_description(this.forthic, this);
15
+ }
12
16
  getLocation() {
13
17
  return this.location;
14
18
  }
19
+ getForthic() {
20
+ return this.forthic;
21
+ }
15
22
  getNote() {
16
23
  return this.note;
17
24
  }
@@ -19,13 +26,14 @@ class ForthicError extends Error {
19
26
  return this.message;
20
27
  }
21
28
  }
29
+ exports.ForthicError = ForthicError;
22
30
  // ============================================================
23
31
  // Interpreter errors
24
32
  // Interpreter couldn't find word in dictionaries
25
33
  class UnknownWordError extends ForthicError {
26
- constructor(word, location) {
34
+ constructor(forthic, word, location) {
27
35
  const note = `Unknown word: ${word}`;
28
- super(note, location);
36
+ super(forthic, note, location);
29
37
  this.word = word;
30
38
  this.name = "UnknownWordError";
31
39
  }
@@ -36,9 +44,9 @@ class UnknownWordError extends ForthicError {
36
44
  exports.UnknownWordError = UnknownWordError;
37
45
  // Variable name is not allowed
38
46
  class InvalidVariableNameError extends ForthicError {
39
- constructor(var_name, addl_note, location) {
47
+ constructor(forthic, var_name, addl_note, location) {
40
48
  const note = `Invalid variable name: ${var_name}(${addl_note})`;
41
- super(note, location);
49
+ super(forthic, note, location);
42
50
  this.var_name = var_name;
43
51
  this.addl_note = addl_note;
44
52
  this.name = "InvalidVariableNameError";
@@ -53,9 +61,9 @@ class InvalidVariableNameError extends ForthicError {
53
61
  exports.InvalidVariableNameError = InvalidVariableNameError;
54
62
  // Interpreter couldn't find screen
55
63
  class UnknownScreenError extends ForthicError {
56
- constructor(screen_name, location) {
64
+ constructor(forthic, screen_name, location) {
57
65
  const note = `Unknown screen: ${screen_name}`;
58
- super(note, location);
66
+ super(forthic, note, location);
59
67
  this.screen_name = screen_name;
60
68
  this.name = "UnknownScreenError";
61
69
  }
@@ -66,9 +74,9 @@ class UnknownScreenError extends ForthicError {
66
74
  exports.UnknownScreenError = UnknownScreenError;
67
75
  // Interpreter couldn't find module
68
76
  class UnknownModuleError extends ForthicError {
69
- constructor(module_name, location) {
77
+ constructor(forthic, module_name, location) {
70
78
  const note = `Unknown module: ${module_name}`;
71
- super(note, location);
79
+ super(forthic, note, location);
72
80
  this.module_name = module_name;
73
81
  this.name = "UnknownModuleError";
74
82
  }
@@ -78,9 +86,9 @@ class UnknownModuleError extends ForthicError {
78
86
  }
79
87
  exports.UnknownModuleError = UnknownModuleError;
80
88
  class TooManyAttemptsError extends ForthicError {
81
- constructor(num_attempts, max_attempts, location) {
89
+ constructor(forthic, num_attempts, max_attempts, location) {
82
90
  const note = `Too many recovery attempts: ${num_attempts} of ${max_attempts}`;
83
- super(note, location);
91
+ super(forthic, note, location);
84
92
  this.num_attempts = num_attempts;
85
93
  this.max_attempts = max_attempts;
86
94
  this.name = "TooManyAttemptsError";
@@ -94,9 +102,9 @@ class TooManyAttemptsError extends ForthicError {
94
102
  }
95
103
  exports.TooManyAttemptsError = TooManyAttemptsError;
96
104
  class WordExecutionError extends ForthicError {
97
- constructor(word_name, error, location) {
98
- const note = `Error executing word: ${word_name}`;
99
- super(note, location);
105
+ constructor(forthic, word_name, error, location) {
106
+ const note = `(${error.message}) when executing word ${word_name}`;
107
+ super(forthic, note, location);
100
108
  this.word_name = word_name;
101
109
  this.error = error;
102
110
  this.name = "WordExecutionError";
@@ -110,9 +118,9 @@ class WordExecutionError extends ForthicError {
110
118
  }
111
119
  exports.WordExecutionError = WordExecutionError;
112
120
  class ModuleError extends ForthicError {
113
- constructor(module_name, error, location) {
121
+ constructor(forthic, module_name, error, location) {
114
122
  const note = `Error in module ${module_name}`;
115
- super(note, location);
123
+ super(forthic, note, location);
116
124
  this.module_name = module_name;
117
125
  this.error = error;
118
126
  this.name = "ModuleError";
@@ -126,17 +134,17 @@ class ModuleError extends ForthicError {
126
134
  }
127
135
  exports.ModuleError = ModuleError;
128
136
  class StackUnderflowError extends ForthicError {
129
- constructor(location) {
137
+ constructor(forthic, location) {
130
138
  const note = `Stack underflow`;
131
- super(note, location);
139
+ super(forthic, note, location);
132
140
  this.name = "StackUnderflowError";
133
141
  }
134
142
  }
135
143
  exports.StackUnderflowError = StackUnderflowError;
136
144
  class UnknownTokenError extends ForthicError {
137
- constructor(token, location) {
145
+ constructor(forthic, token, location) {
138
146
  const note = `(Should never happen) Unknown type of token: ${token}`;
139
- super(note, location);
147
+ super(forthic, note, location);
140
148
  this.token = token;
141
149
  this.name = "UnknownTokenError";
142
150
  }
@@ -146,17 +154,17 @@ class UnknownTokenError extends ForthicError {
146
154
  }
147
155
  exports.UnknownTokenError = UnknownTokenError;
148
156
  class MissingSemicolonError extends ForthicError {
149
- constructor(location) {
150
- const note = `Missing semicolon -- new definition started before previous one was complete`;
151
- super(note, location);
157
+ constructor(forthic, location) {
158
+ const note = `Definition was missing its semicolon`;
159
+ super(forthic, note, location);
152
160
  this.name = "MissingSemicolonError";
153
161
  }
154
162
  }
155
163
  exports.MissingSemicolonError = MissingSemicolonError;
156
164
  class ExtraSemicolonError extends ForthicError {
157
- constructor(location) {
158
- const note = `Extra semicolon -- no definition in progress`;
159
- super(note, location);
165
+ constructor(forthic, location) {
166
+ const note = `Unexpected semicolon -- no definition in progress`;
167
+ super(forthic, note, location);
160
168
  this.name = "ExtraSemicolonError";
161
169
  }
162
170
  }
@@ -171,4 +179,23 @@ class IntentionalStopError extends Error {
171
179
  }
172
180
  }
173
181
  exports.IntentionalStopError = IntentionalStopError;
182
+ // ============================================================
183
+ // Utility functions
184
+ function get_error_description(forthic, forthicError) {
185
+ // If don't have any extra info, just return the note
186
+ if (!forthic || forthic === "" || forthicError.getLocation() === undefined) {
187
+ return forthicError.getNote();
188
+ }
189
+ // Otherwise, return the note and indicate where the error occurred
190
+ const location = forthicError.getLocation();
191
+ // Extract line where error occurred and highlight the error
192
+ const line_num = location.line;
193
+ // Get lines up to line_num
194
+ const lines = forthic.split("\n").slice(0, line_num);
195
+ // Error line is the line with the error, but with the error location highlighted and everything else a space
196
+ const error_line = " ".repeat(location.column - 1) + "^".repeat(location.end_pos - location.start_pos);
197
+ // Print all forthic lines with numbers adding the error line
198
+ const error_message = `${forthicError.getNote()} at line ${line_num}:\n\`\`\`\n${lines.map((line) => `${line}`).join("\n")}\n${error_line}\n\`\`\``;
199
+ return error_message;
200
+ }
174
201
  //# sourceMappingURL=errors.js.map
@@ -1 +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,IAAI,CAA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BAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AALD,oDAKC;AAED,+DAA+D;AAC/D,oBAAoB;AACpB,SAAgB,qBAAqB,CAAC,OAAe,EAAE,YAA0B;IAC7E,qDAAqD;IACrD,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,EAAE,IAAI,YAAY,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE,CAAC;QACzE,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAClC,CAAC;IAED,mEAAmE;IACnE,MAAM,QAAQ,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;IAE5C,4DAA4D;IAC5D,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC;IAE/B,2BAA2B;IAC3B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAErD,6GAA6G;IAC7G,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAC,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAErG,6DAA6D;IAC7D,MAAM,aAAa,GAAG,GAAG,YAAY,CAAC,OAAO,EAAE,YAAY,QAAQ,cAAc,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,UAAU,UAAU,CAAC;IACpJ,OAAO,aAAa,CAAC;AACzB,CAAC"}
@@ -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, { reference_location: forthic_location });
96
+ await interp.run(forthic, 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, { reference_location: forthic_location });
106
+ await interp.run(forthic, 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,EAAE,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,MAAmB;QAC/B,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IA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K,EAAE,EAAE,EAAE,MAAM,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"}
@@ -292,7 +292,7 @@ class GlobalModule extends module_1.Module {
292
292
  const module = interp.cur_module();
293
293
  varnames.forEach((v) => {
294
294
  if (v.match(/__.*/)) {
295
- throw new errors_1.InvalidVariableNameError(v, "Variable names cannot begin with '__'", interp.get_string_location());
295
+ throw new errors_1.InvalidVariableNameError(interp.get_top_input_string(), v, "Variable names cannot begin with '__'", interp.get_string_location());
296
296
  }
297
297
  module.add_variable(v);
298
298
  });
@@ -320,7 +320,7 @@ class GlobalModule extends module_1.Module {
320
320
  const string = interp.stack_pop();
321
321
  const string_location = interp.get_string_location();
322
322
  if (string)
323
- await interp.run(string, { reference_location: string_location });
323
+ await interp.run(string, string_location);
324
324
  }
325
325
  // ( names -- )
326
326
  word_EXPORT(interp) {
@@ -574,7 +574,7 @@ class GlobalModule extends module_1.Module {
574
574
  if (flags.with_key)
575
575
  interp.stack_push(key);
576
576
  interp.stack_push(value);
577
- await interp.run(forthic, { reference_location: string_location });
577
+ await interp.run(forthic, string_location);
578
578
  const group = interp.stack_pop();
579
579
  if (!result[group])
580
580
  result[group] = [];
@@ -631,7 +631,7 @@ class GlobalModule extends module_1.Module {
631
631
  for (let i = 0; i < items.length; i++) {
632
632
  const item = items[i];
633
633
  interp.stack_push(item);
634
- await interp.run(forthic, { reference_location: string_location });
634
+ await interp.run(forthic, string_location);
635
635
  const keys = interp.stack_pop();
636
636
  keys.forEach((k) => {
637
637
  const lowercased_key = k.toLowerCase();
@@ -670,7 +670,7 @@ class GlobalModule extends module_1.Module {
670
670
  if (flags.push_error)
671
671
  errors.push(await execute_returning_error(interp, forthic, string_location));
672
672
  else
673
- await interp.run(forthic, { reference_location: string_location });
673
+ await interp.run(forthic, string_location);
674
674
  }
675
675
  }
676
676
  else {
@@ -684,7 +684,7 @@ class GlobalModule extends module_1.Module {
684
684
  if (flags.push_error)
685
685
  errors.push(await execute_returning_error(interp, forthic, string_location));
686
686
  else
687
- await interp.run(forthic, { reference_location: string_location });
687
+ await interp.run(forthic, string_location);
688
688
  }
689
689
  }
690
690
  if (flags.push_error)
@@ -753,7 +753,7 @@ class GlobalModule extends module_1.Module {
753
753
  value2 = container2[i];
754
754
  interp.stack_push(container1[i]);
755
755
  interp.stack_push(value2);
756
- await interp.run(forthic, { reference_location: string_location });
756
+ await interp.run(forthic, string_location);
757
757
  const res = interp.stack_pop();
758
758
  result.push(res);
759
759
  }
@@ -765,7 +765,7 @@ class GlobalModule extends module_1.Module {
765
765
  const k = keys[i];
766
766
  interp.stack_push(container1[k]);
767
767
  interp.stack_push(container2[k]);
768
- await interp.run(forthic, { reference_location: string_location });
768
+ await interp.run(forthic, string_location);
769
769
  const res = interp.stack_pop();
770
770
  result[k] = res;
771
771
  }
@@ -837,7 +837,7 @@ class GlobalModule extends module_1.Module {
837
837
  const item = array[index];
838
838
  if (!start_found) {
839
839
  interp.stack_push(item);
840
- await interp.run(fstart, { reference_location: fstart_string_location });
840
+ await interp.run(fstart, fstart_string_location);
841
841
  start_found = interp.stack_pop();
842
842
  if (start_found) {
843
843
  start_index = index;
@@ -845,7 +845,7 @@ class GlobalModule extends module_1.Module {
845
845
  }
846
846
  if (start_found && !end_found) {
847
847
  interp.stack_push(item);
848
- await interp.run(fend, { reference_location: fend_string_location });
848
+ await interp.run(fend, fend_string_location);
849
849
  end_found = interp.stack_pop();
850
850
  if (end_found) {
851
851
  end_index = index;
@@ -1030,7 +1030,7 @@ class GlobalModule extends module_1.Module {
1030
1030
  if (flags.with_key)
1031
1031
  interp.stack_push(i);
1032
1032
  interp.stack_push(item);
1033
- await interp.run(forthic, { reference_location: string_location });
1033
+ await interp.run(forthic, string_location);
1034
1034
  const should_select = interp.stack_pop();
1035
1035
  if (should_select)
1036
1036
  result.push(item);
@@ -1045,7 +1045,7 @@ class GlobalModule extends module_1.Module {
1045
1045
  if (flags.with_key)
1046
1046
  interp.stack_push(k);
1047
1047
  interp.stack_push(v);
1048
- await interp.run(forthic, { reference_location: string_location });
1048
+ await interp.run(forthic, string_location);
1049
1049
  const should_select = interp.stack_pop();
1050
1050
  if (should_select)
1051
1051
  result[k] = v;
@@ -1200,7 +1200,7 @@ class GlobalModule extends module_1.Module {
1200
1200
  for (let i = 0; i < vals.length; i++) {
1201
1201
  const val = vals[i];
1202
1202
  interp.stack_push(val);
1203
- await interp.run(forthic, { reference_location: flag_string_position });
1203
+ await interp.run(forthic, flag_string_position);
1204
1204
  const aug_val = interp.stack_pop();
1205
1205
  res.push([val, aug_val]);
1206
1206
  }
@@ -1418,7 +1418,7 @@ class GlobalModule extends module_1.Module {
1418
1418
  interp.stack_push(initial);
1419
1419
  container.forEach(async (item) => {
1420
1420
  interp.stack_push(item);
1421
- await interp.run(forthic, { reference_location: string_location });
1421
+ await interp.run(forthic, string_location);
1422
1422
  });
1423
1423
  result = interp.stack_pop();
1424
1424
  }
@@ -1427,7 +1427,7 @@ class GlobalModule extends module_1.Module {
1427
1427
  Object.keys(container).forEach(async (k) => {
1428
1428
  const v = container[k];
1429
1429
  interp.stack_push(v);
1430
- await interp.run(forthic, { reference_location: string_location });
1430
+ await interp.run(forthic, string_location);
1431
1431
  });
1432
1432
  result = interp.stack_pop();
1433
1433
  }
@@ -2139,7 +2139,7 @@ class GlobalModule extends module_1.Module {
2139
2139
  }
2140
2140
  for (const item of items) {
2141
2141
  interp.stack_push(item);
2142
- await interp.run(fvalue, { reference_location: string_location });
2142
+ await interp.run(fvalue, string_location);
2143
2143
  const value = interp.stack_pop();
2144
2144
  let bucket = "BEFORE";
2145
2145
  for (const range_start of start_ranges) {
@@ -2299,7 +2299,7 @@ class GlobalModule extends module_1.Module {
2299
2299
  const string_location = interp.get_string_location();
2300
2300
  let value = interp.stack_pop();
2301
2301
  if (value === undefined || value === null || value === "") {
2302
- await interp.run(default_forthic, { reference_location: string_location });
2302
+ await interp.run(default_forthic, string_location);
2303
2303
  value = interp.stack_pop();
2304
2304
  }
2305
2305
  interp.stack_push(value);
@@ -2326,7 +2326,7 @@ class GlobalModule extends module_1.Module {
2326
2326
  // Store item so we can push it back later
2327
2327
  const item = interp.stack_pop();
2328
2328
  interp.stack_push(item);
2329
- await interp.run(forthic, { reference_location: string_location });
2329
+ await interp.run(forthic, string_location);
2330
2330
  const res = interp.stack_pop();
2331
2331
  // Push original item and result
2332
2332
  interp.stack_push(item);
@@ -2372,7 +2372,7 @@ class GlobalModule extends module_1.Module {
2372
2372
  const screen_forthic = interp.get_screen_forthic(name);
2373
2373
  const location = new tokenizer_1.CodeLocation({ screen_name: name });
2374
2374
  // await interp.run(screen_forthic, location);
2375
- await interp.run(screen_forthic, { reference_location: location });
2375
+ await interp.run(screen_forthic, location);
2376
2376
  }
2377
2377
  // ( -- )
2378
2378
  word_dot_s(interp) {
@@ -2387,7 +2387,7 @@ class GlobalModule extends module_1.Module {
2387
2387
  }
2388
2388
  // ( -- )
2389
2389
  word_dot_S(interp) {
2390
- const stack = interp.get_stack();
2390
+ const stack = interp.get_stack().reverse();
2391
2391
  console.log(JSON.stringify(stack, null, 2));
2392
2392
  throw new errors_1.IntentionalStopError(".S");
2393
2393
  }
@@ -2415,7 +2415,7 @@ function drill_for_value(record, fields) {
2415
2415
  async function execute_returning_error(interp, forthic, string_location) {
2416
2416
  let result = null;
2417
2417
  try {
2418
- await interp.run(forthic, { reference_location: string_location });
2418
+ await interp.run(forthic, string_location);
2419
2419
  }
2420
2420
  catch (e) {
2421
2421
  result = e;