Esempio n. 1
0
        private bool GenerateGlobals(IndentedTextWriter output, bool showInfo)
        {
            if (_scripts.Globals is null || _scripts.Globals.Count == 0)
            {
                return(false);
            }

            WriteComment("GLOBALS", output);
            output.WriteLine();

            for (int counter = 0; counter < _scripts.Globals.Count; counter++)
            {
                ScriptGlobal global = _scripts.Globals[counter];
                output.Write("(global {0} {1} ", _opcodes.GetTypeInfo((ushort)global.Type).Name, global.Name);
                WriteExpression(global.ExpressionIndex, output);
                if (showInfo)
                {
                    output.WriteLine(")\t\t; Index: {0}, Expression Index: {1}", counter.ToString(), global.ExpressionIndex.Index.ToString());
                }
                else
                {
                    output.WriteLine(")");
                }
            }

            return(true);
        }
Esempio n. 2
0
        private bool GenerateVariables(IndentedTextWriter output, bool showInfo)
        {
            if (_scripts.Variables is null || _scripts.Variables.Count == 0)
            {
                return(false);
            }

            WriteComment("VARIABLES", output);
            output.WriteLine();

            for (int counter = 0; counter < _scripts.Variables.Count; counter++)
            {
                ScriptGlobal variable = _scripts.Variables[counter];
                output.Write("(variable {0} {1} ", _opcodes.GetTypeInfo((ushort)variable.Type).Name, variable.Name);
                WriteExpression(variable.ExpressionIndex, output);
                if (showInfo)
                {
                    output.WriteLine(")\t\t; Index: {0}, Expression Index: {1}", counter.ToString(), variable.ExpressionIndex.Index.ToString());
                }
                else
                {
                    output.WriteLine(")");
                }
            }

            return(true);
        }