Advertisement
Guest User

Untitled

a guest
May 27th, 2015
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Irony.Interpreter.Ast;
  6.  
  7. namespace Irony.Interpreter {
  8. public delegate object SpecialForm(ScriptThread thread, AstNode[] childNodes);
  9.  
  10. public static class SpecialFormsLibrary {
  11. public static object Iif(ScriptThread thread, AstNode[] childNodes) {
  12. var testValue = childNodes[0].Evaluate(thread);
  13. object result = thread.Runtime.IsTrue(testValue) ? childNodes[1].Evaluate(thread) : childNodes[2].Evaluate(thread);
  14. return result;
  15.  
  16. }
  17.  
  18.  
  19. public static object kint = null;
  20. public static object loop(ScriptThread thread, AstNode[] childNodes)
  21. {
  22. object result = null;
  23. string[] words = childNodes[0].ToString().Split(' ');
  24. var iterations = Convert.ToInt32(words[1]);
  25.  
  26. for (int i = 0; i < iterations; i++)
  27. {
  28. result = childNodes[1].Evaluate(thread);
  29. }
  30.  
  31. return result;
  32.  
  33. }
  34.  
  35. }//class
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement