public void CompileImplementation(PascalSharp.Internal.TreeConverter.TreeRealization.common_unit_node SemanticUnit, compilation_unit SyntaxUnit, PascalSharp.Internal.TreeConverter.TreeRealization.unit_node_list UsedUnits, List <Error> ErrorsList, List <CompilerWarning> WarningsList, SyntaxError parser_error, System.Collections.Hashtable bad_nodes, using_namespace_list interface_namespaces, using_namespace_list imlementation_namespaces, Dictionary <syntax_tree_node, string> docs, bool debug, bool debugging) { //if (ErrorsList.Count>0) throw ErrorsList[0]; stv.parser_error = parser_error; stv.bad_nodes_in_syntax_tree = bad_nodes; stv.referenced_units = UsedUnits; stv.using_list.clear(); stv.using_list.AddRange(interface_namespaces); stv.interface_using_list.AddRange(interface_namespaces); stv.using_list.AddRange(imlementation_namespaces); stv.ErrorsList = ErrorsList; stv.WarningsList = WarningsList; stv.SymbolTable.CaseSensitive = SemanticRules.SymbolTableCaseSensitive; if (docs != null) { stv.docs = docs; } stv.debug = debug; stv.debugging = debugging; SystemLibrary.syn_visitor = stv; SetSemanticRules(SyntaxUnit); unit_module umod = SyntaxUnit as unit_module; if (umod == null) { throw new PascalSharp.Internal.TreeConverter.CompilerInternalError("Program has not implementation part"); } //TODO: Переделать, чтобы Сашин код работал с common_unit_node. stv.compiled_unit = (PascalSharp.Internal.TreeConverter.TreeRealization.common_unit_node)SemanticUnit; stv.current_document = new document(SyntaxUnit.file_name); foreach (compiler_directive cd in umod.compiler_directives) { cd.visit(stv); } stv.visit_implementation(umod); //stv.visit(SyntaxUnit); //return stv.compiled_unit; }
//TODO: Исправить коллекцию модулей. public PascalSharp.Internal.TreeConverter.TreeRealization.common_unit_node CompileInterface(compilation_unit SyntaxUnit, PascalSharp.Internal.TreeConverter.TreeRealization.unit_node_list UsedUnits, List <Error> ErrorsList, List <CompilerWarning> WarningsList, SyntaxError parser_error, System.Collections.Hashtable bad_nodes, using_namespace_list namespaces, Dictionary <syntax_tree_node, string> docs, bool debug, bool debugging) { //convertion_data_and_alghoritms.__i = 0; stv.parser_error = parser_error; stv.bad_nodes_in_syntax_tree = bad_nodes; stv.referenced_units = UsedUnits; //stv.comp_units=UsedUnits; //stv.visit(SyntaxUnit //stv.interface_using_list = namespaces; stv.using_list.clear(); stv.interface_using_list.clear(); stv.using_list.AddRange(namespaces); stv.current_document = new document(SyntaxUnit.file_name); stv.ErrorsList = ErrorsList; stv.WarningsList = WarningsList; stv.SymbolTable.CaseSensitive = SemanticRules.SymbolTableCaseSensitive; stv.docs = docs; stv.debug = debug; stv.debugging = debugging; SystemLibrary.syn_visitor = stv; SetSemanticRules(SyntaxUnit); foreach (var cd in SyntaxUnit.compiler_directives) { cd.visit(stv); } stv.DirectivesToNodesLinks = CompilerDirectivesToSyntaxTreeNodesLinker.BuildLinks(SyntaxUnit, ErrorsList); //MikhailoMMX добавил передачу списка ошибок (02.10.10) SyntaxUnit.visit(stv); /*SyntaxTree.program_module pmod=SyntaxUnit as SyntaxTree.program_module; * if (pmod!=null) * { * stv.visit(pmod); * } * else * { * SyntaxTree.unit_module umod=SyntaxUnit as SyntaxTree.unit_module; * if (umod==null) * { * throw new PascalSharp.Internal.TreeConverter.CompilerInternalError("Undefined module type (not program and not unit)"); * } * stv.visit(umod); * }*/ //stv.visit(SyntaxUnit); //if (ErrorsList.Count>0) throw ErrorsList[0]; return(stv.compiled_unit); }