Example #1
0
        internal static Concr FromPtr(PGF g, IntPtr ptr)
        {
            var concr = new Concr();

            concr.PGF = g;
            concr.Ptr = ptr;
            return(concr);
        }
Example #2
0
        /// <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);
        }
Example #3
0
 public GrammarEmbedding(PGF gr)
 {
     this.gr = gr;
 }