Skip to content

Commit

Permalink
Pull arrows out into modules
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneCypher committed Sep 13, 2022
1 parent 771f4c8 commit 013999a
Show file tree
Hide file tree
Showing 31 changed files with 1,087 additions and 999 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/nodejs.yml
Expand Up @@ -155,7 +155,7 @@ jobs:
with:
node-version: 18.x

- name: Verify the version was bumped
- name: Run the benchmarks
run: |
npm install && npm run benny
Expand Down Expand Up @@ -261,6 +261,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Results page
run: |
export TAG=$(awk -F'"' '/"version": ".+"/{ print $4; exit; }' package.json)
Expand Down
18 changes: 17 additions & 1 deletion CHANGELOG.long.md
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file.

1054 merges; 167 releases
1055 merges; 167 releases



Expand All @@ -18,6 +18,22 @@ Published tags:



 

 

## [Untagged] - 9/12/2022 7:19:21 PM

Commit [771f4c8d67274b40451ae6dfef168fe3c15949df](https://github.com/StoneCypher/jssm/commit/771f4c8d67274b40451ae6dfef168fe3c15949df)

Author: `John Haugeland <stonecypher@gmail.com>`

* Add tests for unicode labels (atom and string)
* Fixes StoneCypher/fsl#1193, fixes StoneCypher/fsl#1194




&nbsp;

&nbsp;
Expand Down
33 changes: 17 additions & 16 deletions CHANGELOG.md
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file.

1054 merges; 167 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
1055 merges; 167 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)



Expand All @@ -18,6 +18,22 @@ Published tags:



&nbsp;

&nbsp;

## [Untagged] - 9/12/2022 7:19:21 PM

Commit [771f4c8d67274b40451ae6dfef168fe3c15949df](https://github.com/StoneCypher/jssm/commit/771f4c8d67274b40451ae6dfef168fe3c15949df)

Author: `John Haugeland <stonecypher@gmail.com>`

* Add tests for unicode labels (atom and string)
* Fixes StoneCypher/fsl#1193, fixes StoneCypher/fsl#1194




&nbsp;

&nbsp;
Expand Down Expand Up @@ -163,19 +179,4 @@ Author: `John Haugeland <stonecypher@gmail.com>`
Merges [461a287, 0f3025a]

* Merge pull request #539 from StoneCypher/TrimTweet
* Shorten the tweet notice




&nbsp;

&nbsp;

## [Untagged] - 9/12/2022 9:59:52 AM

Commit [0f3025ae2e484afbda57b5f39f5485c4831e7ce7](https://github.com/StoneCypher/jssm/commit/0f3025ae2e484afbda57b5f39f5485c4831e7ce7)

Author: `John Haugeland <stonecypher@gmail.com>`

* Shorten the tweet notice
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -18,7 +18,7 @@ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
* Generated for version 5.85.7 at 9/12/2022, 7:17:57 PM
* Generated for version 5.85.8 at 9/12/2022, 8:16:52 PM
-->
# jssm
Expand All @@ -29,7 +29,7 @@ share online. Easy to embed.

Readable, useful state machines as one-liner strings.

***4,864 tests*** run 5,755 times. 4,855 specs with 100.0% coverage, 9 fuzz tests with 13.0% coverage. With 2,714 lines, that's about 1.8 tests per line, or 2.1 generated tests per line.
***4,864 tests*** run 5,755 times. 4,855 specs with 100.0% coverage, 9 fuzz tests with 13.2% coverage. With 2,725 lines, that's about 1.8 tests per line, or 2.1 generated tests per line.

***Meet your new state machine library.***

Expand Down
54 changes: 2 additions & 52 deletions dist/es6/jssm.d.ts
@@ -1,61 +1,11 @@
declare type StateType = string;
import { JssmGenericState, JssmGenericConfig, JssmStateConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmStateStyleKeyList, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslDirections, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmStateStyleKeyList, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslDirections, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
import { arrow_direction, arrow_left_kind, arrow_right_kind } from './jssm_arrow';
import { seq, unique, find_repeated, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
import * as constants from './jssm_constants';
declare const shapes: string[], gviz_shapes: string[], named_colors: string[];
import { version, build_time } from './version';
/*********
*
* Return the direction of an arrow - `right`, `left`, or `both`.
*
* ```typescript
* import { arrow_direction } from 'jssm';
*
* arrow_direction('->'); // 'right'
* arrow_direction('<~=>'); // 'both'
* ```
*
* @param arrow The arrow to be evaluated
*
*/
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'
* ```
*
* @param arrow The arrow to be evaluated
*
*/
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'
* ```
*
* @param arrow The arrow to be evaluated
*
*/
declare function arrow_right_kind(arrow: JssmArrow): JssmArrowKind;
/*********
*
* This method wraps the parser call that comes from the peg grammar,
Expand Down
186 changes: 1 addition & 185 deletions dist/es6/jssm.js
Expand Up @@ -2,6 +2,7 @@
import { reduce as reduce_to_639 } from 'reduce-to-639-1';
import { circular_buffer } from 'circular_buffer_js';
import { FslDirections } from './jssm_types';
import { arrow_direction, arrow_left_kind, arrow_right_kind } from './jssm_arrow';
import { base_theme } from './themes/jssm_base_stylesheet';
import { default_theme } from './themes/jssm_theme_default';
import { modern_theme } from './themes/jssm_theme_modern';
Expand All @@ -20,191 +21,6 @@ const { shapes, gviz_shapes, named_colors } = constants;
import { parse } from './fsl_parser';
import { version, build_time } from './version'; // replaced from package.js in build
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'
* ```
*
* @param arrow The arrow to be evaluated
*
*/
function arrow_direction(arrow) {
switch (String(arrow)) {
case '->':
case '→':
case '=>':
case '⇒':
case '~>':
case '↛':
return 'right';
case '<-':
case '←':
case '<=':
case '⇐':
case '<~':
case '↚':
return 'left';
case '<->':
case '↔':
case '<-=>':
case '←⇒':
case '←=>':
case '<-⇒':
case '<-~>':
case '←↛':
case '←~>':
case '<-↛':
case '<=>':
case '⇔':
case '<=->':
case '⇐→':
case '⇐->':
case '<=→':
case '<=~>':
case '⇐↛':
case '⇐~>':
case '<=↛':
case '<~>':
case '↮':
case '<~->':
case '↚→':
case '↚->':
case '<~→':
case '<~=>':
case '↚⇒':
case '↚=>':
case '<~⇒':
return 'both';
default:
throw new JssmError(undefined, `arrow_direction: unknown arrow type ${arrow}`);
}
}
/* eslint-enable complexity */
/* 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'
* ```
*
* @param arrow The arrow to be evaluated
*
*/
function arrow_left_kind(arrow) {
switch (String(arrow)) {
case '->':
case '→':
case '=>':
case '⇒':
case '~>':
case '↛':
return 'none';
case '<-':
case '←':
case '<->':
case '↔':
case '<-=>':
case '←⇒':
case '<-~>':
case '←↛':
return 'legal';
case '<=':
case '⇐':
case '<=>':
case '⇔':
case '<=->':
case '⇐→':
case '<=~>':
case '⇐↛':
return 'main';
case '<~':
case '↚':
case '<~>':
case '↮':
case '<~->':
case '↚→':
case '<~=>':
case '↚⇒':
return 'forced';
default:
throw new JssmError(undefined, `arrow_direction: unknown arrow type ${arrow}`);
}
}
/* eslint-enable complexity */
/* 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'
* ```
*
* @param arrow The arrow to be evaluated
*
*/
function arrow_right_kind(arrow) {
switch (String(arrow)) {
case '<-':
case '←':
case '<=':
case '⇐':
case '<~':
case '↚':
return 'none';
case '->':
case '→':
case '<->':
case '↔':
case '<=->':
case '⇐→':
case '<~->':
case '↚→':
return 'legal';
case '=>':
case '⇒':
case '<=>':
case '⇔':
case '<-=>':
case '←⇒':
case '<~=>':
case '↚⇒':
return 'main';
case '~>':
case '↛':
case '<~>':
case '↮':
case '<-~>':
case '←↛':
case '<=~>':
case '⇐↛':
return 'forced';
default:
throw new JssmError(undefined, `arrow_direction: unknown arrow type ${arrow}`);
}
}
/* eslint-enable complexity */
/*********
*
* Internal method meant to perform factory assembly of an edge. Not meant for
Expand Down

0 comments on commit 013999a

Please sign in to comment.