void Header(YSParseNode HeaderNode) { List <string> Resource_Sources = new List <string> (); YSLinker Linker = new YSLinker(); foreach (YSParseNode HeaderItem in HeaderNode.Children) { if (HeaderItem.Type == NType.Import) { Resource_Sources.Add(HeaderItem.Children [0].Token.Content); } else { Error("Unrecognized header type"); } } foreach (YSLinker.Resource Resource in Linker.LoadResources(Resource_Sources.ToArray())) { ScopeFrame ResourceScope = new ScopeFrame(Resource.Name, ScopeFrame.FrameTypes.Structure); STATE.PushScope(ResourceScope); Yumascript.LPIProcess(ref STATE, Resource.Content); StructureFrame SFrame = STATE.PopScopeNoSave(); IDPacket ResourceFrameID = IDPacket.CreateIDPacket(STATE, Resource.Name, IdentityType.Structure); STATE.PutGeneric(ResourceFrameID, SFrame); } }
public void Run(string ProgramPath) { try { string raw; using (StreamReader sr = new StreamReader(ProgramPath)) { raw = sr.ReadToEnd(); } bool status = Yumascript.LPIProcess(ref State, raw); Console.WriteLine("Program has finished with status " + status); } catch (IOException e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } }