Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            StreamWriter swriter = new StreamWriter(GetOutputFileName(args));
            SourceWriter writer = new SourceWriter(swriter);
            CodeModel model = new CodeModel();
            Compilers.Javascript.Compiler compiler = null;

            string target = GetTarget(args);

            if (target == "node")
                compiler = new NodeCompiler(writer);
            else if (target == "browser")
                compiler = new BrowserCompiler(writer);
            else if (target == "vm")
                compiler = new VirtualMachineCompiler(writer);
            else
                throw new ArgumentException("Invalid target");

            foreach (string filename in GetFileNames(args))
            {
                ChunkReader chunkReader = new ChunkReader(filename);
                CodeReader reader = new CodeReader(chunkReader);

                reader.Process(model);
            }

            compiler.Visit(model);

            swriter.Close();
        }
Exemplo n.º 2
0
 public void Setup()
 {
     this.swriter = new StringWriter();
     this.writer = new SourceWriter(this.swriter);
 }