예제 #1
0
        public Compressor(string readPath, string destPath)
        {
            reader = new CompressReader(readPath);

            writer = new CompressWriter(destPath);

            isCanceled = false;

            writer.Cancel += Writer_Cancel;
        }
예제 #2
0
        public void Write()
        {
            writer.Block($"public static {Ctx.DfaSetType} CreateDfaSet()", () =>
            {
                var compact = new CompactDfaWriter(Grammar);

                var bytes = new CompressWriter().Compress(compact.Write());

                WriteByteArray("byte[] bytes = ", bytes);

                writer.WriteLine();

                writer.WriteLine($"return new CompactDfaReader(new BinReader(new CompressReader().Uncompress(bytes))).Read();");
            });
        }
예제 #3
0
        public void Write()
        {
            writer.Block($"public static {Ctx.ParseTableType} CreateParseTable()", () =>
            {
                Debug.Assert(Grammar.ParseTable != null);

                var compact = new CompactTableWriter(Grammar.ParseTable);

                var bytes = new CompressWriter().Compress(compact.Write());

                WriteByteArray("byte[] bytes = ", bytes);

                writer.WriteLine();

                writer.WriteLine($"return new CompactTableReader(new BinReader(new CompressReader().Uncompress(bytes))).Read();");
            });
        }