Last active
October 24, 2016 22:18
-
-
Save nponeccop/446b0547f3942be0f41b51105c4b02d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph smtp { | |
init -> A [label=greet]; | |
A -> done [label=ehlo]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const patterns = { | |
init_greet : (q, data) => { | |
data | |
.command('EHLO ...') | |
.done(q => q.resolve('A')) | |
} | |
A_ehlo : (q, data) => { | |
q.resolve('done') | |
} | |
} | |
function handle(q, state, event, data) | |
{ | |
const k = state + _ + event; | |
if (k in patterns) | |
{ | |
patterns[k](q, data) | |
} | |
else | |
{ | |
q.resolve('done') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment