Skip to content

Commit

Permalink
known_prop, fixes StoneCypher/fsl#1021
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneCypher committed Jul 13, 2022
1 parent c7191c8 commit 1349b75
Show file tree
Hide file tree
Showing 26 changed files with 733 additions and 297 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.long.md
Expand Up @@ -2,7 +2,7 @@

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

973 merges; 132 releases
974 merges; 132 releases



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



 

 

## [Untagged] - 7/13/2022 8:14:19 AM

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

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

* Default props now making it into machine, fixes StoneCypher/fsl#1039; datastructures, fixes StoneCypher/fsl#1022




&nbsp;

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

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

973 merges; 132 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
974 merges; 132 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)



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



&nbsp;

&nbsp;

## [Untagged] - 7/13/2022 8:14:19 AM

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

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

* Default props now making it into machine, fixes StoneCypher/fsl#1039; datastructures, fixes StoneCypher/fsl#1022




&nbsp;

&nbsp;
Expand Down Expand Up @@ -158,24 +173,4 @@ Commit [462358017970f5d968d8309ba8ee96d74648ec03](https://github.com/StoneCypher

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

* Define do/1 to be a synonym for action/1, fixes StoneCypher/fsl#809




&nbsp;

&nbsp;

<a name="5__77__0" />

## [5.77.0] - 7/7/2022 10:18:06 PM

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

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

Merges [d1b55ae, 2c633a6]

* Merge pull request #511 from StoneCypher/SynonymGoForTransition
* Define go/1 to be a synonym for transition/1, fixes StoneCypher/fsl#810
* Define do/1 to be a synonym for action/1, fixes StoneCypher/fsl#809
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.79.0 at 7/13/2022, 8:09:04 AM
* Generated for version 5.79.0 at 7/13/2022, 9:03:21 AM
-->
# jssm
Expand All @@ -29,7 +29,7 @@ share online. Easy to embed.

Readable, useful state machines as one-liner strings.

***4,718 tests*** run 5,609 times. 4,709 specs with 98.8% coverage, 9 fuzz tests with 5.4% coverage. With 1,849 lines, that's about 2.6 tests per line, or 3.0 generated tests per line.
***4,733 tests*** run 5,624 times. 4,724 specs with 99.7% coverage, 9 fuzz tests with 5.4% coverage. With 1,859 lines, that's about 2.5 tests per line, or 3.0 generated tests per line.

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

Expand Down
2 changes: 1 addition & 1 deletion dist/es6/jssm-dot.js

Large diffs are not rendered by default.

31 changes: 28 additions & 3 deletions dist/es6/jssm.d.ts
Expand Up @@ -299,17 +299,42 @@ declare class Machine<mDT> {
data(): mDT;
/*********
*
* Get the current value of a given property name. COMEBACK
* Get the current value of a given property name.
*
* ```typescript
* ```
*
* @typeparam mDT The type of the machine data member; usually omitted
* ```
*
* @param name The relevant property name to look up
*
*/
prop(name: string): any;
/*********
*
* Check whether a given string is a known property's name.
*
* ```typescript
* const example = sm`property foo default 1; a->b;`;
*
* example.known_prop('foo'); // true
* example.known_prop('bar'); // false
* ```
*
* @param prop_name The relevant property name to look up
*
*/
known_prop(prop_name: string): boolean;
/*********
*
* List all known property names. If you'd also like values, use
* {@link props} instead. The order of the properties is not defined, and
* the properties generally will not be sorted.
*
* ```typescript
* ```
*
*/
known_props(): string[];
/********
*
* Check whether a given state is final (either has no exits or is marked
Expand Down
46 changes: 42 additions & 4 deletions dist/es6/jssm.js
Expand Up @@ -351,8 +351,14 @@ function compile_rule_handler(rule) {
if (rule.key === 'machine_language') {
return { agg_as: 'machine_language', val: reduce_to_639(rule.value) };
}
// manually rehandled to make `undefined` as a property safe
if (rule.key === 'property_definition') {
return { agg_as: 'property_definition', val: { name: rule.name, default_value: rule.default_value } };
if (rule.hasOwnProperty('default_value')) {
return { agg_as: 'property_definition', val: { name: rule.name, default_value: rule.default_value } };
}
else {
return { agg_as: 'property_definition', val: { name: rule.name } };
}
}
if (rule.key === 'state_declaration') {
if (!rule.name) {
Expand All @@ -364,6 +370,7 @@ function compile_rule_handler(rule) {
'arrange_end_declaration'].includes(rule.key)) {
return { agg_as: rule.key, val: [rule.value] };
}
// things that can only exist once and are just a value under their own name
const tautologies = [
'graph_layout', 'start_states', 'end_states', 'machine_name', 'machine_version',
'machine_comment', 'machine_author', 'machine_contributor', 'machine_definition',
Expand Down Expand Up @@ -783,14 +790,14 @@ class Machine {
return true; // todo whargarbl
}
*/
// NEEDS_DOCS
/*********
*
* Get the current value of a given property name. COMEBACK
* Get the current value of a given property name.
*
* ```typescript
* ```
*
* @typeparam mDT The type of the machine data member; usually omitted
* ```
*
* @param name The relevant property name to look up
*
Expand All @@ -807,6 +814,37 @@ class Machine {
return undefined;
}
}
/*********
*
* Check whether a given string is a known property's name.
*
* ```typescript
* const example = sm`property foo default 1; a->b;`;
*
* example.known_prop('foo'); // true
* example.known_prop('bar'); // false
* ```
*
* @param prop_name The relevant property name to look up
*
*/
known_prop(prop_name) {
return this._property_keys.has(prop_name);
}
// NEEDS_DOCS
/*********
*
* List all known property names. If you'd also like values, use
* {@link props} instead. The order of the properties is not defined, and
* the properties generally will not be sorted.
*
* ```typescript
* ```
*
*/
known_props() {
return [...this._property_keys];
}
/********
*
* Check whether a given state is final (either has no exits or is marked
Expand Down
2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.js

Large diffs are not rendered by default.

236 changes: 149 additions & 87 deletions dist/jssm.es5.cjs.nonmin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jssm.es5.iife.js

Large diffs are not rendered by default.

236 changes: 149 additions & 87 deletions dist/jssm.es5.iife.nonmin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/docs/assets/search.js

Large diffs are not rendered by default.

64 changes: 38 additions & 26 deletions docs/docs/classes/jssm.Machine.html

Large diffs are not rendered by default.

0 comments on commit 1349b75

Please sign in to comment.