Package com.stuffwithstuff.magpie

Examples of com.stuffwithstuff.magpie.Magpie


import com.stuffwithstuff.magpie.Repl;
import com.stuffwithstuff.magpie.ReplResult;

public class ConsoleRepl extends MagpieAppHost {
  public ConsoleRepl() {
    mMagpie = new Magpie(this);
   
    mMagpie.defineMethods(ReplMethods.class);
    mMagpie.defineMethod("printString(s is String)",
        "Prints the given string to stdout.", new PrintString());
   
View Full Code Here


    Profiler.display();
  }
 
  public static void execute(String path) throws IOException {
    String script = MagpieAppHost.readFile(path);
    Magpie magpie = new Magpie(new MagpieAppHost());
   
    magpie.defineMethod("printString(s is String)",
        "Prints the given string to stdout.", new Method() {
      public Object call(Object left, Object right) {
        System.out.print(right);
        return null;
      }
    });
   
    String result = magpie.run(new SourceFile(path, script));
    if (result != null) {
      System.out.println(result);
    }
  }
View Full Code Here

TOP

Related Classes of com.stuffwithstuff.magpie.Magpie

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.