Esempio n. 1
0
		public void Serialize(List<string> output, Executable exec, string indention)
		{
			if (exec is Assignment) SerializeAssignment(output, (Assignment)exec, indention);
			else if (exec is ClassDefinition) SerializeClassDefinition(output, (ClassDefinition)exec, indention);
			else if (exec is FunctionDefinition) SerializeFunctionInvocation(output, (FunctionDefinition)exec, indention);
			else if (exec is IfStatement) SerializeIfStatement(output, (IfStatement)exec, indention, false);
			else if (exec is ExpressionAsExecutable) SerializeExpressionAsExecutable(output, (ExpressionAsExecutable)exec, indention);
			else if (exec is ForEachLoop) SerializeForEachLoop(output, (ForEachLoop)exec, indention);
			else if (exec is BreakStatement) SerializeBreakStatement(output, (BreakStatement)exec, indention);
			else if (exec is ReturnStatement) SerializeReturnStatement(output, (ReturnStatement)exec, indention);
			else if (exec is ForLoop) Serialize(output, ((ForLoop)exec).OriginalForEachLoop, indention);
			else if (exec is WhileLoop) SerializeWhileLoop(output, (WhileLoop)exec, indention);
			else throw new NotImplementedException();
		}
Esempio n. 2
0
		public void Serialize(List<string> output, Executable exec, string indention)
		{
			if (exec == null) throw new NullReferenceException();

			if (exec is Assignment) SerializeAssignment(output, (Assignment)exec, indention);
			else if (exec is ExpressionAsExecutable) SerializeExpressionAsExecutable(output, (ExpressionAsExecutable)exec, indention);
			else if (exec is ForEachLoop) SerializeForEachLoop(output, (ForEachLoop)exec, indention);
			else if (exec is ForLoop) SerializeForLoop(output, (ForLoop)exec, indention);
			else if (exec is IfStatement) SerializeIfStatement(output, (IfStatement)exec, indention, true);
			else if (exec is ClassDefinition) SerializeClassDefinition(output, (ClassDefinition)exec, indention);
			else if (exec is BreakStatement) SerializeBreakStatement(output, (BreakStatement)exec, indention);
			else if (exec is FunctionDefinition) SerializeFunctionDefinition(output, (FunctionDefinition)exec, indention);
			else if (exec is ReturnStatement) SerializeReturnStatement(output, (ReturnStatement)exec, indention);
			else if (exec is WhileLoop) SerializeWhileLoop(output, (WhileLoop)exec, indention);
			else throw new NotImplementedException(exec.GetType().ToString());
		}
Esempio n. 3
0
		protected static IList<Executable> Listify(Executable executable)
		{
			return new List<Executable>() { executable };
		}