greybel-interpreter 1.9.4 → 1.9.6

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.
@@ -2,15 +2,19 @@ export interface KeyEvent {
2
2
  keyCode: number;
3
3
  code: string;
4
4
  }
5
+ export interface PrintOptions {
6
+ appendNewLine: boolean;
7
+ replace: boolean;
8
+ }
5
9
  export declare abstract class OutputHandler {
6
- abstract print(message: string, appendNewLine?: boolean): void;
10
+ abstract print(message: string, options: Partial<PrintOptions>): void;
7
11
  abstract progress(timeout: number): PromiseLike<void>;
8
12
  abstract waitForInput(isPassword: boolean, message?: string): PromiseLike<string>;
9
13
  abstract waitForKeyPress(message?: string): PromiseLike<KeyEvent>;
10
14
  abstract clear(): void;
11
15
  }
12
16
  export declare class DefaultOutputHandler extends OutputHandler {
13
- print(message: string, appendNewLine?: boolean): void;
17
+ print(message: string, { appendNewLine }?: Partial<PrintOptions>): void;
14
18
  progress(timeout: number): PromiseLike<void>;
15
19
  waitForInput(_isPassword: boolean, _message?: string): PromiseLike<string>;
16
20
  waitForKeyPress(_message?: string): PromiseLike<KeyEvent>;
@@ -5,7 +5,7 @@ class OutputHandler {
5
5
  }
6
6
  exports.OutputHandler = OutputHandler;
7
7
  class DefaultOutputHandler extends OutputHandler {
8
- print(message, appendNewLine = true) {
8
+ print(message, { appendNewLine = true } = {}) {
9
9
  if (appendNewLine) {
10
10
  process.stdout.write(message + '\n');
11
11
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { ContextForkOptions, ContextOptions, ContextState, ContextType, Debugger, FunctionState, LoopState, OperationContext, ProcessState, Scope } from './context';
2
2
  export { CPS, CPSContext } from './cps';
3
3
  export { DefaultErrorHandler, ErrorHandler } from './handler/error';
4
- export { DefaultOutputHandler, KeyEvent, OutputHandler } from './handler/output';
4
+ export { DefaultOutputHandler, KeyEvent, PrintOptions, OutputHandler } from './handler/output';
5
5
  export { DefaultResourceHandler, ResourceHandler } from './handler/resource';
6
6
  export { HandlerContainer } from './handler-container';
7
7
  export { Interpreter, InterpreterOptions } from './interpreter';
@@ -1,9 +1,9 @@
1
1
  import { ASTBase } from 'greyscript-core';
2
2
  import { OperationContext } from '../context';
3
3
  import { CustomValue } from '../types/base';
4
+ import { CustomNil } from '../types/nil';
4
5
  import { Path } from '../utils/path';
5
6
  import { CPSVisit, Operation } from './operation';
6
- import { CustomNil } from '../types/nil';
7
7
  export declare class SliceSegment {
8
8
  readonly left: Operation;
9
9
  readonly right: Operation;
@@ -15,11 +15,11 @@ const default_1 = require("../types/default");
15
15
  const function_1 = require("../types/function");
16
16
  const list_1 = require("../types/list");
17
17
  const map_1 = require("../types/map");
18
+ const nil_1 = require("../types/nil");
18
19
  const string_1 = require("../types/string");
19
20
  const with_intrinsics_1 = require("../types/with-intrinsics");
20
21
  const path_1 = require("../utils/path");
21
22
  const operation_1 = require("./operation");
22
- const nil_1 = require("../types/nil");
23
23
  class SliceSegment {
24
24
  constructor(left, right) {
25
25
  this.left = left;
@@ -232,6 +232,7 @@ class Resolve extends operation_1.Operation {
232
232
  }
233
233
  return child;
234
234
  }
235
+ throw new Error(`Unknown path ${result.path.toString()}.`);
235
236
  }
236
237
  const handle = ctx.get(result.path);
237
238
  if (autoCall && handle instanceof function_1.CustomFunction) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-interpreter",
3
- "version": "1.9.4",
3
+ "version": "1.9.6",
4
4
  "description": "Interpreter",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",