Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public AstStructure CompileStructure(string codeText)
        {
            if (InitializeCompiler(codeText, GMacSourceParser.ParseStructure, RefResContext) == false)
            {
                this.ReportNormal(
                    "Initializing Compile Temp Structure",
                    codeText,
                    ProgressEventArgsResult.Failure
                    );

                return(null);
            }

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

            try
            {
                var compiledSymbol =
                    new AstStructure(GMacStructureGenerator.Translate(Context, RootParseNode));

                CompiledStructures.Add(compiledSymbol.AccessName, compiledSymbol);

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

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

                return(null);
            }
        }