Esempio n. 1
0
        internal string Generate(SymTables tables)
        {
            var sb = new StringBuilder();

            if ((tables & SymTables.Lines) == SymTables.Lines)
            {
                for (var i = 0; i < Symbols.Lines.Count; i++)
                {
                    var l = Symbols.Lines[i];
                    sb.AppendFormat(LINE_FORMAT, l.Offset, l.Line, l.Column);
                }
            }

            if ((tables & SymTables.Scopes) == SymTables.Scopes)
            {
                for (var i = 0; i < Symbols.Scopes.Count; i++)
                {
                    var s = Symbols.Scopes[i];
                    sb.AppendFormat(SCOPE_FORMAT, s.StartOffset, s.EndOffset, s.Index, s.ParentIndex);
                }
            }

            if ((tables & SymTables.Vars) == SymTables.Vars)
            {
                for (var i = 0; i < Symbols.Vars.Count; i++)
                {
                    var v = Symbols.Vars[i];
                    sb.AppendFormat(VAR_FORMAT, v.Offset, v.Address, v.Scope, v.Name);
                }
            }

            if ((tables & SymTables.Functions) == SymTables.Functions)
            {
                for (var i = 0; i < Symbols.Functions.Count; i++)
                {
                    var f = Symbols.Functions[i];
                    sb.AppendFormat(FUN_FORMAT, f.StartOffset, f.EndOffset, f.Name ?? String.Empty, f.Handle);
                }
            }

            return(sb.ToString());
        }
Esempio n. 2
0
        public string PrintSymTables(SymTables tables)
        {
            var gen = new SymGenerator(Symbols);

            return(gen.Generate(tables));
        }