From 27112f0cb739a4b5a9351369d7c9da61d58df27a Mon Sep 17 00:00:00 2001 From: John Haugeland Date: Sun, 22 May 2022 06:34:53 -0700 Subject: [PATCH 1/2] Document arrow direction fixes StoneCypher/fsl#773, arrow_left_kind fixes StoneCypher/fsl#774, arrow_right_kind fixes StoneCypher/fsl#775, wrap_parse fixes StoneCypher/fsl#776, makeTransition fixes StoneCypher/fsl#777 --- benchmark/results/general.chart.html | 14 +-- benchmark/results/general.json | 136 +++++++++++++-------------- dist/es6/jssm.d.ts | 48 ++++++++++ dist/es6/jssm.js | 54 +++++++++++ dist/jssm.es5.cjs.nonmin.js | 54 +++++++++++ dist/jssm.es5.iife.nonmin.js | 54 +++++++++++ docs/docs/assets/highlight.css | 16 ++-- docs/docs/classes/Machine.html | 2 +- docs/docs/index.html | 54 +++++------ docs/docs/modules.html | 17 +++- jssm.d.ts | 48 ++++++++++ src/ts/jssm.ts | 59 ++++++++++++ src/ts/tests/general.spec.ts | 20 ++++ 13 files changed, 464 insertions(+), 112 deletions(-) diff --git a/benchmark/results/general.chart.html b/benchmark/results/general.chart.html index 3c057530..9b7af34d 100644 --- a/benchmark/results/general.chart.html +++ b/benchmark/results/general.chart.html @@ -28,7 +28,7 @@
- +
Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Machine<mDT>

Type parameters

  • mDT

Hierarchy

  • Machine

Index

Constructors

Properties

Methods

Constructors

  • new Machine<mDT>(__namedParameters: JssmGenericConfig<mDT>): Machine<mDT>
  • Type parameters

    • mDT

    Parameters

    • __namedParameters: JssmGenericConfig<mDT>

    Returns Machine<mDT>

Properties

_actions: Map<string, Map<string, number>>
_any_action_hook: Function
_any_transition_hook: Function
_arrange_declaration: string[][]
_arrange_end_declaration: string[][]
_arrange_start_declaration: string[][]
_dot_preamble: string
_edge_map: Map<string, Map<string, number>>
_edges: JssmTransition<mDT>[]
_entry_hooks: Map<string, Function>
_exit_hooks: Map<string, Function>
_flow: FslDirection
_forced_transition_hook: Function
_fsl_version?: string
_global_action_hooks: Map<string, Function>
_graph_layout: JssmLayout
_has_basic_hooks: boolean
_has_entry_hooks: boolean
_has_exit_hooks: boolean
_has_global_action_hooks: boolean
_has_hooks: boolean
_has_named_hooks: boolean
_has_transition_hooks: boolean
_hooks: Map<string, Function>
_instance_name: string
_machine_author?: string[]
_machine_comment?: string
_machine_contributor?: string[]
_machine_definition?: string
_machine_language?: string
_machine_license?: string
_machine_name?: string
_machine_version?: string
_main_transition_hook: Function
_named_hooks: Map<string, Function>
_named_transitions: Map<string, number>
_raw_state_declaration?: Object[]
_reverse_action_targets: Map<string, Map<string, number>>
_reverse_actions: Map<string, Map<string, number>>
_standard_transition_hook: Function
_state: string
_state_declarations: Map<string, JssmStateDeclaration>
_states: Map<string, JssmGenericState>
_theme: FslTheme

Methods

  • _new_state(state_config: JssmGenericState): string
  • Parameters

    • state_config: JssmGenericState

    Returns string

  • action(actionName: string, newData?: mDT): boolean
  • Parameters

    • actionName: string
    • Optional newData: mDT

    Returns boolean

  • actions(whichState?: string): string[]
  • Parameters

    • whichState: string = ...

    Returns string[]

  • current_action_edge_for(action: string): JssmTransition<mDT>
  • Parameters

    • action: string

    Returns JssmTransition<mDT>

  • current_action_for(action: string): number
  • Parameters

    • action: string

    Returns number

  • dot_preamble(): string
  • edges_between(from: string, to: string): JssmTransition<mDT>[]
  • Parameters

    • from: string
    • to: string

    Returns JssmTransition<mDT>[]

  • flow(): FslDirection
  • force_transition(newState: string, newData?: mDT): boolean
  • Parameters

    • newState: string
    • Optional newData: mDT

    Returns boolean

  • fsl_version(): string
  • get_transition_by_state_names(from: string, to: string): number
  • Parameters

    • from: string
    • to: string

    Returns number

  • graph_layout(): string
  • has_completes(): boolean
  • has_state(whichState: string): boolean
  • Parameters

    • whichState: string

    Returns boolean

  • has_terminals(): boolean
  • has_unenterables(): boolean
  • hook(from: string, to: string, handler: Function): Machine<mDT>
  • hook_action(from: string, to: string, action: string, handler: Function): Machine<mDT>
  • Parameters

    • from: string
    • to: string
    • action: string
    • handler: Function

    Returns Machine<mDT>

  • hook_any_action(handler: Function): Machine<mDT>
  • hook_any_transition(handler: Function): Machine<mDT>
  • hook_entry(to: string, handler: Function): Machine<mDT>
  • hook_exit(from: string, handler: Function): Machine<mDT>
  • hook_forced_transition(handler: Function): Machine<mDT>
  • hook_global_action(action: string, handler: Function): Machine<mDT>
  • hook_main_transition(handler: Function): Machine<mDT>
  • hook_standard_transition(handler: Function): Machine<mDT>
  • instance_name(): string
  • is_complete(): boolean
  • is_final(): boolean
  • is_terminal(): boolean
  • is_unenterable(whichState: string): boolean
  • Parameters

    • whichState: string

    Returns boolean

  • list_actions(): string[]
  • list_edges(): JssmTransition<mDT>[]
  • list_entrances(whichState?: string): string[]
  • Parameters

    • whichState: string = ...

    Returns string[]

  • list_exit_actions(whichState?: string): string[]
  • Parameters

    • whichState: string = ...

    Returns string[]

  • list_exits(whichState?: string): string[]
  • Parameters

    • whichState: string = ...

    Returns string[]

  • list_named_transitions(): Map<string, number>
  • list_states_having_action(whichState: string): string[]
  • Parameters

    • whichState: string

    Returns string[]

  • list_transitions(whichState?: string): JssmTransitionList
  • Parameters

    • whichState: string = ...

    Returns JssmTransitionList

  • lookup_transition_for(from: string, to: string): JssmTransition<mDT>
  • Parameters

    • from: string
    • to: string

    Returns JssmTransition<mDT>

  • machine_author(): string[]
  • machine_comment(): string
  • machine_contributor(): string[]
  • machine_definition(): string
  • machine_language(): string
  • machine_license(): string
  • machine_name(): string
  • machine_state(): JssmMachineInternalState<mDT>
  • Returns JssmMachineInternalState<mDT>

  • machine_version(): string
  • probabilistic_histo_walk(n: number): Map<string, number>
  • Parameters

    • n: number

    Returns Map<string, number>

  • probabilistic_transition(): boolean
  • probabilistic_walk(n: number): string[]
  • Parameters

    • n: number

    Returns string[]

  • probable_action_exits(whichState?: string): any[]
  • Parameters

    • whichState: string = ...

    Returns any[]

  • probable_exits_for(whichState: string): JssmTransition<mDT>[]
  • Parameters

    • whichState: string

    Returns JssmTransition<mDT>[]

  • raw_state_declarations(): Object[]
  • set_hook(HookDesc: HookDescription): void
  • Parameters

    • HookDesc: HookDescription

    Returns void

  • sm(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>
  • Parameters

    • template_strings: TemplateStringsArray
    • Rest ...remainder: any[]

    Returns Machine<mDT>

  • state(): string
  • state_declaration(which: string): JssmStateDeclaration
  • Parameters

    • which: string

    Returns JssmStateDeclaration

  • state_declarations(): Map<string, JssmStateDeclaration>
  • Returns Map<string, JssmStateDeclaration>

  • state_for(whichState: string): JssmGenericState
  • Parameters

    • whichState: string

    Returns JssmGenericState

  • state_is_complete(whichState: string): boolean
  • Parameters

    • whichState: string

    Returns boolean

  • state_is_final(whichState: string): boolean
  • Parameters

    • whichState: string

    Returns boolean

  • state_is_terminal(whichState: string): boolean
  • Parameters

    • whichState: string

    Returns boolean

  • states(): string[]
  • theme(): FslTheme
  • transition(newState: string, newData?: mDT): boolean
  • Parameters

    • newState: string
    • Optional newData: mDT

    Returns boolean

  • transition_impl(newStateOrAction: string, newData: mDT, wasForced: boolean, wasAction: boolean): boolean
  • Parameters

    • newStateOrAction: string
    • newData: mDT
    • wasForced: boolean
    • wasAction: boolean

    Returns boolean

  • valid_action(action: string, _newData?: mDT): boolean
  • Parameters

    • action: string
    • Optional _newData: mDT

    Returns boolean

  • valid_force_transition(newState: string, _newData?: mDT): boolean
  • Parameters

    • newState: string
    • Optional _newData: mDT

    Returns boolean

  • valid_transition(newState: string, _newData?: mDT): boolean
  • Parameters

    • newState: string
    • Optional _newData: mDT

    Returns boolean

Generated using TypeDoc

\ No newline at end of file +Machine | jssm
Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Machine<mDT>

Type parameters

  • mDT

Hierarchy

  • Machine

Index

Constructors

Properties

Methods

Constructors

  • new Machine<mDT>(__namedParameters: JssmGenericConfig<mDT>): Machine<mDT>
  • Type parameters

    • mDT

    Parameters

    • __namedParameters: JssmGenericConfig<mDT>

    Returns Machine<mDT>

Properties

_actions: Map<string, Map<string, number>>
_any_action_hook: Function
_any_transition_hook: Function
_arrange_declaration: string[][]
_arrange_end_declaration: string[][]
_arrange_start_declaration: string[][]
_dot_preamble: string
_edge_map: Map<string, Map<string, number>>
_edges: JssmTransition<mDT>[]
_entry_hooks: Map<string, Function>
_exit_hooks: Map<string, Function>
_flow: FslDirection
_forced_transition_hook: Function
_fsl_version?: string
_global_action_hooks: Map<string, Function>
_graph_layout: JssmLayout
_has_basic_hooks: boolean
_has_entry_hooks: boolean
_has_exit_hooks: boolean
_has_global_action_hooks: boolean
_has_hooks: boolean
_has_named_hooks: boolean
_has_transition_hooks: boolean
_hooks: Map<string, Function>
_instance_name: string
_machine_author?: string[]
_machine_comment?: string
_machine_contributor?: string[]
_machine_definition?: string
_machine_language?: string
_machine_license?: string
_machine_name?: string
_machine_version?: string
_main_transition_hook: Function
_named_hooks: Map<string, Function>
_named_transitions: Map<string, number>
_raw_state_declaration?: Object[]
_reverse_action_targets: Map<string, Map<string, number>>
_reverse_actions: Map<string, Map<string, number>>
_standard_transition_hook: Function
_state: string
_state_declarations: Map<string, JssmStateDeclaration>
_states: Map<string, JssmGenericState>
_theme: FslTheme

Methods

  • _new_state(state_config: JssmGenericState): string
  • Parameters

    • state_config: JssmGenericState

    Returns string

  • action(actionName: string, newData?: mDT): boolean
  • Parameters

    • actionName: string
    • Optional newData: mDT

    Returns boolean

  • actions(whichState?: string): string[]
  • Parameters

    • whichState: string = ...

    Returns string[]

  • current_action_edge_for(action: string): JssmTransition<mDT>
  • Parameters

    • action: string

    Returns JssmTransition<mDT>

  • current_action_for(action: string): number
  • Parameters

    • action: string

    Returns number

  • dot_preamble(): string
  • edges_between(from: string, to: string): JssmTransition<mDT>[]
  • Parameters

    • from: string
    • to: string

    Returns JssmTransition<mDT>[]

  • flow(): FslDirection
  • force_transition(newState: string, newData?: mDT): boolean
  • Parameters

    • newState: string
    • Optional newData: mDT

    Returns boolean

  • fsl_version(): string
  • get_transition_by_state_names(from: string, to: string): number
  • Parameters

    • from: string
    • to: string

    Returns number

  • graph_layout(): string
  • has_completes(): boolean
  • has_state(whichState: string): boolean
  • Parameters

    • whichState: string

    Returns boolean

  • has_terminals(): boolean
  • has_unenterables(): boolean
  • hook(from: string, to: string, handler: Function): Machine<mDT>
  • hook_action(from: string, to: string, action: string, handler: Function): Machine<mDT>
  • Parameters

    • from: string
    • to: string
    • action: string
    • handler: Function

    Returns Machine<mDT>

  • hook_any_action(handler: Function): Machine<mDT>
  • hook_any_transition(handler: Function): Machine<mDT>
  • hook_entry(to: string, handler: Function): Machine<mDT>
  • hook_exit(from: string, handler: Function): Machine<mDT>
  • hook_forced_transition(handler: Function): Machine<mDT>
  • hook_global_action(action: string, handler: Function): Machine<mDT>
  • hook_main_transition(handler: Function): Machine<mDT>
  • hook_standard_transition(handler: Function): Machine<mDT>
  • instance_name(): string
  • is_complete(): boolean
  • is_final(): boolean
  • is_terminal(): boolean
  • is_unenterable(whichState: string): boolean
  • Parameters

    • whichState: string

    Returns boolean

  • list_actions(): string[]
  • list_edges(): JssmTransition<mDT>[]
  • list_entrances(whichState?: string): string[]
  • Parameters

    • whichState: string = ...

    Returns string[]

  • list_exit_actions(whichState?: string): string[]
  • Parameters

    • whichState: string = ...

    Returns string[]

  • list_exits(whichState?: string): string[]
  • Parameters

    • whichState: string = ...

    Returns string[]

  • list_named_transitions(): Map<string, number>
  • list_states_having_action(whichState: string): string[]
  • Parameters

    • whichState: string

    Returns string[]

  • list_transitions(whichState?: string): JssmTransitionList
  • Parameters

    • whichState: string = ...

    Returns JssmTransitionList

  • lookup_transition_for(from: string, to: string): JssmTransition<mDT>
  • Parameters

    • from: string
    • to: string

    Returns JssmTransition<mDT>

  • machine_author(): string[]
  • machine_comment(): string
  • machine_contributor(): string[]
  • machine_definition(): string
  • machine_language(): string
  • machine_license(): string
  • machine_name(): string
  • machine_state(): JssmMachineInternalState<mDT>
  • Returns JssmMachineInternalState<mDT>

  • machine_version(): string
  • probabilistic_histo_walk(n: number): Map<string, number>
  • Parameters

    • n: number

    Returns Map<string, number>

  • probabilistic_transition(): boolean
  • probabilistic_walk(n: number): string[]
  • Parameters

    • n: number

    Returns string[]

  • probable_action_exits(whichState?: string): any[]
  • Parameters

    • whichState: string = ...

    Returns any[]

  • probable_exits_for(whichState: string): JssmTransition<mDT>[]
  • Parameters

    • whichState: string

    Returns JssmTransition<mDT>[]

  • raw_state_declarations(): Object[]
  • set_hook(HookDesc: HookDescription): void
  • Parameters

    • HookDesc: HookDescription

    Returns void

  • sm(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>
  • Parameters

    • template_strings: TemplateStringsArray
    • Rest ...remainder: any[]

    Returns Machine<mDT>

  • state(): string
  • state_declaration(which: string): JssmStateDeclaration
  • Parameters

    • which: string

    Returns JssmStateDeclaration

  • state_declarations(): Map<string, JssmStateDeclaration>
  • Returns Map<string, JssmStateDeclaration>

  • state_for(whichState: string): JssmGenericState
  • Parameters

    • whichState: string

    Returns JssmGenericState

  • state_is_complete(whichState: string): boolean
  • Parameters

    • whichState: string

    Returns boolean

  • state_is_final(whichState: string): boolean
  • Parameters

    • whichState: string

    Returns boolean

  • state_is_terminal(whichState: string): boolean
  • Parameters

    • whichState: string

    Returns boolean

  • states(): string[]
  • theme(): FslTheme
  • transition(newState: string, newData?: mDT): boolean
  • Parameters

    • newState: string
    • Optional newData: mDT

    Returns boolean

  • transition_impl(newStateOrAction: string, newData: mDT, wasForced: boolean, wasAction: boolean): boolean
  • Parameters

    • newStateOrAction: string
    • newData: mDT
    • wasForced: boolean
    • wasAction: boolean

    Returns boolean

  • valid_action(action: string, _newData?: mDT): boolean
  • Parameters

    • action: string
    • Optional _newData: mDT

    Returns boolean

  • valid_force_transition(newState: string, _newData?: mDT): boolean
  • Parameters

    • newState: string
    • Optional _newData: mDT

    Returns boolean

  • valid_transition(newState: string, _newData?: mDT): boolean
  • Parameters

    • newState: string
    • Optional _newData: mDT

    Returns boolean

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/docs/index.html b/docs/docs/index.html index bd8947ed..7648ce52 100644 --- a/docs/docs/index.html +++ b/docs/docs/index.html @@ -15,38 +15,38 @@

Discord community



Wouldn't it be nice if your TypeScript and Javascript state machines were simple and readable one-liners?

-
import { sm } from 'jssm';

const TrafficLight = sm`Red -> Green -> Yellow -> Red;`; +
import { sm } from 'jssm';

const TrafficLight = sm`Red -> Green -> Yellow -> Red;`;

Wouldn't it be great if they were easy to work with?

-
const log = s => console.log(s);

log( TrafficLight.state() ); // 'Red'

Machine.transition('Green'); // true
log( TrafficLight.state() ); // 'Green' +
const log = s => console.log(s);

log( TrafficLight.state() ); // 'Red'

Machine.transition('Green'); // true
log( TrafficLight.state() ); // 'Green'

What if the notation supported action names easily?

-
const TLWA = sm`Red 'next' -> Green 'next' -> Yellow 'next' -> Red;`;  // TLWA = Traffic Light With Actions

log( TLWA.state() ); // 'Red'

TLWA.action('next'); // true
log( TLWA.state() ); // 'Green'

TLWA.action('next'); // true
log( TLWA.state() ); // 'Yellow'

TLWA.action('next'); // true
log( TLWA.state() ); // 'Red' +
const TLWA = sm`Red 'next' -> Green 'next' -> Yellow 'next' -> Red;`;  // TLWA = Traffic Light With Actions

log( TLWA.state() ); // 'Red'

TLWA.action('next'); // true
log( TLWA.state() ); // 'Green'

TLWA.action('next'); // true
log( TLWA.state() ); // 'Yellow'

TLWA.action('next'); // true
log( TLWA.state() ); // 'Red'

What if integration with the outside was straightforward?

-
const MTL = sm`Red 'next' -> Green 'next' -> Yellow 'next' -> Red;`  // MTL = More Traffic Lights
.hook('Red', 'Green', () => log('GO GO GO') ) // node will jump the gun when you hit return, though
.hook_entry('Red', () => log('STOP') ); // so put it on one line in node

log( MTL.state() ); // 'Red'

TLWA.action('next'); // true, console logs 'GO GO GO'
log( TLWA.state() ); // 'Green'

TLWA.action('next'); // true
log( TLWA.state() ); // 'Yellow'

TLWA.action('next'); // true, console logs 'STOP'
log( TLWA.state() ); // 'Red' +
const MTL = sm`Red 'next' -> Green 'next' -> Yellow 'next' -> Red;`  // MTL = More Traffic Lights
.hook('Red', 'Green', () => log('GO GO GO') ) // node will jump the gun when you hit return, though
.hook_entry('Red', () => log('STOP') ); // so put it on one line in node

log( MTL.state() ); // 'Red'

TLWA.action('next'); // true, console logs 'GO GO GO'
log( TLWA.state() ); // 'Green'

TLWA.action('next'); // true
log( TLWA.state() ); // 'Yellow'

TLWA.action('next'); // true, console logs 'STOP'
log( TLWA.state() ); // 'Red'

What if the machine followed JS standards, and distinguished refusals as false from mistakes as thrown?

-
const ATL = sm`Red -> Green -> Yellow -> Red;`;  // ATL = Another Traffic Light

log( ATL.state() ); // 'Red' - uses 1st state unless told otherwise
ATL.transition('Yellow'); // false (Yellow isn't allowed from Red)
ATL.transition('Blue'); // throws (Blue isn't a state at all) +
const ATL = sm`Red -> Green -> Yellow -> Red;`;  // ATL = Another Traffic Light

log( ATL.state() ); // 'Red' - uses 1st state unless told otherwise
ATL.transition('Yellow'); // false (Yellow isn't allowed from Red)
ATL.transition('Blue'); // throws (Blue isn't a state at all)

What if there were easy convenience notations for lists, and for designating main-path => vs available path -> vs only-when-forced ~> ?

-
const TrafficLightWithOff = sm`
Red => Green => Yellow => Red;
[Red Yellow Green] ~> Off -> Red;
`; +
const TrafficLightWithOff = sm`
Red => Green => Yellow => Red;
[Red Yellow Green] ~> Off -> Red;
`;

What if that were easy to render visually?

-
const TrafficLightWithOff = sm`
Red => Green => Yellow => Red;
[Red Yellow Green] ~> Off -> Red;
`; +
const TrafficLightWithOff = sm`
Red => Green => Yellow => Red;
[Red Yellow Green] ~> Off -> Red;
`;

@@ -55,7 +55,7 @@

What if that were easy to render visually, with styling, in PNG, JPEG, or SVG?

-
const TrafficLightWithOff = sm`
Red => Green => Yellow => Red;
[Red Yellow Green] ~> Off -> Red;

flow: left;

state Red : { background-color: pink; corners: rounded; };
state Yellow : { background-color: lightyellow; corners: rounded; };
state Green : { background-color: lightgreen; corners: rounded; };

state Off : {
background-color : steelblue;
text-color : white;
shape : octagon;
linestyle : dashed;
};
`; +
const TrafficLightWithOff = sm`
Red => Green => Yellow => Red;
[Red Yellow Green] ~> Off -> Red;

flow: left;

state Red : { background-color: pink; corners: rounded; };
state Yellow : { background-color: lightyellow; corners: rounded; };
state Green : { background-color: lightgreen; corners: rounded; };

state Off : {
background-color : steelblue;
text-color : white;
shape : octagon;
linestyle : dashed;
};
`;

@@ -127,7 +127,7 @@

TL;DR

Specify finite state machines with a brief syntax. Run them; they're fast. Make mistakes; they're strict. Derive charts. Save and load states, and histories. Make machine factories to churn out dozens or thousands of instances. Impress friends and loved ones. Cure corns and callouses.

-
Red 'Proceed' -> Green 'Proceed' -> Yellow 'Proceed' -> Red;
+
Red 'Proceed' -> Green 'Proceed' -> Yellow 'Proceed' -> Red;
 

This will produce the following FSM (graphed with jssm-viz):

@@ -211,7 +211,7 @@

Quick Terminology

Basic concepts

This is a trivial traffic light FSM, with three states, three transitions, and one action:

-
Red 'Proceed' -> Green 'Proceed' -> Yellow 'Proceed' -> Red;
+
Red 'Proceed' -> Green 'Proceed' -> Yellow 'Proceed' -> Red;
 

Let's review its pieces.

@@ -329,7 +329,7 @@

0: Lights always have an off state

Off -> Red;
 

We will give that transition an action, and call it TurnOn.

-
Off 'TurnOn' -> Red;
+
Off 'TurnOn' -> Red;
 

So far, our machine is simple:

@@ -341,11 +341,11 @@

1: Traffic lights have a three-color cycle

The main path of a traffic light is cycling from Green to Yellow, then to Red, then back again. Because this is the main path, we'll mark these steps => main transitions.

-
Off 'TurnOn' -> Red => Green => Yellow => Red;
+
Off 'TurnOn' -> Red => Green => Yellow => Red;
 

We will give those all the same action name, Proceed, indicating "next color" without needing to know what we're currently on.

-
Off 'TurnOn' -> Red 'Proceed' => Green 'Proceed' => Yellow 'Proceed' => Red;
+
Off 'TurnOn' -> Red 'Proceed' => Green 'Proceed' => Yellow 'Proceed' => Red;
 

Machine's still pretty simple:

@@ -358,13 +358,13 @@

2: Traffic lights can be shut down

We'd also like to be able to turn this light back off. Because that's expected to be a rarity, we'll require that it be a ~> forced transition.

We could write

-
Off 'TurnOn' -> Red 'Proceed' => Green 'Proceed' => Yellow 'Proceed' => Red;
Red ~> Off;
Yellow ~> Off;
Green ~> Off; +
Off 'TurnOn' -> Red 'Proceed' => Green 'Proceed' => Yellow 'Proceed' => Red;
Red ~> Off;
Yellow ~> Off;
Green ~> Off;

But that takes a lot of space even with this short list, so, instead we'll use the array notation

-
Off 'TurnOn' -> Red 'Proceed' => Green 'Proceed' => Yellow 'Proceed' => Red;
[Red Yellow Green] ~> Off; +
Off 'TurnOn' -> Red 'Proceed' => Green 'Proceed' => Yellow 'Proceed' => Red;
[Red Yellow Green] ~> Off;

And we'd like those all to have the action TurnOff, so

-
Off 'TurnOn' -> Red 'Proceed' => Green 'Proceed' => Yellow 'Proceed' => Red;
[Red Yellow Green] 'TurnOff' ~> Off; +
Off 'TurnOn' -> Red 'Proceed' => Green 'Proceed' => Yellow 'Proceed' => Red;
[Red Yellow Green] 'TurnOff' ~> Off;

Machine's still not too bad:

@@ -414,7 +414,7 @@

An introduction to machine design

0: Empty machine

We'll start with an empty machine.

-
EmptyWaiting 'Wait' -> EmptyWaiting;
+
EmptyWaiting 'Wait' -> EmptyWaiting;
 


@@ -426,7 +426,7 @@

1: Should be able to eject cards

We'll add the ability to physically eject the user's card and reset to the empty and waiting state. Right now it'll dangle around un-used at the top, but later it'll become useful.

This is expressed as the path EjectCardAndReset -> EmptyWaiting;

-
EmptyWaiting 'Wait' -> EmptyWaiting;
EjectCardAndReset -> EmptyWaiting; +
EmptyWaiting 'Wait' -> EmptyWaiting;
EjectCardAndReset -> EmptyWaiting;


@@ -437,7 +437,7 @@

2: Should be able to insert cards

We'll add the ability to physically insert a card, next. You know, the, uh, thing ATMs are pretty much for.

To get this, add the path leg EmptyWaiting 'InsertCard' -> HasCardNoAuth;

-
EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;
EjectCardAndReset -> EmptyWaiting; +
EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;
EjectCardAndReset -> EmptyWaiting;

Notice that the new state, HasCardNoAuth, has been rendered red. This is because it is terminal - there is no exit from this node currently. (EmptyAndWaiting did not render that way because it had a transition to itself.) @@ -453,7 +453,7 @@

3: Should be able to cancel and recover the card

Next, we should have a cancel, because the ATM's 7 key is broken, and we need our card back. Cancel will exit to the main menu, and return our card credential.

To that end, we add the path HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;

-
EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;

EjectCardAndReset -> EmptyWaiting; +
EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;

EjectCardAndReset -> EmptyWaiting;


@@ -466,7 +466,7 @@

4: Can give the wrong PIN

wrong-PIN path, so, apparently that's a product to someone.

When they get the PIN wrong, they're prompted to try again (or to cancel.)

We'll add the path HasCardNoAuth 'WrongPIN' -> HasCardNoAuth;

-
EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;
HasCardNoAuth 'WrongPIN' -> HasCardNoAuth;

EjectCardAndReset -> EmptyWaiting; +
EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;
HasCardNoAuth 'WrongPIN' -> HasCardNoAuth;

EjectCardAndReset -> EmptyWaiting;


@@ -478,7 +478,7 @@

5: Can give the correct PIN

Next, let's give the ability to get the password right.

We'll add two paths. The first gets the password right: HasCardNoAuth 'RightPIN' -> MainMenu;

The second, from our new state MainMenu, gives people the ability to leave: MainMenu 'ExitReturnCard' -> EjectCardAndReset;

-
EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;
HasCardNoAuth 'WrongPIN' -> HasCardNoAuth;
HasCardNoAuth 'RightPIN' -> MainMenu;

MainMenu 'ExitReturnCard' -> EjectCardAndReset;

EjectCardAndReset -> EmptyWaiting; +
EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;
HasCardNoAuth 'WrongPIN' -> HasCardNoAuth;
HasCardNoAuth 'RightPIN' -> MainMenu;

MainMenu 'ExitReturnCard' -> EjectCardAndReset;

EjectCardAndReset -> EmptyWaiting;


@@ -491,7 +491,7 @@

6: Can check balance from main menu

Let's add the ability to check your balance. First pick that from the main menu, then pick which account to see the balance of, then you're shown a screen with the information you requested; then go back to the main menu.

That's MainMenu 'CheckBalance' -> PickAccount -> DisplayBalance -> MainMenu;.

-
EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;
HasCardNoAuth 'WrongPIN' -> HasCardNoAuth;
HasCardNoAuth 'RightPIN' -> MainMenu;

MainMenu 'ExitReturnCard' -> EjectCardAndReset;
MainMenu 'CheckBalance' -> PickAccount -> DisplayBalance -> MainMenu;

EjectCardAndReset -> EmptyWaiting; +
EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;
HasCardNoAuth 'WrongPIN' -> HasCardNoAuth;
HasCardNoAuth 'RightPIN' -> MainMenu;

MainMenu 'ExitReturnCard' -> EjectCardAndReset;
MainMenu 'CheckBalance' -> PickAccount -> DisplayBalance -> MainMenu;

EjectCardAndReset -> EmptyWaiting;


@@ -526,10 +526,10 @@

7: Can deposit money from main menu

  • Rule 11: BankAuditOffer 'HumanRejectAudit' -> RejectPhysicalMoney;
  • Or, as a block,

    -
    MainMenu 'AcceptDeposit' -> TentativeAcceptMoney;

    TentativeAcceptMoney 'AcceptFail' -> RejectPhysicalMoney -> MainMenu;
    TentativeAcceptMoney 'AcceptSucceed' -> PickDepositAccount -> RequestValue 'TellBank' -> BankResponse;

    BankResponse 'BankNo' -> RejectPhysicalMoney;
    BankResponse 'BankYes' -> ConsumeMoney -> NotifyConsumed -> MainMenu;
    BankResponse 'BankAudit' -> BankAuditOffer 'HumanAcceptAudit' -> ConsumeMoney;

    BankAuditOffer 'HumanRejectAudit' -> RejectPhysicalMoney; +
    MainMenu 'AcceptDeposit' -> TentativeAcceptMoney;

    TentativeAcceptMoney 'AcceptFail' -> RejectPhysicalMoney -> MainMenu;
    TentativeAcceptMoney 'AcceptSucceed' -> PickDepositAccount -> RequestValue 'TellBank' -> BankResponse;

    BankResponse 'BankNo' -> RejectPhysicalMoney;
    BankResponse 'BankYes' -> ConsumeMoney -> NotifyConsumed -> MainMenu;
    BankResponse 'BankAudit' -> BankAuditOffer 'HumanAcceptAudit' -> ConsumeMoney;

    BankAuditOffer 'HumanRejectAudit' -> RejectPhysicalMoney;

    Which leaves us with the total code

    -
    EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

    HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;
    HasCardNoAuth 'WrongPIN' -> HasCardNoAuth;
    HasCardNoAuth 'RightPIN' -> MainMenu;

    MainMenu 'AcceptDeposit' -> TentativeAcceptMoney;
    MainMenu 'ExitReturnCard' -> EjectCardAndReset;
    MainMenu 'CheckBalance' -> PickCheckBalanceAccount -> DisplayBalance -> MainMenu;

    TentativeAcceptMoney 'AcceptFail' -> RejectPhysicalMoney -> MainMenu;
    TentativeAcceptMoney 'AcceptSucceed' -> PickDepositAccount -> RequestValue 'TellBank' -> BankResponse;

    BankResponse 'BankNo' -> RejectPhysicalMoney;
    BankResponse 'BankYes' -> ConsumeMoney -> NotifyConsumed -> MainMenu;
    BankResponse 'BankAudit' -> BankAuditOffer 'HumanAcceptAudit' -> ConsumeMoney;

    BankAuditOffer 'HumanRejectAudit' -> RejectPhysicalMoney;

    EjectCardAndReset -> EmptyWaiting; +
    EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

    HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;
    HasCardNoAuth 'WrongPIN' -> HasCardNoAuth;
    HasCardNoAuth 'RightPIN' -> MainMenu;

    MainMenu 'AcceptDeposit' -> TentativeAcceptMoney;
    MainMenu 'ExitReturnCard' -> EjectCardAndReset;
    MainMenu 'CheckBalance' -> PickCheckBalanceAccount -> DisplayBalance -> MainMenu;

    TentativeAcceptMoney 'AcceptFail' -> RejectPhysicalMoney -> MainMenu;
    TentativeAcceptMoney 'AcceptSucceed' -> PickDepositAccount -> RequestValue 'TellBank' -> BankResponse;

    BankResponse 'BankNo' -> RejectPhysicalMoney;
    BankResponse 'BankYes' -> ConsumeMoney -> NotifyConsumed -> MainMenu;
    BankResponse 'BankAudit' -> BankAuditOffer 'HumanAcceptAudit' -> ConsumeMoney;

    BankAuditOffer 'HumanRejectAudit' -> RejectPhysicalMoney;

    EjectCardAndReset -> EmptyWaiting;


    @@ -561,10 +561,10 @@

    8: Can withdraw money from main menu

    Rule 1 canceller: PickWithdrawlAccount 'CancelWithdrawl' -> MainMenu; Rule 2 canceller: PickWithdrawlAmount 'SwitchAccounts' -> PickWithdrawlAccount;

    Or as a whole, we're adding

    -
    MainMenu -> PickWithdrawlAccount -> PickAmount -> AcctHasMoney? 'TooHighForAcct' -> PickWithdrawlAccount;
    AcctHasMoney? -> MachineHasMoney? 'MachineLowOnCash' -> PickAmount;
    MachineHasMoney? -> ConfirmWithdrawWithHuman 'MakeChanges' -> PickWithdrawlAmount;
    ConfirmWithdrawWithHuman 'PostWithdrawl' -> BankWithdrawlResponse;
    BankWithdrawlResponse 'WithdrawlFailure' -> WithdrawlFailureExplanation -> PickWithdrawlAccount;
    BankWithdrawlResponse 'WithdrawlSuccess' -> DispenseMoney -> MainMenu;

    PickWithdrawlAccount 'CancelWithdrawl' -> MainMenu;
    PickWithdrawlAmount 'SwitchAccounts' -> PickWithdrawlAccount; +
    MainMenu -> PickWithdrawlAccount -> PickAmount -> AcctHasMoney? 'TooHighForAcct' -> PickWithdrawlAccount;
    AcctHasMoney? -> MachineHasMoney? 'MachineLowOnCash' -> PickAmount;
    MachineHasMoney? -> ConfirmWithdrawWithHuman 'MakeChanges' -> PickWithdrawlAmount;
    ConfirmWithdrawWithHuman 'PostWithdrawl' -> BankWithdrawlResponse;
    BankWithdrawlResponse 'WithdrawlFailure' -> WithdrawlFailureExplanation -> PickWithdrawlAccount;
    BankWithdrawlResponse 'WithdrawlSuccess' -> DispenseMoney -> MainMenu;

    PickWithdrawlAccount 'CancelWithdrawl' -> MainMenu;
    PickWithdrawlAmount 'SwitchAccounts' -> PickWithdrawlAccount;

    Which leaves us with

    -
    EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

    HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;
    HasCardNoAuth 'WrongPIN' -> HasCardNoAuth;
    HasCardNoAuth 'RightPIN' -> MainMenu;

    MainMenu 'AcceptDeposit' -> TentativeAcceptMoney;
    MainMenu 'ExitReturnCard' -> EjectCardAndReset;
    MainMenu 'CheckBalance' -> PickCheckBalanceAccount -> DisplayBalance -> MainMenu;

    TentativeAcceptMoney 'AcceptFail' -> RejectPhysicalMoney -> MainMenu;
    TentativeAcceptMoney 'AcceptSucceed' -> PickDepositAccount -> RequestValue 'TellBank' -> BankResponse;

    BankResponse 'BankNo' -> RejectPhysicalMoney;
    BankResponse 'BankYes' -> ConsumeMoney -> NotifyConsumed -> MainMenu;
    BankResponse 'BankAudit' -> BankAuditOffer 'HumanAcceptAudit' -> ConsumeMoney;

    BankAuditOffer 'HumanRejectAudit' -> RejectPhysicalMoney;

    MainMenu -> PickWithdrawlAccount -> PickAmount -> AcctHasMoney? 'TooHighForAcct' -> PickWithdrawlAccount;
    AcctHasMoney? -> MachineHasMoney? 'MachineLowOnCash' -> PickAmount;
    MachineHasMoney? -> ConfirmWithdrawWithHuman 'MakeChanges' -> PickWithdrawlAmount;
    ConfirmWithdrawWithHuman 'PostWithdrawl' -> BankWithdrawlResponse;
    BankWithdrawlResponse 'WithdrawlFailure' -> WithdrawlFailureExplanation -> PickWithdrawlAccount;
    BankWithdrawlResponse 'WithdrawlSuccess' -> DispenseMoney -> MainMenu;

    PickWithdrawlAccount 'CancelWithdrawl' -> MainMenu;
    PickWithdrawlAmount 'SwitchAccounts' -> PickWithdrawlAccount;

    EjectCardAndReset -> EmptyWaiting; +
    EmptyWaiting 'Wait' -> EmptyWaiting 'InsertCard' -> HasCardNoAuth;

    HasCardNoAuth 'CancelAuthReturnCard' -> EjectCardAndReset;
    HasCardNoAuth 'WrongPIN' -> HasCardNoAuth;
    HasCardNoAuth 'RightPIN' -> MainMenu;

    MainMenu 'AcceptDeposit' -> TentativeAcceptMoney;
    MainMenu 'ExitReturnCard' -> EjectCardAndReset;
    MainMenu 'CheckBalance' -> PickCheckBalanceAccount -> DisplayBalance -> MainMenu;

    TentativeAcceptMoney 'AcceptFail' -> RejectPhysicalMoney -> MainMenu;
    TentativeAcceptMoney 'AcceptSucceed' -> PickDepositAccount -> RequestValue 'TellBank' -> BankResponse;

    BankResponse 'BankNo' -> RejectPhysicalMoney;
    BankResponse 'BankYes' -> ConsumeMoney -> NotifyConsumed -> MainMenu;
    BankResponse 'BankAudit' -> BankAuditOffer 'HumanAcceptAudit' -> ConsumeMoney;

    BankAuditOffer 'HumanRejectAudit' -> RejectPhysicalMoney;

    MainMenu -> PickWithdrawlAccount -> PickAmount -> AcctHasMoney? 'TooHighForAcct' -> PickWithdrawlAccount;
    AcctHasMoney? -> MachineHasMoney? 'MachineLowOnCash' -> PickAmount;
    MachineHasMoney? -> ConfirmWithdrawWithHuman 'MakeChanges' -> PickWithdrawlAmount;
    ConfirmWithdrawWithHuman 'PostWithdrawl' -> BankWithdrawlResponse;
    BankWithdrawlResponse 'WithdrawlFailure' -> WithdrawlFailureExplanation -> PickWithdrawlAccount;
    BankWithdrawlResponse 'WithdrawlSuccess' -> DispenseMoney -> MainMenu;

    PickWithdrawlAccount 'CancelWithdrawl' -> MainMenu;
    PickWithdrawlAmount 'SwitchAccounts' -> PickWithdrawlAccount;

    EjectCardAndReset -> EmptyWaiting;

    As you can see, building up even very complex state machines is actually relatively straightforward, in a short diff --git a/docs/docs/modules.html b/docs/docs/modules.html index 24f0cdb8..80569e3c 100644 --- a/docs/docs/modules.html +++ b/docs/docs/modules.html @@ -1 +1,16 @@ -jssm

    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    jssm

    Index

    Variables

    gviz_shapes: string[] = ...
    histograph: Function = ...
    named_colors: string[] = ...
    seq: Function = ...
    shapes: string[] = gviz_shapes
    version: string = "5.65.1"
    weighted_histo_key: Function = ...
    weighted_rand_select: Function = ...
    weighted_sample_select: Function = ...

    Functions

    • arrow_direction(arrow: JssmArrow): JssmArrowDirection
    • Parameters

      • arrow: JssmArrow

      Returns JssmArrowDirection

    • arrow_left_kind(arrow: JssmArrow): JssmArrowKind
    • Parameters

      • arrow: JssmArrow

      Returns JssmArrowKind

    • arrow_right_kind(arrow: JssmArrow): JssmArrowKind
    • Parameters

      • arrow: JssmArrow

      Returns JssmArrowKind

    • compile<mDT>(tree: JssmParseTree): JssmGenericConfig<mDT>
    • Type parameters

      • mDT

      Parameters

      • tree: JssmParseTree

      Returns JssmGenericConfig<mDT>

    • from<mDT>(MachineAsString: string, ExtraConstructorFields?: Partial<JssmGenericConfig<mDT>>): Machine<mDT>
    • Type parameters

      • mDT

      Parameters

      • MachineAsString: string
      • Optional ExtraConstructorFields: Partial<JssmGenericConfig<mDT>>

      Returns Machine<mDT>

    • make<mDT>(plan: string): JssmGenericConfig<mDT>
    • Type parameters

      • mDT

      Parameters

      • plan: string

      Returns JssmGenericConfig<mDT>

    • parse(input: string, options?: Object): any
    • Parameters

      • input: string
      • Optional options: Object

      Returns any

    • sm<mDT>(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>
    • Type parameters

      • mDT

      Parameters

      • template_strings: TemplateStringsArray
      • Rest ...remainder: any[]

      Returns Machine<mDT>

    • transfer_state_properties(state_decl: JssmStateDeclaration): JssmStateDeclaration
    • Parameters

      • state_decl: JssmStateDeclaration

      Returns JssmStateDeclaration

    Legend

    • Property
    • Method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +jssm
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    jssm

    Index

    Variables

    gviz_shapes: string[] = ...
    histograph: Function = ...
    named_colors: string[] = ...
    seq: Function = ...
    shapes: string[] = gviz_shapes
    version: string = "5.65.1"
    weighted_histo_key: Function = ...
    weighted_rand_select: Function = ...
    weighted_sample_select: Function = ...

    Functions

    • arrow_direction(arrow: JssmArrow): JssmArrowDirection
    • +

      Return the direction of an arrow - right, left, or both.

      +
      import { arrow_direction } from './jssm';

      arrow_direction('->'); // 'right'
      arrow_direction('<~=>'); // 'both' +
      +

      Parameters

      • arrow: JssmArrow

      Returns JssmArrowDirection

    • arrow_left_kind(arrow: JssmArrow): JssmArrowKind
    • +

      Return the direction of an arrow - right, left, or both.

      +
      import { arrow_left_kind } from './jssm';

      arrow_left_kind('<-'); // 'legal'
      arrow_left_kind('<='); // 'main'
      arrow_left_kind('<~'); // 'forced'
      arrow_left_kind('<->'); // 'legal'
      arrow_left_kind('->'); // 'none' +
      +

      Parameters

      • arrow: JssmArrow

      Returns JssmArrowKind

    • arrow_right_kind(arrow: JssmArrow): JssmArrowKind
    • +

      Return the direction of an arrow - right, left, or both.

      +
      import { arrow_left_kind } from './jssm';

      arrow_left_kind('->'); // 'legal'
      arrow_left_kind('=>'); // 'main'
      arrow_left_kind('~>'); // 'forced'
      arrow_left_kind('<->'); // 'legal'
      arrow_left_kind('<-'); // 'none' +
      +

      Parameters

      • arrow: JssmArrow

      Returns JssmArrowKind

    • compile<mDT>(tree: JssmParseTree): JssmGenericConfig<mDT>
    • Type parameters

      • mDT

      Parameters

      • tree: JssmParseTree

      Returns JssmGenericConfig<mDT>

    • from<mDT>(MachineAsString: string, ExtraConstructorFields?: Partial<JssmGenericConfig<mDT>>): Machine<mDT>
    • Type parameters

      • mDT

      Parameters

      • MachineAsString: string
      • Optional ExtraConstructorFields: Partial<JssmGenericConfig<mDT>>

      Returns Machine<mDT>

    • make<mDT>(plan: string): JssmGenericConfig<mDT>
    • Type parameters

      • mDT

      Parameters

      • plan: string

      Returns JssmGenericConfig<mDT>

    • parse(input: string, options?: Object): any
    • +

      Internal convenience method for alting out an object as the options call. + Not generally meant for external use.

      +

      Parameters

      • input: string
      • Optional options: Object

      Returns any

    • sm<mDT>(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>
    • Type parameters

      • mDT

      Parameters

      • template_strings: TemplateStringsArray
      • Rest ...remainder: any[]

      Returns Machine<mDT>

    • transfer_state_properties(state_decl: JssmStateDeclaration): JssmStateDeclaration
    • Parameters

      • state_decl: JssmStateDeclaration

      Returns JssmStateDeclaration

    Legend

    • Property
    • Method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/jssm.d.ts b/jssm.d.ts index 387c2900..f3926298 100644 --- a/jssm.d.ts +++ b/jssm.d.ts @@ -4,9 +4,57 @@ JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmAr import { seq, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util'; import { shapes, gviz_shapes, named_colors } from './jssm_constants'; import { version } from './version'; +/********* + * + * Return the direction of an arrow - `right`, `left`, or `both`. + * + * ```typescript + * import { arrow_direction } from './jssm'; + * + * arrow_direction('->'); // 'right' + * arrow_direction('<~=>'); // 'both' + * ``` + * + */ declare function arrow_direction(arrow: JssmArrow): JssmArrowDirection; +/********* + * + * Return the direction of an arrow - `right`, `left`, or `both`. + * + * ```typescript + * import { arrow_left_kind } from './jssm'; + * + * arrow_left_kind('<-'); // 'legal' + * arrow_left_kind('<='); // 'main' + * arrow_left_kind('<~'); // 'forced' + * arrow_left_kind('<->'); // 'legal' + * arrow_left_kind('->'); // 'none' + * ``` + * + */ declare function arrow_left_kind(arrow: JssmArrow): JssmArrowKind; +/********* + * + * Return the direction of an arrow - `right`, `left`, or `both`. + * + * ```typescript + * import { arrow_left_kind } from './jssm'; + * + * arrow_left_kind('->'); // 'legal' + * arrow_left_kind('=>'); // 'main' + * arrow_left_kind('~>'); // 'forced' + * arrow_left_kind('<->'); // 'legal' + * arrow_left_kind('<-'); // 'none' + * ``` + * + */ declare function arrow_right_kind(arrow: JssmArrow): JssmArrowKind; +/********* + * + * Internal convenience method for alting out an object as the options call. + * Not generally meant for external use. + * + */ declare function wrap_parse(input: string, options?: Object): any; declare function compile(tree: JssmParseTree): JssmGenericConfig; declare function make(plan: string): JssmGenericConfig; diff --git a/src/ts/jssm.ts b/src/ts/jssm.ts index 2c0e82d5..2db05aeb 100644 --- a/src/ts/jssm.ts +++ b/src/ts/jssm.ts @@ -53,6 +53,19 @@ import { JssmError } from './jssm_error'; /* eslint-disable complexity */ +/********* + * + * Return the direction of an arrow - `right`, `left`, or `both`. + * + * ```typescript + * import { arrow_direction } from './jssm'; + * + * arrow_direction('->'); // 'right' + * arrow_direction('<~=>'); // 'both' + * ``` + * + */ + function arrow_direction(arrow: JssmArrow): JssmArrowDirection { switch (String(arrow)) { @@ -95,6 +108,22 @@ function arrow_direction(arrow: JssmArrow): JssmArrowDirection { /* eslint-disable complexity */ +/********* + * + * Return the direction of an arrow - `right`, `left`, or `both`. + * + * ```typescript + * import { arrow_left_kind } from './jssm'; + * + * arrow_left_kind('<-'); // 'legal' + * arrow_left_kind('<='); // 'main' + * arrow_left_kind('<~'); // 'forced' + * arrow_left_kind('<->'); // 'legal' + * arrow_left_kind('->'); // 'none' + * ``` + * + */ + function arrow_left_kind(arrow: JssmArrow): JssmArrowKind { switch (String(arrow)) { @@ -137,6 +166,22 @@ function arrow_left_kind(arrow: JssmArrow): JssmArrowKind { /* eslint-disable complexity */ +/********* + * + * Return the direction of an arrow - `right`, `left`, or `both`. + * + * ```typescript + * import { arrow_left_kind } from './jssm'; + * + * arrow_left_kind('->'); // 'legal' + * arrow_left_kind('=>'); // 'main' + * arrow_left_kind('~>'); // 'forced' + * arrow_left_kind('<->'); // 'legal' + * arrow_left_kind('<-'); // 'none' + * ``` + * + */ + function arrow_right_kind(arrow: JssmArrow): JssmArrowKind { switch (String(arrow)) { @@ -177,6 +222,13 @@ function arrow_right_kind(arrow: JssmArrow): JssmArrowKind { +/********* + * + * Internal method meant to perform factory assembly of an edge. Not meant for + * external use. + * + */ + function makeTransition( this_se : JssmCompileSe, @@ -224,6 +276,13 @@ function makeTransition( +/********* + * + * Internal convenience method for alting out an object as the options call. + * Not generally meant for external use. + * + */ + function wrap_parse(input: string, options?: Object) { return parse(input, options || {}); } diff --git a/src/ts/tests/general.spec.ts b/src/ts/tests/general.spec.ts index e2c323e4..05ec916e 100644 --- a/src/ts/tests/general.spec.ts +++ b/src/ts/tests/general.spec.ts @@ -79,6 +79,26 @@ describe('Stochastic weather', () => { +describe('Arrow direction', () => { + + test('arrow_direction reads left correctly', () => + expect(jssm.arrow_direction('<-')) + .toBe('left') ); + + test('arrow_direction reads right correctly', () => + expect(jssm.arrow_direction('->')) + .toBe('right') ); + + test('arrow_direction reads both correctly', () => + expect(jssm.arrow_direction('<->')) + .toBe('both') ); + +}); + + + + + describe('list exit actions', () => { const machine = new jssm.Machine({ From 63bb52566b530ee36c0d8182a32356e45a2533a0 Mon Sep 17 00:00:00 2001 From: John Haugeland Date: Sun, 22 May 2022 06:40:05 -0700 Subject: [PATCH 2/2] forgot version bump --- benchmark/results/general.chart.html | 14 +-- benchmark/results/general.json | 124 +++++++++++++-------------- dist/es6/version.js | 2 +- dist/jssm.es5.cjs.js | 2 +- dist/jssm.es5.cjs.nonmin.js | 2 +- dist/jssm.es5.iife.js | 2 +- dist/jssm.es5.iife.nonmin.js | 2 +- docs/docs/classes/Machine.html | 2 +- docs/docs/modules.html | 10 +-- package.json | 3 +- src/ts/version.ts | 2 +- 11 files changed, 83 insertions(+), 82 deletions(-) diff --git a/benchmark/results/general.chart.html b/benchmark/results/general.chart.html index 9b7af34d..a38cd7ff 100644 --- a/benchmark/results/general.chart.html +++ b/benchmark/results/general.chart.html @@ -28,7 +28,7 @@
    - +
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Class Machine<mDT>

    Type parameters

    • mDT

    Hierarchy

    • Machine

    Index

    Constructors

    Properties

    Methods

    Constructors

    • new Machine<mDT>(__namedParameters: JssmGenericConfig<mDT>): Machine<mDT>
    • Type parameters

      • mDT

      Parameters

      • __namedParameters: JssmGenericConfig<mDT>

      Returns Machine<mDT>

    Properties

    _actions: Map<string, Map<string, number>>
    _any_action_hook: Function
    _any_transition_hook: Function
    _arrange_declaration: string[][]
    _arrange_end_declaration: string[][]
    _arrange_start_declaration: string[][]
    _dot_preamble: string
    _edge_map: Map<string, Map<string, number>>
    _edges: JssmTransition<mDT>[]
    _entry_hooks: Map<string, Function>
    _exit_hooks: Map<string, Function>
    _flow: FslDirection
    _forced_transition_hook: Function
    _fsl_version?: string
    _global_action_hooks: Map<string, Function>
    _graph_layout: JssmLayout
    _has_basic_hooks: boolean
    _has_entry_hooks: boolean
    _has_exit_hooks: boolean
    _has_global_action_hooks: boolean
    _has_hooks: boolean
    _has_named_hooks: boolean
    _has_transition_hooks: boolean
    _hooks: Map<string, Function>
    _instance_name: string
    _machine_author?: string[]
    _machine_comment?: string
    _machine_contributor?: string[]
    _machine_definition?: string
    _machine_language?: string
    _machine_license?: string
    _machine_name?: string
    _machine_version?: string
    _main_transition_hook: Function
    _named_hooks: Map<string, Function>
    _named_transitions: Map<string, number>
    _raw_state_declaration?: Object[]
    _reverse_action_targets: Map<string, Map<string, number>>
    _reverse_actions: Map<string, Map<string, number>>
    _standard_transition_hook: Function
    _state: string
    _state_declarations: Map<string, JssmStateDeclaration>
    _states: Map<string, JssmGenericState>
    _theme: FslTheme

    Methods

    • _new_state(state_config: JssmGenericState): string
    • Parameters

      • state_config: JssmGenericState

      Returns string

    • action(actionName: string, newData?: mDT): boolean
    • Parameters

      • actionName: string
      • Optional newData: mDT

      Returns boolean

    • actions(whichState?: string): string[]
    • Parameters

      • whichState: string = ...

      Returns string[]

    • current_action_edge_for(action: string): JssmTransition<mDT>
    • Parameters

      • action: string

      Returns JssmTransition<mDT>

    • current_action_for(action: string): number
    • Parameters

      • action: string

      Returns number

    • dot_preamble(): string
    • edges_between(from: string, to: string): JssmTransition<mDT>[]
    • Parameters

      • from: string
      • to: string

      Returns JssmTransition<mDT>[]

    • flow(): FslDirection
    • force_transition(newState: string, newData?: mDT): boolean
    • Parameters

      • newState: string
      • Optional newData: mDT

      Returns boolean

    • fsl_version(): string
    • get_transition_by_state_names(from: string, to: string): number
    • Parameters

      • from: string
      • to: string

      Returns number

    • graph_layout(): string
    • has_completes(): boolean
    • has_state(whichState: string): boolean
    • Parameters

      • whichState: string

      Returns boolean

    • has_terminals(): boolean
    • has_unenterables(): boolean
    • hook(from: string, to: string, handler: Function): Machine<mDT>
    • hook_action(from: string, to: string, action: string, handler: Function): Machine<mDT>
    • Parameters

      • from: string
      • to: string
      • action: string
      • handler: Function

      Returns Machine<mDT>

    • hook_any_action(handler: Function): Machine<mDT>
    • hook_any_transition(handler: Function): Machine<mDT>
    • hook_entry(to: string, handler: Function): Machine<mDT>
    • hook_exit(from: string, handler: Function): Machine<mDT>
    • hook_forced_transition(handler: Function): Machine<mDT>
    • hook_global_action(action: string, handler: Function): Machine<mDT>
    • hook_main_transition(handler: Function): Machine<mDT>
    • hook_standard_transition(handler: Function): Machine<mDT>
    • instance_name(): string
    • is_complete(): boolean
    • is_final(): boolean
    • is_terminal(): boolean
    • is_unenterable(whichState: string): boolean
    • Parameters

      • whichState: string

      Returns boolean

    • list_actions(): string[]
    • list_edges(): JssmTransition<mDT>[]
    • list_entrances(whichState?: string): string[]
    • Parameters

      • whichState: string = ...

      Returns string[]

    • list_exit_actions(whichState?: string): string[]
    • Parameters

      • whichState: string = ...

      Returns string[]

    • list_exits(whichState?: string): string[]
    • Parameters

      • whichState: string = ...

      Returns string[]

    • list_named_transitions(): Map<string, number>
    • list_states_having_action(whichState: string): string[]
    • Parameters

      • whichState: string

      Returns string[]

    • list_transitions(whichState?: string): JssmTransitionList
    • Parameters

      • whichState: string = ...

      Returns JssmTransitionList

    • lookup_transition_for(from: string, to: string): JssmTransition<mDT>
    • Parameters

      • from: string
      • to: string

      Returns JssmTransition<mDT>

    • machine_author(): string[]
    • machine_comment(): string
    • machine_contributor(): string[]
    • machine_definition(): string
    • machine_language(): string
    • machine_license(): string
    • machine_name(): string
    • machine_state(): JssmMachineInternalState<mDT>
    • Returns JssmMachineInternalState<mDT>

    • machine_version(): string
    • probabilistic_histo_walk(n: number): Map<string, number>
    • Parameters

      • n: number

      Returns Map<string, number>

    • probabilistic_transition(): boolean
    • probabilistic_walk(n: number): string[]
    • Parameters

      • n: number

      Returns string[]

    • probable_action_exits(whichState?: string): any[]
    • Parameters

      • whichState: string = ...

      Returns any[]

    • probable_exits_for(whichState: string): JssmTransition<mDT>[]
    • Parameters

      • whichState: string

      Returns JssmTransition<mDT>[]

    • raw_state_declarations(): Object[]
    • set_hook(HookDesc: HookDescription): void
    • Parameters

      • HookDesc: HookDescription

      Returns void

    • sm(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>
    • Parameters

      • template_strings: TemplateStringsArray
      • Rest ...remainder: any[]

      Returns Machine<mDT>

    • state(): string
    • state_declaration(which: string): JssmStateDeclaration
    • Parameters

      • which: string

      Returns JssmStateDeclaration

    • state_declarations(): Map<string, JssmStateDeclaration>
    • Returns Map<string, JssmStateDeclaration>

    • state_for(whichState: string): JssmGenericState
    • Parameters

      • whichState: string

      Returns JssmGenericState

    • state_is_complete(whichState: string): boolean
    • Parameters

      • whichState: string

      Returns boolean

    • state_is_final(whichState: string): boolean
    • Parameters

      • whichState: string

      Returns boolean

    • state_is_terminal(whichState: string): boolean
    • Parameters

      • whichState: string

      Returns boolean

    • states(): string[]
    • theme(): FslTheme
    • transition(newState: string, newData?: mDT): boolean
    • Parameters

      • newState: string
      • Optional newData: mDT

      Returns boolean

    • transition_impl(newStateOrAction: string, newData: mDT, wasForced: boolean, wasAction: boolean): boolean
    • Parameters

      • newStateOrAction: string
      • newData: mDT
      • wasForced: boolean
      • wasAction: boolean

      Returns boolean

    • valid_action(action: string, _newData?: mDT): boolean
    • Parameters

      • action: string
      • Optional _newData: mDT

      Returns boolean

    • valid_force_transition(newState: string, _newData?: mDT): boolean
    • Parameters

      • newState: string
      • Optional _newData: mDT

      Returns boolean

    • valid_transition(newState: string, _newData?: mDT): boolean
    • Parameters

      • newState: string
      • Optional _newData: mDT

      Returns boolean

    Legend

    • Property
    • Method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +Machine | jssm
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Class Machine<mDT>

    Type parameters

    • mDT

    Hierarchy

    • Machine

    Index

    Constructors

    Properties

    Methods

    Constructors

    • new Machine<mDT>(__namedParameters: JssmGenericConfig<mDT>): Machine<mDT>
    • Type parameters

      • mDT

      Parameters

      • __namedParameters: JssmGenericConfig<mDT>

      Returns Machine<mDT>

    Properties

    _actions: Map<string, Map<string, number>>
    _any_action_hook: Function
    _any_transition_hook: Function
    _arrange_declaration: string[][]
    _arrange_end_declaration: string[][]
    _arrange_start_declaration: string[][]
    _dot_preamble: string
    _edge_map: Map<string, Map<string, number>>
    _edges: JssmTransition<mDT>[]
    _entry_hooks: Map<string, Function>
    _exit_hooks: Map<string, Function>
    _flow: FslDirection
    _forced_transition_hook: Function
    _fsl_version?: string
    _global_action_hooks: Map<string, Function>
    _graph_layout: JssmLayout
    _has_basic_hooks: boolean
    _has_entry_hooks: boolean
    _has_exit_hooks: boolean
    _has_global_action_hooks: boolean
    _has_hooks: boolean
    _has_named_hooks: boolean
    _has_transition_hooks: boolean
    _hooks: Map<string, Function>
    _instance_name: string
    _machine_author?: string[]
    _machine_comment?: string
    _machine_contributor?: string[]
    _machine_definition?: string
    _machine_language?: string
    _machine_license?: string
    _machine_name?: string
    _machine_version?: string
    _main_transition_hook: Function
    _named_hooks: Map<string, Function>
    _named_transitions: Map<string, number>
    _raw_state_declaration?: Object[]
    _reverse_action_targets: Map<string, Map<string, number>>
    _reverse_actions: Map<string, Map<string, number>>
    _standard_transition_hook: Function
    _state: string
    _state_declarations: Map<string, JssmStateDeclaration>
    _states: Map<string, JssmGenericState>
    _theme: FslTheme

    Methods

    • _new_state(state_config: JssmGenericState): string
    • Parameters

      • state_config: JssmGenericState

      Returns string

    • action(actionName: string, newData?: mDT): boolean
    • Parameters

      • actionName: string
      • Optional newData: mDT

      Returns boolean

    • actions(whichState?: string): string[]
    • Parameters

      • whichState: string = ...

      Returns string[]

    • current_action_edge_for(action: string): JssmTransition<mDT>
    • Parameters

      • action: string

      Returns JssmTransition<mDT>

    • current_action_for(action: string): number
    • Parameters

      • action: string

      Returns number

    • dot_preamble(): string
    • edges_between(from: string, to: string): JssmTransition<mDT>[]
    • Parameters

      • from: string
      • to: string

      Returns JssmTransition<mDT>[]

    • flow(): FslDirection
    • force_transition(newState: string, newData?: mDT): boolean
    • Parameters

      • newState: string
      • Optional newData: mDT

      Returns boolean

    • fsl_version(): string
    • get_transition_by_state_names(from: string, to: string): number
    • Parameters

      • from: string
      • to: string

      Returns number

    • graph_layout(): string
    • has_completes(): boolean
    • has_state(whichState: string): boolean
    • Parameters

      • whichState: string

      Returns boolean

    • has_terminals(): boolean
    • has_unenterables(): boolean
    • hook(from: string, to: string, handler: Function): Machine<mDT>
    • hook_action(from: string, to: string, action: string, handler: Function): Machine<mDT>
    • Parameters

      • from: string
      • to: string
      • action: string
      • handler: Function

      Returns Machine<mDT>

    • hook_any_action(handler: Function): Machine<mDT>
    • hook_any_transition(handler: Function): Machine<mDT>
    • hook_entry(to: string, handler: Function): Machine<mDT>
    • hook_exit(from: string, handler: Function): Machine<mDT>
    • hook_forced_transition(handler: Function): Machine<mDT>
    • hook_global_action(action: string, handler: Function): Machine<mDT>
    • hook_main_transition(handler: Function): Machine<mDT>
    • hook_standard_transition(handler: Function): Machine<mDT>
    • instance_name(): string
    • is_complete(): boolean
    • is_final(): boolean
    • is_terminal(): boolean
    • is_unenterable(whichState: string): boolean
    • Parameters

      • whichState: string

      Returns boolean

    • list_actions(): string[]
    • list_edges(): JssmTransition<mDT>[]
    • list_entrances(whichState?: string): string[]
    • Parameters

      • whichState: string = ...

      Returns string[]

    • list_exit_actions(whichState?: string): string[]
    • Parameters

      • whichState: string = ...

      Returns string[]

    • list_exits(whichState?: string): string[]
    • Parameters

      • whichState: string = ...

      Returns string[]

    • list_named_transitions(): Map<string, number>
    • list_states_having_action(whichState: string): string[]
    • Parameters

      • whichState: string

      Returns string[]

    • list_transitions(whichState?: string): JssmTransitionList
    • Parameters

      • whichState: string = ...

      Returns JssmTransitionList

    • lookup_transition_for(from: string, to: string): JssmTransition<mDT>
    • Parameters

      • from: string
      • to: string

      Returns JssmTransition<mDT>

    • machine_author(): string[]
    • machine_comment(): string
    • machine_contributor(): string[]
    • machine_definition(): string
    • machine_language(): string
    • machine_license(): string
    • machine_name(): string
    • machine_state(): JssmMachineInternalState<mDT>
    • Returns JssmMachineInternalState<mDT>

    • machine_version(): string
    • probabilistic_histo_walk(n: number): Map<string, number>
    • Parameters

      • n: number

      Returns Map<string, number>

    • probabilistic_transition(): boolean
    • probabilistic_walk(n: number): string[]
    • Parameters

      • n: number

      Returns string[]

    • probable_action_exits(whichState?: string): any[]
    • Parameters

      • whichState: string = ...

      Returns any[]

    • probable_exits_for(whichState: string): JssmTransition<mDT>[]
    • Parameters

      • whichState: string

      Returns JssmTransition<mDT>[]

    • raw_state_declarations(): Object[]
    • set_hook(HookDesc: HookDescription): void
    • Parameters

      • HookDesc: HookDescription

      Returns void

    • sm(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>
    • Parameters

      • template_strings: TemplateStringsArray
      • Rest ...remainder: any[]

      Returns Machine<mDT>

    • state(): string
    • state_declaration(which: string): JssmStateDeclaration
    • Parameters

      • which: string

      Returns JssmStateDeclaration

    • state_declarations(): Map<string, JssmStateDeclaration>
    • Returns Map<string, JssmStateDeclaration>

    • state_for(whichState: string): JssmGenericState
    • Parameters

      • whichState: string

      Returns JssmGenericState

    • state_is_complete(whichState: string): boolean
    • Parameters

      • whichState: string

      Returns boolean

    • state_is_final(whichState: string): boolean
    • Parameters

      • whichState: string

      Returns boolean

    • state_is_terminal(whichState: string): boolean
    • Parameters

      • whichState: string

      Returns boolean

    • states(): string[]
    • theme(): FslTheme
    • transition(newState: string, newData?: mDT): boolean
    • Parameters

      • newState: string
      • Optional newData: mDT

      Returns boolean

    • transition_impl(newStateOrAction: string, newData: mDT, wasForced: boolean, wasAction: boolean): boolean
    • Parameters

      • newStateOrAction: string
      • newData: mDT
      • wasForced: boolean
      • wasAction: boolean

      Returns boolean

    • valid_action(action: string, _newData?: mDT): boolean
    • Parameters

      • action: string
      • Optional _newData: mDT

      Returns boolean

    • valid_force_transition(newState: string, _newData?: mDT): boolean
    • Parameters

      • newState: string
      • Optional _newData: mDT

      Returns boolean

    • valid_transition(newState: string, _newData?: mDT): boolean
    • Parameters

      • newState: string
      • Optional _newData: mDT

      Returns boolean

    Legend

    • Property
    • Method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/docs/modules.html b/docs/docs/modules.html index 80569e3c..2dd65769 100644 --- a/docs/docs/modules.html +++ b/docs/docs/modules.html @@ -1,16 +1,16 @@ -jssm
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    jssm

    Index

    Variables

    gviz_shapes: string[] = ...
    histograph: Function = ...
    named_colors: string[] = ...
    seq: Function = ...
    shapes: string[] = gviz_shapes
    version: string = "5.65.1"
    weighted_histo_key: Function = ...
    weighted_rand_select: Function = ...
    weighted_sample_select: Function = ...

    Functions

    • arrow_direction(arrow: JssmArrow): JssmArrowDirection
    • +jssm
      Options
      All
      • Public
      • Public/Protected
      • All
      Menu

      jssm

      Index

      Variables

      gviz_shapes: string[] = ...
      histograph: Function = ...
      named_colors: string[] = ...
      seq: Function = ...
      shapes: string[] = gviz_shapes
      version: string = "5.65.2"
      weighted_histo_key: Function = ...
      weighted_rand_select: Function = ...
      weighted_sample_select: Function = ...

      Functions

      • arrow_direction(arrow: JssmArrow): JssmArrowDirection
      • Return the direction of an arrow - right, left, or both.

        import { arrow_direction } from './jssm';

        arrow_direction('->'); // 'right'
        arrow_direction('<~=>'); // 'both'
        -

        Parameters

        • arrow: JssmArrow

        Returns JssmArrowDirection

      • arrow_left_kind(arrow: JssmArrow): JssmArrowKind
      • +

        Parameters

        • arrow: JssmArrow

        Returns JssmArrowDirection

      • arrow_left_kind(arrow: JssmArrow): JssmArrowKind
      • Return the direction of an arrow - right, left, or both.

        import { arrow_left_kind } from './jssm';

        arrow_left_kind('<-'); // 'legal'
        arrow_left_kind('<='); // 'main'
        arrow_left_kind('<~'); // 'forced'
        arrow_left_kind('<->'); // 'legal'
        arrow_left_kind('->'); // 'none'
        -

        Parameters

        • arrow: JssmArrow

        Returns JssmArrowKind

      • arrow_right_kind(arrow: JssmArrow): JssmArrowKind
      • +

        Parameters

        • arrow: JssmArrow

        Returns JssmArrowKind

      • arrow_right_kind(arrow: JssmArrow): JssmArrowKind
      • Return the direction of an arrow - right, left, or both.

        import { arrow_left_kind } from './jssm';

        arrow_left_kind('->'); // 'legal'
        arrow_left_kind('=>'); // 'main'
        arrow_left_kind('~>'); // 'forced'
        arrow_left_kind('<->'); // 'legal'
        arrow_left_kind('<-'); // 'none'
        -

        Parameters

        • arrow: JssmArrow

        Returns JssmArrowKind

      • compile<mDT>(tree: JssmParseTree): JssmGenericConfig<mDT>
      • Type parameters

        • mDT

        Parameters

        • tree: JssmParseTree

        Returns JssmGenericConfig<mDT>

      • from<mDT>(MachineAsString: string, ExtraConstructorFields?: Partial<JssmGenericConfig<mDT>>): Machine<mDT>
      • Type parameters

        • mDT

        Parameters

        • MachineAsString: string
        • Optional ExtraConstructorFields: Partial<JssmGenericConfig<mDT>>

        Returns Machine<mDT>

      • make<mDT>(plan: string): JssmGenericConfig<mDT>
      • Type parameters

        • mDT

        Parameters

        • plan: string

        Returns JssmGenericConfig<mDT>

      • parse(input: string, options?: Object): any
      • +

        Parameters

        • arrow: JssmArrow

        Returns JssmArrowKind

      • compile<mDT>(tree: JssmParseTree): JssmGenericConfig<mDT>
      • Type parameters

        • mDT

        Parameters

        • tree: JssmParseTree

        Returns JssmGenericConfig<mDT>

      • from<mDT>(MachineAsString: string, ExtraConstructorFields?: Partial<JssmGenericConfig<mDT>>): Machine<mDT>
      • Type parameters

        • mDT

        Parameters

        • MachineAsString: string
        • Optional ExtraConstructorFields: Partial<JssmGenericConfig<mDT>>

        Returns Machine<mDT>

      • make<mDT>(plan: string): JssmGenericConfig<mDT>
      • Type parameters

        • mDT

        Parameters

        • plan: string

        Returns JssmGenericConfig<mDT>

      • parse(input: string, options?: Object): any
      • Internal convenience method for alting out an object as the options call. Not generally meant for external use.

        -

        Parameters

        • input: string
        • Optional options: Object

        Returns any

      • sm<mDT>(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>
      • Type parameters

        • mDT

        Parameters

        • template_strings: TemplateStringsArray
        • Rest ...remainder: any[]

        Returns Machine<mDT>

      • transfer_state_properties(state_decl: JssmStateDeclaration): JssmStateDeclaration
      • Parameters

        • state_decl: JssmStateDeclaration

        Returns JssmStateDeclaration

      Legend

      • Property
      • Method

      Settings

      Theme

      Generated using TypeDoc

      \ No newline at end of file +

      Parameters

      • input: string
      • Optional options: Object

      Returns any

    • sm<mDT>(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>
    • Type parameters

      • mDT

      Parameters

      • template_strings: TemplateStringsArray
      • Rest ...remainder: any[]

      Returns Machine<mDT>

    • transfer_state_properties(state_decl: JssmStateDeclaration): JssmStateDeclaration
    • Parameters

      • state_decl: JssmStateDeclaration

      Returns JssmStateDeclaration

    Legend

    • Property
    • Method

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/package.json b/package.json index 624b22e3..38f53a47 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jssm", - "version": "5.65.1", + "version": "5.65.2", "engines": { "node": ">=10.0.0" }, @@ -45,6 +45,7 @@ "vet": "npm run eslint && npm run audit", "benny": "node ./src/buildjs/benchmark.js", "build": "npm run vet && npm run test && npm run site && npm run docs && npm run benny", + "buildnb": "npm run vet && npm run test && npm run site && npm run docs", "qbuild": "npm run test", "ci_build": "npm run vet && npm run test", "minify": "mv dist/es6/jssm-dot.js dist/es6/jssm-dot.nonmin.js && terser dist/es6/jssm-dot.nonmin.js > dist/es6/jssm-dot.js", diff --git a/src/ts/version.ts b/src/ts/version.ts index 44c64142..49a42a70 100644 --- a/src/ts/version.ts +++ b/src/ts/version.ts @@ -1,3 +1,3 @@ -const version: string = "5.65.1"; +const version: string = "5.65.2"; export { version };