public Compressor(string readPath, string destPath) { reader = new CompressReader(readPath); writer = new CompressWriter(destPath); isCanceled = false; writer.Cancel += Writer_Cancel; }
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();"); }); }
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();"); }); }