diff options
Diffstat (limited to 'javascripts/NfaState.js')
-rw-r--r-- | javascripts/NfaState.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/javascripts/NfaState.js b/javascripts/NfaState.js new file mode 100644 index 0000000..6e7a413 --- /dev/null +++ b/javascripts/NfaState.js @@ -0,0 +1,21 @@ +/* + * State + * + */ +function NfaState(symbol) { + if(!symbol) { + this.symbol = EPSILON; + } else { + this.symbol = symbol; + } + this.followUps = []; + this.marked = false; + this.id = NEXTSTATE++; +} + +NfaState.prototype.mark = function(bool) { this.marked = bool } +NfaState.prototype.getFollowUp = function(index) { return this.followUps[index] } +NfaState.prototype.setFollowUp = function(index, state) { + if (!((index == 0) || (index==1)) ) return; + this.followUps[index] = state; +} |