Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Irony.Interpreter.Ast;
- namespace Irony.Interpreter {
- public delegate object SpecialForm(ScriptThread thread, AstNode[] childNodes);
- public static class SpecialFormsLibrary {
- public static object Iif(ScriptThread thread, AstNode[] childNodes) {
- var testValue = childNodes[0].Evaluate(thread);
- object result = thread.Runtime.IsTrue(testValue) ? childNodes[1].Evaluate(thread) : childNodes[2].Evaluate(thread);
- return result;
- }
- public static object kint = null;
- public static object loop(ScriptThread thread, AstNode[] childNodes)
- {
- object result = null;
- string[] words = childNodes[0].ToString().Split(' ');
- var iterations = Convert.ToInt32(words[1]);
- for (int i = 0; i < iterations; i++)
- {
- result = childNodes[1].Evaluate(thread);
- }
- return result;
- }
- }//class
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement