/* ************************************************************************
#
#  DivConq
#
#  http://divconq.com/
#
#  Copyright:
#    Copyright 2012 eTimeline, LLC. All rights reserved.
#
#  License:
#    See the license.txt file in the project's top-level directory for details.
#
#  Authors:
#    * Andy White
#
************************************************************************ */
package divconq.script.inst;

import divconq.script.IInstructionProvider;
import divconq.script.Instruction;
import divconq.xml.XElement;

public class CoreInstructionProvider implements IInstructionProvider {
	@Override
	public Instruction createInstruction(XElement def) {
		String tag = def.getName();
		
		if ("Main".equals(tag))
			return new Main();
		
		if ("Function".equals(tag))
			return new Function();
		
		if ("CallFunction".equals(tag))
			return new CallFunction();
		
		if ("Var".equals(tag))
			return new Var();
		
		if ("Global".equals(tag))
			return new Global();
		
		if ("With".equals(tag))
			return new With();
		
		if ("For".equals(tag))
			return new For();
		
		if ("While".equals(tag))
			return new While();
		
		if ("Until".equals(tag))
			return new Until();
		
		if ("If".equals(tag))
			return new If();
		
		if ("Switch".equals(tag))
			return new Switch();
		
		if ("Case".equals(tag))
			return new Case();
		
		if ("Break".equals(tag))
			return new Break();
		
		if ("Continue".equals(tag))
			return new Continue();
		
		if ("Exit".equals(tag))
			return new Exit();
		
		if ("Debug".equals(tag))
			return new Debug();
		
		if ("Info".equals(tag))
			return new Info();
		
		if ("Warn".equals(tag))
			return new Warn();
		
		if ("Error".equals(tag))
			return new Error();
		
		return null;
	}
}
