public SemanticError(Module module, IParseTree place, ITokenStream tokens, string msg) : base(ErrorUtils.MakeMessage(module, place, tokens, msg)) { this.text = msg; this.module = module; this.place = place; this.tokens = tokens; }
public SyntaxError(string file, int line, int char_pos, string msg) : base(ErrorUtils.MakeMessage(file, line, char_pos, msg)) { this.text = msg; this.line = line; this.char_pos = char_pos; this.file = file; }
bool WriteCompilationResultToFile(BuildConf conf, List <CompilerWorker> compiler_workers, string file_path) { using (FileStream dfs = new FileStream(file_path, FileMode.Create, System.IO.FileAccess.Write)) { var mwriter = new MsgPack.MsgPackWriter(dfs); mwriter.Write(ModuleLoader.COMPILE_FMT); mwriter.Write(FILE_VERSION); int total_modules = 0; foreach (var w in compiler_workers) { if (w.error == null) { CheckUniqueSymbols(w); } //NOTE: exit in case of error if (w.error != null) { if (conf.err_file == "-") { Console.Error.WriteLine(ErrorUtils.ToJson(w.error)); } else { File.WriteAllText(conf.err_file, ErrorUtils.ToJson(w.error)); } return(false); } total_modules += w.file2path.Count; } mwriter.Write(total_modules); //NOTE: we'd like to write file binary modules in the same order they were added for (int file_idx = 0; file_idx < conf.files.Count; ++file_idx) { var file = conf.files[file_idx]; foreach (var w in compiler_workers) { if (file_idx >= w.start && file_idx < w.start + w.count) { var path = w.file2path[file]; var compiled_file = w.file2compiled[file]; mwriter.Write((byte)conf.module_fmt); mwriter.Write(path.name); if (conf.module_fmt == ModuleBinaryFormat.FMT_BIN) { mwriter.Write(File.ReadAllBytes(compiled_file)); } else if (conf.module_fmt == ModuleBinaryFormat.FMT_LZ4) { mwriter.Write(EncodeToLZ4(File.ReadAllBytes(compiled_file))); } else if (conf.module_fmt == ModuleBinaryFormat.FMT_FILE_REF) { mwriter.Write(compiled_file); } else { throw new Exception("Unsupported format: " + conf.module_fmt); } break; } } } return(true); } }
public SymbolError(Symbol symbol, string text) : base(ErrorUtils.MakeMessage(symbol, text)) { this.text = text; this.symbol = symbol; }
public BuildError(string file, Exception inner) : base(ErrorUtils.MakeMessage(file, 0, 0, inner.Message), inner) { this.text = inner.Message; this.file = file; }
public BuildError(string file, string msg) : base(ErrorUtils.MakeMessage(file, 0, 0, msg)) { this.text = msg; this.file = file; }