public static IokeObject NewFromStream(Runtime runtime, TextReader reader, IokeObject message, IokeObject context) { try { IokeParser parser = new IokeParser(runtime, reader, context, message); IokeObject m = parser.ParseFully(); if(m == null) { Message mx = new Message(runtime, ".", null, true); mx.Line = 0; mx.Position = 0; return runtime.CreateMessage(mx); } return m; } catch(ControlFlow cf) { // Pass through! throw cf; } catch(Exception e) { runtime.ReportNativeException(e, message, context); return null; } }
public static IokeObject NewFromStream(Runtime runtime, TextReader reader, IokeObject message, IokeObject context) { try { iokeParser parser = new iokeParser(new CommonTokenStream(new iokeLexer(new ANTLRReaderStream(reader)))); // Console.Error.WriteLine("parseFully ..."); ITree t = parser.parseFully(); // Console.Error.WriteLine("t: " + t.ToStringTree()); if(t == null) { Message mx = new Message(runtime, ".", null, Type.TERMINATOR); mx.Line = 0; mx.Position = 0; return runtime.CreateMessage(mx); } IokeObject m = FromTree(runtime, t); // Console.Error.WriteLine("m: " + m); // Console.Error.WriteLine("m1: " + m); OpShuffle(m); // Console.Error.WriteLine("m2: " + m); return m; } catch(Exception e) { runtime.ReportNativeException(e, message, context); return null; } }