Пример #1
0
 public SaveFilePropertiesTranspiler(SourceCodeBuilder builder, Sphere56TranspilerVisitor parentVisitor,
                                     ISet <string> forbiddenProperties, MultiValueDictionary <string, string> invalidPropertyValues)
 {
     this.builder               = builder;
     this.parentVisitor         = parentVisitor;
     this.forbiddenProperties   = forbiddenProperties;
     this.invalidPropertyValues = invalidPropertyValues;
 }
        private void TranspileScripts()
        {
            foreach (var file in compilation.CompiledFiles)
            {
                var outputFileName  = GetOutputFileName(file.FileName);
                var outputDirectory = Path.GetDirectoryName(outputFileName);
                if (!Directory.Exists(outputDirectory))
                {
                    Directory.CreateDirectory(outputDirectory);
                }

                Console.WriteLine($"Transpiling to {outputFileName}");
                var transpiler = new Sphere56TranspilerVisitor(compilation.DefinitionRepository);
                transpiler.Visit(file.ParsedTree);
                File.WriteAllText(outputFileName, transpiler.Output);
            }
        }
Пример #3
0
        public void Transpile(TranspileOptions options)
        {
            if (File.Exists(options.InputPath))
            {
                ParseFile(options.InputPath);
            }
            else if (Directory.Exists(options.InputPath))
            {
                ParseDirectory(options.InputPath);
            }
            else
            {
                throw new CommandLineException($"Cannot find {options.InputPath}");
            }

            if (compilation.CompilationErrors.Any())
            {
                foreach (var error in compilation.CompilationErrors)
                {
                    if (!string.IsNullOrEmpty(error.FileName))
                    {
                        Console.WriteLine(error.FileName);
                    }
                    Console.WriteLine(error.Message);
                }
            }
            else
            {
                var fileNameHandler = new TranspileCommandFileNameHandler(options);
                foreach (var file in compilation.CompiledFiles)
                {
                    var outputFileName  = fileNameHandler.GetOututFileNameFromInput(file.FileName);
                    var outputDirectory = Path.GetDirectoryName(outputFileName);
                    if (!Directory.Exists(outputDirectory))
                    {
                        Directory.CreateDirectory(outputDirectory);
                    }

                    Console.WriteLine($"Transpiling to {outputFileName}");
                    var transpiler = new Sphere56TranspilerVisitor(compilation.DefinitionRepository);
                    transpiler.Visit(file.ParsedTree);
                    File.WriteAllText(outputFileName, transpiler.Output);
                }
            }
        }
 public MacroRemoverTranspiler(SourceCodeBuilder builder, Sphere56TranspilerVisitor transpiler)
 {
     this.builder    = builder;
     this.transpiler = transpiler;
 }
 public ItemSaveFilePropertiesTranspiler(SourceCodeBuilder builder, Sphere56TranspilerVisitor parentVisitor, MultiValueDictionary <string, string> invalidPropertyValues)
     : base(builder, parentVisitor, forbiddenProperties, invalidPropertyValues)
 {
 }
Пример #6
0
 public ChainedMemberTranspiler(SourceCodeBuilder builder, Sphere56TranspilerVisitor sphere56TranspilerVisitor)
 {
     this.builder          = builder;
     this.parentTranspiler = sphere56TranspilerVisitor;
 }
Пример #7
0
 public CharsTranspiler(IDefinitionsRepository definitionsRepository = null)
 {
     parentVisitor = new Sphere56TranspilerVisitor(definitionsRepository ?? new DefinitionsRepository(), builder);
 }
Пример #8
0
 public WorldTranspiler(IDefinitionsRepository definitionsRepository = null)
 {
     dataVisitor  = new Sphere56TranspilerVisitor(definitionsRepository ?? new DefinitionsRepository(), dataBuilder);
     worldVisitor = new Sphere56TranspilerVisitor(definitionsRepository ?? new DefinitionsRepository(), worldBuilder);
 }
Пример #9
0
 public LiteralArgumentTranspiler(Sphere56TranspilerVisitor parentTranspiler, SourceCodeBuilder builder, bool stripDoubleQuotes = false)
 {
     this.parentTranspiler  = parentTranspiler;
     this.builder           = builder;
     this.stripDoubleQuotes = stripDoubleQuotes;
 }
 public DialogPositionTranspiler(SourceCodeBuilder builder, Sphere56TranspilerVisitor parentTranspiler)
 {
     this.builder          = builder;
     this.parentTranspiler = parentTranspiler;
 }
 public FirstMemberAccessNameTranspiler(SourceCodeBuilder builder, Sphere56TranspilerVisitor parentTranspiler)
 {
     this.builder          = builder;
     this.parentTranspiler = parentTranspiler;
 }
 public SpecialFunctionTranspiler(SourceCodeBuilder builder, Sphere56TranspilerVisitor transpiler)
 {
     this.builder    = builder;
     this.transpiler = transpiler;
 }
Пример #13
0
 public SafeTranspiler(SourceCodeBuilder builder, Sphere56TranspilerVisitor transpiler)
 {
     this.builder    = builder;
     this.transpiler = transpiler;
 }
 public VariableNameTranspiler(SourceCodeBuilder builder, Sphere56TranspilerVisitor parentTranspiler)
 {
     this.builder          = builder;
     this.parentTranspiler = parentTranspiler;
 }
Пример #15
0
 public DialogFunctionArgumentsTranspiler(Sphere56TranspilerVisitor parentTranspiler, SourceCodeBuilder builder)
 {
     this.builder          = builder;
     this.parentTranspiler = parentTranspiler;
 }