Skip to content

Instantly share code, notes, and snippets.

@brianray
Last active October 25, 2017 03:04
Show Gist options
  • Save brianray/5d9d38476eaac9bb2c892cfcc3d516c5 to your computer and use it in GitHub Desktop.
Save brianray/5d9d38476eaac9bb2c892cfcc3d516c5 to your computer and use it in GitHub Desktop.
FSM_MAP = (
# {'src':, 'dst':, 'condition':, 'callback': },
{'src': S_NEW_GROUP,
'dst': S_PRE,
'condition': "[A-Za-z|+|-|\d]",
'callback': T_APPEND_CHAR_PRE}, # 1
{'src': S_PRE,
'dst': S_PRE,
'condition': "[A-Za-z|+|-|\d]",
'callback': T_APPEND_CHAR_PRE}, # 2
{'src': S_PRE,
'dst': S_SUBJ,
'condition': "\(",
'callback': T_SKIP}, # 3
{'src': S_SUBJ,
'dst': S_SUBJ,
'condition': "[^\)]",
'callback': T_APPEND_CHAR_SUBJ}, # 4
{'src': S_SUBJ,
'dst': S_END_RULE,
'condition': "\)",
'callback': T_END_RULE}, # 5
{'src': S_END_RULE,
'dst': S_END_GROUP,
'condition': "\)",
'callback': T_END_GROUP}, # 6
{'src': S_END_RULE,
'dst': S_OP,
'condition': "[\&|\|]",
'callback': T_ADD_OP_NEW_RULE}, # 7
{'src': S_END_GROUP,
'dst': S_OP,
'condition': "[\&|\|]",
'callback': T_ADD_GROUP_OP}, # 8
{'src': S_OP,
'dst': S_NEW_GROUP,
'condition': "\(",
'callback': T_NEW_GROUP}, # 9
{'src': S_OP,
'dst': S_PRE,
'condition': "[A-Za-z|+|-|\d]",
'callback': T_APPEND_CHAR_PRE}, # 10
{'src': S_SUBJ,
'dst': S_END_RULE,
'condition': "\)",
'callback': T_END_RULE}) # 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment