diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 470051016..8438863a6 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "1"; public const string Build = "0"; - public const string Revision = "1196"; + public const string Revision = "1197"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index 3d0a75fe4..e5ee1a57a 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=1 -%REVISION%=1196 %COREVERSION%=0 +%REVISION%=1197 +%MINOR%=1 %MAJOR%=3 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 335169596..07fe6dc30 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.1.0.1196' +!define VERSION '3.1.0.1197' diff --git a/SyntaxTree/tree/NodesGenerator.exe b/SyntaxTree/tree/NodesGenerator.exe index 5a0b462b1..ac31be6d8 100644 Binary files a/SyntaxTree/tree/NodesGenerator.exe and b/SyntaxTree/tree/NodesGenerator.exe differ diff --git a/SyntaxTree/tree/Tree.cs b/SyntaxTree/tree/Tree.cs index 636b3d3eb..6226103b6 100644 --- a/SyntaxTree/tree/Tree.cs +++ b/SyntaxTree/tree/Tree.cs @@ -272,6 +272,13 @@ namespace PascalABCCompiler.SyntaxTree this._right_logical_bracket=_right_logical_bracket; source_context = sc; } + // Конструкторы списка + public statement_list(statement elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _subnodes=new List(); protected syntax_tree_node _left_logical_bracket; @@ -323,6 +330,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public statement_list Add(statement elem, SourceContext sc = null) + { + subnodes.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(statement el) + { + subnodes.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + subnodes.InsertRange(0, els); + } + + public void AddMany(params statement[] els) + { + subnodes.AddRange(els); + } + + private int FindIndex(statement el) + { + var ind = subnodes.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(statement el, statement newel) + { + subnodes.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(statement el, IEnumerable newels) + { + subnodes.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(statement el, statement newel) + { + subnodes.Insert(FindIndex(el), newel); + } + + public void InsertBefore(statement el, IEnumerable newels) + { + subnodes.InsertRange(FindIndex(el), newels); + } + + public bool Remove(statement el) + { + return subnodes.Remove(el); + } + + public void Replace(statement el, statement newel) + { + subnodes[FindIndex(el)] = newel; + } + + public void Replace(statement el, IEnumerable newels) + { + var ind = FindIndex(el); + subnodes.RemoveAt(ind); + subnodes.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -1760,6 +1837,13 @@ namespace PascalABCCompiler.SyntaxTree this._names=_names; source_context = sc; } + // Конструкторы списка + public named_type_reference(ident elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _names=new List(); @@ -1779,6 +1863,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public named_type_reference Add(ident elem, SourceContext sc = null) + { + names.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(ident el) + { + names.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + names.InsertRange(0, els); + } + + public void AddMany(params ident[] els) + { + names.AddRange(els); + } + + private int FindIndex(ident el) + { + var ind = names.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(ident el, ident newel) + { + names.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(ident el, IEnumerable newels) + { + names.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(ident el, ident newel) + { + names.Insert(FindIndex(el), newel); + } + + public void InsertBefore(ident el, IEnumerable newels) + { + names.InsertRange(FindIndex(el), newels); + } + + public bool Remove(ident el) + { + return names.Remove(el); + } + + public void Replace(ident el, ident newel) + { + names[FindIndex(el)] = newel; + } + + public void Replace(ident el, IEnumerable newels) + { + var ind = FindIndex(el); + names.RemoveAt(ind); + names.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -1888,6 +2042,13 @@ namespace PascalABCCompiler.SyntaxTree this._var_definitions=_var_definitions; source_context = sc; } + // Конструкторы списка + public variable_definitions(var_def_statement elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _var_definitions=new List(); @@ -1907,6 +2068,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public variable_definitions Add(var_def_statement elem, SourceContext sc = null) + { + var_definitions.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(var_def_statement el) + { + var_definitions.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + var_definitions.InsertRange(0, els); + } + + public void AddMany(params var_def_statement[] els) + { + var_definitions.AddRange(els); + } + + private int FindIndex(var_def_statement el) + { + var ind = var_definitions.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(var_def_statement el, var_def_statement newel) + { + var_definitions.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(var_def_statement el, IEnumerable newels) + { + var_definitions.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(var_def_statement el, var_def_statement newel) + { + var_definitions.Insert(FindIndex(el), newel); + } + + public void InsertBefore(var_def_statement el, IEnumerable newels) + { + var_definitions.InsertRange(FindIndex(el), newels); + } + + public bool Remove(var_def_statement el) + { + return var_definitions.Remove(el); + } + + public void Replace(var_def_statement el, var_def_statement newel) + { + var_definitions[FindIndex(el)] = newel; + } + + public void Replace(var_def_statement el, IEnumerable newels) + { + var ind = FindIndex(el); + var_definitions.RemoveAt(ind); + var_definitions.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -2005,6 +2236,13 @@ namespace PascalABCCompiler.SyntaxTree this._idents=_idents; source_context = sc; } + // Конструкторы списка + public ident_list(ident elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _idents=new List(); @@ -2024,6 +2262,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public ident_list Add(ident elem, SourceContext sc = null) + { + idents.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(ident el) + { + idents.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + idents.InsertRange(0, els); + } + + public void AddMany(params ident[] els) + { + idents.AddRange(els); + } + + private int FindIndex(ident el) + { + var ind = idents.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(ident el, ident newel) + { + idents.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(ident el, IEnumerable newels) + { + idents.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(ident el, ident newel) + { + idents.Insert(FindIndex(el), newel); + } + + public void InsertBefore(ident el, IEnumerable newels) + { + idents.InsertRange(FindIndex(el), newels); + } + + public bool Remove(ident el) + { + return idents.Remove(el); + } + + public void Replace(ident el, ident newel) + { + idents[FindIndex(el)] = newel; + } + + public void Replace(ident el, IEnumerable newels) + { + var ind = FindIndex(el); + idents.RemoveAt(ind); + idents.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -2426,6 +2734,13 @@ namespace PascalABCCompiler.SyntaxTree this._defs=_defs; source_context = sc; } + // Конструкторы списка + public declarations(declaration elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _defs=new List(); @@ -2445,6 +2760,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public declarations Add(declaration elem, SourceContext sc = null) + { + defs.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(declaration el) + { + defs.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + defs.InsertRange(0, els); + } + + public void AddMany(params declaration[] els) + { + defs.AddRange(els); + } + + private int FindIndex(declaration el) + { + var ind = defs.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(declaration el, declaration newel) + { + defs.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(declaration el, IEnumerable newels) + { + defs.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(declaration el, declaration newel) + { + defs.Insert(FindIndex(el), newel); + } + + public void InsertBefore(declaration el, IEnumerable newels) + { + defs.InsertRange(FindIndex(el), newels); + } + + public bool Remove(declaration el) + { + return defs.Remove(el); + } + + public void Replace(declaration el, declaration newel) + { + defs[FindIndex(el)] = newel; + } + + public void Replace(declaration el, IEnumerable newels) + { + var ind = FindIndex(el); + defs.RemoveAt(ind); + defs.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -2543,6 +2928,13 @@ namespace PascalABCCompiler.SyntaxTree this._compilation_units=_compilation_units; source_context = sc; } + // Конструкторы списка + public program_tree(compilation_unit elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _compilation_units=new List(); @@ -2562,6 +2954,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public program_tree Add(compilation_unit elem, SourceContext sc = null) + { + compilation_units.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(compilation_unit el) + { + compilation_units.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + compilation_units.InsertRange(0, els); + } + + public void AddMany(params compilation_unit[] els) + { + compilation_units.AddRange(els); + } + + private int FindIndex(compilation_unit el) + { + var ind = compilation_units.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(compilation_unit el, compilation_unit newel) + { + compilation_units.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(compilation_unit el, IEnumerable newels) + { + compilation_units.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(compilation_unit el, compilation_unit newel) + { + compilation_units.Insert(FindIndex(el), newel); + } + + public void InsertBefore(compilation_unit el, IEnumerable newels) + { + compilation_units.InsertRange(FindIndex(el), newels); + } + + public bool Remove(compilation_unit el) + { + return compilation_units.Remove(el); + } + + public void Replace(compilation_unit el, compilation_unit newel) + { + compilation_units[FindIndex(el)] = newel; + } + + public void Replace(compilation_unit el, IEnumerable newels) + { + var ind = FindIndex(el); + compilation_units.RemoveAt(ind); + compilation_units.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -2871,6 +3333,13 @@ namespace PascalABCCompiler.SyntaxTree this._expressions=_expressions; source_context = sc; } + // Конструкторы списка + public expression_list(expression elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _expressions=new List(); @@ -2890,6 +3359,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public expression_list Add(expression elem, SourceContext sc = null) + { + expressions.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(expression el) + { + expressions.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + expressions.InsertRange(0, els); + } + + public void AddMany(params expression[] els) + { + expressions.AddRange(els); + } + + private int FindIndex(expression el) + { + var ind = expressions.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(expression el, expression newel) + { + expressions.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(expression el, IEnumerable newels) + { + expressions.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(expression el, expression newel) + { + expressions.Insert(FindIndex(el), newel); + } + + public void InsertBefore(expression el, IEnumerable newels) + { + expressions.InsertRange(FindIndex(el), newels); + } + + public bool Remove(expression el) + { + return expressions.Remove(el); + } + + public void Replace(expression el, expression newel) + { + expressions[FindIndex(el)] = newel; + } + + public void Replace(expression el, IEnumerable newels) + { + var ind = FindIndex(el); + expressions.RemoveAt(ind); + expressions.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -4253,6 +4792,13 @@ namespace PascalABCCompiler.SyntaxTree this._indexers=_indexers; source_context = sc; } + // Конструкторы списка + public indexers_types(type_definition elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _indexers=new List(); @@ -4272,6 +4818,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public indexers_types Add(type_definition elem, SourceContext sc = null) + { + indexers.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(type_definition el) + { + indexers.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + indexers.InsertRange(0, els); + } + + public void AddMany(params type_definition[] els) + { + indexers.AddRange(els); + } + + private int FindIndex(type_definition el) + { + var ind = indexers.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(type_definition el, type_definition newel) + { + indexers.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(type_definition el, IEnumerable newels) + { + indexers.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(type_definition el, type_definition newel) + { + indexers.Insert(FindIndex(el), newel); + } + + public void InsertBefore(type_definition el, IEnumerable newels) + { + indexers.InsertRange(FindIndex(el), newels); + } + + public bool Remove(type_definition el) + { + return indexers.Remove(el); + } + + public void Replace(type_definition el, type_definition newel) + { + indexers[FindIndex(el)] = newel; + } + + public void Replace(type_definition el, IEnumerable newels) + { + var ind = FindIndex(el); + indexers.RemoveAt(ind); + indexers.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -4946,6 +5562,13 @@ namespace PascalABCCompiler.SyntaxTree this._params_list=_params_list; source_context = sc; } + // Конструкторы списка + public formal_parameters(typed_parameters elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _params_list=new List(); @@ -4965,6 +5588,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public formal_parameters Add(typed_parameters elem, SourceContext sc = null) + { + params_list.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(typed_parameters el) + { + params_list.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + params_list.InsertRange(0, els); + } + + public void AddMany(params typed_parameters[] els) + { + params_list.AddRange(els); + } + + private int FindIndex(typed_parameters el) + { + var ind = params_list.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(typed_parameters el, typed_parameters newel) + { + params_list.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(typed_parameters el, IEnumerable newels) + { + params_list.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(typed_parameters el, typed_parameters newel) + { + params_list.Insert(FindIndex(el), newel); + } + + public void InsertBefore(typed_parameters el, IEnumerable newels) + { + params_list.InsertRange(FindIndex(el), newels); + } + + public bool Remove(typed_parameters el) + { + return params_list.Remove(el); + } + + public void Replace(typed_parameters el, typed_parameters newel) + { + params_list[FindIndex(el)] = newel; + } + + public void Replace(typed_parameters el, IEnumerable newels) + { + var ind = FindIndex(el); + params_list.RemoveAt(ind); + params_list.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -5063,6 +5756,13 @@ namespace PascalABCCompiler.SyntaxTree this._proc_attributes=_proc_attributes; source_context = sc; } + // Конструкторы списка + public procedure_attributes_list(procedure_attribute elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _proc_attributes=new List(); @@ -5082,6 +5782,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public procedure_attributes_list Add(procedure_attribute elem, SourceContext sc = null) + { + proc_attributes.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(procedure_attribute el) + { + proc_attributes.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + proc_attributes.InsertRange(0, els); + } + + public void AddMany(params procedure_attribute[] els) + { + proc_attributes.AddRange(els); + } + + private int FindIndex(procedure_attribute el) + { + var ind = proc_attributes.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(procedure_attribute el, procedure_attribute newel) + { + proc_attributes.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(procedure_attribute el, IEnumerable newels) + { + proc_attributes.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(procedure_attribute el, procedure_attribute newel) + { + proc_attributes.Insert(FindIndex(el), newel); + } + + public void InsertBefore(procedure_attribute el, IEnumerable newels) + { + proc_attributes.InsertRange(FindIndex(el), newels); + } + + public bool Remove(procedure_attribute el) + { + return proc_attributes.Remove(el); + } + + public void Replace(procedure_attribute el, procedure_attribute newel) + { + proc_attributes[FindIndex(el)] = newel; + } + + public void Replace(procedure_attribute el, IEnumerable newels) + { + var ind = FindIndex(el); + proc_attributes.RemoveAt(ind); + proc_attributes.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -5915,6 +6685,13 @@ namespace PascalABCCompiler.SyntaxTree this._types_decl=_types_decl; source_context = sc; } + // Конструкторы списка + public type_declarations(type_declaration elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _types_decl=new List(); @@ -5934,6 +6711,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public type_declarations Add(type_declaration elem, SourceContext sc = null) + { + types_decl.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(type_declaration el) + { + types_decl.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + types_decl.InsertRange(0, els); + } + + public void AddMany(params type_declaration[] els) + { + types_decl.AddRange(els); + } + + private int FindIndex(type_declaration el) + { + var ind = types_decl.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(type_declaration el, type_declaration newel) + { + types_decl.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(type_declaration el, IEnumerable newels) + { + types_decl.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(type_declaration el, type_declaration newel) + { + types_decl.Insert(FindIndex(el), newel); + } + + public void InsertBefore(type_declaration el, IEnumerable newels) + { + types_decl.InsertRange(FindIndex(el), newels); + } + + public bool Remove(type_declaration el) + { + return types_decl.Remove(el); + } + + public void Replace(type_declaration el, type_declaration newel) + { + types_decl[FindIndex(el)] = newel; + } + + public void Replace(type_declaration el, IEnumerable newels) + { + var ind = FindIndex(el); + types_decl.RemoveAt(ind); + types_decl.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -6409,6 +7256,13 @@ namespace PascalABCCompiler.SyntaxTree this._const_defs=_const_defs; source_context = sc; } + // Конструкторы списка + public consts_definitions_list(const_definition elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _const_defs=new List(); @@ -6428,6 +7282,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public consts_definitions_list Add(const_definition elem, SourceContext sc = null) + { + const_defs.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(const_definition el) + { + const_defs.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + const_defs.InsertRange(0, els); + } + + public void AddMany(params const_definition[] els) + { + const_defs.AddRange(els); + } + + private int FindIndex(const_definition el) + { + var ind = const_defs.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(const_definition el, const_definition newel) + { + const_defs.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(const_definition el, IEnumerable newels) + { + const_defs.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(const_definition el, const_definition newel) + { + const_defs.Insert(FindIndex(el), newel); + } + + public void InsertBefore(const_definition el, IEnumerable newels) + { + const_defs.InsertRange(FindIndex(el), newels); + } + + public bool Remove(const_definition el) + { + return const_defs.Remove(el); + } + + public void Replace(const_definition el, const_definition newel) + { + const_defs[FindIndex(el)] = newel; + } + + public void Replace(const_definition el, IEnumerable newels) + { + var ind = FindIndex(el); + const_defs.RemoveAt(ind); + const_defs.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -6901,6 +7825,13 @@ namespace PascalABCCompiler.SyntaxTree this._units=_units; source_context = sc; } + // Конструкторы списка + public uses_list(unit_or_namespace elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _units=new List(); @@ -6920,6 +7851,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public uses_list Add(unit_or_namespace elem, SourceContext sc = null) + { + units.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(unit_or_namespace el) + { + units.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + units.InsertRange(0, els); + } + + public void AddMany(params unit_or_namespace[] els) + { + units.AddRange(els); + } + + private int FindIndex(unit_or_namespace el) + { + var ind = units.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(unit_or_namespace el, unit_or_namespace newel) + { + units.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(unit_or_namespace el, IEnumerable newels) + { + units.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(unit_or_namespace el, unit_or_namespace newel) + { + units.Insert(FindIndex(el), newel); + } + + public void InsertBefore(unit_or_namespace el, IEnumerable newels) + { + units.InsertRange(FindIndex(el), newels); + } + + public bool Remove(unit_or_namespace el) + { + return units.Remove(el); + } + + public void Replace(unit_or_namespace el, unit_or_namespace newel) + { + units[FindIndex(el)] = newel; + } + + public void Replace(unit_or_namespace el, IEnumerable newels) + { + var ind = FindIndex(el); + units.RemoveAt(ind); + units.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -7202,6 +8203,13 @@ namespace PascalABCCompiler.SyntaxTree this._Language=_Language; source_context = sc; } + // Конструкторы списка + public compilation_unit(compiler_directive elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected string _file_name; protected List _compiler_directives=new List(); @@ -7253,6 +8261,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public compilation_unit Add(compiler_directive elem, SourceContext sc = null) + { + compiler_directives.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(compiler_directive el) + { + compiler_directives.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + compiler_directives.InsertRange(0, els); + } + + public void AddMany(params compiler_directive[] els) + { + compiler_directives.AddRange(els); + } + + private int FindIndex(compiler_directive el) + { + var ind = compiler_directives.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(compiler_directive el, compiler_directive newel) + { + compiler_directives.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(compiler_directive el, IEnumerable newels) + { + compiler_directives.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(compiler_directive el, compiler_directive newel) + { + compiler_directives.Insert(FindIndex(el), newel); + } + + public void InsertBefore(compiler_directive el, IEnumerable newels) + { + compiler_directives.InsertRange(FindIndex(el), newels); + } + + public bool Remove(compiler_directive el) + { + return compiler_directives.Remove(el); + } + + public void Replace(compiler_directive el, compiler_directive newel) + { + compiler_directives[FindIndex(el)] = newel; + } + + public void Replace(compiler_directive el, IEnumerable newels) + { + var ind = FindIndex(el); + compiler_directives.RemoveAt(ind); + compiler_directives.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -8344,6 +9422,13 @@ namespace PascalABCCompiler.SyntaxTree this._explicit_interface_name=_explicit_interface_name; source_context = sc; } + // Конструкторы списка + public method_name(ident elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _ln; protected ident _class_name; @@ -8411,6 +9496,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public method_name Add(ident elem, SourceContext sc = null) + { + ln.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(ident el) + { + ln.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + ln.InsertRange(0, els); + } + + public void AddMany(params ident[] els) + { + ln.AddRange(els); + } + + private int FindIndex(ident el) + { + var ind = ln.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(ident el, ident newel) + { + ln.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(ident el, IEnumerable newels) + { + ln.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(ident el, ident newel) + { + ln.Insert(FindIndex(el), newel); + } + + public void InsertBefore(ident el, IEnumerable newels) + { + ln.InsertRange(FindIndex(el), newels); + } + + public bool Remove(ident el) + { + return ln.Remove(el); + } + + public void Replace(ident el, ident newel) + { + ln[FindIndex(el)] = newel; + } + + public void Replace(ident el, IEnumerable newels) + { + var ind = FindIndex(el); + ln.RemoveAt(ind); + ln.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -10265,6 +11420,13 @@ namespace PascalABCCompiler.SyntaxTree this._access_mod=_access_mod; source_context = sc; } + // Конструкторы списка + public class_members(declaration elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _members=new List(); protected access_modifer_node _access_mod; @@ -10300,6 +11462,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public class_members Add(declaration elem, SourceContext sc = null) + { + members.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(declaration el) + { + members.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + members.InsertRange(0, els); + } + + public void AddMany(params declaration[] els) + { + members.AddRange(els); + } + + private int FindIndex(declaration el) + { + var ind = members.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(declaration el, declaration newel) + { + members.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(declaration el, IEnumerable newels) + { + members.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(declaration el, declaration newel) + { + members.Insert(FindIndex(el), newel); + } + + public void InsertBefore(declaration el, IEnumerable newels) + { + members.InsertRange(FindIndex(el), newels); + } + + public bool Remove(declaration el) + { + return members.Remove(el); + } + + public void Replace(declaration el, declaration newel) + { + members[FindIndex(el)] = newel; + } + + public void Replace(declaration el, IEnumerable newels) + { + var ind = FindIndex(el); + members.RemoveAt(ind); + members.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -10509,6 +11741,13 @@ namespace PascalABCCompiler.SyntaxTree this._class_def_blocks=_class_def_blocks; source_context = sc; } + // Конструкторы списка + public class_body(class_members elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _class_def_blocks=new List(); @@ -10528,6 +11767,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public class_body Add(class_members elem, SourceContext sc = null) + { + class_def_blocks.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(class_members el) + { + class_def_blocks.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + class_def_blocks.InsertRange(0, els); + } + + public void AddMany(params class_members[] els) + { + class_def_blocks.AddRange(els); + } + + private int FindIndex(class_members el) + { + var ind = class_def_blocks.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(class_members el, class_members newel) + { + class_def_blocks.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(class_members el, IEnumerable newels) + { + class_def_blocks.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(class_members el, class_members newel) + { + class_def_blocks.Insert(FindIndex(el), newel); + } + + public void InsertBefore(class_members el, IEnumerable newels) + { + class_def_blocks.InsertRange(FindIndex(el), newels); + } + + public bool Remove(class_members el) + { + return class_def_blocks.Remove(el); + } + + public void Replace(class_members el, class_members newel) + { + class_def_blocks[FindIndex(el)] = newel; + } + + public void Replace(class_members el, IEnumerable newels) + { + var ind = FindIndex(el); + class_def_blocks.RemoveAt(ind); + class_def_blocks.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -11386,6 +12695,13 @@ namespace PascalABCCompiler.SyntaxTree this._rec_consts=_rec_consts; source_context = sc; } + // Конструкторы списка + public record_const(record_const_definition elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _rec_consts=new List(); @@ -11405,6 +12721,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public record_const Add(record_const_definition elem, SourceContext sc = null) + { + rec_consts.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(record_const_definition el) + { + rec_consts.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + rec_consts.InsertRange(0, els); + } + + public void AddMany(params record_const_definition[] els) + { + rec_consts.AddRange(els); + } + + private int FindIndex(record_const_definition el) + { + var ind = rec_consts.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(record_const_definition el, record_const_definition newel) + { + rec_consts.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(record_const_definition el, IEnumerable newels) + { + rec_consts.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(record_const_definition el, record_const_definition newel) + { + rec_consts.Insert(FindIndex(el), newel); + } + + public void InsertBefore(record_const_definition el, IEnumerable newels) + { + rec_consts.InsertRange(FindIndex(el), newels); + } + + public bool Remove(record_const_definition el) + { + return rec_consts.Remove(el); + } + + public void Replace(record_const_definition el, record_const_definition newel) + { + rec_consts[FindIndex(el)] = newel; + } + + public void Replace(record_const_definition el, IEnumerable newels) + { + var ind = FindIndex(el); + rec_consts.RemoveAt(ind); + rec_consts.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -12109,6 +13495,13 @@ namespace PascalABCCompiler.SyntaxTree this._literals=_literals; source_context = sc; } + // Конструкторы списка + public literal_const_line(literal elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _literals=new List(); @@ -12128,6 +13521,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public literal_const_line Add(literal elem, SourceContext sc = null) + { + literals.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(literal el) + { + literals.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + literals.InsertRange(0, els); + } + + public void AddMany(params literal[] els) + { + literals.AddRange(els); + } + + private int FindIndex(literal el) + { + var ind = literals.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(literal el, literal newel) + { + literals.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(literal el, IEnumerable newels) + { + literals.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(literal el, literal newel) + { + literals.Insert(FindIndex(el), newel); + } + + public void InsertBefore(literal el, IEnumerable newels) + { + literals.InsertRange(FindIndex(el), newels); + } + + public bool Remove(literal el) + { + return literals.Remove(el); + } + + public void Replace(literal el, literal newel) + { + literals[FindIndex(el)] = newel; + } + + public void Replace(literal el, IEnumerable newels) + { + var ind = FindIndex(el); + literals.RemoveAt(ind); + literals.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -12520,6 +13983,13 @@ namespace PascalABCCompiler.SyntaxTree this._vars=_vars; source_context = sc; } + // Конструкторы списка + public variant_list(variant elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _vars=new List(); @@ -12539,6 +14009,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public variant_list Add(variant elem, SourceContext sc = null) + { + vars.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(variant el) + { + vars.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + vars.InsertRange(0, els); + } + + public void AddMany(params variant[] els) + { + vars.AddRange(els); + } + + private int FindIndex(variant el) + { + var ind = vars.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(variant el, variant newel) + { + vars.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(variant el, IEnumerable newels) + { + vars.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(variant el, variant newel) + { + vars.Insert(FindIndex(el), newel); + } + + public void InsertBefore(variant el, IEnumerable newels) + { + vars.InsertRange(FindIndex(el), newels); + } + + public bool Remove(variant el) + { + return vars.Remove(el); + } + + public void Replace(variant el, variant newel) + { + vars[FindIndex(el)] = newel; + } + + public void Replace(variant el, IEnumerable newels) + { + var ind = FindIndex(el); + vars.RemoveAt(ind); + vars.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -12771,6 +14311,13 @@ namespace PascalABCCompiler.SyntaxTree this._vars=_vars; source_context = sc; } + // Конструкторы списка + public variant_types(variant_type elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _vars=new List(); @@ -12790,6 +14337,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public variant_types Add(variant_type elem, SourceContext sc = null) + { + vars.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(variant_type el) + { + vars.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + vars.InsertRange(0, els); + } + + public void AddMany(params variant_type[] els) + { + vars.AddRange(els); + } + + private int FindIndex(variant_type el) + { + var ind = vars.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(variant_type el, variant_type newel) + { + vars.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(variant_type el, IEnumerable newels) + { + vars.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(variant_type el, variant_type newel) + { + vars.Insert(FindIndex(el), newel); + } + + public void InsertBefore(variant_type el, IEnumerable newels) + { + vars.InsertRange(FindIndex(el), newels); + } + + public bool Remove(variant_type el) + { + return vars.Remove(el); + } + + public void Replace(variant_type el, variant_type newel) + { + vars[FindIndex(el)] = newel; + } + + public void Replace(variant_type el, IEnumerable newels) + { + var ind = FindIndex(el); + vars.RemoveAt(ind); + vars.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -14994,6 +16611,13 @@ namespace PascalABCCompiler.SyntaxTree this._variants=_variants; source_context = sc; } + // Конструкторы списка + public case_variants(case_variant elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _variants=new List(); @@ -15013,6 +16637,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public case_variants Add(case_variant elem, SourceContext sc = null) + { + variants.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(case_variant el) + { + variants.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + variants.InsertRange(0, els); + } + + public void AddMany(params case_variant[] els) + { + variants.AddRange(els); + } + + private int FindIndex(case_variant el) + { + var ind = variants.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(case_variant el, case_variant newel) + { + variants.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(case_variant el, IEnumerable newels) + { + variants.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(case_variant el, case_variant newel) + { + variants.Insert(FindIndex(el), newel); + } + + public void InsertBefore(case_variant el, IEnumerable newels) + { + variants.InsertRange(FindIndex(el), newels); + } + + public bool Remove(case_variant el) + { + return variants.Remove(el); + } + + public void Replace(case_variant el, case_variant newel) + { + variants[FindIndex(el)] = newel; + } + + public void Replace(case_variant el, IEnumerable newels) + { + var ind = FindIndex(el); + variants.RemoveAt(ind); + variants.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -15245,6 +16939,13 @@ namespace PascalABCCompiler.SyntaxTree this._vars=_vars; source_context = sc; } + // Конструкторы списка + public var_def_list_for_record(var_def_statement elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _vars=new List(); @@ -15264,6 +16965,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public var_def_list_for_record Add(var_def_statement elem, SourceContext sc = null) + { + vars.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(var_def_statement el) + { + vars.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + vars.InsertRange(0, els); + } + + public void AddMany(params var_def_statement[] els) + { + vars.AddRange(els); + } + + private int FindIndex(var_def_statement el) + { + var ind = vars.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(var_def_statement el, var_def_statement newel) + { + vars.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(var_def_statement el, IEnumerable newels) + { + vars.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(var_def_statement el, var_def_statement newel) + { + vars.Insert(FindIndex(el), newel); + } + + public void InsertBefore(var_def_statement el, IEnumerable newels) + { + vars.InsertRange(FindIndex(el), newels); + } + + public bool Remove(var_def_statement el) + { + return vars.Remove(el); + } + + public void Replace(var_def_statement el, var_def_statement newel) + { + vars[FindIndex(el)] = newel; + } + + public void Replace(var_def_statement el, IEnumerable newels) + { + var ind = FindIndex(el); + vars.RemoveAt(ind); + vars.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -15853,6 +17624,13 @@ namespace PascalABCCompiler.SyntaxTree this._parameters=_parameters; source_context = sc; } + // Конструкторы списка + public property_parameter_list(property_parameter elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _parameters=new List(); @@ -15872,6 +17650,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public property_parameter_list Add(property_parameter elem, SourceContext sc = null) + { + parameters.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(property_parameter el) + { + parameters.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + parameters.InsertRange(0, els); + } + + public void AddMany(params property_parameter[] els) + { + parameters.AddRange(els); + } + + private int FindIndex(property_parameter el) + { + var ind = parameters.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(property_parameter el, property_parameter newel) + { + parameters.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(property_parameter el, IEnumerable newels) + { + parameters.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(property_parameter el, property_parameter newel) + { + parameters.Insert(FindIndex(el), newel); + } + + public void InsertBefore(property_parameter el, IEnumerable newels) + { + parameters.InsertRange(FindIndex(el), newels); + } + + public bool Remove(property_parameter el) + { + return parameters.Remove(el); + } + + public void Replace(property_parameter el, property_parameter newel) + { + parameters[FindIndex(el)] = newel; + } + + public void Replace(property_parameter el, IEnumerable newels) + { + var ind = FindIndex(el); + parameters.RemoveAt(ind); + parameters.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -17242,6 +19090,13 @@ namespace PascalABCCompiler.SyntaxTree this._handlers=_handlers; source_context = sc; } + // Конструкторы списка + public exception_handler_list(exception_handler elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _handlers=new List(); @@ -17261,6 +19116,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public exception_handler_list Add(exception_handler elem, SourceContext sc = null) + { + handlers.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(exception_handler el) + { + handlers.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + handlers.InsertRange(0, els); + } + + public void AddMany(params exception_handler[] els) + { + handlers.AddRange(els); + } + + private int FindIndex(exception_handler el) + { + var ind = handlers.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(exception_handler el, exception_handler newel) + { + handlers.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(exception_handler el, IEnumerable newels) + { + handlers.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(exception_handler el, exception_handler newel) + { + handlers.Insert(FindIndex(el), newel); + } + + public void InsertBefore(exception_handler el, IEnumerable newels) + { + handlers.InsertRange(FindIndex(el), newels); + } + + public bool Remove(exception_handler el) + { + return handlers.Remove(el); + } + + public void Replace(exception_handler el, exception_handler newel) + { + handlers[FindIndex(el)] = newel; + } + + public void Replace(exception_handler el, IEnumerable newels) + { + var ind = FindIndex(el); + handlers.RemoveAt(ind); + handlers.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -18138,6 +20063,13 @@ namespace PascalABCCompiler.SyntaxTree this._namespaces=_namespaces; source_context = sc; } + // Конструкторы списка + public using_list(unit_or_namespace elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _namespaces=new List(); @@ -18157,6 +20089,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public using_list Add(unit_or_namespace elem, SourceContext sc = null) + { + namespaces.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(unit_or_namespace el) + { + namespaces.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + namespaces.InsertRange(0, els); + } + + public void AddMany(params unit_or_namespace[] els) + { + namespaces.AddRange(els); + } + + private int FindIndex(unit_or_namespace el) + { + var ind = namespaces.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(unit_or_namespace el, unit_or_namespace newel) + { + namespaces.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(unit_or_namespace el, IEnumerable newels) + { + namespaces.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(unit_or_namespace el, unit_or_namespace newel) + { + namespaces.Insert(FindIndex(el), newel); + } + + public void InsertBefore(unit_or_namespace el, IEnumerable newels) + { + namespaces.InsertRange(FindIndex(el), newels); + } + + public bool Remove(unit_or_namespace el) + { + return namespaces.Remove(el); + } + + public void Replace(unit_or_namespace el, unit_or_namespace newel) + { + namespaces[FindIndex(el)] = newel; + } + + public void Replace(unit_or_namespace el, IEnumerable newels) + { + var ind = FindIndex(el); + namespaces.RemoveAt(ind); + namespaces.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -18741,6 +20743,13 @@ namespace PascalABCCompiler.SyntaxTree this._types=_types; source_context = sc; } + // Конструкторы списка + public named_type_reference_list(named_type_reference elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _types=new List(); @@ -18760,6 +20769,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public named_type_reference_list Add(named_type_reference elem, SourceContext sc = null) + { + types.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(named_type_reference el) + { + types.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + types.InsertRange(0, els); + } + + public void AddMany(params named_type_reference[] els) + { + types.AddRange(els); + } + + private int FindIndex(named_type_reference el) + { + var ind = types.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(named_type_reference el, named_type_reference newel) + { + types.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(named_type_reference el, IEnumerable newels) + { + types.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(named_type_reference el, named_type_reference newel) + { + types.Insert(FindIndex(el), newel); + } + + public void InsertBefore(named_type_reference el, IEnumerable newels) + { + types.InsertRange(FindIndex(el), newels); + } + + public bool Remove(named_type_reference el) + { + return types.Remove(el); + } + + public void Replace(named_type_reference el, named_type_reference newel) + { + types[FindIndex(el)] = newel; + } + + public void Replace(named_type_reference el, IEnumerable newels) + { + var ind = FindIndex(el); + types.RemoveAt(ind); + types.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -18877,6 +20956,13 @@ namespace PascalABCCompiler.SyntaxTree this._params_list=_params_list; source_context = sc; } + // Конструкторы списка + public template_param_list(type_definition elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _params_list=new List(); @@ -18896,6 +20982,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public template_param_list Add(type_definition elem, SourceContext sc = null) + { + params_list.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(type_definition el) + { + params_list.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + params_list.InsertRange(0, els); + } + + public void AddMany(params type_definition[] els) + { + params_list.AddRange(els); + } + + private int FindIndex(type_definition el) + { + var ind = params_list.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(type_definition el, type_definition newel) + { + params_list.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(type_definition el, IEnumerable newels) + { + params_list.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(type_definition el, type_definition newel) + { + params_list.Insert(FindIndex(el), newel); + } + + public void InsertBefore(type_definition el, IEnumerable newels) + { + params_list.InsertRange(FindIndex(el), newels); + } + + public bool Remove(type_definition el) + { + return params_list.Remove(el); + } + + public void Replace(type_definition el, type_definition newel) + { + params_list[FindIndex(el)] = newel; + } + + public void Replace(type_definition el, IEnumerable newels) + { + var ind = FindIndex(el); + params_list.RemoveAt(ind); + params_list.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -19559,6 +21715,13 @@ namespace PascalABCCompiler.SyntaxTree this._defs=_defs; source_context = sc; } + // Конструкторы списка + public where_type_specificator_list(type_definition elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _defs=new List(); @@ -19578,6 +21741,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public where_type_specificator_list Add(type_definition elem, SourceContext sc = null) + { + defs.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(type_definition el) + { + defs.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + defs.InsertRange(0, els); + } + + public void AddMany(params type_definition[] els) + { + defs.AddRange(els); + } + + private int FindIndex(type_definition el) + { + var ind = defs.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(type_definition el, type_definition newel) + { + defs.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(type_definition el, IEnumerable newels) + { + defs.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(type_definition el, type_definition newel) + { + defs.Insert(FindIndex(el), newel); + } + + public void InsertBefore(type_definition el, IEnumerable newels) + { + defs.InsertRange(FindIndex(el), newels); + } + + public bool Remove(type_definition el) + { + return defs.Remove(el); + } + + public void Replace(type_definition el, type_definition newel) + { + defs[FindIndex(el)] = newel; + } + + public void Replace(type_definition el, IEnumerable newels) + { + var ind = FindIndex(el); + defs.RemoveAt(ind); + defs.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -19810,6 +22043,13 @@ namespace PascalABCCompiler.SyntaxTree this._defs=_defs; source_context = sc; } + // Конструкторы списка + public where_definition_list(where_definition elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _defs=new List(); @@ -19829,6 +22069,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public where_definition_list Add(where_definition elem, SourceContext sc = null) + { + defs.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(where_definition el) + { + defs.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + defs.InsertRange(0, els); + } + + public void AddMany(params where_definition[] els) + { + defs.AddRange(els); + } + + private int FindIndex(where_definition el) + { + var ind = defs.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(where_definition el, where_definition newel) + { + defs.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(where_definition el, IEnumerable newels) + { + defs.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(where_definition el, where_definition newel) + { + defs.Insert(FindIndex(el), newel); + } + + public void InsertBefore(where_definition el, IEnumerable newels) + { + defs.InsertRange(FindIndex(el), newels); + } + + public bool Remove(where_definition el) + { + return defs.Remove(el); + } + + public void Replace(where_definition el, where_definition newel) + { + defs[FindIndex(el)] = newel; + } + + public void Replace(where_definition el, IEnumerable newels) + { + var ind = FindIndex(el); + defs.RemoveAt(ind); + defs.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -21510,6 +23820,13 @@ namespace PascalABCCompiler.SyntaxTree this._enumerators=_enumerators; source_context = sc; } + // Конструкторы списка + public enumerator_list(enumerator elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _enumerators=new List(); @@ -21529,6 +23846,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public enumerator_list Add(enumerator elem, SourceContext sc = null) + { + enumerators.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(enumerator el) + { + enumerators.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + enumerators.InsertRange(0, els); + } + + public void AddMany(params enumerator[] els) + { + enumerators.AddRange(els); + } + + private int FindIndex(enumerator el) + { + var ind = enumerators.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(enumerator el, enumerator newel) + { + enumerators.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(enumerator el, IEnumerable newels) + { + enumerators.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(enumerator el, enumerator newel) + { + enumerators.Insert(FindIndex(el), newel); + } + + public void InsertBefore(enumerator el, IEnumerable newels) + { + enumerators.InsertRange(FindIndex(el), newels); + } + + public bool Remove(enumerator el) + { + return enumerators.Remove(el); + } + + public void Replace(enumerator el, enumerator newel) + { + enumerators[FindIndex(el)] = newel; + } + + public void Replace(enumerator el, IEnumerable newels) + { + var ind = FindIndex(el); + enumerators.RemoveAt(ind); + enumerators.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -21959,6 +24346,13 @@ namespace PascalABCCompiler.SyntaxTree this._attributes=_attributes; source_context = sc; } + // Конструкторы списка + public type_definition_attr_list(type_definition_attr elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _attributes=new List(); @@ -21978,6 +24372,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public type_definition_attr_list Add(type_definition_attr elem, SourceContext sc = null) + { + attributes.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(type_definition_attr el) + { + attributes.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + attributes.InsertRange(0, els); + } + + public void AddMany(params type_definition_attr[] els) + { + attributes.AddRange(els); + } + + private int FindIndex(type_definition_attr el) + { + var ind = attributes.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(type_definition_attr el, type_definition_attr newel) + { + attributes.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(type_definition_attr el, IEnumerable newels) + { + attributes.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(type_definition_attr el, type_definition_attr newel) + { + attributes.Insert(FindIndex(el), newel); + } + + public void InsertBefore(type_definition_attr el, IEnumerable newels) + { + attributes.InsertRange(FindIndex(el), newels); + } + + public bool Remove(type_definition_attr el) + { + return attributes.Remove(el); + } + + public void Replace(type_definition_attr el, type_definition_attr newel) + { + attributes[FindIndex(el)] = newel; + } + + public void Replace(type_definition_attr el, IEnumerable newels) + { + var ind = FindIndex(el); + attributes.RemoveAt(ind); + attributes.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -22361,6 +24825,13 @@ namespace PascalABCCompiler.SyntaxTree this._directives=_directives; source_context = sc; } + // Конструкторы списка + public compiler_directive_list(compiler_directive elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _directives=new List(); @@ -22380,6 +24851,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public compiler_directive_list Add(compiler_directive elem, SourceContext sc = null) + { + directives.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(compiler_directive el) + { + directives.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + directives.InsertRange(0, els); + } + + public void AddMany(params compiler_directive[] els) + { + directives.AddRange(els); + } + + private int FindIndex(compiler_directive el) + { + var ind = directives.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(compiler_directive el, compiler_directive newel) + { + directives.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(compiler_directive el, IEnumerable newels) + { + directives.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(compiler_directive el, compiler_directive newel) + { + directives.Insert(FindIndex(el), newel); + } + + public void InsertBefore(compiler_directive el, IEnumerable newels) + { + directives.InsertRange(FindIndex(el), newels); + } + + public bool Remove(compiler_directive el) + { + return directives.Remove(el); + } + + public void Replace(compiler_directive el, compiler_directive newel) + { + directives[FindIndex(el)] = newel; + } + + public void Replace(compiler_directive el, IEnumerable newels) + { + var ind = FindIndex(el); + directives.RemoveAt(ind); + directives.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -22661,6 +25202,13 @@ namespace PascalABCCompiler.SyntaxTree this._sections=_sections; source_context = sc; } + // Конструкторы списка + public documentation_comment_list(documentation_comment_section elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _sections=new List(); @@ -22680,6 +25228,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public documentation_comment_list Add(documentation_comment_section elem, SourceContext sc = null) + { + sections.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(documentation_comment_section el) + { + sections.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + sections.InsertRange(0, els); + } + + public void AddMany(params documentation_comment_section[] els) + { + sections.AddRange(els); + } + + private int FindIndex(documentation_comment_section el) + { + var ind = sections.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(documentation_comment_section el, documentation_comment_section newel) + { + sections.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(documentation_comment_section el, IEnumerable newels) + { + sections.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(documentation_comment_section el, documentation_comment_section newel) + { + sections.Insert(FindIndex(el), newel); + } + + public void InsertBefore(documentation_comment_section el, IEnumerable newels) + { + sections.InsertRange(FindIndex(el), newels); + } + + public bool Remove(documentation_comment_section el) + { + return sections.Remove(el); + } + + public void Replace(documentation_comment_section el, documentation_comment_section newel) + { + sections[FindIndex(el)] = newel; + } + + public void Replace(documentation_comment_section el, IEnumerable newels) + { + var ind = FindIndex(el); + sections.RemoveAt(ind); + sections.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -22782,6 +25400,13 @@ namespace PascalABCCompiler.SyntaxTree this._text=_text; source_context = sc; } + // Конструкторы списка + public documentation_comment_tag(documentation_comment_tag_param elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected string _name; protected List _parameters=new List(); @@ -22833,6 +25458,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public documentation_comment_tag Add(documentation_comment_tag_param elem, SourceContext sc = null) + { + parameters.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(documentation_comment_tag_param el) + { + parameters.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + parameters.InsertRange(0, els); + } + + public void AddMany(params documentation_comment_tag_param[] els) + { + parameters.AddRange(els); + } + + private int FindIndex(documentation_comment_tag_param el) + { + var ind = parameters.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(documentation_comment_tag_param el, documentation_comment_tag_param newel) + { + parameters.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(documentation_comment_tag_param el, IEnumerable newels) + { + parameters.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(documentation_comment_tag_param el, documentation_comment_tag_param newel) + { + parameters.Insert(FindIndex(el), newel); + } + + public void InsertBefore(documentation_comment_tag_param el, IEnumerable newels) + { + parameters.InsertRange(FindIndex(el), newels); + } + + public bool Remove(documentation_comment_tag_param el) + { + return parameters.Remove(el); + } + + public void Replace(documentation_comment_tag_param el, documentation_comment_tag_param newel) + { + parameters[FindIndex(el)] = newel; + } + + public void Replace(documentation_comment_tag_param el, IEnumerable newels) + { + var ind = FindIndex(el); + parameters.RemoveAt(ind); + parameters.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -23051,6 +25746,13 @@ namespace PascalABCCompiler.SyntaxTree this._text=_text; source_context = sc; } + // Конструкторы списка + public documentation_comment_section(documentation_comment_tag elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _tags=new List(); protected string _text; @@ -23086,6 +25788,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public documentation_comment_section Add(documentation_comment_tag elem, SourceContext sc = null) + { + tags.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(documentation_comment_tag el) + { + tags.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + tags.InsertRange(0, els); + } + + public void AddMany(params documentation_comment_tag[] els) + { + tags.AddRange(els); + } + + private int FindIndex(documentation_comment_tag el) + { + var ind = tags.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(documentation_comment_tag el, documentation_comment_tag newel) + { + tags.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(documentation_comment_tag el, IEnumerable newels) + { + tags.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(documentation_comment_tag el, documentation_comment_tag newel) + { + tags.Insert(FindIndex(el), newel); + } + + public void InsertBefore(documentation_comment_tag el, IEnumerable newels) + { + tags.InsertRange(FindIndex(el), newels); + } + + public bool Remove(documentation_comment_tag el) + { + return tags.Remove(el); + } + + public void Replace(documentation_comment_tag el, documentation_comment_tag newel) + { + tags[FindIndex(el)] = newel; + } + + public void Replace(documentation_comment_tag el, IEnumerable newels) + { + var ind = FindIndex(el); + tags.RemoveAt(ind); + tags.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -24096,6 +26868,13 @@ namespace PascalABCCompiler.SyntaxTree this._attributes=_attributes; source_context = sc; } + // Конструкторы списка + public simple_attribute_list(attribute elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _attributes=new List(); @@ -24115,6 +26894,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public simple_attribute_list Add(attribute elem, SourceContext sc = null) + { + attributes.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(attribute el) + { + attributes.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + attributes.InsertRange(0, els); + } + + public void AddMany(params attribute[] els) + { + attributes.AddRange(els); + } + + private int FindIndex(attribute el) + { + var ind = attributes.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(attribute el, attribute newel) + { + attributes.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(attribute el, IEnumerable newels) + { + attributes.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(attribute el, attribute newel) + { + attributes.Insert(FindIndex(el), newel); + } + + public void InsertBefore(attribute el, IEnumerable newels) + { + attributes.InsertRange(FindIndex(el), newels); + } + + public bool Remove(attribute el) + { + return attributes.Remove(el); + } + + public void Replace(attribute el, attribute newel) + { + attributes[FindIndex(el)] = newel; + } + + public void Replace(attribute el, IEnumerable newels) + { + var ind = FindIndex(el); + attributes.RemoveAt(ind); + attributes.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -24213,6 +27062,13 @@ namespace PascalABCCompiler.SyntaxTree this._attributes=_attributes; source_context = sc; } + // Конструкторы списка + public attribute_list(simple_attribute_list elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _attributes=new List(); @@ -24232,6 +27088,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public attribute_list Add(simple_attribute_list elem, SourceContext sc = null) + { + attributes.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(simple_attribute_list el) + { + attributes.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + attributes.InsertRange(0, els); + } + + public void AddMany(params simple_attribute_list[] els) + { + attributes.AddRange(els); + } + + private int FindIndex(simple_attribute_list el) + { + var ind = attributes.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(simple_attribute_list el, simple_attribute_list newel) + { + attributes.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(simple_attribute_list el, IEnumerable newels) + { + attributes.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(simple_attribute_list el, simple_attribute_list newel) + { + attributes.Insert(FindIndex(el), newel); + } + + public void InsertBefore(simple_attribute_list el, IEnumerable newels) + { + attributes.InsertRange(FindIndex(el), newels); + } + + public bool Remove(simple_attribute_list el) + { + return attributes.Remove(el); + } + + public void Replace(simple_attribute_list el, simple_attribute_list newel) + { + attributes[FindIndex(el)] = newel; + } + + public void Replace(simple_attribute_list el, IEnumerable newels) + { + var ind = FindIndex(el); + attributes.RemoveAt(ind); + attributes.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -24348,6 +27274,13 @@ namespace PascalABCCompiler.SyntaxTree this._substituting_node=_substituting_node; source_context = sc; } + // Конструкторы списка + public function_lambda_definition(declaration elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected ident_list _ident_list; protected type_definition _return_type; @@ -24511,6 +27444,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public function_lambda_definition Add(declaration elem, SourceContext sc = null) + { + defs.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(declaration el) + { + defs.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + defs.InsertRange(0, els); + } + + public void AddMany(params declaration[] els) + { + defs.AddRange(els); + } + + private int FindIndex(declaration el) + { + var ind = defs.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(declaration el, declaration newel) + { + defs.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(declaration el, IEnumerable newels) + { + defs.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(declaration el, declaration newel) + { + defs.Insert(FindIndex(el), newel); + } + + public void InsertBefore(declaration el, IEnumerable newels) + { + defs.InsertRange(FindIndex(el), newels); + } + + public bool Remove(declaration el) + { + return defs.Remove(el); + } + + public void Replace(declaration el, declaration newel) + { + defs[FindIndex(el)] = newel; + } + + public void Replace(declaration el, IEnumerable newels) + { + var ind = FindIndex(el); + defs.RemoveAt(ind); + defs.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -24788,6 +27791,13 @@ namespace PascalABCCompiler.SyntaxTree this._fictive=_fictive; source_context = sc; } + // Конструкторы списка + public semantic_check(syntax_tree_node elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected string _CheckName; protected List _param=new List(); @@ -24839,6 +27849,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public semantic_check Add(syntax_tree_node elem, SourceContext sc = null) + { + param.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(syntax_tree_node el) + { + param.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + param.InsertRange(0, els); + } + + public void AddMany(params syntax_tree_node[] els) + { + param.AddRange(els); + } + + private int FindIndex(syntax_tree_node el) + { + var ind = param.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(syntax_tree_node el, syntax_tree_node newel) + { + param.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(syntax_tree_node el, IEnumerable newels) + { + param.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(syntax_tree_node el, syntax_tree_node newel) + { + param.Insert(FindIndex(el), newel); + } + + public void InsertBefore(syntax_tree_node el, IEnumerable newels) + { + param.InsertRange(FindIndex(el), newels); + } + + public bool Remove(syntax_tree_node el) + { + return param.Remove(el); + } + + public void Replace(syntax_tree_node el, syntax_tree_node newel) + { + param[FindIndex(el)] = newel; + } + + public void Replace(syntax_tree_node el, IEnumerable newels) + { + var ind = FindIndex(el); + param.RemoveAt(ind); + param.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -25336,6 +28416,13 @@ namespace PascalABCCompiler.SyntaxTree this._name_expr=_name_expr; source_context = sc; } + // Конструкторы списка + public name_assign_expr_list(name_assign_expr elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _name_expr=new List(); @@ -25355,6 +28442,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public name_assign_expr_list Add(name_assign_expr elem, SourceContext sc = null) + { + name_expr.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(name_assign_expr el) + { + name_expr.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + name_expr.InsertRange(0, els); + } + + public void AddMany(params name_assign_expr[] els) + { + name_expr.AddRange(els); + } + + private int FindIndex(name_assign_expr el) + { + var ind = name_expr.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(name_assign_expr el, name_assign_expr newel) + { + name_expr.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(name_assign_expr el, IEnumerable newels) + { + name_expr.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(name_assign_expr el, name_assign_expr newel) + { + name_expr.Insert(FindIndex(el), newel); + } + + public void InsertBefore(name_assign_expr el, IEnumerable newels) + { + name_expr.InsertRange(FindIndex(el), newels); + } + + public bool Remove(name_assign_expr el) + { + return name_expr.Remove(el); + } + + public void Replace(name_assign_expr el, name_assign_expr newel) + { + name_expr[FindIndex(el)] = newel; + } + + public void Replace(name_assign_expr el, IEnumerable newels) + { + var ind = FindIndex(el); + name_expr.RemoveAt(ind); + name_expr.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -27175,6 +30332,13 @@ namespace PascalABCCompiler.SyntaxTree this._variables=_variables; source_context = sc; } + // Конструкторы списка + public addressed_value_list(addressed_value elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _variables=new List(); @@ -27198,16 +30362,81 @@ namespace PascalABCCompiler.SyntaxTree { variables.Add(av); } - public addressed_value_list(addressed_value av, SourceContext sc) - { - variables.Add(av); - source_context = sc; - } public void Add(addressed_value av) { variables.Add(av); } + // Методы списка + public addressed_value_list Add(addressed_value elem, SourceContext sc = null) + { + variables.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(addressed_value el) + { + variables.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + variables.InsertRange(0, els); + } + + public void AddMany(params addressed_value[] els) + { + variables.AddRange(els); + } + + private int FindIndex(addressed_value el) + { + var ind = variables.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(addressed_value el, addressed_value newel) + { + variables.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(addressed_value el, IEnumerable newels) + { + variables.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(addressed_value el, addressed_value newel) + { + variables.Insert(FindIndex(el), newel); + } + + public void InsertBefore(addressed_value el, IEnumerable newels) + { + variables.InsertRange(FindIndex(el), newels); + } + + public bool Remove(addressed_value el) + { + return variables.Remove(el); + } + + public void Replace(addressed_value el, addressed_value newel) + { + variables[FindIndex(el)] = newel; + } + + public void Replace(addressed_value el, IEnumerable newels) + { + var ind = FindIndex(el); + variables.RemoveAt(ind); + variables.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// @@ -27436,6 +30665,13 @@ namespace PascalABCCompiler.SyntaxTree this._listunitsections=_listunitsections; source_context = sc; } + // Конструкторы списка + public uses_closure(uses_list elem, SourceContext sc = null) + { + Add(elem, sc); + } + + // Окончание конструкторов списка protected List _listunitsections=new List(); @@ -27455,6 +30691,76 @@ namespace PascalABCCompiler.SyntaxTree } + // Методы списка + public uses_closure Add(uses_list elem, SourceContext sc = null) + { + listunitsections.Add(elem); + if (sc != null) + source_context = sc; + return this; + } + + public void AddFirst(uses_list el) + { + listunitsections.Insert(0, el); + } + + public void AddFirst(IEnumerable els) + { + listunitsections.InsertRange(0, els); + } + + public void AddMany(params uses_list[] els) + { + listunitsections.AddRange(els); + } + + private int FindIndex(uses_list el) + { + var ind = listunitsections.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); + return ind; + } + + public void InsertAfter(uses_list el, uses_list newel) + { + listunitsections.Insert(FindIndex(el) + 1, newel); + } + + public void InsertAfter(uses_list el, IEnumerable newels) + { + listunitsections.InsertRange(FindIndex(el) + 1, newels); + } + + public void InsertBefore(uses_list el, uses_list newel) + { + listunitsections.Insert(FindIndex(el), newel); + } + + public void InsertBefore(uses_list el, IEnumerable newels) + { + listunitsections.InsertRange(FindIndex(el), newels); + } + + public bool Remove(uses_list el) + { + return listunitsections.Remove(el); + } + + public void Replace(uses_list el, uses_list newel) + { + listunitsections[FindIndex(el)] = newel; + } + + public void Replace(uses_list el, IEnumerable newels) + { + var ind = FindIndex(el); + listunitsections.RemoveAt(ind); + listunitsections.InsertRange(ind, newels); + } + + // Окончание методов списка /// ///Свойство для получения количества всех подузлов без элементов поля типа List /// diff --git a/SyntaxTree/tree/TreeHelper.cs b/SyntaxTree/tree/TreeHelper.cs index 3249aaa8f..0750e65c4 100644 --- a/SyntaxTree/tree/TreeHelper.cs +++ b/SyntaxTree/tree/TreeHelper.cs @@ -67,80 +67,23 @@ namespace PascalABCCompiler.SyntaxTree public partial class statement_list { - public statement_list(statement st, SourceContext sc) - { - Add(st, sc); - } public statement_list(params statement[] sts) { AddMany(sts); } - public statement_list Add(statement st, SourceContext sc = null) - { - subnodes.Add(st); - if (sc != null) - source_context = sc; - return this; - } + //-- List members begin public List list { get { return subnodes; } } - public void AddMany(params statement[] els) - { - list.AddRange(els); - } + public void AddMany(IEnumerable els) { list.AddRange(els); } - public bool Remove(statement el) - { - return list.Remove(el); - } - private int FindIndex(statement el) - { - var ind = list.FindIndex(x => x == el); - if (ind == -1) - throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); - return ind; - } - public void Replace(statement el, statement newel) - { - list[FindIndex(el)] = newel; - } - public void Replace(statement el, IEnumerable newels) - { - var ind = FindIndex(el); - list.RemoveAt(ind); - list.InsertRange(ind,newels); - } - public void InsertAfter(statement el, statement newel) - { - list.Insert(FindIndex(el) + 1, newel); - } - public void InsertBefore(statement el, statement newel) - { - list.Insert(FindIndex(el), newel); - } - public void InsertAfter(statement el, IEnumerable newels) - { - list.InsertRange(FindIndex(el) + 1, newels); - } - public void InsertBefore(statement el, IEnumerable newels) - { - list.InsertRange(FindIndex(el), newels); - } - public void AddFirst(statement el) - { - list.Insert(0, el); - } - public void AddFirst(IEnumerable els) - { - list.InsertRange(0, els); - } + public static statement_list Empty { get { return new statement_list(); } @@ -251,17 +194,7 @@ namespace PascalABCCompiler.SyntaxTree { this.names = name.Split('.').Select(s => new ident(s)).ToList(); } - public named_type_reference(ident id, SourceContext sc = null) - { - Add(id, sc); - } - public named_type_reference Add(ident id, SourceContext sc = null) - { - names.Add(id); - if (sc != null) - source_context = sc; - return this; - } + public override string ToString() { var sb = new System.Text.StringBuilder(); @@ -297,74 +230,22 @@ namespace PascalABCCompiler.SyntaxTree public partial class variable_definitions { - public variable_definitions(var_def_statement _var_def_statement, SourceContext sc = null) - { - Add(_var_def_statement, sc); - } - public variable_definitions Add(var_def_statement _var_def_statement, SourceContext sc = null) - { - var_definitions.Add(_var_def_statement); - if (sc != null) - source_context = sc; - return this; - } //-- List members begin public List list { get { return var_definitions; } } - public void AddMany(params var_def_statement[] sts) - { - list.AddRange(sts); - } - public bool Remove(var_def_statement st) - { - return list.Remove(st); - } - private int FindIndex(var_def_statement st) - { - var ind = list.FindIndex(x => x == st); - if (ind == -1) - throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, st)); - return ind; - } - public void Replace(var_def_statement st, var_def_statement newst) - { - list[FindIndex(st)] = newst; - } - public void InsertAfter(var_def_statement st, var_def_statement newst) - { - list.Insert(FindIndex(st) + 1, newst); - } - public void InsertBefore(var_def_statement st, var_def_statement newst) - { - list.Insert(FindIndex(st), newst); - } - public void AddFirst(var_def_statement st) - { - list.Insert(0, st); - } //-- List members end } public partial class ident_list { - public ident_list(ident id, SourceContext sc) + public ident_list(params ident[] idents) { - Add(id, sc); - } - public ident_list(params ident[] ids) - { - AddMany(ids); - } - public ident_list Add(ident id, SourceContext sc = null) - { - idents.Add(id); - if (sc != null) - source_context = sc; - return this; + this.idents = idents.ToList(); } + public override string ToString() { var sb = new System.Text.StringBuilder(); @@ -379,37 +260,6 @@ namespace PascalABCCompiler.SyntaxTree get { return idents; } } - public void AddMany(params ident[] els) - { - list.AddRange(els); - } - public bool Remove(ident el) - { - return list.Remove(el); - } - private int FindIndex(ident el) - { - var ind = list.FindIndex(x => x == el); - if (ind == -1) - throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); - return ind; - } - public void Replace(ident el, ident newel) - { - list[FindIndex(el)] = newel; - } - public void InsertAfter(ident el, ident newel) - { - list.Insert(FindIndex(el) + 1, newel); - } - public void InsertBefore(ident el, ident newel) - { - list.Insert(FindIndex(el), newel); - } - public void AddFirst(ident el) - { - list.Insert(0, el); - } //-- List members end } @@ -451,72 +301,13 @@ namespace PascalABCCompiler.SyntaxTree public partial class declarations { - public declarations(declaration _declaration, SourceContext sc = null) - { - Add(_declaration, sc); - } - public declarations Add(declaration _declaration, SourceContext sc = null) - { - defs.Add(_declaration); - if (sc != null) - source_context = sc; - return this; - } //-- List members begin public List list { get { return defs; } } - public void AddMany(params declaration[] els) - { - list.AddRange(els); - } - public bool Remove(declaration el) - { - return list.Remove(el); - } - private int FindIndex(declaration el) - { - var ind = list.FindIndex(x => x == el); - if (ind == -1) - throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); - return ind; - } - public void Replace(declaration el, declaration newel) - { - list[FindIndex(el)] = newel; - } - public void Replace(declaration el, IEnumerable newels) - { - var ind = FindIndex(el); - list.RemoveAt(ind); - list.InsertRange(ind, newels); - } - public void InsertAfter(declaration el, declaration newel) - { - list.Insert(FindIndex(el) + 1, newel); - } - public void InsertBefore(declaration el, declaration newel) - { - list.Insert(FindIndex(el), newel); - } - public void InsertAfter(declaration el, IEnumerable newels) - { - list.InsertRange(FindIndex(el) + 1, newels); - } - public void InsertBefore(declaration el, IEnumerable newels) - { - list.InsertRange(FindIndex(el), newels); - } - public void AddFirst(declaration el) - { - list.Insert(0, el); - } - public void AddFirst(IEnumerable els) - { - list.InsertRange(0, els); - } + public static statement_list Empty { get { return new statement_list(); } @@ -526,17 +317,7 @@ namespace PascalABCCompiler.SyntaxTree public partial class program_tree { - public program_tree(compilation_unit cu, SourceContext sc = null) - { - Add(cu, sc); - } - public program_tree Add(compilation_unit cu, SourceContext sc = null) - { - compilation_units.Add(cu); - if (sc != null) - source_context = sc; - return this; - } + } public partial class program_name @@ -557,17 +338,6 @@ namespace PascalABCCompiler.SyntaxTree public partial class expression_list { - public expression_list(expression _expression, SourceContext sc = null) - { - Add(_expression, sc); - } - public expression_list Add(expression _expression, SourceContext sc = null) - { - expressions.Add(_expression); - if (sc != null) - source_context = sc; - return this; - } public static expression_list Empty { get { return new expression_list(); } @@ -605,17 +375,7 @@ namespace PascalABCCompiler.SyntaxTree public partial class indexers_types { - public indexers_types(type_definition _type_definition, SourceContext sc = null) - { - Add(_type_definition, sc); - } - public indexers_types Add(type_definition _type_definition, SourceContext sc = null) - { - indexers.Add(_type_definition); - if (sc != null) - source_context = sc; - return this; - } + } public partial class label_definitions @@ -654,17 +414,6 @@ namespace PascalABCCompiler.SyntaxTree public partial class formal_parameters { - public formal_parameters(typed_parameters _typed_parameters, SourceContext sc = null) - { - Add(_typed_parameters, sc); - } - public formal_parameters Add(typed_parameters _typed_parameters, SourceContext sc = null) - { - params_list.Add(_typed_parameters); - if (sc != null) - source_context = sc; - return this; - } public override string ToString() { return string.Join(",", params_list.Select(p => p.ToString())); @@ -677,19 +426,8 @@ namespace PascalABCCompiler.SyntaxTree /// public partial class procedure_attributes_list { - public procedure_attributes_list(procedure_attribute _procedure_attribute, SourceContext sc = null) - { - Add(_procedure_attribute, sc); - } public procedure_attributes_list(proc_attribute attr, SourceContext sc = null) : this(new procedure_attribute(attr), sc) { } - public procedure_attributes_list Add(procedure_attribute _procedure_attribute, SourceContext sc = null) - { - proc_attributes.Add(_procedure_attribute); - if (sc != null) - source_context = sc; - return this; - } } public partial class procedure_header @@ -862,32 +600,12 @@ namespace PascalABCCompiler.SyntaxTree public partial class type_declarations { - public type_declarations(type_declaration _type_declaration, SourceContext sc = null) - { - Add(_type_declaration, sc); - } - public type_declarations Add(type_declaration _type_declaration, SourceContext sc = null) - { - types_decl.Add(_type_declaration); - if (sc != null) - source_context = sc; - return this; - } + } public partial class consts_definitions_list { - public consts_definitions_list(const_definition _const_definition, SourceContext sc = null) - { - Add(_const_definition, sc); - } - public consts_definitions_list Add(const_definition _const_definition, SourceContext sc = null) - { - const_defs.Add(_const_definition); - if (sc != null) - source_context = sc; - return this; - } + } public partial class unit_or_namespace @@ -904,18 +622,7 @@ namespace PascalABCCompiler.SyntaxTree { Add(new unit_or_namespace(name), sc); } - public uses_list(unit_or_namespace un, SourceContext sc = null) - { - Add(un, sc); - } - - public uses_list Add(unit_or_namespace un, SourceContext sc = null) - { - units.Add(un); - if (sc != null) - source_context = sc; - return this; - } + public uses_list AddUsesList(uses_list ul, SourceContext sc = null) { foreach (var un in ul.units) @@ -1058,21 +765,12 @@ namespace PascalABCCompiler.SyntaxTree { get { return new class_members(access_modifer.private_modifer); } } - public class_members(declaration _declaration, SourceContext sc = null) - { - Add(_declaration, sc); - } + public class_members(access_modifer access) { access_mod = new access_modifer_node(access); } - public class_members Add(declaration _declaration, SourceContext sc) - { - members.Add(_declaration); - if (sc != null) - source_context = sc; - return this; - } + public class_members Add(params declaration[] decls) { foreach (var d in decls) @@ -1083,17 +781,7 @@ namespace PascalABCCompiler.SyntaxTree public partial class class_body { - public class_body(class_members _class_members, SourceContext sc = null) - { - Add(_class_members, sc); - } - public class_body Add(class_members _class_members, SourceContext sc = null) - { - class_def_blocks.Add(_class_members); - if (sc != null) - source_context = sc; - return this; - } + } public partial class class_definition @@ -1107,62 +795,22 @@ namespace PascalABCCompiler.SyntaxTree public partial class record_const { - public record_const(record_const_definition _record_const_definition, SourceContext sc = null) - { - Add(_record_const_definition, sc); - } - public record_const Add(record_const_definition _record_const_definition, SourceContext sc = null) - { - rec_consts.Add(_record_const_definition); - if (sc != null) - source_context = sc; - return this; - } + } public partial class literal_const_line { - public literal_const_line(literal _literal, SourceContext sc = null) - { - Add(_literal, sc); - } - public literal_const_line Add(literal _literal, SourceContext sc = null) - { - literals.Add(_literal); - if (sc != null) - source_context = sc; - return this; - } + } public partial class variant_list { - public variant_list(variant _variant, SourceContext sc = null) - { - Add(_variant, sc); - } - public variant_list Add(variant _variant, SourceContext sc = null) - { - vars.Add(_variant); - if (sc != null) - source_context = sc; - return this; - } + } public partial class variant_types { - public variant_types(variant_type _variant_type, SourceContext sc = null) - { - Add(_variant_type, sc); - } - public variant_types Add(variant_type _variant_type, SourceContext sc = null) - { - vars.Add(_variant_type); - if (sc != null) - source_context = sc; - return this; - } + } public partial class procedure_call @@ -1208,47 +856,17 @@ namespace PascalABCCompiler.SyntaxTree public partial class case_variants { - public case_variants(case_variant _case_variant, SourceContext sc = null) - { - Add(_case_variant, sc); - } - public case_variants Add(case_variant _case_variant, SourceContext sc = null) - { - variants.Add(_case_variant); - if (sc != null) - source_context = sc; - return this; - } + } public partial class var_def_list_for_record { - public var_def_list_for_record(var_def_statement _var_def_statement, SourceContext sc = null) - { - Add(_var_def_statement, sc); - } - public var_def_list_for_record Add(var_def_statement _var_def_statement, SourceContext sc = null) - { - vars.Add(_var_def_statement); - if (sc != null) - source_context = sc; - return this; - } + } public partial class property_parameter_list { - public property_parameter_list(property_parameter _property_parameter, SourceContext sc = null) - { - Add(_property_parameter, sc); - } - public property_parameter_list Add(property_parameter _property_parameter, SourceContext sc = null) - { - parameters.Add(_property_parameter); - if (sc != null) - source_context = sc; - return this; - } + } public partial class initfinal_part @@ -1278,25 +896,11 @@ namespace PascalABCCompiler.SyntaxTree public partial class exception_handler_list { - public exception_handler_list(exception_handler _exception_handler, SourceContext sc = null) - { - Add(_exception_handler, sc); - } - public exception_handler_list Add(exception_handler _exception_handler, SourceContext sc = null) - { - handlers.Add(_exception_handler); - if (sc != null) - source_context = sc; - return this; - } + } public partial class named_type_reference_list { - public named_type_reference_list(named_type_reference _named_type_reference, SourceContext sc = null) - { - Add(_named_type_reference, sc); - } public named_type_reference_list(string name) { Add(new named_type_reference(name)); @@ -1306,13 +910,7 @@ namespace PascalABCCompiler.SyntaxTree Add(new named_type_reference(name1)); Add(new named_type_reference(name2)); } - public named_type_reference_list Add(named_type_reference _named_type_reference, SourceContext sc = null) - { - types.Add(_named_type_reference); - if (sc != null) - source_context = sc; - return this; - } + public override string ToString() { return string.Join(",", this.types.Select(x => x.ToString()).ToArray()); @@ -1326,19 +924,6 @@ namespace PascalABCCompiler.SyntaxTree foreach (var ntr in names.Split(',').Select(s => new named_type_reference(s))) Add(ntr); } - - public template_param_list(type_definition _type_definition, SourceContext sc = null) - { - Add(_type_definition, sc); - } - - public template_param_list Add(type_definition _type_definition, SourceContext sc = null) - { - params_list.Add(_type_definition); - if (sc != null) - source_context = sc; - return this; - } } public partial class int64_const @@ -1373,32 +958,12 @@ namespace PascalABCCompiler.SyntaxTree public partial class where_type_specificator_list { - public where_type_specificator_list(type_definition _type_definition, SourceContext sc = null) - { - Add(_type_definition, sc); - } - public where_type_specificator_list Add(type_definition _type_definition, SourceContext sc = null) - { - defs.Add(_type_definition); - if (sc != null) - source_context = sc; - return this; - } + } public partial class where_definition_list { - public where_definition_list(where_definition _where_definition, SourceContext sc = null) - { - Add(_where_definition, sc); - } - public where_definition_list Add(where_definition _where_definition, SourceContext sc = null) - { - defs.Add(_where_definition); - if (sc != null) - source_context = sc; - return this; - } + } public partial class var_statement @@ -1441,77 +1006,27 @@ namespace PascalABCCompiler.SyntaxTree public partial class enumerator_list { - public enumerator_list(enumerator _enumerator, SourceContext sc = null) - { - Add(_enumerator, sc); - } - public enumerator_list Add(enumerator _enumerator, SourceContext sc = null) - { - enumerators.Add(_enumerator); - if (sc != null) - source_context = sc; - return this; - } + } public partial class type_definition_attr_list { - public type_definition_attr_list(type_definition_attr _type_definition_attr, SourceContext sc = null) - { - Add(_type_definition_attr, sc); - } - public type_definition_attr_list Add(type_definition_attr _type_definition_attr, SourceContext sc = null) - { - attributes.Add(_type_definition_attr); - if (sc != null) - source_context = sc; - return this; - } + } public partial class compiler_directive_list { - public compiler_directive_list(compiler_directive _compiler_directive, SourceContext sc = null) - { - Add(_compiler_directive, sc); - } - public compiler_directive_list Add(compiler_directive _compiler_directive, SourceContext sc = null) - { - directives.Add(_compiler_directive); - if (sc != null) - source_context = sc; - return this; - } + } public partial class documentation_comment_list { - public documentation_comment_list(documentation_comment_section _documentation_comment_section, SourceContext sc = null) - { - Add(_documentation_comment_section, sc); - } - public documentation_comment_list Add(documentation_comment_section _documentation_comment_section, SourceContext sc = null) - { - sections.Add(_documentation_comment_section); - if (sc != null) - source_context = sc; - return this; - } + } public partial class documentation_comment_section { - public documentation_comment_section(documentation_comment_tag _documentation_comment_tag, SourceContext sc = null) - { - Add(_documentation_comment_tag, sc); - } - public documentation_comment_section Add(documentation_comment_tag _documentation_comment_tag, SourceContext sc = null) - { - tags.Add(_documentation_comment_tag); - if (sc != null) - source_context = sc; - return this; - } + } public partial class bracket_expr @@ -1524,32 +1039,12 @@ namespace PascalABCCompiler.SyntaxTree public partial class simple_attribute_list { - public simple_attribute_list(attribute _attribute, SourceContext sc = null) - { - Add(_attribute, sc); - } - public simple_attribute_list Add(attribute _attribute, SourceContext sc = null) - { - attributes.Add(_attribute); - if (sc != null) - source_context = sc; - return this; - } + } public partial class attribute_list { - public attribute_list(simple_attribute_list _simple_attribute_list, SourceContext sc = null) - { - Add(_simple_attribute_list, sc); - } - public attribute_list Add(simple_attribute_list _simple_attribute_list, SourceContext sc = null) - { - attributes.Add(_simple_attribute_list); - if (sc != null) - source_context = sc; - return this; - } + } public partial class function_lambda_definition @@ -1597,13 +1092,7 @@ namespace PascalABCCompiler.SyntaxTree public partial class name_assign_expr_list { - public name_assign_expr_list Add(name_assign_expr ne, SourceContext sc = null) - { - name_expr.Add(ne); - if (sc != null) - source_context = sc; - return this; - } + } public partial class unnamed_type_object @@ -1679,17 +1168,7 @@ namespace PascalABCCompiler.SyntaxTree public partial class uses_closure { - public uses_closure(uses_list st, SourceContext sc) - { - Add(st, sc); - } - public uses_closure Add(uses_list ul, SourceContext sc = null) - { - listunitsections.Add(ul); - if (sc != null) - source_context = sc; - return this; - } + } diff --git a/SyntaxTree/tree/tree.nin b/SyntaxTree/tree/tree.nin index 8e6ec163f..4f0b0b5c8 100644 Binary files a/SyntaxTree/tree/tree.nin and b/SyntaxTree/tree/tree.nin differ diff --git a/Utils/NodesGeneratorNew/NodeGenerator.cs b/Utils/NodesGeneratorNew/NodeGenerator.cs index 86d5d2537..173ba5616 100644 --- a/Utils/NodesGeneratorNew/NodeGenerator.cs +++ b/Utils/NodesGeneratorNew/NodeGenerator.cs @@ -241,7 +241,144 @@ namespace NodeGenerator } "; - public static string change_word(string where,string from,string to) + // Шаблоны кода для узлов, содержащих список + + // Методы + + // переменные шаблона: + // list_name имя поля, типа List + // list_element_type тип элементов списка + // node_name название узла + + public static readonly string list_add_many_method = +@" public void AddMany(params list_element_type[] els) + { + list_name.AddRange(els); + } +"; + public static readonly string list_remove_method = +@" public bool Remove(list_element_type el) + { + return list_name.Remove(el); + } +"; + public static readonly string list_find_index_method = +@" private int FindIndex(list_element_type el) + { + var ind = list_name.FindIndex(x => x == el); + if (ind == -1) + throw new Exception(string.Format(""У списка {0} не найден элемент {1} среди дочерних\n"", this, el)); + return ind; + } +"; + public static readonly string list_replace_method = +@" public void Replace(list_element_type el, list_element_type newel) + { + list_name[FindIndex(el)] = newel; + } +"; + public static readonly string list_replace_many_method = +@" public void Replace(list_element_type el, IEnumerable newels) + { + var ind = FindIndex(el); + list_name.RemoveAt(ind); + list_name.InsertRange(ind, newels); + } +"; + public static readonly string list_insert_after_method = +@" public void InsertAfter(list_element_type el, list_element_type newel) + { + list_name.Insert(FindIndex(el) + 1, newel); + } +"; + public static readonly string list_insert_before_method = +@" public void InsertBefore(list_element_type el, list_element_type newel) + { + list_name.Insert(FindIndex(el), newel); + } +"; + public static readonly string list_insert_after_many_method = +@" public void InsertAfter(list_element_type el, IEnumerable newels) + { + list_name.InsertRange(FindIndex(el) + 1, newels); + } +"; + public static readonly string list_insert_before_many_method = +@" public void InsertBefore(list_element_type el, IEnumerable newels) + { + list_name.InsertRange(FindIndex(el), newels); + } +"; + public static readonly string list_add_first_method = +@" public void AddFirst(list_element_type el) + { + list_name.Insert(0, el); + } +"; + + public static readonly string list_add_first_many_method = +@" public void AddFirst(IEnumerable els) + { + list_name.InsertRange(0, els); + } +"; + public static readonly string list_add_method = +@" public node_name Add(list_element_type elem, SourceContext sc = null) + { + list_name.Add(elem); + if (sc != null) + source_context = sc; + return this; + } +"; + + public static readonly string[] list_methods = + { + list_add_method, + list_add_first_method, + list_add_first_many_method, + list_add_many_method, + list_find_index_method, + list_insert_after_method, + list_insert_after_many_method, + list_insert_before_method, + list_insert_before_many_method, + list_remove_method, + list_replace_method, + list_replace_many_method + }; + + // !Методы + + // Конструкторы + + // переменные шаблона: + // list_name имя поля, типа List + // list_element_type тип элементов списка + // node_name имя узла + + public static readonly string list_one_element_constructor = +@" public node_name(list_element_type elem, SourceContext sc = null) + { + Add(elem, sc); + } +"; + public static readonly string[] list_constructors = + { + list_one_element_constructor + }; + + // !Конструкторы + + // Свойства + + public static readonly string[] list_properties; + + // !Свойства + + // !Шаблоны кода для узлов, содержащих список + + public static string change_word(string where,string from,string to) { Regex rg=new Regex(from); return rg.Replace(where,to); @@ -259,9 +396,26 @@ namespace NodeGenerator where=change_word(where,sr); } return where; - } + } - public static string create_property(string property_type,string property_name,string field_name,string help_context) + /// + /// Производит замены в списке строк + /// + /// Список строк, в которых необходимо произвести замену + /// Список замен + /// Результат замен + public static string[] change_words_in_list(string[] list, params string_repl[] replacements) + { + string[] result = new string[list.Count()]; + + for (int i = 0; i < list.Count(); ++i) + result[i] = change_words(list[i], replacements); + + return result; + } + + + public static string create_property(string property_type,string property_name,string field_name,string help_context) { return change_words(prop_template,new string_repl("property_type",property_type), new string_repl("property_name",property_name),new string_repl("field_name",field_name), @@ -283,9 +437,53 @@ namespace NodeGenerator public static string create_simple_constructor(string class_name) { return change_words(simple_constructor_template,new string_repl("class_name",class_name)); - } + } - } + + /// + /// Генерирует конструкторы для списков, используя + /// + /// Название поля-списка + /// Тип элементов списка + /// Название синтаксического узла + /// Код конструкторов + public static string generate_list_constructors(string list_field_name, string list_elem_type, string node_name) + { + // Для всех шаблонов конструкторов подставляем значения переменных шаблона + string[] constructors = change_words_in_list(list_constructors, + new string_repl("list_name", list_field_name), + new string_repl("list_element_type", list_elem_type), + new string_repl("node_name", node_name)); + + return string.Join(Environment.NewLine, constructors); + } + + /// + /// Генерирует методы для списков, используя + /// + /// Название поля-списка + /// Тип элементов списка + /// Название синтаксического узла + /// Код методов + public static string generate_list_methods(string list_field_name, string list_elem_type, string node_name) + { + string[] methods = change_words_in_list(list_methods, + new string_repl("list_name", list_field_name), + new string_repl("list_element_type", list_elem_type), + new string_repl("node_name", node_name)); + + return string.Join(Environment.NewLine, methods); + } + + /// + /// Генерирует свойства для списков, используя + /// + /// Код свойств + public static string generate_list_properties() + { + throw new NotImplementedException(); + } + } [Serializable] public class HelpContext @@ -2921,7 +3119,66 @@ namespace NodeGenerator } //\ssyy - public void generate_code(StreamWriter sw,HelpStorage hst) + // !Генерация кода для узлов, содержащих список + + /// + /// Генерация методов для узлов, содержащих список наследников syntax_tree_node (если такой список есть) + /// + /// Writer потока, в который добавляется сгенерированный код + private void generate_list_methods(StreamWriter sw) + { + // Генерируем методы только для одного поля-списка + // Получаем первый список узлов-наследников syntax_tree_node + var list_fields = subnodes.OfType().Where(field => field.val_field_type_name.StartsWith("List<")); + simple_element list_field = null; + if (list_fields.Count() > 0) + list_field = list_fields.First(); + + // Записываем код методов, если узел найден + if (list_field != null) + { + sw.WriteLine(text_consts.tab2 + "// Методы списка"); + sw.WriteLine(text_consts.generate_list_methods(list_field.field_name, list_field.list_type, this.node_name)); + sw.WriteLine(text_consts.tab2 + "// Окончание методов списка"); + } + } + + /// + /// Генерация конструкторов для узлов, содержащих список наследников syntax_tree_node (если такой список есть) + /// + /// Writer потока, в который добавляется сгенерированный код + private void generate_list_constructors(StreamWriter sw) + { + // Генерируем конструкторы только для одного поля-списка + // Получаем первый список узлов-наследников syntax_tree_node + var list_fields = subnodes.OfType().Where(field => field.val_field_type_name.StartsWith("List<")); + simple_element list_field = null; + if (list_fields.Count() > 0) + list_field = list_fields.First(); + + // Записываем код методов, если узел найден + if (list_field != null) + { + sw.WriteLine(text_consts.tab2 + "// Конструкторы списка"); + sw.WriteLine(text_consts.generate_list_constructors(list_field.field_name, list_field.list_type, this.node_name)); + sw.WriteLine(text_consts.tab2 + "// Окончание конструкторов списка"); + } + } + + /// + /// Генерация конструкторов для узлов, содержащих список наследников syntax_tree_node (если такой список есть) + /// + /// Writer потока, в который добавляется сгенерированный код + private void generate_list_properties(StreamWriter sw) + { + // TODO: реализовать генерацию свойств + + //sw.WriteLine(text_consts.generate_list_properties()); + } + + // !Генерация кода для узлов, содержащих список + + public void generate_code(StreamWriter sw,HelpStorage hst) { //sw.WriteLine(); @@ -2962,6 +3219,8 @@ namespace NodeGenerator generate_big_constructor_code(sw, true, true); } + generate_list_constructors(sw); + sw.WriteLine(); foreach (node_field_info nfi in _subnodes) { @@ -2979,6 +3238,8 @@ namespace NodeGenerator if (_subnodes.Count>0) sw.WriteLine(); + generate_list_properties(sw); + foreach (method_info mi in _methods) { mi.generate_code(sw, this, hst); @@ -2987,6 +3248,8 @@ namespace NodeGenerator if (_methods.Count > 0) sw.WriteLine(); + generate_list_methods(sw); + generate_subnodes_number_property(sw); generate_indexer(sw);