Exemple #1
0
        public void RemoveCompiledSymbolsFromAst()
        {
            var textLogItem =
                CompiledSymbols
                .Select(s => s.AccessName)
                .Concatenate(Environment.NewLine, "", "", "    ", "");

            var progressId = this.ReportStart("Removing Compiled Symbols", textLogItem);

            foreach (var pair in CompiledMacros)
            {
                ((SymbolWithScope)pair.Value.AssociatedMacro.ParentLanguageSymbol)
                .RemoveChildSymbol(pair.Value.Name);
            }

            CompiledMacros.Clear();

            foreach (var pair in CompiledStructures)
            {
                ((SymbolWithScope)pair.Value.AssociatedStructure.ParentLanguageSymbol)
                .RemoveChildSymbol(pair.Value.Name);
            }

            CompiledStructures.Clear();

            this.ReportFinish(progressId, textLogItem);
        }
Exemple #2
0
        public AstMacro CompileMacro(string codeText)
        {
            if (InitializeCompiler(codeText, GMacSourceParser.ParseMacro, RefResContext) == false)
            {
                this.ReportNormal(
                    "Initializing Compile Temp Macro",
                    codeText,
                    ProgressEventArgsResult.Failure
                    );

                return(null);
            }

            this.ReportNormal(
                "Initializing Compile Temp Macro",
                codeText,
                ProgressEventArgsResult.Success
                );

            try
            {
                var compiledSymbol =
                    new AstMacro(GMacMacroGenerator.Translate(Context, RootParseNode));

                CompiledMacros.Add(compiledSymbol.AccessName, compiledSymbol);

                this.ReportNormal(
                    "Compiling Temp Macro",
                    compiledSymbol.AccessName,
                    ProgressEventArgsResult.Success
                    );

                return(compiledSymbol);
            }
            catch (Exception e)
            {
                this.ReportError("Error Compiling Temp Macro", e);

                return(null);
            }
        }