internal static Concr FromPtr(PGF g, IntPtr ptr) { var concr = new Concr(); concr.PGF = g; concr.Ptr = ptr; return(concr); }
/// <summary> /// Reads a grammar with the specified file path. /// </summary> /// <param name="fn">The path to the file.</param> /// <returns>an object representing the grammar in memory.</returns> public static PGF ReadPGF(string fn) { var obj = new PGF(); var exn = new NativeGU.NativeExceptionContext(new NativeGU.NativeMemoryPool()); obj.pool = new NativeGU.NativeMemoryPool(); obj._ptr = Native.pgf_read(fn, obj.pool.Ptr, exn.Ptr); if (exn.IsRaised) { throw new PGFError($"Could not read PGF from file {fn}. ({System.IO.Directory.GetCurrentDirectory()})"); } return(obj); }
public GrammarEmbedding(PGF gr) { this.gr = gr; }