def expand_state_definition(source, loc, tokens):
indent = "<STR_LIT:U+0020>" * (pp.col(loc, source) - <NUM_LIT:1>)<EOL>statedef = []<EOL>states = set()<EOL>fromTo = {}<EOL>for tn in tokens.transitions:<EOL><INDENT>states.add(tn.from_state)<EOL>states.add(tn.to_state)<EOL>fromTo[tn.from_state] = tn.to_state<EOL><DEDENT>baseStateClass = tokens.name<EOL>statedef.extend([<EOL>"<STR_LIT>" % baseStateClass,<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>])<EOL>statedef.extend("<STR_LIT>".format(s, baseStateClass) for s in states)<EOL>statedef.extend("<STR_LIT>".format(s, fromTo[s]) for s in states if s in fromTo)<EOL>statedef.extend([<EOL>"<STR_LIT>".format(baseStateClass=baseStateClass),<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>])<EOL>return indent + ("<STR_LIT:\n>" + indent).join(statedef) + "<STR_LIT:\n>"<EOL>
Parse action to convert statemachine to corresponding Python classes and methods