<commit_before>package ice.fsm;

class FSM
{
	private var stack:Array<Void->Void>;
	
	public function new() 
	{
		stack = new Array<Void->Void>();
	}
	
	/**
	 * Updates the current state
	 */
	public function Update()
	{
		stack[stack.length - 1]();
	}
	
	/**
	 * Adds a state to the top of the stack
	 * @param	state	The state to be added
	 */
	public function PushState(state:Void->Void)
	{
		stack[stack.length] = state;
	}
	
	/**
	 * Removes and returns the current state
	 */
	public function PopState():Void->Void
	{
		return stack.pop();
	}
	
	/**
	 * Replaces the current state, and returns it
	 * @param	state	the new state to be added
	 */
	public function ReplaceState(state:Void->Void):Void->Void
	{
		var returnState = PopState();
		PushState(state);
		return returnState;
	}
	
	public function destroy()<commit_msg>allow passing info to fsm<commit_after>package ice.fsm;

class FSM
{
	private var stack:Array<Void->Void>;
	
	public var info(get, null):Dynamic;
	private var infos:Array<Dynamic>;
	
	public inline function get_info():Dynamic
	{
		return infos[infos.length -1];
	}
	
	public function new() 
	{
		stack = new Array < Void->Void > ();
		infos = new Array<Dynamic>();
	}
	
	/**
	 * Updates the current state
	 */
	public function Update()
	{
		stack[stack.length - 1]();
	}
	
	/**
	 * Adds a state to the top of the stack
	 * @param	state	The state to be added
	 */
	public function PushState(state:Void->Void, ?info:Dynamic)
	{
		stack[stack.length] = state;
		infos.push(info);
	}
	
	/**
	 * Removes and returns the current state
	 */
	public function PopState():Void->Void
	{
		infos.pop();
		return stack.pop();
	}
	
	/**
	 * Replaces the current state, and returns it
	 * @param	state	the new state to be added
	 */
	public function ReplaceState(state:Void->Void, ?info:Dynamic):Void->Void
	{
		var returnState = PopState();
		PushState(state,info);
		return returnState;
	}
	
	public function destroy()
{'fraction_non_alphanumeric': 0.1313340227507756, 'fraction_numerical': 0.0015511892450879006, 'mean_word_length': 3.3191964285714284, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7340643', 'n_tokens_mistral': 706, 'n_tokens_neox': 651, 'n_words': 187}