Beispiel #1
0
        public Assembler(string asmName, string asm, IFileSystem fileLoader)
        {
            originalSource  = asm;
            this.fileLoader = fileLoader;

            // Note that order of instantiation matters here, as some object depend on others in slightly stupid ways that can be fixed in needed to avoid circular issues with instantiation
            parser      = new Parser(this);
            LineManager = new LineManager(asmName);
            assembly    = new AssemblyData(this);
            evaluator   = new ExpressionEvaluator(Values);
        }
Beispiel #2
0
        private void CreateErrorListing()
        {
            for (int i = 0; i < Errors.Count; i++)
            {
                var    error = Errors[i];
                int    sourceLine;
                string sourceName;
                LineManager.GetSourceLocation(error.SourceLine, out sourceLine, out sourceName);

                var detail = new ErrorDetail(sourceLine, sourceName, error.Code, error.Message);
                errorDetails.Add(detail);
            }
        }
Beispiel #3
0
        public Assembler(string asmName, Stream asmFile, IFileSystem fileLoader)
        {
            // Read file (as UTF-8) to string
            StreamReader reader = new StreamReader(asmFile, Encoding.UTF8, true);
            string       asm    = reader.ReadToEnd();

            originalSource  = asm;
            this.fileLoader = fileLoader;

            // Note that order of instantiation matters here, as some object depend on others in slightly stupid ways that can be fixed in needed to avoid circular issues with instantiation
            parser      = new Parser(this);
            LineManager = new LineManager(asmName);
            assembly    = new AssemblyData(this);
            evaluator   = new ExpressionEvaluator(Values);
        }