Skip to content

Commit

Permalink
Move errthang to exact objects. Continued juggling around cycles and …
Browse files Browse the repository at this point in the history
…stripes.
  • Loading branch information
StoneCypher committed Sep 24, 2017
1 parent d2cc765 commit 12186d9
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,3 +1,4 @@
* [[`d2cc765030`](https://github.com/StoneCypher/jssm/commit/d2cc765030)] - extracted transition creation in prep for cycles/stripes (John Haugeland)
* [[`c794f7ba5c`](https://github.com/StoneCypher/jssm/commit/c794f7ba5c)] - oh wow travis marks failing for branches? (John Haugeland)
* [[`d1abf9799b`](https://github.com/StoneCypher/jssm/commit/d1abf9799b)] - underway (John Haugeland)
* [[`4ba92631ff`](https://github.com/StoneCypher/jssm/commit/4ba92631ff)] - +0 bugfix, parse tests (John Haugeland)
Expand Down
36 changes: 34 additions & 2 deletions build/tests/cycles.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 41 additions & 30 deletions src/js/jssm-types.js
Expand Up @@ -5,9 +5,9 @@



type JssmSuccess = { success: true };
type JssmFailure = { success: false, error: mixed };
type JssmIncomplete = { success: 'incomplete' };
type JssmSuccess = {| success: true |};
type JssmFailure = {| success: false, error: mixed |};
type JssmIncomplete = {| success: 'incomplete' |};
type JssmResult = JssmSuccess | JssmFailure | JssmIncomplete;

type JssmPermitted = 'required' | 'disallowed';
Expand All @@ -24,7 +24,7 @@ type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp';



type JssmMachineInternalState<NT, DT> = {
type JssmMachineInternalState<NT, DT> = {|

internal_state_impl_version : 1,

Expand All @@ -36,17 +36,19 @@ type JssmMachineInternalState<NT, DT> = {
reverse_actions : Map< NT, Map<NT, number> >,
edges : Array< JssmTransition<NT, DT> >

};
|};




type JssmGenericState<NT> = {|

type JssmGenericState<NT> = {
from : Array< NT > ,
name : NT ,
to : Array< NT > ,
complete : boolean
};

|};



Expand All @@ -60,10 +62,16 @@ type JssmTransitionPermitterMaybeArray<NT, DT> = JssmTransitionPermitter<



type JssmCycleStatement = {| key: string, value: number |};





type JssmStatePermitter<NT, DT> = (OldState: NT, NewState: NT, OldData: DT, NewData: DT) => boolean;
type JssmStatePermitterMaybeArray<NT, DT> = JssmStatePermitter<NT, DT> | Array< JssmStatePermitter<NT, DT> >;

type JssmGenericMachine<NT, DT> = {
type JssmGenericMachine<NT, DT> = {|

name? : string,
state : NT,
Expand All @@ -81,35 +89,37 @@ type JssmGenericMachine<NT, DT> = {

keep_history? : boolean | number

};
|};





type JssmTransition<NT, DT> = {
from : NT,
to : NT,
name? : string,
action? : NT,
check? : JssmTransitionPermitterMaybeArray<NT, DT>, // validate this edge's transition; usually about data
probability? : number, // for stoch modelling, would like to constrain to [0..1], dunno how
kind : JssmArrowKind,
forced_only : boolean,
main_path : boolean
};
type JssmTransition<NT, DT> = {|

from : NT,
to : NT,
name? : string,
action? : NT,
check? : JssmTransitionPermitterMaybeArray<NT, DT>, // validate this edge's transition; usually about data
probability? : number, // for stoch modelling, would like to constrain to [0..1], dunno how
kind : JssmArrowKind,
forced_only : boolean,
main_path : boolean

|};

type JssmTransitions<NT, DT> = Array< JssmTransition<NT, DT> >;

type JssmTransitionList<NT> = {
type JssmTransitionList<NT> = {|
entrances : Array<NT>,
exits : Array<NT>
};
|};




type JssmGenericConfig<NT, DT> = {
type JssmGenericConfig<NT, DT> = {|

graph_layout? : JssmLayout,

Expand Down Expand Up @@ -146,24 +156,24 @@ type JssmGenericConfig<NT, DT> = {

auto_api? : boolean | string // boolean false means don't; boolean true means do; string means do-with-this-prefix

};
|};





type JssmCompileRule = {
type JssmCompileRule = {|

agg_as : string,
val : mixed

};
|};





type JssmCompileSe<NT> = {
type JssmCompileSe<NT> = {|

to : NT,
se : JssmCompileSe<NT>,
Expand All @@ -173,20 +183,20 @@ type JssmCompileSe<NT> = {
l_probability : number,
r_probability : number

};
|};





type JssmCompileSeStart<NT> = {
type JssmCompileSeStart<NT> = {|

from : NT,
se : JssmCompileSe<NT>,
key : string,
value? : string | mixed | number

};
|};



Expand All @@ -209,6 +219,7 @@ export type {
JssmTransition,
JssmTransitions,
JssmTransitionList,
JssmCycleStatement,

JssmArrow,
JssmArrowKind,
Expand Down

0 comments on commit 12186d9

Please sign in to comment.