Деактивация кнопок, связанных с Intellisense, для языков без Intellisense + разделение ILanguageInformation на два интерфейса (#3378)
* Refactor language information classes * Implement SimpleLanguageInformation abstract class * Move some properties to SimpleLanguageInformation * Implement format and debug buttons disabling if Intellisense is not supported for current language * Add Intellisense available check in FormsExtensions to deactivate menu items if needed * Change function interfaces in VisibilityService * Replace CodeCompletionController.CurrentParser null checks with IntellisenseAvailable method call * Refactor IParser and BaseParser to deduplicate code * Fix BuildTreeInSpecialMode in SPythonParser * Add SimpleParser class for new languages without Intellisense * Delete duplicate SetDebugButtonsEnabled function * Add Intellisense available check in RunService when attaching debugger * Delete inner check in SetDebugButtonsEnabled to improve architecture * Change CurrentParser property in CodeCompletion to be CurrentLanguage * Divide ILanguageInformation into two interfaces (creating new ILanguageIntellisenseSupport) * Fix LanguageIntellisenseSupport initialization in BaseLanguage * Fix RunService fictive_attach logic * Disable Intellisense parsing for languages without Intellisense support * Add DefaultLanguageInformation abstract class * Add default implementation for SetSemanticConstants in BaseLanguage * Simplify IParser interface * Update developer guide documentation
This commit is contained in:
parent
333201895f
commit
b23f9c96d0
File diff suppressed because it is too large
Load diff
|
|
@ -11,6 +11,7 @@ namespace Languages.SPython
|
|||
public SPythonLanguage() : base(
|
||||
|
||||
languageInformation: new Frontend.Data.SPythonLanguageInformation(),
|
||||
languageIntellisenseSupport: new Frontend.Data.SPythonIntellisenseSupport(),
|
||||
parser: new SPythonParser.SPythonLanguageParser(),
|
||||
docParser: null,
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -14,32 +14,13 @@ namespace SPythonParser
|
|||
{
|
||||
public List<ISyntaxTreeConverter> SyntaxTreeConvertersForIntellisense { get; set; }
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CompilerDirectives = new List<compiler_directive>();
|
||||
|
||||
Errors.Clear();
|
||||
}
|
||||
|
||||
protected override void PreBuildTree(string FileName)
|
||||
{
|
||||
CompilerDirectives = new List<compiler_directive>();
|
||||
|
||||
}
|
||||
|
||||
protected override syntax_tree_node BuildTreeInNormalMode(string FileName, string Text, bool compilingNotMainProgram, List<string> DefinesList = null)
|
||||
{
|
||||
Errors.Clear();
|
||||
Warnings.Clear();
|
||||
|
||||
syntax_tree_node root = Parse(Text, FileName, false, compilingNotMainProgram, DefinesList);
|
||||
|
||||
if (Errors.Count > 0)
|
||||
return null;
|
||||
|
||||
if (root != null && root is compilation_unit)
|
||||
(root as compilation_unit).file_name = FileName;
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
|
@ -114,15 +95,11 @@ namespace SPythonParser
|
|||
|
||||
protected override syntax_tree_node BuildTreeInSpecialMode(string FileName, string Text, bool compilingNotMainProgram)
|
||||
{
|
||||
Errors.Clear();
|
||||
|
||||
return Parse(Text, FileName, compilingNotMainProgram);
|
||||
return Parse(Text, FileName, compilingNotMainProgram: compilingNotMainProgram);
|
||||
}
|
||||
|
||||
protected override syntax_tree_node BuildTreeInFormatterMode(string FileName, string Text)
|
||||
{
|
||||
Errors.Clear();
|
||||
|
||||
return Parse(Text, FileName, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ namespace CodeCompletion
|
|||
|
||||
public Dictionary<syntax_tree_node, string> docs = new Dictionary<syntax_tree_node, string>();
|
||||
// static bool parsers_loaded=false;
|
||||
public IParser Parser;
|
||||
|
||||
static CodeCompletionController()
|
||||
{
|
||||
|
|
@ -48,6 +47,11 @@ namespace CodeCompletion
|
|||
// static string cur_ext = ".pas";
|
||||
private static ILanguage currentLanguage;
|
||||
|
||||
/// <summary>
|
||||
/// Запоминает язык текущего открытого файла.
|
||||
/// Если язык файла не поддерживается в системе, то ошибка не выбрасывается,
|
||||
/// текущему языку присваивается null.
|
||||
/// </summary>
|
||||
public static void SetLanguage(string fileName)
|
||||
{
|
||||
currentLanguage = LanguageProvider.SelectLanguageByExtensionSafe(fileName);
|
||||
|
|
@ -58,14 +62,21 @@ namespace CodeCompletion
|
|||
pabcNamespaces.Clear();
|
||||
}
|
||||
|
||||
// нужно переделать на использование ILanguage EVA
|
||||
public static IParser CurrentParser
|
||||
public static ILanguage CurrentLanguage
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentLanguage?.Parser;
|
||||
return currentLanguage;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поддерживается ли Intellisense для текущего языка
|
||||
/// </summary>
|
||||
public static bool IntellisenseAvailable()
|
||||
{
|
||||
return CurrentLanguage != null && CurrentLanguage.LanguageIntellisenseSupport != null;
|
||||
}
|
||||
|
||||
public DomConverter Compile(string FileName, string Text)
|
||||
{
|
||||
|
|
@ -75,11 +86,9 @@ namespace CodeCompletion
|
|||
|
||||
ILanguage currentLanguage = LanguageProvider.SelectLanguageByExtension(FileName);
|
||||
|
||||
Parser = currentLanguage.Parser;
|
||||
|
||||
try
|
||||
{
|
||||
cu = Parser.GetCompilationUnit(FileName, Text, ErrorsList, Warnings, ParseMode.Normal, false);
|
||||
cu = currentLanguage.Parser.GetCompilationUnit(FileName, Text, ErrorsList, Warnings, ParseMode.Normal, false);
|
||||
|
||||
ErrorsList.Clear();
|
||||
|
||||
|
|
@ -117,7 +126,7 @@ namespace CodeCompletion
|
|||
string tmp = ParsersHelper.GetModifiedProgramm(Text);
|
||||
if (tmp != null)
|
||||
{
|
||||
cu = Parser.GetCompilationUnit(FileName, Text, ErrorsList, Warnings, ParseMode.Special, false);
|
||||
cu = currentLanguage.Parser.GetCompilationUnit(FileName, Text, ErrorsList, Warnings, ParseMode.Special, false);
|
||||
}
|
||||
|
||||
ErrorsList.Clear();
|
||||
|
|
@ -179,11 +188,9 @@ namespace CodeCompletion
|
|||
if (currentLanguage == null)
|
||||
return dconv;
|
||||
|
||||
Parser = currentLanguage.Parser;
|
||||
|
||||
if (Text != null)
|
||||
{
|
||||
cu = Parser.GetCompilationUnit(FileName, Text, ErrorsList, Warnings, ParseMode.Normal, true);
|
||||
cu = currentLanguage.Parser.GetCompilationUnit(FileName, Text, ErrorsList, Warnings, ParseMode.Normal, true);
|
||||
}
|
||||
ErrorsList.Clear();
|
||||
Warnings.Clear();
|
||||
|
|
@ -212,7 +219,7 @@ namespace CodeCompletion
|
|||
string tmp = ParsersHelper.GetModifiedProgramm(Text);
|
||||
if (tmp != null)
|
||||
{
|
||||
cu = Parser.GetCompilationUnit(FileName, Text, ErrorsList, Warnings, ParseMode.Special, true);
|
||||
cu = currentLanguage.Parser.GetCompilationUnit(FileName, Text, ErrorsList, Warnings, ParseMode.Special, true);
|
||||
}
|
||||
|
||||
ErrorsList.Clear();
|
||||
|
|
@ -252,31 +259,31 @@ namespace CodeCompletion
|
|||
|
||||
public PascalABCCompiler.Parsers.KeywordKind GetKeywordKind(string name)
|
||||
{
|
||||
if (CodeCompletionController.CurrentParser != null)
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetKeywordKind(name);
|
||||
if (CodeCompletionController.IntellisenseAvailable())
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetKeywordKind(name);
|
||||
return PascalABCCompiler.Parsers.KeywordKind.None;
|
||||
}
|
||||
|
||||
public bool IsKeyword(string name)
|
||||
{
|
||||
if (CodeCompletionController.CurrentParser != null)
|
||||
if (CodeCompletionController.IntellisenseAvailable())
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.IsKeyword(name);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IsKeyword(name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<string> GetKeywords()
|
||||
{
|
||||
if (CodeCompletionController.CurrentParser != null)
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.KeywordsStorage.KeywordsForIntellisenseList;
|
||||
if (CodeCompletionController.IntellisenseAvailable())
|
||||
return CodeCompletionController.CurrentLanguage.LanguageInformation.KeywordsStorage.KeywordsForIntellisenseList;
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
public List<string> GetTypeKeywords()
|
||||
{
|
||||
if (CodeCompletionController.CurrentParser != null)
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.KeywordsStorage.TypeKeywords;
|
||||
if (CodeCompletionController.IntellisenseAvailable())
|
||||
return CodeCompletionController.CurrentLanguage.LanguageInformation.KeywordsStorage.TypeKeywords;
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ namespace CodeCompletion
|
|||
if (elem == null || !(elem is ProcScope))
|
||||
{
|
||||
int pos = 0;
|
||||
string full_name = CodeCompletionController.CurrentParser.LanguageInformation.ConstructOverridedMethodHeader(procs[i], out pos);
|
||||
string full_name = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.ConstructOverridedMethodHeader(procs[i], out pos);
|
||||
SymInfo si = new SymInfo(full_name.Substring(pos), procs[i].si.kind, full_name);
|
||||
si.acc_mod = procs[i].si.acc_mod;
|
||||
meths.Add(si);
|
||||
|
|
@ -605,7 +605,7 @@ namespace CodeCompletion
|
|||
}
|
||||
|
||||
}
|
||||
string s = CodeCompletionController.CurrentParser.LanguageInformation.GetSimpleDescriptionWithoutNamespace((si as ElementScope).sc as PascalABCCompiler.Parsers.ITypeScope);
|
||||
string s = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetSimpleDescriptionWithoutNamespace((si as ElementScope).sc as PascalABCCompiler.Parsers.ITypeScope);
|
||||
if (s != out_si.name)
|
||||
out_si.addit_name = s;
|
||||
}
|
||||
|
|
@ -765,7 +765,7 @@ namespace CodeCompletion
|
|||
pos.metadata_type = MetadataType.Class;
|
||||
if (!only_check)
|
||||
{
|
||||
pos.metadata = CodeCompletionController.CurrentParser.LanguageInformation.GetCompiledTypeRepresentation(cs.CompiledType, cs.CompiledType, ref pos.line, ref pos.column);
|
||||
pos.metadata = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetCompiledTypeRepresentation(cs.CompiledType, cs.CompiledType, ref pos.line, ref pos.column);
|
||||
Type t = cs.CompiledType;
|
||||
int lines = 0;
|
||||
int ind = pos.metadata.IndexOf('\n');
|
||||
|
|
@ -787,7 +787,7 @@ namespace CodeCompletion
|
|||
pos.metadata_title = prepare_file_name(cfs.CompiledField.DeclaringType.Name);
|
||||
if (!only_check)
|
||||
{
|
||||
pos.metadata = CodeCompletionController.CurrentParser.LanguageInformation.GetCompiledTypeRepresentation(cfs.CompiledField.DeclaringType, cfs.CompiledField, ref pos.line, ref pos.column);
|
||||
pos.metadata = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetCompiledTypeRepresentation(cfs.CompiledField.DeclaringType, cfs.CompiledField, ref pos.line, ref pos.column);
|
||||
Type t = cfs.CompiledField.DeclaringType;
|
||||
int lines = 0;
|
||||
int ind = pos.metadata.IndexOf('\n');
|
||||
|
|
@ -809,7 +809,7 @@ namespace CodeCompletion
|
|||
pos.metadata_type = MetadataType.Method;
|
||||
if (!only_check)
|
||||
{
|
||||
pos.metadata = CodeCompletionController.CurrentParser.LanguageInformation.GetCompiledTypeRepresentation(cms.CompiledMethod.DeclaringType, cms.CompiledMethod, ref pos.line, ref pos.column);
|
||||
pos.metadata = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetCompiledTypeRepresentation(cms.CompiledMethod.DeclaringType, cms.CompiledMethod, ref pos.line, ref pos.column);
|
||||
Type t = cms.CompiledMethod.DeclaringType;
|
||||
int lines = 0;
|
||||
int ind = pos.metadata.IndexOf('\n');
|
||||
|
|
@ -829,7 +829,7 @@ namespace CodeCompletion
|
|||
pos.metadata_type = MetadataType.Property;
|
||||
if (!only_check)
|
||||
{
|
||||
pos.metadata = CodeCompletionController.CurrentParser.LanguageInformation.GetCompiledTypeRepresentation((ss as CompiledPropertyScope).CompiledProperty.DeclaringType, (ss as CompiledPropertyScope).CompiledProperty, ref pos.line, ref pos.column);
|
||||
pos.metadata = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetCompiledTypeRepresentation((ss as CompiledPropertyScope).CompiledProperty.DeclaringType, (ss as CompiledPropertyScope).CompiledProperty, ref pos.line, ref pos.column);
|
||||
Type t = cps.CompiledProperty.DeclaringType;
|
||||
int lines = 0;
|
||||
int ind = pos.metadata.IndexOf('\n');
|
||||
|
|
@ -849,7 +849,7 @@ namespace CodeCompletion
|
|||
pos.metadata_type = MetadataType.Constructor;
|
||||
if (!only_check)
|
||||
{
|
||||
pos.metadata = CodeCompletionController.CurrentParser.LanguageInformation.GetCompiledTypeRepresentation(ccs.CompiledConstructor.DeclaringType, ccs.CompiledConstructor, ref pos.line, ref pos.column);
|
||||
pos.metadata = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetCompiledTypeRepresentation(ccs.CompiledConstructor.DeclaringType, ccs.CompiledConstructor, ref pos.line, ref pos.column);
|
||||
Type t = ccs.CompiledConstructor.DeclaringType;
|
||||
int lines = 0;
|
||||
int ind = pos.metadata.IndexOf('\n');
|
||||
|
|
@ -869,7 +869,7 @@ namespace CodeCompletion
|
|||
pos.metadata_type = MetadataType.Event;
|
||||
if (!only_check)
|
||||
{
|
||||
pos.metadata = CodeCompletionController.CurrentParser.LanguageInformation.GetCompiledTypeRepresentation(ces.CompiledEvent.DeclaringType, ces.CompiledEvent, ref pos.line, ref pos.column);
|
||||
pos.metadata = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetCompiledTypeRepresentation(ces.CompiledEvent.DeclaringType, ces.CompiledEvent, ref pos.line, ref pos.column);
|
||||
Type t = ces.CompiledEvent.DeclaringType;
|
||||
int lines = 0;
|
||||
int ind = pos.metadata.IndexOf('\n');
|
||||
|
|
@ -1113,7 +1113,7 @@ namespace CodeCompletion
|
|||
if (ps.is_constructor)
|
||||
si = new ElementScope(ps.declaringType);
|
||||
}
|
||||
string[] description = CodeCompletionController.CurrentParser.LanguageInformation.GetIndexerString(si);
|
||||
string[] description = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetIndexerString(si);
|
||||
if (description != null)
|
||||
for (int i = 0; i < description.Length; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ namespace CodeCompletion
|
|||
var co = new CompilerOptions();
|
||||
co.SavePCU = false;
|
||||
co.GenerateCode = false;
|
||||
if (!currentUnitLanguage.ApplySyntaxTreeConvertersForIntellisense)
|
||||
if (!currentUnitLanguage.LanguageIntellisenseSupport.ApplySyntaxTreeConvertersForIntellisense)
|
||||
co.UnitSyntaxTree = cu;
|
||||
co.SourceFileName = cu.source_context.FileName;
|
||||
co.ForIntellisense = true;
|
||||
|
|
@ -474,9 +474,9 @@ namespace CodeCompletion
|
|||
else if (has_lambdas(_assign.from))
|
||||
_assign.from.visit(this);
|
||||
else if (_assign.to is ident && cur_scope != null && cur_scope.Name.StartsWith("<>lambda")
|
||||
&& (_assign.to as ident).name.Equals(currentUnitLanguage.LanguageInformation.ResultVariableName, currentUnitLanguage.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase))
|
||||
&& (_assign.to as ident).name.Equals(currentUnitLanguage.LanguageIntellisenseSupport.ResultVariableName, currentUnitLanguage.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var sc = cur_scope.FindNameOnlyInThisType(currentUnitLanguage.LanguageInformation.ResultVariableName);
|
||||
var sc = cur_scope.FindNameOnlyInThisType(currentUnitLanguage.LanguageIntellisenseSupport.ResultVariableName);
|
||||
if (sc is ElementScope)
|
||||
{
|
||||
ElementScope es = sc as ElementScope;
|
||||
|
|
@ -935,7 +935,7 @@ namespace CodeCompletion
|
|||
{
|
||||
returned_scope = TypeTable.string_type;//entry_scope.FindName(StringConstants.string_type_name);
|
||||
//cnst_val.prim_val = "'"+_string_const.Value+"'";
|
||||
cnst_val.prim_val = this.converter.controller.Parser.LanguageInformation.GetStringForString(_string_const.Value);
|
||||
cnst_val.prim_val = currentUnitLanguage.LanguageIntellisenseSupport.GetStringForString(_string_const.Value);
|
||||
}
|
||||
|
||||
public override void visit(expression_list _expression_list)
|
||||
|
|
@ -2094,7 +2094,7 @@ namespace CodeCompletion
|
|||
|
||||
returned_scope = ps;
|
||||
|
||||
var resultName = currentUnitLanguage.LanguageInformation.ResultVariableName;
|
||||
var resultName = currentUnitLanguage.LanguageIntellisenseSupport.ResultVariableName;
|
||||
if (resultName != null)
|
||||
{
|
||||
ps.AddName(resultName, new ElementScope(new SymInfo(resultName, SymbolKind.Variable, resultName), ps.return_type, ps));
|
||||
|
|
@ -2170,7 +2170,7 @@ namespace CodeCompletion
|
|||
if (bl.program_code.subnodes.Count == 1)
|
||||
{
|
||||
var ass = bl.program_code.subnodes[0] as assign;
|
||||
if (ass != null && ass.to is ident && (ass.to as ident).name.Equals(currentUnitLanguage.LanguageInformation.ResultVariableName, currentUnitLanguage.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase))
|
||||
if (ass != null && ass.to is ident && (ass.to as ident).name.Equals(currentUnitLanguage.LanguageIntellisenseSupport.ResultVariableName, currentUnitLanguage.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!(ass.from is nil_const))
|
||||
{
|
||||
|
|
@ -2262,7 +2262,7 @@ namespace CodeCompletion
|
|||
if (_type_declaration.type_def is class_definition)
|
||||
{
|
||||
class_definition cl_def = _type_declaration.type_def as class_definition;
|
||||
string key = this.converter.controller.Parser.LanguageInformation.GetClassKeyword(cl_def.keyword);
|
||||
string key = currentUnitLanguage.LanguageIntellisenseSupport.GetClassKeyword(cl_def.keyword);
|
||||
if (cl_def.attribute == class_attribute.Auto)
|
||||
key = "auto " + key;
|
||||
else if ((cl_def.attribute & class_attribute.Abstract) == class_attribute.Abstract)
|
||||
|
|
@ -2528,7 +2528,7 @@ namespace CodeCompletion
|
|||
var languageUsingStandardUnit = Languages.Facade.LanguageProvider.Instance.Languages.Find(lang => lang.SystemUnitNames.Contains(unitName));
|
||||
|
||||
// Пока что добавили возможость грубо отключить добавление NET пространств имен по умолчанию здесь (второе условие нужно, чтобы в стандартные модули языка они тоже не добавлялись) EVA
|
||||
if (currentUnitLanguage.LanguageInformation.AddStandardNetNamespacesToUserScope && (languageUsingStandardUnit?.LanguageInformation.AddStandardNetNamespacesToUserScope ?? true))
|
||||
if (currentUnitLanguage.LanguageIntellisenseSupport.AddStandardNetNamespacesToUserScope && (languageUsingStandardUnit?.LanguageIntellisenseSupport.AddStandardNetNamespacesToUserScope ?? true))
|
||||
namespaces.AddRange(PascalABCCompiler.NetHelper.NetHelper.GetNamespaces(_as));
|
||||
|
||||
InterfaceUnitScope unit_scope = null;
|
||||
|
|
@ -2661,7 +2661,7 @@ namespace CodeCompletion
|
|||
{
|
||||
// добавление стандартных типов можно делать в отдельный фиктивный модуль, как в основном компиляторе
|
||||
// это позволит работать директиве DisableStandardUnits, а также не будет засорять сам стандартный модуль типами EVA
|
||||
add_standart_types(entry_scope, language.LanguageInformation);
|
||||
add_standart_types(entry_scope, language.LanguageIntellisenseSupport);
|
||||
|
||||
if (language == Languages.Facade.LanguageProvider.Instance.MainLanguage)
|
||||
{
|
||||
|
|
@ -2684,7 +2684,7 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
if (currentUnitLanguage.ApplySyntaxTreeConvertersForIntellisense)
|
||||
if (currentUnitLanguage.LanguageIntellisenseSupport.ApplySyntaxTreeConvertersForIntellisense)
|
||||
{
|
||||
foreach (ISyntaxTreeConverter converter in currentUnitLanguage.SyntaxTreeConverters)
|
||||
{
|
||||
|
|
@ -2729,7 +2729,8 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
if (currentUnitLanguage.ApplySyntaxTreeConvertersForIntellisense && currentUnitLanguage.LanguageInformation.SyntaxTreeIsConvertedAfterUsedModulesCompilation)
|
||||
if (currentUnitLanguage.LanguageIntellisenseSupport.ApplySyntaxTreeConvertersForIntellisense
|
||||
&& currentUnitLanguage.LanguageInformation.SyntaxTreeIsConvertedAfterUsedModulesCompilation)
|
||||
{
|
||||
var namesFromUsedUnits = CollectNamesFromUsedUnits(cur_scope);
|
||||
|
||||
|
|
@ -2889,7 +2890,7 @@ namespace CodeCompletion
|
|||
//get_standart_types(dc.stv);
|
||||
|
||||
// для SPython, например, не нужно подсказывать стандартные модули в программе, это условие для этого EVA
|
||||
if (currentUnitLanguage.LanguageInformation.AddStandardUnitNamesToUserScope)
|
||||
if (currentUnitLanguage.LanguageIntellisenseSupport.AddStandardUnitNamesToUserScope)
|
||||
{
|
||||
entry_scope.AddName(unitName, dc.visitor.entry_scope);
|
||||
}
|
||||
|
|
@ -2907,7 +2908,7 @@ namespace CodeCompletion
|
|||
dc.visitor.entry_scope.InitAssemblies();
|
||||
entry_scope.AddUsedUnit(dc.visitor.entry_scope);
|
||||
//get_standart_types(dc.stv);
|
||||
if (currentUnitLanguage.LanguageInformation.AddStandardUnitNamesToUserScope)
|
||||
if (currentUnitLanguage.LanguageIntellisenseSupport.AddStandardUnitNamesToUserScope)
|
||||
{
|
||||
entry_scope.AddName(unitName, dc.visitor.entry_scope);
|
||||
}
|
||||
|
|
@ -3153,7 +3154,7 @@ namespace CodeCompletion
|
|||
currentUnitLanguage = Languages.Facade.LanguageProvider.Instance.SelectLanguageByName(_program_module.Language);
|
||||
|
||||
// Пока что добавили возможость грубо отключить добавление NET пространств имен по умолчанию здесь EVA
|
||||
if (currentUnitLanguage.LanguageInformation.AddStandardNetNamespacesToUserScope)
|
||||
if (currentUnitLanguage.LanguageIntellisenseSupport.AddStandardNetNamespacesToUserScope)
|
||||
namespaces.AddRange(PascalABCCompiler.NetHelper.NetHelper.GetNamespaces(_as));
|
||||
|
||||
//List<Scope> netScopes = new List<Scope>();
|
||||
|
|
@ -3261,7 +3262,7 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
if (currentUnitLanguage.ApplySyntaxTreeConvertersForIntellisense)
|
||||
if (currentUnitLanguage.LanguageIntellisenseSupport.ApplySyntaxTreeConvertersForIntellisense)
|
||||
{
|
||||
foreach (ISyntaxTreeConverter converter in currentUnitLanguage.SyntaxTreeConverters)
|
||||
{
|
||||
|
|
@ -3310,7 +3311,8 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
if (currentUnitLanguage.ApplySyntaxTreeConvertersForIntellisense && currentUnitLanguage.LanguageInformation.SyntaxTreeIsConvertedAfterUsedModulesCompilation)
|
||||
if (currentUnitLanguage.LanguageIntellisenseSupport.ApplySyntaxTreeConvertersForIntellisense
|
||||
&& currentUnitLanguage.LanguageInformation.SyntaxTreeIsConvertedAfterUsedModulesCompilation)
|
||||
{
|
||||
var namesFromUsedUnits = CollectNamesFromUsedUnits(cur_scope);
|
||||
|
||||
|
|
@ -3387,7 +3389,7 @@ namespace CodeCompletion
|
|||
}
|
||||
}
|
||||
|
||||
private void add_standart_types(SymScope cur_scope, ILanguageInformation languageInfo)
|
||||
private void add_standart_types(SymScope cur_scope, ILanguageIntellisenseSupport languageIntellisenseSupport)
|
||||
{
|
||||
|
||||
var standardTypesData = new List<Tuple<PascalABCCompiler.Parsers.KeywordKind, CompiledScope>>()
|
||||
|
|
@ -3415,7 +3417,7 @@ namespace CodeCompletion
|
|||
var keywordKind = data.Item1;
|
||||
var type = data.Item2;
|
||||
|
||||
var type_name = languageInfo.GetStandardTypeByKeyword(keywordKind);
|
||||
var type_name = languageIntellisenseSupport.GetStandardTypeByKeyword(keywordKind);
|
||||
|
||||
if (type_name != null)
|
||||
{
|
||||
|
|
@ -4647,7 +4649,7 @@ namespace CodeCompletion
|
|||
{
|
||||
returned_scope = TypeTable.char_type;//entry_scope.FindName(StringConstants.char_type_name);
|
||||
if (in_kav)
|
||||
cnst_val.prim_val = this.converter.controller.Parser.LanguageInformation.GetStringForChar(_char_const.cconst);
|
||||
cnst_val.prim_val = currentUnitLanguage.LanguageIntellisenseSupport.GetStringForChar(_char_const.cconst);
|
||||
//cnst_val.prim_val = "'"+_char_const.cconst.ToString()+"'";
|
||||
else cnst_val.prim_val = _char_const.cconst;
|
||||
}
|
||||
|
|
@ -4660,7 +4662,7 @@ namespace CodeCompletion
|
|||
public override void visit(sharp_char_const _sharp_char_const)
|
||||
{
|
||||
returned_scope = TypeTable.char_type;//entry_scope.FindName(StringConstants.char_type_name);
|
||||
cnst_val.prim_val = this.converter.controller.Parser.LanguageInformation.GetStringForSharpChar(_sharp_char_const.char_num);
|
||||
cnst_val.prim_val = currentUnitLanguage.LanguageIntellisenseSupport.GetStringForSharpChar(_sharp_char_const.char_num);
|
||||
}
|
||||
|
||||
private bool in_kav=true;
|
||||
|
|
@ -5788,7 +5790,7 @@ namespace CodeCompletion
|
|||
TypeScope saved_return_type = ps.return_type;
|
||||
if (!disable_lambda_compilation)
|
||||
{
|
||||
string resultName = currentUnitLanguage.LanguageInformation.ResultVariableName;
|
||||
string resultName = currentUnitLanguage.LanguageIntellisenseSupport.ResultVariableName;
|
||||
if (awaitedProcType != null)
|
||||
{
|
||||
var invokeMeth = awaitedProcType.FindNameOnlyInType("Invoke") as ProcScope;
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ namespace CodeCompletion
|
|||
|
||||
public List<ProcScope> GetExtensionMethods(TypeScope ts, string name=null)
|
||||
{
|
||||
StringComparison comparison = CodeCompletionController.CurrentParser.LanguageInformation.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
|
||||
StringComparison comparison = CodeCompletionController.CurrentLanguage.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
|
||||
|
||||
if (ts is TypeSynonim)
|
||||
return GetExtensionMethods((ts as TypeSynonim).actType, name);
|
||||
|
|
@ -757,7 +757,7 @@ namespace CodeCompletion
|
|||
SymScope minScope = null;
|
||||
|
||||
// задает нужна ли модификация алгоритма с обходом всех кандидатов EVA
|
||||
bool findMinScope = CodeCompletionController.CurrentParser.LanguageInformation.UsesFunctionsOverlappingSourceContext;
|
||||
bool findMinScope = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.UsesFunctionsOverlappingSourceContext;
|
||||
|
||||
SymScope foundScope = FindScopeByLocation(line, column, ref minScope, findMinScope);
|
||||
|
||||
|
|
@ -974,7 +974,7 @@ namespace CodeCompletion
|
|||
if (o is SymScope)
|
||||
ss = o as SymScope;
|
||||
else
|
||||
if (!CodeCompletionController.CurrentParser.LanguageInformation.CaseSensitive)
|
||||
if (!CodeCompletionController.CurrentLanguage.CaseSensitive)
|
||||
ss = (o as List<SymScope>)[0];
|
||||
else
|
||||
{
|
||||
|
|
@ -996,7 +996,7 @@ namespace CodeCompletion
|
|||
}
|
||||
if (ss == null) return null;
|
||||
TypeScope ts = ss as TypeScope;
|
||||
if (CodeCompletionController.CurrentParser.LanguageInformation.CaseSensitive)
|
||||
if (CodeCompletionController.CurrentLanguage.CaseSensitive)
|
||||
{
|
||||
string shortName = System.Text.RegularExpressions.Regex.Replace(name, @"`\d+$", "");
|
||||
|
||||
|
|
@ -1021,10 +1021,10 @@ namespace CodeCompletion
|
|||
else
|
||||
if (members != null)
|
||||
foreach (SymScope ss in members)
|
||||
if (string.Compare(ss.si.name, name, !CodeCompletionController.CurrentParser.LanguageInformation.CaseSensitive) == 0)
|
||||
if (string.Compare(ss.si.name, name, !CodeCompletionController.CurrentLanguage.CaseSensitive) == 0)
|
||||
if (ss.loc != null && loc != null && check_for_def && cur_line != -1 && cur_col != -1)
|
||||
{
|
||||
if (string.Compare(ss.loc.file_name, loc.file_name, !CodeCompletionController.CurrentParser.LanguageInformation.CaseSensitive) == 0 && this != ss)
|
||||
if (string.Compare(ss.loc.file_name, loc.file_name, !CodeCompletionController.CurrentLanguage.CaseSensitive) == 0 && this != ss)
|
||||
{
|
||||
if (IsClassMember(ss) || IsAfterDefinition(ss.loc.begin_line_num, ss.loc.begin_column_num))
|
||||
{
|
||||
|
|
@ -1068,7 +1068,7 @@ namespace CodeCompletion
|
|||
}
|
||||
else if (members != null)
|
||||
foreach (SymScope ss in members)
|
||||
if (string.Compare(ss.si.name, name, !CodeCompletionController.CurrentParser.LanguageInformation.CaseSensitive) == 0)
|
||||
if (string.Compare(ss.si.name, name, !CodeCompletionController.CurrentLanguage.CaseSensitive) == 0)
|
||||
if (ss.loc != null && loc != null && check_for_def && cur_line != -1 && cur_col != -1)
|
||||
{
|
||||
if (string.Compare(ss.loc.file_name, loc.file_name, true) == 0 && this != ss && ss.topScope != this)
|
||||
|
|
@ -1405,7 +1405,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser?.LanguageInformation.GetSimpleDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage?.LanguageIntellisenseSupport.GetSimpleDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1688,12 +1688,12 @@ namespace CodeCompletion
|
|||
|
||||
public override void BuildDescription()
|
||||
{
|
||||
si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
si.description = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
|
||||
public void MakeDescription()
|
||||
{
|
||||
si.description = CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this);
|
||||
si.description = CodeCompletionController.CurrentLanguage?.LanguageIntellisenseSupport.GetDescription(this);
|
||||
if (!string.IsNullOrEmpty(documentation))
|
||||
si.description += Environment.NewLine + documentation;
|
||||
}
|
||||
|
|
@ -1799,7 +1799,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser?.LanguageInformation.GetSimpleDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage?.LanguageIntellisenseSupport.GetSimpleDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2271,7 +2271,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage?.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2608,7 +2608,7 @@ namespace CodeCompletion
|
|||
{
|
||||
if (documentation != null && documentation.Length > 0 && documentation[0] == '-') return;
|
||||
this.si.description = this.ToString();
|
||||
this.si.addit_name = CodeCompletionController.CurrentParser?.LanguageInformation.GetShortName(this);
|
||||
this.si.addit_name = CodeCompletionController.CurrentLanguage?.LanguageIntellisenseSupport.GetShortName(this);
|
||||
if (documentation != null) this.si.description += "\n" + this.documentation;
|
||||
}
|
||||
|
||||
|
|
@ -2616,7 +2616,7 @@ namespace CodeCompletion
|
|||
{
|
||||
if (documentation != null && documentation.Length > 0 && documentation[0] == '-') return;
|
||||
si.description = ToString();
|
||||
si.addit_name = CodeCompletionController.CurrentParser.LanguageInformation.GetShortName(this);
|
||||
si.addit_name = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetShortName(this);
|
||||
}
|
||||
|
||||
public void AddTemplateParameter(string name)
|
||||
|
|
@ -2841,8 +2841,8 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
simp_descr = CodeCompletionController.CurrentParser?.LanguageInformation.GetSimpleDescription(this);
|
||||
return CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this);
|
||||
simp_descr = CodeCompletionController.CurrentLanguage?.LanguageIntellisenseSupport.GetSimpleDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage?.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2934,7 +2934,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3055,7 +3055,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3213,7 +3213,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3915,7 +3915,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage?.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4036,7 +4036,7 @@ namespace CodeCompletion
|
|||
public override string ToString()
|
||||
{
|
||||
//return left.ToString() + ".." + right.ToString();
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4236,7 +4236,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4314,7 +4314,7 @@ namespace CodeCompletion
|
|||
this.topScope = topScope;
|
||||
if (baseScope == null)
|
||||
{
|
||||
if (CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
|
||||
if (CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IncludeDotNetEntities)
|
||||
switch (kind)
|
||||
{
|
||||
case SymbolKind.Struct: this.baseScope = TypeTable.get_compiled_type(new SymInfo(typeof(ValueType).Name, SymbolKind.Struct, typeof(ValueType).FullName), typeof(ValueType)); break;
|
||||
|
|
@ -4330,10 +4330,10 @@ namespace CodeCompletion
|
|||
si = new SymInfo("type", kind, "type");
|
||||
switch (kind)
|
||||
{
|
||||
case SymbolKind.Struct: si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Struct); break;
|
||||
case SymbolKind.Class: si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Class); break;
|
||||
case SymbolKind.Interface: si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Interface); break;
|
||||
case SymbolKind.Enum: si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Enum); break;
|
||||
case SymbolKind.Struct: si.description = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Struct); break;
|
||||
case SymbolKind.Class: si.description = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Class); break;
|
||||
case SymbolKind.Interface: si.description = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Interface); break;
|
||||
case SymbolKind.Enum: si.description = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Enum); break;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4928,17 +4928,17 @@ namespace CodeCompletion
|
|||
|
||||
public override void BuildDescription()
|
||||
{
|
||||
si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
si.description = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
|
||||
// Случай делегата
|
||||
if (aliased && this is ProcType)
|
||||
si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetSynonimDescription(this);
|
||||
si.description = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetSynonimDescription(this);
|
||||
}
|
||||
|
||||
//opisanie, vysvechivaetsja v zheltkom okoshke
|
||||
public override string GetDescription()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
|
||||
//dubl?????
|
||||
|
|
@ -5471,7 +5471,7 @@ namespace CodeCompletion
|
|||
|
||||
public override void BuildDescription()
|
||||
{
|
||||
si.description = CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this);
|
||||
si.description = CodeCompletionController.CurrentLanguage?.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
|
||||
private SymInfo convertToDefaultNETNames(Type t, SymInfo si)
|
||||
|
|
@ -5772,7 +5772,7 @@ namespace CodeCompletion
|
|||
}
|
||||
if (si.name == null)
|
||||
AssemblyDocCache.AddDescribeToComplete(this.si, ctn);
|
||||
this.si.name = CodeCompletionController.CurrentParser?.LanguageInformation.GetShortName(this);
|
||||
this.si.name = CodeCompletionController.CurrentLanguage?.LanguageIntellisenseSupport.GetShortName(this);
|
||||
this.si.kind = get_kind();
|
||||
this.si.description = GetDescription();
|
||||
|
||||
|
|
@ -6131,7 +6131,7 @@ namespace CodeCompletion
|
|||
public override string GetFullName()
|
||||
{
|
||||
//return ctn.FullName;
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetSimpleDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetSimpleDescription(this);
|
||||
}
|
||||
|
||||
public override List<ProcScope> GetOverridableMethods()
|
||||
|
|
@ -6420,13 +6420,13 @@ namespace CodeCompletion
|
|||
|
||||
public override string GetDescription()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser?.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage?.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
|
||||
public override SymInfo[] GetNames(ExpressionVisitor ev, PascalABCCompiler.Parsers.KeywordKind keyword, bool called_in_base)
|
||||
{
|
||||
List<SymInfo> syms = new List<SymInfo>();
|
||||
if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
|
||||
if (!CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IncludeDotNetEntities)
|
||||
return syms.ToArray();
|
||||
MemberInfo[] mis = ctn.GetMembers(BindingFlags.Public | BindingFlags.NonPublic |/*BindingFlags.Instance|*/BindingFlags.Static | BindingFlags.FlattenHierarchy);
|
||||
List<MemberInfo> constrs = new List<MemberInfo>();
|
||||
|
|
@ -6552,7 +6552,7 @@ namespace CodeCompletion
|
|||
public SymInfo[] GetStaticNames()
|
||||
{
|
||||
List<SymInfo> syms = new List<SymInfo>();
|
||||
if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
|
||||
if (!CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IncludeDotNetEntities)
|
||||
return syms.ToArray();
|
||||
MemberInfo[] mis = ctn.GetMembers(BindingFlags.Public | BindingFlags.NonPublic |/*BindingFlags.Instance|*/BindingFlags.Static | BindingFlags.FlattenHierarchy);
|
||||
|
||||
|
|
@ -6637,7 +6637,7 @@ namespace CodeCompletion
|
|||
public override SymInfo[] GetNamesAsInObject(ExpressionVisitor ev)
|
||||
{
|
||||
List<SymInfo> syms = new List<SymInfo>();
|
||||
if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
|
||||
if (!CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IncludeDotNetEntities)
|
||||
return syms.ToArray();
|
||||
MemberInfo[] mis = ctn.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
|
||||
List<MemberInfo> members = new List<MemberInfo>();
|
||||
|
|
@ -6719,7 +6719,7 @@ namespace CodeCompletion
|
|||
public override SymInfo[] GetNamesAsInBaseClass(ExpressionVisitor ev, bool is_static)
|
||||
{
|
||||
List<SymInfo> syms = new List<SymInfo>();
|
||||
if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
|
||||
if (!CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IncludeDotNetEntities)
|
||||
return syms.ToArray();
|
||||
MemberInfo[] mis = ctn.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy);
|
||||
if (ctn.IsInterface)
|
||||
|
|
@ -6841,7 +6841,7 @@ namespace CodeCompletion
|
|||
public override SymInfo[] GetNames()
|
||||
{
|
||||
List<SymInfo> syms = new List<SymInfo>();
|
||||
if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
|
||||
if (!CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IncludeDotNetEntities)
|
||||
return syms.ToArray();
|
||||
MemberInfo[] mis = ctn.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy);
|
||||
if (ctn.IsInterface)
|
||||
|
|
@ -6960,7 +6960,7 @@ namespace CodeCompletion
|
|||
public override SymInfo[] GetNamesAsInObject()
|
||||
{
|
||||
List<SymInfo> syms = new List<SymInfo>();
|
||||
if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
|
||||
if (!CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IncludeDotNetEntities)
|
||||
return syms.ToArray();
|
||||
MemberInfo[] mis = ctn.GetMembers(BindingFlags.Public | BindingFlags.Instance);
|
||||
foreach (MemberInfo mi in mis)
|
||||
|
|
@ -7052,10 +7052,10 @@ namespace CodeCompletion
|
|||
|
||||
public override List<SymScope> FindOverloadNames(string name)
|
||||
{
|
||||
StringComparison comparison = CodeCompletionController.CurrentParser.LanguageInformation.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
|
||||
StringComparison comparison = CodeCompletionController.CurrentLanguage.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
|
||||
|
||||
List<SymScope> names = new List<SymScope>();
|
||||
List<PascalABCCompiler.TreeConverter.SymbolInfo> sil = PascalABCCompiler.NetHelper.NetHelper.FindNameIncludeProtected(ctn, name, CodeCompletionController.CurrentParser.LanguageInformation.CaseSensitive);
|
||||
List<PascalABCCompiler.TreeConverter.SymbolInfo> sil = PascalABCCompiler.NetHelper.NetHelper.FindNameIncludeProtected(ctn, name, CodeCompletionController.CurrentLanguage.CaseSensitive);
|
||||
//IEnumerable<MemberInfo> ext_meths = PascalABCCompiler.NetHelper.NetHelper.GetExtensionMethods(ctn);
|
||||
List<ProcScope> pascal_ext_meths = this.GetExtensionMethods(name, this);
|
||||
if (sil != null && sil.Count > 1 && sil.FirstOrDefault().sym_info.semantic_node_type == semantic_node_type.basic_property_node)
|
||||
|
|
@ -7221,10 +7221,10 @@ namespace CodeCompletion
|
|||
|
||||
public override SymScope FindName(string name)
|
||||
{
|
||||
StringComparison comparison = CodeCompletionController.CurrentParser.LanguageInformation.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
|
||||
StringComparison comparison = CodeCompletionController.CurrentLanguage.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
|
||||
|
||||
List<PascalABCCompiler.TreeConverter.SymbolInfo> sil = PascalABCCompiler.NetHelper.NetHelper.FindNameIncludeProtected(ctn, name, CodeCompletionController.CurrentParser.LanguageInformation.CaseSensitive);
|
||||
if (!CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
|
||||
List<PascalABCCompiler.TreeConverter.SymbolInfo> sil = PascalABCCompiler.NetHelper.NetHelper.FindNameIncludeProtected(ctn, name, CodeCompletionController.CurrentLanguage.CaseSensitive);
|
||||
if (!CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IncludeDotNetEntities)
|
||||
return null;
|
||||
if (sil == null)
|
||||
{
|
||||
|
|
@ -7371,7 +7371,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetFullTypeName(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetFullTypeName(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7511,7 +7511,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7603,7 +7603,7 @@ namespace CodeCompletion
|
|||
public override string ToString()
|
||||
{
|
||||
//return "event "+ TypeUtility.GetShortTypeName(ei.DeclaringType) +"."+ ei.Name + ": "+sc.ToString();
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7705,7 +7705,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7786,7 +7786,7 @@ namespace CodeCompletion
|
|||
}
|
||||
if (si.name == null)
|
||||
AssemblyDocCache.AddDescribeToComplete(this.si, mi);
|
||||
this.si.name = CodeCompletionController.CurrentParser.LanguageInformation.GetShortName(this);
|
||||
this.si.name = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetShortName(this);
|
||||
this.si.description = this.ToString();
|
||||
//this.si.describe += "\n"+AssemblyDocCache.GetDocumentation(mi.DeclaringType.Assembly,"M:"+mi.DeclaringType.FullName+"."+mi.Name+GetParamNames());
|
||||
this.topScope = declaringType;
|
||||
|
|
@ -7831,7 +7831,7 @@ namespace CodeCompletion
|
|||
this.is_global = is_global;
|
||||
if (si.name == null)
|
||||
AssemblyDocCache.AddDescribeToComplete(this.si, mi);
|
||||
this.si.name = CodeCompletionController.CurrentParser.LanguageInformation.GetShortName(this);
|
||||
this.si.name = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetShortName(this);
|
||||
this.si.description = this.ToString();
|
||||
//this.si.describe += "\n"+AssemblyDocCache.GetDocumentation(mi.DeclaringType.Assembly,"M:"+mi.DeclaringType.FullName+"."+mi.Name+GetParamNames());
|
||||
this.topScope = declaringType;
|
||||
|
|
@ -7997,7 +7997,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -8024,7 +8024,7 @@ namespace CodeCompletion
|
|||
foreach (ParameterInfo pi in mi.GetParameters())
|
||||
parameters.Add(new CompiledParameterScope(new SymInfo(pi.Name, SymbolKind.Parameter, pi.Name), pi));
|
||||
|
||||
this.si.name = CodeCompletionController.CurrentParser.LanguageInformation.GetShortName(this);
|
||||
this.si.name = CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetShortName(this);
|
||||
this.si.description = this.ToString();//+"\n"+AssemblyDocCache.GetDocumentation(mi.DeclaringType.Assembly,"M:"+mi.DeclaringType.FullName+".#ctor"+GetParamNames());
|
||||
this.topScope = declaringType;
|
||||
if (mi.IsPrivate)
|
||||
|
|
@ -8113,7 +8113,7 @@ namespace CodeCompletion
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
|
||||
return CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDescription(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ namespace CodeCompletion
|
|||
shouldPositions.Add(new Position(line + 1, col + 1, 0, 0, null));
|
||||
string expr_without_brackets = null;
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw = PascalABCCompiler.Parsers.KeywordKind.None;
|
||||
string full_expr = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpressionFromAnyPosition(pos, content, line, col, out keyw, out expr_without_brackets);
|
||||
string full_expr = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindExpressionFromAnyPosition(pos, content, line, col, out keyw, out expr_without_brackets);
|
||||
List<PascalABCCompiler.Errors.Error> Errors = new List<PascalABCCompiler.Errors.Error>();
|
||||
var errors = new List<PascalABCCompiler.Errors.Error>();
|
||||
expression expr = parser.GetExpression("test" + System.IO.Path.GetExtension(FileName), full_expr, errors, new List<PascalABCCompiler.Errors.CompilerWarning>());
|
||||
|
|
@ -160,7 +160,7 @@ namespace CodeCompletion
|
|||
shouldPositions.Add(new Position(line + 1, col, 0, 0, null));
|
||||
string expr_without_brackets = null;
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw = PascalABCCompiler.Parsers.KeywordKind.None;
|
||||
string full_expr = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpressionFromAnyPosition(pos, content, line, col, out keyw, out expr_without_brackets);
|
||||
string full_expr = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindExpressionFromAnyPosition(pos, content, line, col, out keyw, out expr_without_brackets);
|
||||
List<PascalABCCompiler.Errors.Error> Errors = new List<PascalABCCompiler.Errors.Error>();
|
||||
var errors = new List<PascalABCCompiler.Errors.Error>();
|
||||
expression expr = parser.GetExpression("test" + System.IO.Path.GetExtension(FileName), full_expr, errors, new List<PascalABCCompiler.Errors.CompilerWarning>());
|
||||
|
|
@ -239,7 +239,7 @@ namespace CodeCompletion
|
|||
{
|
||||
string expr_without_brackets = null;
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw;
|
||||
var expr = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpressionFromAnyPosition(pos, content, line, col, out keyw, out expr_without_brackets);
|
||||
var expr = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindExpressionFromAnyPosition(pos, content, line, col, out keyw, out expr_without_brackets);
|
||||
if (expr == null)
|
||||
expr = expr_without_brackets;
|
||||
var errors = new List<PascalABCCompiler.Errors.Error>();
|
||||
|
|
@ -253,7 +253,7 @@ namespace CodeCompletion
|
|||
{
|
||||
string expr_without_brackets = null;
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw;
|
||||
var expr = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpressionFromAnyPosition(pos, content, line, col, out keyw, out expr_without_brackets);
|
||||
var expr = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindExpressionFromAnyPosition(pos, content, line, col, out keyw, out expr_without_brackets);
|
||||
if (expr == null)
|
||||
expr = expr_without_brackets;
|
||||
var errors = new List<PascalABCCompiler.Errors.Error>();
|
||||
|
|
@ -270,7 +270,7 @@ namespace CodeCompletion
|
|||
{
|
||||
string expr_without_brackets = null;
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw;
|
||||
var expr = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpressionFromAnyPosition(pos, content, line, col, out keyw, out expr_without_brackets);
|
||||
var expr = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindExpressionFromAnyPosition(pos, content, line, col, out keyw, out expr_without_brackets);
|
||||
if (expr == null)
|
||||
expr = expr_without_brackets;
|
||||
var errors = new List<PascalABCCompiler.Errors.Error>();
|
||||
|
|
@ -345,266 +345,266 @@ namespace CodeCompletion
|
|||
int col=0;
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw;
|
||||
//LanguageIntegration.LanguageIntegrator.ReloadAllParsers();
|
||||
IParser parser = LanguageProvider.Instance.MainLanguage.Parser;
|
||||
var languageIntellisenseSupport = LanguageProvider.Instance.MainLanguage.LanguageIntellisenseSupport;
|
||||
|
||||
string test_str = "System.Console";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "System(2+3,-Test34).Console";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "(a+b*c-e)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "a[2,3+b[2-3*b(2*Test-&var,nil)]][56,89,(44)]";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "begin test";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim(' ','\n','\t')=="test");
|
||||
|
||||
test_str = "begin test[4]";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim(' ','\n','\t')=="test[4]");
|
||||
|
||||
test_str = "begin sin(2)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim(' ','\n','\t')=="sin(2)");
|
||||
|
||||
test_str = "repeat test";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim(' ','\n','\t')=="test");
|
||||
|
||||
test_str = "while test";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim(' ','\n','\t')=="test");
|
||||
|
||||
test_str = "Test(new Text2, new Text3(2,3),inherited Create).a[new Text3]";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "Test[new Text2, new Text3(2,3),inherited Create].a[new Text3]";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "Str(a:2)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "Str(a:2:5)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "&Begin.&Var.&else.&for";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "a[s<5]";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "a[s>5]";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "a(s<5)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "a(s>5)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "ab{2 hsdjsdh 'ddd'}";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "TClass&<integer>.abc";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "TClass&<integer>";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "Test[new {dsdsdsd} Text2, new Text3{sdsd}(2,{''''''} 3),inherited {zez snj }Create]{...}.a{^^}[new Text3]";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "begin \n \t\t \n bb \t";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="bb");
|
||||
|
||||
test_str = "Test\n[new {dsdsdsd\n} Text2, new \t Text3(2,{''''''} 3),inherited {zez snj }Create]{...}.a{^^}[new Text3]";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "test//abcd\ntest.abcd";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="test.abcd");
|
||||
|
||||
test_str = "test(2,3) < ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "test(2,3) + ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "test(2,3) * ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "test(2,3) div ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "test(2,3) - ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "test(2,3) shl ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "(s as string)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s==test_str);
|
||||
|
||||
test_str = "begin (s as string)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="(s as string)");
|
||||
|
||||
test_str = "test(2,3) shr ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "test(2,3) > ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "test(2,3) or ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "test(2,3) and ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "test(2,3) xor ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "test(2,3) mod ppp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')=="ppp");
|
||||
|
||||
test_str = "typeof(char)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')==test_str);
|
||||
|
||||
test_str = "sizeof(char)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off,test_str,line,col,out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off,test_str,line,col,out keyw);
|
||||
assert(s.Trim('\n',' ','\t')==test_str);
|
||||
|
||||
test_str = "()->(obj as string).Trim";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == "(obj as string).Trim");
|
||||
|
||||
test_str = "Seq(0)\n.f1//комментарий\n.Print";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == "Seq(0)\n.f1\n.Print");
|
||||
|
||||
test_str = "$'is {a}'";
|
||||
off = test_str.Length-2;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == "a");
|
||||
|
||||
test_str = "seq1.Where(i ->(i = 1) or (i = 2)).JoinIntoString";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == "seq1.Where(i ->(i = 1) or (i = 2)).JoinIntoString");
|
||||
|
||||
test_str = "$'{f1(s0)}'";
|
||||
off = test_str.Length - 3;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == "s0");
|
||||
|
||||
test_str = "f1&<byte>\n.ToString";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == test_str);
|
||||
|
||||
test_str = "a[2:]";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == test_str);
|
||||
|
||||
test_str = "' '' '";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == test_str);
|
||||
|
||||
test_str = "' '' '' '";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == test_str);
|
||||
|
||||
test_str = "' ' '";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == "");
|
||||
|
||||
test_str = "(2..4)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw);
|
||||
s = languageIntellisenseSupport.FindExpression(off, test_str, line, col, out keyw);
|
||||
assert(s.Trim('\n', ' ', '\t') == test_str);
|
||||
|
||||
|
||||
|
|
@ -613,228 +613,228 @@ namespace CodeCompletion
|
|||
//testirovanie nazhatija skobki
|
||||
test_str = "writeln";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "Console.WriteLine";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "begin writeln";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s.Trim('\n',' ','\t') == "writeln");
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "Console{dsdsdsd}.WriteLine{''''''sds}";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "test(2,3).mmm";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "test[2<3].a";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "test[2>3].a";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "test[2>3] .a";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "23 < test";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s.Trim('\n',' ','\t') == "test");
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "23 > test";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s.Trim('\n',' ','\t') == "test");
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "(a<b) + test";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s.Trim('\n',' ','\t') == "test");
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "test2[sin(2,3),cos(2)]";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
|
||||
test_str = "sin{sdsd}(2,3).ttt";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "new System.Collections.Generic.List<integer>";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "TClass&<T>.bbb";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "()->(obj as string).Trim";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s == "(obj as string).Trim");
|
||||
assert(num_param == 0);
|
||||
|
||||
test_str = "test; \n sin";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "sin");
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "new TClass";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "Proc1({}2+3,'aasd',Proc2(a[34,{}2],new TClass(f('ssd')))).zzz";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "'abc'.tostring('aa','bb{()').ggg";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "Test([],[1,2,3],{cdsds} \tsin";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "{cdsds} \tsin");
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "test(2+3,aa.bb";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == "aa.bb");
|
||||
|
||||
test_str = "test(2<3).bb";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "sin(new TClass<integer>,TClass&<real>).pp";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "raise new TClass";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "new TClass");
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "begin test(2)";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "test(2)");
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "//aaaa\nConsole.WriteLine";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "Console.WriteLine");
|
||||
assert(num_param==0);
|
||||
|
||||
test_str = "System.Math.DivRem";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s.Trim(' ', '\n', '\t') == "System.Math.DivRem");
|
||||
assert(num_param == 0);
|
||||
|
||||
test_str = "seq1.Where(i ->(i = 1) or (i = 2)).JoinIntoString";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s.Trim('\n', ' ', '\t') == "seq1.Where(i ->(i = 1) or (i = 2)).JoinIntoString");
|
||||
|
||||
test_str = "seq1.Where(i ->(i = '1') or (i = '2')).JoinIntoString";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s.Trim('\n', ' ', '\t') == "seq1.Where(i ->(i = '1') or (i = '2')).JoinIntoString");
|
||||
|
||||
test_str = "f1&<array of byte>";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s.Trim('\n', ' ', '\t') == "f1&<array of byte>");
|
||||
|
||||
test_str = "f1&<sequence of byte>";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s.Trim('\n', ' ', '\t') == "f1&<sequence of byte>");
|
||||
|
||||
test_str = "&var.&uses.&procedure";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,'(',ref num_param);
|
||||
assert(s == test_str);
|
||||
|
||||
test_str = "s.OrderBy";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s == test_str);
|
||||
|
||||
test_str = "f1&<byte>\n.ToString";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s.Trim('\n', ' ', '\t') == "f1&<byte>\n.ToString");
|
||||
|
||||
test_str = "begin ''.PadLeft";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s.Trim('\n', ' ', '\t') == "''.PadLeft");
|
||||
|
||||
test_str = "begin var s := ''.PadLeft";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s.Trim('\n', ' ', '\t') == "''.PadLeft");
|
||||
|
||||
test_str = "begin \n var s := ''.PadLeft";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s.Trim('\n', ' ', '\t') == "''.PadLeft");
|
||||
|
||||
test_str = "writeln(23);\n ''.PadLeft";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s.Trim('\n', ' ', '\t') == "''.PadLeft");
|
||||
|
||||
test_str = "writeln(23);\n ''.PadLeft(2).ToString";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, '(', ref num_param);
|
||||
assert(s.Trim('\n', ' ', '\t') == "''.PadLeft(2).ToString");
|
||||
|
||||
|
||||
|
|
@ -843,129 +843,129 @@ namespace CodeCompletion
|
|||
test_str = ";test(3,aa.bb";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s == "test");
|
||||
assert(num_param == 3);
|
||||
|
||||
test_str = ";test(a[2,3,4],sin(2+3),aa.bb";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s == "test");
|
||||
assert(num_param == 4);
|
||||
|
||||
test_str = "Console.WriteLine(a[2,3,4]{ds},[1,2+3,5,'aa)'],sin(2+3,4+f(3)),aa.bb,(23)";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s == "Console.WriteLine");
|
||||
assert(num_param == 6);
|
||||
|
||||
test_str = "Console.WriteLine(new TClass(2,3";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s == "new TClass");
|
||||
assert(num_param == 3);
|
||||
|
||||
test_str = "Console.WriteLine(new{} TClass(2+f(2,[]),3";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s == "new{} TClass");
|
||||
assert(num_param == 3);
|
||||
|
||||
test_str = "begin \n\t sin(";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "sin");
|
||||
assert(num_param == 2);
|
||||
|
||||
test_str = "sin(2)";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "");
|
||||
|
||||
test_str = "begin f(2)+sin(2,3,4)";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "");
|
||||
|
||||
test_str = ";\n [sin(f(3)),a[3]";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "");
|
||||
|
||||
test_str = ";\n (sin)";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "");
|
||||
|
||||
test_str = "max(2<3";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "max");
|
||||
assert(num_param == 2);
|
||||
|
||||
test_str = "max(2>3";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "max");
|
||||
assert(num_param == 2);
|
||||
|
||||
test_str = "max(Test&<integer>(2,3)";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "max");
|
||||
assert(num_param == 2);
|
||||
|
||||
test_str = "new TextABC(60,110,110,'Hello!',RGB(x";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "RGB");
|
||||
assert(num_param == 2);
|
||||
|
||||
test_str = "new TextABC(60,110,110,'Hello!',new RGB(x";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "new RGB");
|
||||
assert(num_param == 2);
|
||||
|
||||
test_str = "new TextABC(new RGB(x";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "new RGB");
|
||||
assert(num_param == 2);
|
||||
|
||||
test_str = "new TextABC(new RGB(x,(2)";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "new RGB");
|
||||
assert(num_param == 3);
|
||||
|
||||
test_str = "new TextABC(new RGB(x(2)";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off,test_str,line,col,',',ref num_param);
|
||||
assert(s.Trim(' ','\n','\t') == "new RGB");
|
||||
assert(num_param == 2);
|
||||
|
||||
test_str = "Power(10 div 2";
|
||||
off = test_str.Length;
|
||||
num_param = 1;
|
||||
s = parser.LanguageInformation.FindExpressionForMethod(off, test_str, line, col, ',', ref num_param);
|
||||
s = languageIntellisenseSupport.FindExpressionForMethod(off, test_str, line, col, ',', ref num_param);
|
||||
assert(s.Trim(' ', '\n', '\t') == "Power");
|
||||
assert(num_param == 2);
|
||||
|
||||
|
|
@ -975,77 +975,77 @@ namespace CodeCompletion
|
|||
//mouse hover
|
||||
test_str = "sin(2)";
|
||||
off = 1;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
assert(s.Trim('\n',' ','\t')=="sin(2)");
|
||||
|
||||
test_str = "sin(2,3,4)";
|
||||
off = 1;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
assert(s.Trim('\n',' ','\t')=="sin(2,3,4)");
|
||||
|
||||
test_str = "sin {sdsd'} (2,3,4)";
|
||||
off = 1;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
assert(s.Trim('\n',' ','\t')==test_str);
|
||||
|
||||
test_str = "sin (df,'3)+2','{')";
|
||||
off = 1;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
assert(s.Trim('\n',' ','\t')==test_str);
|
||||
|
||||
test_str = "cos()";
|
||||
off = 1;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
assert(s.Trim('\n',' ','\t')==test_str);
|
||||
|
||||
test_str = "cos{()}";
|
||||
off = 1;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
assert(s.Trim('\n',' ','\t')=="cos");
|
||||
|
||||
test_str = "cos//()";
|
||||
off = 1;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
assert(s.Trim('\n',' ','\t')=="cos");
|
||||
|
||||
test_str = "cos(//)";
|
||||
off = 1;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
assert(s.Trim('\n',' ','\t')=="cos");
|
||||
|
||||
test_str = "cos('//')";
|
||||
off = 1;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
assert(s.Trim('\n',' ','\t')==test_str);
|
||||
|
||||
test_str = "cos({//})";
|
||||
off = 1;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
assert(s.Trim('\n',' ','\t')==test_str);
|
||||
|
||||
test_str = "cos(Math.Cos(x)+1)";
|
||||
off = 1;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off,test_str,line,col,out keyw,out str);
|
||||
assert(s.Trim('\n',' ','\t')==test_str);
|
||||
|
||||
test_str = "new t1<byte>(2)";
|
||||
off = 5;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off, test_str, line, col, out keyw, out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off, test_str, line, col, out keyw, out str);
|
||||
assert(s.Trim('\n', ' ', '\t') == "new t1<byte>(2)");
|
||||
|
||||
test_str = "new t1<List<byte>>(2)";
|
||||
off = 5;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off, test_str, line, col, out keyw, out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off, test_str, line, col, out keyw, out str);
|
||||
assert(s.Trim('\n', ' ', '\t') == "new t1<List<byte>>(2)");
|
||||
|
||||
test_str = "t1&<byte>.x";
|
||||
off = test_str.Length;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off, test_str, line, col, out keyw, out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off, test_str, line, col, out keyw, out str);
|
||||
assert(s.Trim('\n', ' ', '\t') == "t1&<byte>.x");
|
||||
|
||||
test_str = "Arr(0).Select&<integer,ft>";
|
||||
off = 8;
|
||||
s = parser.LanguageInformation.FindExpressionFromAnyPosition(off, test_str, line, col, out keyw, out str);
|
||||
s = languageIntellisenseSupport.FindExpressionFromAnyPosition(off, test_str, line, col, out keyw, out str);
|
||||
assert(s.Trim('\n', ' ', '\t') == "Arr(0).Select&<integer,ft>");
|
||||
|
||||
//----
|
||||
|
|
@ -1055,7 +1055,7 @@ namespace CodeCompletion
|
|||
StreamWriter sw = new StreamWriter("mscorlib.txt");
|
||||
foreach (Type t in types)
|
||||
{
|
||||
sw.WriteLine(parser.LanguageInformation.GetCompiledTypeRepresentation(t, t, ref i, ref j));
|
||||
sw.WriteLine(languageIntellisenseSupport.GetCompiledTypeRepresentation(t, t, ref i, ref j));
|
||||
}
|
||||
|
||||
sw.Close();
|
||||
|
|
@ -1063,7 +1063,7 @@ namespace CodeCompletion
|
|||
sw = new StreamWriter(typeof(System.Diagnostics.Process).Assembly.ManifestModule.ScopeName+".txt");
|
||||
foreach (Type t in types)
|
||||
{
|
||||
sw.WriteLine(parser.LanguageInformation.GetCompiledTypeRepresentation(t, t, ref i, ref j));
|
||||
sw.WriteLine(languageIntellisenseSupport.GetCompiledTypeRepresentation(t, t, ref i, ref j));
|
||||
}
|
||||
|
||||
sw.Close();
|
||||
|
|
@ -1072,7 +1072,7 @@ namespace CodeCompletion
|
|||
sw = new StreamWriter(typeof(System.Data.Constraint).Assembly.ManifestModule.ScopeName + ".txt");
|
||||
foreach (Type t in types)
|
||||
{
|
||||
sw.WriteLine(parser.LanguageInformation.GetCompiledTypeRepresentation(t, t, ref i, ref j));
|
||||
sw.WriteLine(languageIntellisenseSupport.GetCompiledTypeRepresentation(t, t, ref i, ref j));
|
||||
}
|
||||
|
||||
sw.Close();
|
||||
|
|
@ -1081,7 +1081,7 @@ namespace CodeCompletion
|
|||
sw = new StreamWriter(typeof(System.Xml.XmlDocument).Assembly.ManifestModule.ScopeName + ".txt");
|
||||
foreach (Type t in types)
|
||||
{
|
||||
sw.WriteLine(parser.LanguageInformation.GetCompiledTypeRepresentation(t, t, ref i, ref j));
|
||||
sw.WriteLine(languageIntellisenseSupport.GetCompiledTypeRepresentation(t, t, ref i, ref j));
|
||||
}
|
||||
sw.Close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@
|
|||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using PascalABCCompiler.Parsers;
|
||||
using System.Collections.Generic;
|
||||
using PascalABCCompiler.SyntaxTreeConverters;
|
||||
using PascalABCCompiler.SystemLibrary;
|
||||
using PascalABCCompiler.TreeConverter;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Languages.Facade
|
||||
{
|
||||
|
|
@ -13,14 +14,17 @@ namespace Languages.Facade
|
|||
/// </summary>
|
||||
public abstract class BaseLanguage : ILanguage
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Все параметры должны быть не null (и не пустым массивом), кроме IDocParser в случае, если он не требуется
|
||||
/// Все параметры должны быть не null (и не пустым массивом),
|
||||
/// кроме IDocParser и ILanguageIntellisenseSupport в случае, если они не требуются
|
||||
/// </summary>
|
||||
public BaseLanguage(ILanguageInformation languageInformation,
|
||||
public BaseLanguage(ILanguageInformation languageInformation, ILanguageIntellisenseSupport languageIntellisenseSupport,
|
||||
IParser parser, IDocParser docParser, List<ISyntaxTreeConverter> syntaxTreeConverters)
|
||||
{
|
||||
this.LanguageInformation = languageInformation;
|
||||
this.LanguageIntellisenseSupport = languageIntellisenseSupport;
|
||||
if (this.LanguageIntellisenseSupport != null)
|
||||
this.LanguageIntellisenseSupport.LanguageInformation = languageInformation;
|
||||
this.Parser = parser;
|
||||
this.Parser.LanguageInformation = languageInformation;
|
||||
this.DocParser = docParser;
|
||||
|
|
@ -39,19 +43,37 @@ namespace Languages.Facade
|
|||
|
||||
public string[] SystemUnitNames => LanguageInformation.SystemUnitNames;
|
||||
|
||||
public virtual ILanguageInformation LanguageInformation { get; }
|
||||
public ILanguageInformation LanguageInformation { get; }
|
||||
|
||||
public virtual IParser Parser { get; protected set; }
|
||||
public ILanguageIntellisenseSupport LanguageIntellisenseSupport { get; }
|
||||
|
||||
public virtual IDocParser DocParser { get; protected set; }
|
||||
public IParser Parser { get; protected set; }
|
||||
|
||||
public virtual List<ISyntaxTreeConverter> SyntaxTreeConverters { get; protected set; }
|
||||
public IDocParser DocParser { get; protected set; }
|
||||
|
||||
public bool ApplySyntaxTreeConvertersForIntellisense => LanguageInformation.ApplySyntaxTreeConvertersForIntellisense;
|
||||
public List<ISyntaxTreeConverter> SyntaxTreeConverters { get; protected set; }
|
||||
|
||||
public virtual syntax_tree_visitor SyntaxTreeToSemanticTreeConverter { get; protected set; }
|
||||
public syntax_tree_visitor SyntaxTreeToSemanticTreeConverter { get; protected set; }
|
||||
|
||||
public abstract void SetSemanticConstants();
|
||||
public virtual void SetSemanticConstants()
|
||||
{
|
||||
SemanticRulesConstants.ClassBaseType = SystemLibrary.object_type;
|
||||
SemanticRulesConstants.StructBaseType = SystemLibrary.value_type;
|
||||
SemanticRulesConstants.AddResultVariable = true;
|
||||
SemanticRulesConstants.ZeroBasedStrings = true;
|
||||
SemanticRulesConstants.FastStrings = false;
|
||||
SemanticRulesConstants.InitStringAsEmptyString = true;
|
||||
SemanticRulesConstants.UseDivisionAssignmentOperatorsForIntegerTypes = false;
|
||||
SemanticRulesConstants.ManyVariablesOneInitializator = false;
|
||||
SemanticRulesConstants.OrderIndependedMethodNames = true;
|
||||
SemanticRulesConstants.OrderIndependedFunctionNames = false;
|
||||
SemanticRulesConstants.OrderIndependedTypeNames = false;
|
||||
SemanticRulesConstants.EnableExitProcedure = true;
|
||||
SemanticRulesConstants.StrongPointersTypeCheckForDotNet = true;
|
||||
SemanticRulesConstants.AllowChangeLoopVariable = false;
|
||||
SemanticRulesConstants.AllowGlobalVisibilityForPABCDll = true;
|
||||
SemanticRulesConstants.AllowMethodCallsWithoutParentheses = false;
|
||||
}
|
||||
|
||||
public abstract void SetSyntaxTreeToSemanticTreeConverter();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ namespace Languages.Facade
|
|||
|
||||
ILanguageInformation LanguageInformation { get; }
|
||||
|
||||
ILanguageIntellisenseSupport LanguageIntellisenseSupport { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Основной парсер языка
|
||||
/// </summary>
|
||||
|
|
@ -45,11 +47,6 @@ namespace Languages.Facade
|
|||
/// </summary>
|
||||
List<ISyntaxTreeConverter> SyntaxTreeConverters { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Вызывать ли преобразователей синтаксического дерева в работе Intellisense
|
||||
/// </summary>
|
||||
bool ApplySyntaxTreeConvertersForIntellisense { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Преобразователь из синтаксического дерева в семантическое
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using PascalABCCompiler.ParserTools.Directives;
|
||||
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
using PascalABCCompiler.SyntaxTree;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -8,25 +9,9 @@ using System.Text;
|
|||
|
||||
namespace PascalABCCompiler.Parsers
|
||||
{
|
||||
public abstract class BaseLanguageInformation : ILanguageInformation
|
||||
public abstract class BaseLanguageIntellisenseSupport : ILanguageIntellisenseSupport
|
||||
{
|
||||
public abstract string Name { get; }
|
||||
|
||||
public abstract string Version { get; }
|
||||
|
||||
public abstract string Copyright { get; }
|
||||
|
||||
public abstract bool CaseSensitive { get; }
|
||||
|
||||
public abstract string[] FilesExtensions { get; }
|
||||
|
||||
public abstract string[] SystemUnitNames { get; }
|
||||
|
||||
public abstract BaseKeywords KeywordsStorage { get; }
|
||||
|
||||
public abstract Dictionary<string, DirectiveInfo> ValidDirectives { get; protected set; }
|
||||
|
||||
public abstract string CommentSymbol { get; }
|
||||
public ILanguageInformation LanguageInformation { get; set; }
|
||||
|
||||
public abstract string BodyStartBracket { get; }
|
||||
|
||||
|
|
@ -46,8 +31,6 @@ namespace PascalABCCompiler.Parsers
|
|||
public abstract string ProcedureName { get; }
|
||||
public abstract string FunctionName { get; }
|
||||
|
||||
public abstract bool SyntaxTreeIsConvertedAfterUsedModulesCompilation { get; }
|
||||
|
||||
public abstract bool ApplySyntaxTreeConvertersForIntellisense { get; }
|
||||
|
||||
public abstract bool IncludeDotNetEntities { get; }
|
||||
|
|
@ -58,11 +41,12 @@ namespace PascalABCCompiler.Parsers
|
|||
|
||||
public abstract bool UsesFunctionsOverlappingSourceContext { get; }
|
||||
|
||||
public virtual Dictionary<string, string> SpecialModulesAliases => null;
|
||||
|
||||
protected abstract string IntTypeName { get; }
|
||||
|
||||
public abstract bool IsParams(string paramDescription);
|
||||
public virtual bool IsParams(string paramDescription)
|
||||
{
|
||||
return paramDescription.TrimStart().StartsWith("params");
|
||||
}
|
||||
|
||||
public virtual void RenameOrExcludeSpecialNames(SymInfo[] symInfos) { }
|
||||
|
||||
|
|
@ -141,9 +125,48 @@ namespace PascalABCCompiler.Parsers
|
|||
return null;
|
||||
}
|
||||
|
||||
public abstract string GetArrayDescription(string elementType, int rank);
|
||||
public virtual string GetArrayDescription(string elementType, int rank)
|
||||
{
|
||||
if (rank == 1)
|
||||
return "array of " + elementType;
|
||||
else
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append('[');
|
||||
for (int i = 0; i < rank - 1; i++)
|
||||
sb.Append(DelimiterInIndexer);
|
||||
sb.Append(']');
|
||||
return "array" + sb.ToString() + " of " + elementType;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract string GetClassKeyword(class_keyword keyw);
|
||||
public virtual string GetClassKeyword(class_keyword keyw)
|
||||
{
|
||||
switch (keyw)
|
||||
{
|
||||
case class_keyword.Class: return "class";
|
||||
case class_keyword.Interface: return "interface";
|
||||
case class_keyword.Record: return "record";
|
||||
case class_keyword.TemplateClass: return "template class";
|
||||
case class_keyword.TemplateRecord: return "template record";
|
||||
case class_keyword.TemplateInterface: return "template interface";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual string GetKeyword(SymbolKind kind)
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
case SymbolKind.Class: return "class";
|
||||
case SymbolKind.Enum: return "enum";
|
||||
case SymbolKind.Struct: return "record";
|
||||
case SymbolKind.Type: return "type";
|
||||
case SymbolKind.Interface: return "interface";
|
||||
case SymbolKind.Null: return "nil";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public string GetCompiledTypeRepresentation(Type t, MemberInfo mi, ref int line, ref int col)
|
||||
{
|
||||
|
|
@ -609,7 +632,7 @@ namespace PascalABCCompiler.Parsers
|
|||
|
||||
public abstract string GetDescription(IBaseScope scope);
|
||||
|
||||
|
||||
|
||||
// поменять на abstract EVA
|
||||
public virtual string GetDocumentTemplate(string lineText, string Text, int line, int col, int pos)
|
||||
{
|
||||
|
|
@ -918,16 +941,19 @@ namespace PascalABCCompiler.Parsers
|
|||
return "string" + "[" + scope.Length + "]";
|
||||
}
|
||||
|
||||
public abstract string GetKeyword(SymbolKind kind);
|
||||
|
||||
public KeywordKind GetKeywordKind(string name)
|
||||
{
|
||||
if (KeywordsStorage.KeywordKinds.TryGetValue(name, out var kind))
|
||||
if (LanguageInformation.KeywordsStorage.KeywordKinds.TryGetValue(name, out var kind))
|
||||
return kind;
|
||||
else
|
||||
return KeywordKind.None;
|
||||
}
|
||||
|
||||
public virtual string GetShortName(ICompiledConstructorScope scope)
|
||||
{
|
||||
return StringConstants.default_constructor_name;
|
||||
}
|
||||
|
||||
public string GetShortName(ICompiledTypeScope scope)
|
||||
{
|
||||
return GetShortTypeName(scope.CompiledType);
|
||||
|
|
@ -947,7 +973,6 @@ namespace PascalABCCompiler.Parsers
|
|||
return GetShortTypeName(scope.CompiledMethod);
|
||||
}
|
||||
|
||||
public abstract string GetShortName(ICompiledConstructorScope scope);
|
||||
|
||||
public string GetShortName(IProcScope scope)
|
||||
{
|
||||
|
|
@ -1433,9 +1458,9 @@ namespace PascalABCCompiler.Parsers
|
|||
return sc.Name + (((sc as ITypeScope).TemplateArguments != null && !sc.Name.EndsWith("<>") && sc.Name != "class") ? "<>" : "") + ".";
|
||||
}
|
||||
|
||||
if (sc is IInterfaceUnitScope && SpecialModulesAliases != null)
|
||||
if (sc is IInterfaceUnitScope && LanguageInformation.SpecialModulesAliases != null)
|
||||
{
|
||||
var p = SpecialModulesAliases.FirstOrDefault(kv => kv.Value == sc.Name);
|
||||
var p = LanguageInformation.SpecialModulesAliases.FirstOrDefault(kv => kv.Value == sc.Name);
|
||||
|
||||
if (!p.Equals(default(KeyValuePair<string, string>)))
|
||||
return p.Key + ".";
|
||||
|
|
@ -1454,9 +1479,9 @@ namespace PascalABCCompiler.Parsers
|
|||
return sc.Name + (((sc as ITypeScope).TemplateArguments != null && !sc.Name.EndsWith("<>")) ? "<>" : "");
|
||||
}
|
||||
|
||||
if (sc is IInterfaceUnitScope && SpecialModulesAliases != null)
|
||||
if (sc is IInterfaceUnitScope && LanguageInformation.SpecialModulesAliases != null)
|
||||
{
|
||||
var p = SpecialModulesAliases.FirstOrDefault(kv => kv.Value == sc.Name);
|
||||
var p = LanguageInformation.SpecialModulesAliases.FirstOrDefault(kv => kv.Value == sc.Name);
|
||||
|
||||
if (!p.Equals(default(KeyValuePair<string, string>)))
|
||||
return p.Key + ".";
|
||||
|
|
@ -1579,11 +1604,20 @@ namespace PascalABCCompiler.Parsers
|
|||
|
||||
public abstract string GetStandardTypeByKeyword(KeywordKind keyw);
|
||||
|
||||
public abstract string GetStringForChar(char c);
|
||||
public virtual string GetStringForChar(char c)
|
||||
{
|
||||
return "'" + c.ToString() + "'";
|
||||
}
|
||||
|
||||
public abstract string GetStringForSharpChar(int num);
|
||||
public virtual string GetStringForSharpChar(int num)
|
||||
{
|
||||
return "#" + num.ToString();
|
||||
}
|
||||
|
||||
public abstract string GetStringForString(string s);
|
||||
public virtual string GetStringForString(string s)
|
||||
{
|
||||
return "'" + s + "'";
|
||||
}
|
||||
|
||||
public abstract string GetSynonimDescription(ITypeScope scope);
|
||||
|
||||
|
|
@ -1633,14 +1667,23 @@ namespace PascalABCCompiler.Parsers
|
|||
return null;
|
||||
}
|
||||
|
||||
public abstract bool IsDefinitionIdentifierAfterKeyword(KeywordKind keyw);
|
||||
public virtual bool IsDefinitionIdentifierAfterKeyword(KeywordKind keyw)
|
||||
{
|
||||
if (keyw == PascalABCCompiler.Parsers.KeywordKind.Function || keyw == PascalABCCompiler.Parsers.KeywordKind.Constructor || keyw == PascalABCCompiler.Parsers.KeywordKind.Destructor || keyw == PascalABCCompiler.Parsers.KeywordKind.Type || keyw == PascalABCCompiler.Parsers.KeywordKind.Var
|
||||
|| keyw == PascalABCCompiler.Parsers.KeywordKind.Unit || keyw == PascalABCCompiler.Parsers.KeywordKind.Const || keyw == PascalABCCompiler.Parsers.KeywordKind.Program || keyw == PascalABCCompiler.Parsers.KeywordKind.Punkt)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsKeyword(string value)
|
||||
{
|
||||
return KeywordsStorage.KeywordsForIntellisenseSet.Contains(value);
|
||||
return LanguageInformation.KeywordsStorage.KeywordsForIntellisenseSet.Contains(value);
|
||||
}
|
||||
|
||||
public abstract bool IsMethodCallParameterSeparator(char key);
|
||||
public virtual bool IsMethodCallParameterSeparator(char key)
|
||||
{
|
||||
return key == ',';
|
||||
}
|
||||
|
||||
public virtual bool IsNamespaceAfterKeyword(KeywordKind keyw)
|
||||
{
|
||||
|
|
@ -1657,7 +1700,12 @@ namespace PascalABCCompiler.Parsers
|
|||
return key == '(';
|
||||
}
|
||||
|
||||
public abstract bool IsTypeAfterKeyword(KeywordKind keyw);
|
||||
public virtual bool IsTypeAfterKeyword(KeywordKind keyw)
|
||||
{
|
||||
if (keyw == KeywordKind.Colon || keyw == KeywordKind.Of || keyw == KeywordKind.TypeDecl)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// перенести реализацию сюда EVA
|
||||
public virtual string SkipNew(int off, string Text, ref KeywordKind keyw)
|
||||
|
|
@ -1713,7 +1761,7 @@ namespace PascalABCCompiler.Parsers
|
|||
{
|
||||
keyword = KeywordKind.Raise;
|
||||
}
|
||||
else if (KeywordsStorage.KeywordsTreatedAsFunctions.Contains(s))
|
||||
else if (LanguageInformation.KeywordsStorage.KeywordsTreatedAsFunctions.Contains(s))
|
||||
{
|
||||
keyword = KeywordKind.None;
|
||||
}
|
||||
|
|
@ -8,11 +8,11 @@ namespace PascalABCCompiler.Parsers
|
|||
{
|
||||
public abstract class BaseParser : IParser
|
||||
{
|
||||
public List<Error> Errors { get; protected set; } = new List<Error>();
|
||||
protected List<Error> Errors = new List<Error>();
|
||||
|
||||
public List<CompilerWarning> Warnings { get; protected set; } = new List<CompilerWarning>();
|
||||
protected List<CompilerWarning> Warnings = new List<CompilerWarning>();
|
||||
|
||||
public List<compiler_directive> CompilerDirectives { get; protected set; } = new List<compiler_directive>();
|
||||
protected List<compiler_directive> CompilerDirectives = new List<compiler_directive>();
|
||||
|
||||
public ILanguageInformation LanguageInformation { get; set; }
|
||||
|
||||
|
|
@ -71,8 +71,11 @@ namespace PascalABCCompiler.Parsers
|
|||
|
||||
private void InitializeBeforeParsing(List<Error> Errors, List<CompilerWarning> Warnings)
|
||||
{
|
||||
Errors.Clear();
|
||||
Warnings.Clear();
|
||||
this.Errors = Errors;
|
||||
this.Warnings = Warnings;
|
||||
this.CompilerDirectives = new List<compiler_directive>();
|
||||
}
|
||||
|
||||
protected virtual syntax_tree_node BuildTree(string FileName, string Text, List<Error> Errors, List<CompilerWarning> Warnings, ParseMode ParseMode, bool compilingNotMainProgram, List<string> DefinesList = null)
|
||||
|
|
@ -134,10 +137,5 @@ namespace PascalABCCompiler.Parsers
|
|||
|
||||
protected abstract syntax_tree_node BuildTreeInStatementMode(string FileName, string Text);
|
||||
|
||||
public virtual void Reset()
|
||||
{
|
||||
// если нужно - переопределяйте
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
35
ParserTools/ParserTools/DefaultLanguageInformation.cs
Normal file
35
ParserTools/ParserTools/DefaultLanguageInformation.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
|
||||
using PascalABCCompiler.ParserTools.Directives;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PascalABCCompiler.Parsers
|
||||
{
|
||||
public abstract class DefaultLanguageInformation : ILanguageInformation
|
||||
{
|
||||
public abstract string Name { get; }
|
||||
|
||||
public abstract string Version { get; }
|
||||
|
||||
public abstract string Copyright { get; }
|
||||
|
||||
public abstract bool CaseSensitive { get; }
|
||||
|
||||
public abstract string[] FilesExtensions { get; }
|
||||
|
||||
public abstract string[] SystemUnitNames { get; }
|
||||
|
||||
public abstract BaseKeywords KeywordsStorage { get; }
|
||||
|
||||
public virtual bool SyntaxTreeIsConvertedAfterUsedModulesCompilation => false;
|
||||
|
||||
public virtual Dictionary<string, DirectiveInfo> ValidDirectives => null;
|
||||
|
||||
// Важно переопределять для реализации тестов
|
||||
public virtual string CommentSymbol => "//";
|
||||
|
||||
public virtual Dictionary<string, string> SpecialModulesAliases => null;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,10 +6,10 @@ using PascalABCCompiler.SyntaxTree;
|
|||
|
||||
namespace PascalABCCompiler.Parsers
|
||||
{
|
||||
/// <summary>
|
||||
/// Интерфейс, предоставляющий информацию интеллисенсу
|
||||
/// </summary>
|
||||
public interface ILanguageInformation
|
||||
/// <summary>
|
||||
/// Информация о языке
|
||||
/// </summary>
|
||||
public interface ILanguageInformation
|
||||
{
|
||||
/// <summary>
|
||||
/// Название языка
|
||||
|
|
@ -41,6 +41,43 @@ namespace PascalABCCompiler.Parsers
|
|||
/// </summary>
|
||||
string[] SystemUnitNames { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Нужно ли вызывать конверторы синтаксического дерева, срабатывающие после компиляции зависимостей
|
||||
/// </summary>
|
||||
bool SyntaxTreeIsConvertedAfterUsedModulesCompilation { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Класс с информацией о ключевых словах языка
|
||||
/// </summary>
|
||||
BaseKeywords KeywordsStorage
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Данные о всех поддерживаемых директивах компилятора
|
||||
/// </summary>
|
||||
Dictionary<string, ParserTools.Directives.DirectiveInfo> ValidDirectives { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Обозначение однострочного комментария (используется в TestRunner)
|
||||
/// </summary>
|
||||
string CommentSymbol { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Имена стандартных модулей, которые не совпадают с именами их файлов.
|
||||
/// Можно задавать null.
|
||||
/// </summary>
|
||||
Dictionary<string, string> SpecialModulesAliases { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Интерфейс, предоставляющий информацию интеллисенсу
|
||||
/// </summary>
|
||||
public interface ILanguageIntellisenseSupport
|
||||
{
|
||||
ILanguageInformation LanguageInformation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Получить полное описание элемента (в желтой подсказке)
|
||||
/// </summary>
|
||||
|
|
@ -176,30 +213,11 @@ namespace PascalABCCompiler.Parsers
|
|||
|
||||
int FindParamDelimForIndexer(string descriptionAfterOpeningParenthesis, int number);
|
||||
|
||||
/// <summary>
|
||||
/// Нужно ли вызывать конверторы синтаксического дерева, срабатывающие после компиляции зависимостей
|
||||
/// </summary>
|
||||
bool SyntaxTreeIsConvertedAfterUsedModulesCompilation { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Вызывать ли преобразователей синтаксического дерева в работе Intellisense
|
||||
/// </summary>
|
||||
bool ApplySyntaxTreeConvertersForIntellisense { get; }
|
||||
|
||||
Dictionary<string, string> SpecialModulesAliases { get; }
|
||||
|
||||
BaseKeywords KeywordsStorage
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Данные о всех поддерживаемых директивах компилятора
|
||||
/// </summary>
|
||||
Dictionary<string, ParserTools.Directives.DirectiveInfo> ValidDirectives { get; }
|
||||
|
||||
string CommentSymbol { get; }
|
||||
|
||||
string BodyStartBracket
|
||||
{
|
||||
get;
|
||||
|
|
|
|||
|
|
@ -3,22 +3,12 @@
|
|||
using System.Collections.Generic;
|
||||
using PascalABCCompiler.SyntaxTree;
|
||||
using PascalABCCompiler.Errors;
|
||||
using System;
|
||||
|
||||
namespace PascalABCCompiler.Parsers
|
||||
{
|
||||
public enum ParseMode { Normal, Expression, Statement, Special, ForFormatter, TypeAsExpression };
|
||||
public interface IParser
|
||||
{
|
||||
List<Error> Errors { get; }
|
||||
|
||||
List<CompilerWarning> Warnings { get; }
|
||||
|
||||
List<compiler_directive> CompilerDirectives
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
ILanguageInformation LanguageInformation { get; set; }
|
||||
|
||||
compilation_unit GetCompilationUnit(string FileName, string Text, List<Error> Errors, List<CompilerWarning> Warnings, ParseMode parseMode, bool compilingNotMainProgram, List<string> DefinesList = null);
|
||||
|
|
@ -30,8 +20,6 @@ namespace PascalABCCompiler.Parsers
|
|||
statement GetStatement(string FileName, string Text, List<Error> Errors, List<CompilerWarning> Warnings);
|
||||
|
||||
expression GetTypeAsExpression(string FileName, string Text, List<Error> Errors, List<CompilerWarning> Warnings);
|
||||
|
||||
void Reset();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
38
ParserTools/ParserTools/SimpleParser.cs
Normal file
38
ParserTools/ParserTools/SimpleParser.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using PascalABCCompiler.SyntaxTree;
|
||||
|
||||
namespace PascalABCCompiler.Parsers
|
||||
{
|
||||
/// <summary>
|
||||
/// Базовый класс для парсера без поддержки построения частей дерева и построения дерева с пропуском ошибок (Special mode)
|
||||
/// </summary>
|
||||
public abstract class SimpleParser : BaseParser
|
||||
{
|
||||
protected override syntax_tree_node BuildTreeInExprMode(string FileName, string Text)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
protected override syntax_tree_node BuildTreeInFormatterMode(string FileName, string Text)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
protected override syntax_tree_node BuildTreeInSpecialMode(string FileName, string Text, bool compilingNotMainProgram)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
protected override syntax_tree_node BuildTreeInStatementMode(string FileName, string Text)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
protected override syntax_tree_node BuildTreeInTypeExprMode(string FileName, string Text)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -71,17 +71,6 @@ namespace Languages.Pascal.Frontend.Wrapping
|
|||
/// </summary>
|
||||
public class PascalABCNewLanguageParser : BaseParser
|
||||
{
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
CompilerDirectives = new List<compiler_directive>();
|
||||
Errors.Clear();
|
||||
}
|
||||
|
||||
protected override void PreBuildTree(string FileName)
|
||||
{
|
||||
CompilerDirectives = new List<compiler_directive>();
|
||||
}
|
||||
|
||||
private syntax_tree_node Parse(string Text, string fileName, bool buildTreeForFormatter = false, List<string> definesList = null)
|
||||
{
|
||||
|
|
@ -115,8 +104,6 @@ namespace Languages.Pascal.Frontend.Wrapping
|
|||
|
||||
protected override syntax_tree_node BuildTreeInNormalMode(string FileName, string Text, bool compilingNotMainProgram, List<string> DefinesList = null)
|
||||
{
|
||||
Errors.Clear();
|
||||
Warnings.Clear();
|
||||
syntax_tree_node root = Parse(Text, FileName, false, DefinesList);
|
||||
|
||||
if (Errors.Count > 0)
|
||||
|
|
@ -163,14 +150,12 @@ namespace Languages.Pascal.Frontend.Wrapping
|
|||
|
||||
protected override syntax_tree_node BuildTreeInSpecialMode(string FileName, string Text, bool compilingNotMainProgram)
|
||||
{
|
||||
Errors.Clear();
|
||||
syntax_tree_node root = Parse(Text, FileName);
|
||||
return root;
|
||||
}
|
||||
|
||||
protected override syntax_tree_node BuildTreeInFormatterMode(string FileName, string Text)
|
||||
{
|
||||
Errors.Clear();
|
||||
syntax_tree_node root = Parse(Text, FileName, true);
|
||||
return root;
|
||||
}
|
||||
|
|
|
|||
1799
PascalABCLanguageInfo/PascalABCIntellisenseSupport.cs
Normal file
1799
PascalABCLanguageInfo/PascalABCIntellisenseSupport.cs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -15,6 +15,7 @@ namespace Languages.Pascal
|
|||
public PascalABCLanguage() : base(
|
||||
|
||||
languageInformation: new Frontend.Data.PascalABCLanguageInformation(),
|
||||
languageIntellisenseSupport: new Frontend.Data.PascalABCIntellisenseSupport(),
|
||||
parser: new Frontend.Wrapping.PascalABCNewLanguageParser(),
|
||||
docParser: new Frontend.Documentation.PascalDocTagsLanguageParser(),
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -362,8 +362,8 @@ namespace VisualPascalABCPlugins
|
|||
|
||||
public interface IWidgetStatusContoller
|
||||
{
|
||||
void SetStartDebugEnabled();
|
||||
void SetStartDebugDisabled();
|
||||
void SetStartDebugAndRunEnabled();
|
||||
void SetStartDebugAndRunDisabled();
|
||||
void SetDebugStopDisabled();
|
||||
void SetDebugStopEnabled();
|
||||
void SetAddExprMenuVisible(bool val);
|
||||
|
|
@ -372,10 +372,10 @@ namespace VisualPascalABCPlugins
|
|||
void SetDebugPausedDisabled();
|
||||
void SetPlayButtonsVisible(bool val);
|
||||
void SetStopEnabled(bool enabled);
|
||||
void SetCompilingButtonsEnabled(bool Enabled);
|
||||
void SetCompilingAndRunButtonsEnabled(bool Enabled);
|
||||
void SetDebugButtonsEnabled(bool val);
|
||||
void SetOptionsEnabled(bool val);
|
||||
bool CompilingButtonsEnabled { get; set; }
|
||||
bool CompilingAndRunButtonsEnabled { get; set; }
|
||||
void EnableCodeCompletionToolTips(bool val);
|
||||
void ChangeContinueDebugNameOnStart();
|
||||
void ChangeStartDebugNameOnContinue();
|
||||
|
|
|
|||
|
|
@ -348,8 +348,8 @@ namespace VisualPascalABCPlugins
|
|||
|
||||
public interface IWidgetStatusContoller
|
||||
{
|
||||
void SetStartDebugEnabled();
|
||||
void SetStartDebugDisabled();
|
||||
void SetStartDebugAndRunEnabled();
|
||||
void SetStartDebugAndRunDisabled();
|
||||
void SetDebugStopDisabled();
|
||||
void SetDebugStopEnabled();
|
||||
void SetAddExprMenuVisible(bool val);
|
||||
|
|
@ -358,10 +358,10 @@ namespace VisualPascalABCPlugins
|
|||
void SetDebugPausedDisabled();
|
||||
void SetPlayButtonsVisible(bool val);
|
||||
void SetStopEnabled(bool enabled);
|
||||
void SetCompilingButtonsEnabled(bool Enabled);
|
||||
void SetCompilingAndRunButtonsEnabled(bool Enabled);
|
||||
void SetDebugButtonsEnabled(bool val);
|
||||
void SetOptionsEnabled(bool val);
|
||||
bool CompilingButtonsEnabled { get; set; }
|
||||
bool CompilingAndRunButtonsEnabled { get; set; }
|
||||
void EnableCodeCompletionToolTips(bool val);
|
||||
void ChangeContinueDebugNameOnStart();
|
||||
void ChangeStartDebugNameOnContinue();
|
||||
|
|
|
|||
|
|
@ -67,11 +67,11 @@ namespace ICSharpCode.TextEditor.Util
|
|||
if (param_num == -1)
|
||||
return;
|
||||
|
||||
var languageInfo = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation;
|
||||
var languageIntellisenseSupport = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport;
|
||||
|
||||
int startIndex = basicDescription.IndexOf("(", basicDescription.IndexOf("(" + PascalABCCompiler.StringResources.Get("CODE_COMPLETION_EXTENSION")) + 1) + 1;
|
||||
|
||||
int paranthesisIndex = languageInfo.FindClosingParenthesis(basicDescription.Substring(startIndex), ')');
|
||||
int paranthesisIndex = languageIntellisenseSupport.FindClosingParenthesis(basicDescription.Substring(startIndex), ')');
|
||||
|
||||
if (paranthesisIndex == -1)
|
||||
return;
|
||||
|
|
@ -84,7 +84,7 @@ namespace ICSharpCode.TextEditor.Util
|
|||
|
||||
if (bold_beg != 0)
|
||||
{
|
||||
int paramDelimIndex = languageInfo.FindParamDelim(basicDescription.Substring(bold_beg), 1);
|
||||
int paramDelimIndex = languageIntellisenseSupport.FindParamDelim(basicDescription.Substring(bold_beg), 1);
|
||||
|
||||
if (paramDelimIndex == -1)
|
||||
{
|
||||
|
|
@ -105,7 +105,7 @@ namespace ICSharpCode.TextEditor.Util
|
|||
{
|
||||
string paramDescription = basicDescription.Substring(startIndex, paranthesisIndex);
|
||||
|
||||
if (languageInfo.IsParams(paramDescription))
|
||||
if (languageIntellisenseSupport.IsParams(paramDescription))
|
||||
{
|
||||
bold_beg = startIndex;
|
||||
bold_len = paranthesisIndex;
|
||||
|
|
@ -115,15 +115,15 @@ namespace ICSharpCode.TextEditor.Util
|
|||
{
|
||||
string descriptionAfterBracket = basicDescription.Substring(startIndex);
|
||||
|
||||
int paramDelimIndex = languageInfo.FindParamDelim(descriptionAfterBracket, paramsCount - 1);
|
||||
int paramDelimIndex = languageIntellisenseSupport.FindParamDelim(descriptionAfterBracket, paramsCount - 1);
|
||||
|
||||
if (paramDelimIndex != -1)
|
||||
{
|
||||
int paramDelimLength = languageInfo.ParameterDelimiter.Length;
|
||||
int paramDelimLength = languageIntellisenseSupport.ParameterDelimiter.Length;
|
||||
|
||||
string paramDescription = descriptionAfterBracket.Substring(paramDelimIndex + paramDelimLength, paranthesisIndex - paramDelimIndex - paramDelimLength);
|
||||
|
||||
if (languageInfo.IsParams(paramDescription))
|
||||
if (languageIntellisenseSupport.IsParams(paramDescription))
|
||||
{
|
||||
bold_beg = paramDelimIndex + startIndex + paramDelimLength;
|
||||
bold_len = end_sk - bold_beg;
|
||||
|
|
@ -133,12 +133,12 @@ namespace ICSharpCode.TextEditor.Util
|
|||
}
|
||||
else
|
||||
{
|
||||
int paramDelimIndex = languageInfo.FindParamDelim(basicDescription.Substring(startIndex), param_num - 1);
|
||||
int paramDelimIndex = languageIntellisenseSupport.FindParamDelim(basicDescription.Substring(startIndex), param_num - 1);
|
||||
|
||||
if (paramDelimIndex != -1)
|
||||
{
|
||||
bold_beg = paramDelimIndex + startIndex + languageInfo.ParameterDelimiter.Length;
|
||||
int secondParamDelimIndex = languageInfo.FindParamDelim(basicDescription.Substring(startIndex), param_num);
|
||||
bold_beg = paramDelimIndex + startIndex + languageIntellisenseSupport.ParameterDelimiter.Length;
|
||||
int secondParamDelimIndex = languageIntellisenseSupport.FindParamDelim(basicDescription.Substring(startIndex), param_num);
|
||||
|
||||
if (secondParamDelimIndex == -1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace VisualPascalABC
|
|||
private System.Threading.Thread MainProgramThread = System.Threading.Thread.CurrentThread;
|
||||
private System.Threading.Thread StartingThread;
|
||||
public delegate void SetFlagDelegate(bool flag);
|
||||
private SetFlagDelegate SetCompilingButtonsEnabled;
|
||||
private SetFlagDelegate SetCompilingAndRunButtonsEnabled;
|
||||
private SetFlagDelegate SetDebugButtonsEnabled;
|
||||
public ConvertTextDelegate ConvertUnitTextProperty { get; set; }
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ namespace VisualPascalABC
|
|||
Dictionary<string, CodeFileDocumentControl> OpenDocuments;
|
||||
|
||||
public VisualEnvironmentCompiler(InvokeDegegate beginInvoke,
|
||||
SetFlagDelegate setCompilingButtonsEnabled, SetFlagDelegate setCompilingDebugEnabled, SetTextDelegate setStateText,
|
||||
SetFlagDelegate setCompilingAndRunButtonsEnabled, SetFlagDelegate setCompilingDebugEnabled, SetTextDelegate setStateText,
|
||||
SetTextDelegate addTextToCompilerMessages, ToolStripMenuItem pluginsMenuItem,
|
||||
ToolStrip pluginsToolStrip, ExecuteSourceLocationActionDelegate ExecuteSLAction,
|
||||
ExecuteVisualEnvironmentCompilerActionDelegate ExecuteVECAction,
|
||||
|
|
@ -77,7 +77,7 @@ namespace VisualPascalABC
|
|||
this.StandartDirectories = StandartDirectories;
|
||||
this.ErrorsManager = ErrorsManager;
|
||||
this.ChangeVisualEnvironmentState += onChangeVisualEnvironmentState;
|
||||
SetCompilingButtonsEnabled = setCompilingButtonsEnabled;
|
||||
SetCompilingAndRunButtonsEnabled = setCompilingAndRunButtonsEnabled;
|
||||
SetDebugButtonsEnabled = setCompilingDebugEnabled;
|
||||
SetStateText = setStateText;
|
||||
AddTextToCompilerMessages = addTextToCompilerMessages;
|
||||
|
|
@ -362,7 +362,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
case PascalABCCompiler.CompilerState.CompilationStarting:
|
||||
RusName = VECStringResources.Get("STATE_START_COMPILING_ASSEMBLY{0}");
|
||||
SetCompilingButtonsEnabled(false);
|
||||
SetCompilingAndRunButtonsEnabled(false);
|
||||
ParsedFiles.Clear();
|
||||
break;
|
||||
case PascalABCCompiler.CompilerState.BeginCompileFile: RusName = VECStringResources.Get("STATE_BEGINCOMPILEFILE{0}"); break;
|
||||
|
|
@ -407,21 +407,22 @@ namespace VisualPascalABC
|
|||
if (!ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPlugins)))
|
||||
LoadPlugins(null);
|
||||
|
||||
SetCompilingButtonsEnabled(true);
|
||||
SetDebugButtonsEnabled(true);
|
||||
SetCompilingAndRunButtonsEnabled(true);
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
SetDebugButtonsEnabled(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Compiler == sender)
|
||||
{
|
||||
SetCompilingButtonsEnabled(true);
|
||||
SetCompilingAndRunButtonsEnabled(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PascalABCCompiler.CompilerState.Reloading:
|
||||
if (Compiler == sender)
|
||||
SetCompilingButtonsEnabled(false);
|
||||
SetCompilingAndRunButtonsEnabled(false);
|
||||
RusName = VECStringResources.Get("STATE_RELOADING");
|
||||
break;
|
||||
case PascalABCCompiler.CompilerState.CompilationFinished:
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@ namespace VisualPascalABC
|
|||
this.StepOutButton.Visible = false;
|
||||
PlayPauseButtonsVisibleInPanel = PlayPauseButtonsVisibleInPanel;
|
||||
SetDebugButtonsEnabled(false);
|
||||
SetRunButtonsEnabled(false);
|
||||
}
|
||||
|
||||
AddOwnedForm(CompilerForm1 = new CompilerForm());
|
||||
|
|
@ -335,7 +336,7 @@ namespace VisualPascalABC
|
|||
|
||||
RunManager RunnerManager = (WorkbenchServiceFactory.RunService as WorkbenchRunService).RunnerManager;
|
||||
VisualEnvironmentCompiler = new VisualEnvironmentCompiler(
|
||||
this.BeginInvoke, SetCompilingButtonsEnabled, SetDedugButtonsEnabled, SetStateText,
|
||||
this.BeginInvoke, SetCompilingAndRunButtonsEnabled, SetDebugButtonsEnabled, SetStateText,
|
||||
AddTextToCompilerMessagesSync, miPlugins, toolStrip1,
|
||||
ExecuteSourceLocationAction, ExecuteVisualEnvironmentCompilerAction, ErrorsManager, RunnerManager,
|
||||
WorkbenchServiceFactory.DebuggerManager, UserOptions, WorkbenchStorage.StandartDirectories, OpenDocuments, this);
|
||||
|
|
@ -403,9 +404,9 @@ namespace VisualPascalABC
|
|||
WorkbenchServiceFactory.FileService.OpenFile(FileNameToWait, null);
|
||||
}
|
||||
SetStopEnabled(false);
|
||||
CompilingButtonsEnabled = CloseButtonsEnabled = SaveAllButtonsEnabled = SaveButtonsEnabled = false;
|
||||
SetDedugButtonsEnabled(false);
|
||||
SetCompilingButtonsEnabled(false);
|
||||
CompilingAndRunButtonsEnabled = CloseButtonsEnabled = SaveAllButtonsEnabled = SaveButtonsEnabled = false;
|
||||
SetDebugButtonsEnabled(false);
|
||||
SetCompilingAndRunButtonsEnabled(false);
|
||||
|
||||
HelpFileName = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.HelpFileName, WorkbenchStorage.StandartDirectories);
|
||||
DotNetHelpFileName = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.DotNetHelpFileName, WorkbenchStorage.StandartDirectories);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static void Rename(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
IDocument doc = textArea.Document;
|
||||
string textContent = doc.TextContent;
|
||||
ccp = new CodeCompletionProvider();
|
||||
|
|
@ -60,7 +60,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static void RenameUnit(string FileName, string new_val)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
ccp = new CodeCompletionProvider();
|
||||
IDocument doc = null;
|
||||
CodeCompletion.CodeCompletionController controller = new CodeCompletion.CodeCompletionController();
|
||||
|
|
@ -121,11 +121,8 @@ namespace VisualPascalABC
|
|||
public static List<Position> GetDefinitionPosition(TextArea textArea, bool only_check)
|
||||
{
|
||||
|
||||
IParser parser = CodeCompletion.CodeCompletionController.CurrentParser;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return new List<Position>();
|
||||
|
||||
if (parser == null)
|
||||
return new List<Position>();
|
||||
|
||||
IDocument doc = textArea.Document;
|
||||
string textContent = doc.TextContent;
|
||||
ccp = new CodeCompletionProvider();
|
||||
|
|
@ -137,7 +134,7 @@ namespace VisualPascalABC
|
|||
|
||||
|
||||
// Проверка, что компилируем Паскаль временно EVA 10.11.2024
|
||||
if (parser == Languages.Facade.LanguageProvider.Instance.SelectLanguageByName(StringConstants.pascalLanguageName).Parser)
|
||||
if (CodeCompletion.CodeCompletionController.CurrentLanguage == Languages.Facade.LanguageProvider.Instance.MainLanguage)
|
||||
{
|
||||
if (expressionResult != full_expr && full_expr.StartsWith("("))
|
||||
return new List<Position>();
|
||||
|
|
@ -158,7 +155,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static List<Position> GetRealizationPosition(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return new List<Position>();
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return new List<Position>();
|
||||
IDocument doc = textArea.Document;
|
||||
string textContent = doc.TextContent;
|
||||
ccp = new CodeCompletionProvider();
|
||||
|
|
@ -172,7 +169,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static List<SymbolsViewerSymbol> FindReferences(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return new List<SymbolsViewerSymbol>();
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return new List<SymbolsViewerSymbol>();
|
||||
ccp = new CodeCompletionProvider();
|
||||
string full_expr;
|
||||
string expressionResult = FindFullExpression(textArea.Document.TextContent, textArea, out ccp.keyword, out full_expr);
|
||||
|
|
@ -181,7 +178,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static void GotoRealization(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
position = GetRealizationPosition(textArea);
|
||||
if (position == null || position.Count == 0) return;
|
||||
if (position.Count == 1)
|
||||
|
|
@ -210,7 +207,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static bool CanGoTo(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
List<Position> poses = GetDefinitionPosition(textArea, true);
|
||||
if (poses == null || poses.Count == 0) return false;
|
||||
foreach (Position pos in poses)
|
||||
|
|
@ -223,7 +220,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static bool CanGoToRealization(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
List<Position> poses = GetRealizationPosition(textArea);
|
||||
if (poses == null || poses.Count == 0) return false;
|
||||
foreach (Position pos in poses)
|
||||
|
|
@ -238,7 +235,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
ccp = new CodeCompletionProvider();
|
||||
string full_expr;
|
||||
string expressionResult = FindFullExpression(textArea.Document.TextContent, textArea, out ccp.keyword, out full_expr);
|
||||
|
|
@ -259,7 +256,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
ccp = new CodeCompletionProvider();
|
||||
Position pos = new Position();
|
||||
//string text = "procedure Test(a : integer);\n begin \n x := 1; \n end;";//ccp.GetRealizationTextToAdd(out pos);
|
||||
|
|
@ -276,7 +273,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
ccp = new CodeCompletionProvider();
|
||||
Position pos = new Position();
|
||||
//string text = "procedure Test(a : integer);\n begin \n x := 1; \n end;";//ccp.GetRealizationTextToAdd(out pos);
|
||||
|
|
@ -299,7 +296,7 @@ namespace VisualPascalABC
|
|||
private static TextArea _textArea;
|
||||
public static void GenerateOverridableMethods(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
ccp = new CodeCompletionProvider();
|
||||
_textArea = textArea;
|
||||
int off = textArea.Caret.Offset;
|
||||
|
|
@ -329,7 +326,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static void GenerateClassOrMethodRealization(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
ccp = new CodeCompletionProvider();
|
||||
Position pos = new Position();
|
||||
//string text = "procedure Test(a : integer);\n begin \n x := 1; \n end;";//ccp.GetRealizationTextToAdd(out pos);
|
||||
|
|
@ -459,12 +456,12 @@ namespace VisualPascalABC
|
|||
|
||||
public static bool GenerateCommentTemplate(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
ccp = new CodeCompletionProvider();
|
||||
//if (!should_insert_comment(textArea))
|
||||
// return false;
|
||||
string lineText = get_next_line(textArea);
|
||||
string addit = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.GetDocumentTemplate(
|
||||
string addit = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDocumentTemplate(
|
||||
lineText, textArea.Document.TextContent, textArea.Caret.Line, textArea.Caret.Column, textArea.Caret.Offset);
|
||||
if (addit == null)
|
||||
return false;
|
||||
|
|
@ -506,7 +503,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static void GotoDefinition(TextArea _textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
position = GetDefinitionPosition(_textArea, false);
|
||||
if (position == null) return;
|
||||
if (position.Count == 1)
|
||||
|
|
@ -544,9 +541,9 @@ namespace VisualPascalABC
|
|||
keyw = PascalABCCompiler.Parsers.KeywordKind.None;
|
||||
string expr_without_brackets = null;
|
||||
full_expr = null;
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser != null)
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
{
|
||||
full_expr = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpressionFromAnyPosition(_textArea.Caret.Offset, Text, _textArea.Caret.Line, _textArea.Caret.Column, out keyw, out expr_without_brackets);
|
||||
full_expr = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindExpressionFromAnyPosition(_textArea.Caret.Offset, Text, _textArea.Caret.Line, _textArea.Caret.Column, out keyw, out expr_without_brackets);
|
||||
return expr_without_brackets;
|
||||
}
|
||||
return null;
|
||||
|
|
@ -554,7 +551,7 @@ namespace VisualPascalABC
|
|||
|
||||
private static string FindOnlyIdent(string Text, TextArea _textArea, ref string name)
|
||||
{
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindOnlyIdentifier(_textArea.Caret.Offset, Text, _textArea.Caret.Line, _textArea.Caret.Column, ref name);
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindOnlyIdentifier(_textArea.Caret.Offset, Text, _textArea.Caret.Line, _textArea.Caret.Column, ref name);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -642,7 +639,7 @@ namespace VisualPascalABC
|
|||
if (!WorkbenchServiceFactory.Workbench.UserOptions.CodeCompletionDot)
|
||||
return;
|
||||
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null)
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return;
|
||||
|
||||
is_begin = true;
|
||||
|
|
@ -687,7 +684,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
public override void Execute(TextArea textArea)
|
||||
{
|
||||
if (WorkbenchServiceFactory.DebuggerManager.IsRunning)
|
||||
if (WorkbenchServiceFactory.DebuggerManager.IsRunning || !CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return;
|
||||
WorkbenchServiceFactory.Workbench.ErrorsListWindow.ClearErrorList();
|
||||
VisualPABCSingleton.MainForm.CurrentCodeFileDocument.DeselectAll();
|
||||
|
|
@ -697,12 +694,14 @@ namespace VisualPascalABC
|
|||
// MainForm.VisualEnvironmentCompiler.Compiler.ParsersController.Compile(
|
||||
// file_name, TextEditor.Text, null, Errors, PascalABCCompiler.Parsers.ParseMode.Normal);
|
||||
string text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName, PascalABCCompiler.SourceFileOperation.GetText) as string;
|
||||
|
||||
PascalABCCompiler.SyntaxTree.compilation_unit cu =
|
||||
Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtensionSafe(VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName)?.Parser.GetCompilationUnitForFormatter(
|
||||
CodeCompletion.CodeCompletionController.CurrentLanguage.Parser.GetCompilationUnitForFormatter(
|
||||
VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName,
|
||||
text, //VisualPascalABC.Form1.Form1_object._currentCodeFileDocument.TextEditor.Text,
|
||||
Errors,
|
||||
new List<PascalABCCompiler.Errors.CompilerWarning>());
|
||||
|
||||
if (Errors.Count == 0)
|
||||
{
|
||||
string formattedText = cf.FormatTree(text, cu, textArea.Caret.Line + 1, textArea.Caret.Column + 1);
|
||||
|
|
@ -732,17 +731,18 @@ namespace VisualPascalABC
|
|||
{
|
||||
//try
|
||||
{
|
||||
if (!WorkbenchServiceFactory.Workbench.UserOptions.CodeCompletionDot)
|
||||
return;
|
||||
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
|
||||
textArea = _textArea;
|
||||
int off = textArea.Caret.Offset;
|
||||
string text = textArea.Document.TextContent.Substring(0, textArea.Caret.Offset);
|
||||
|
||||
if (!WorkbenchServiceFactory.Workbench.UserOptions.CodeCompletionDot)
|
||||
return;
|
||||
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
CodeCompletionProvider completionDataProvider = new CodeCompletionProvider();
|
||||
|
||||
completionDataProvider.preSelection = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindPattern(off, text, out var is_pattern);
|
||||
completionDataProvider.preSelection = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindPattern(off, text, out var is_pattern);
|
||||
|
||||
codeCompletionWindow = PABCNETCodeCompletionWindow.ShowCompletionWindow(
|
||||
VisualPABCSingleton.MainForm, // The parent window for the completion window
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ namespace VisualPascalABC
|
|||
{
|
||||
public static PascalABCCompiler.Parsers.KeywordKind TestForKeyword(string Text, int i)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser != null && CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation !=null)
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.TestForKeyword(Text, i);
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.TestForKeyword(Text, i);
|
||||
return PascalABCCompiler.Parsers.KeywordKind.None;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
if (!WorkbenchServiceFactory.Workbench.UserOptions.AllowCodeCompletion || !VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.compilerLoaded)
|
||||
return false;
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
if (codeCompletionWindow != null)
|
||||
{
|
||||
// If completion window is open and wants to handle the key, don't let the text area
|
||||
|
|
@ -93,8 +93,6 @@ namespace VisualPascalABC
|
|||
}
|
||||
if (key == '.')
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null)
|
||||
return false;
|
||||
if (!string.IsNullOrEmpty(WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.SelectionManager.SelectedText))
|
||||
{
|
||||
WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.Caret.Position = WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.SelectionManager.SelectionCollection[0].StartPosition;
|
||||
|
|
@ -123,7 +121,6 @@ namespace VisualPascalABC
|
|||
}
|
||||
else if (key == '(' || key == '[' || key == ',')
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (VisualPABCSingleton.MainForm.UserOptions.CodeCompletionParams)
|
||||
{
|
||||
ICSharpCode.TextEditor.Gui.InsightWindow.IInsightDataProvider idp = new DefaultInsightDataProvider(-1, false, key);
|
||||
|
|
@ -145,7 +142,6 @@ namespace VisualPascalABC
|
|||
}
|
||||
else if (key == ' ')
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (VisualPABCSingleton.MainForm.UserOptions.CodeCompletionDot)
|
||||
{
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw = KeywordChecker.TestForKeyword(editor.Document.TextContent, editor.ActiveTextAreaControl.TextArea.Caret.Offset - 1);
|
||||
|
|
@ -171,7 +167,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else if (key == '\n')
|
||||
{
|
||||
if (VisualPABCSingleton.MainForm.UserOptions.AllowCodeCompletion && CodeCompletion.CodeCompletionController.CurrentParser != null)
|
||||
if (VisualPABCSingleton.MainForm.UserOptions.AllowCodeCompletion)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -193,9 +189,8 @@ namespace VisualPascalABC
|
|||
{
|
||||
if (VisualPABCSingleton.MainForm.UserOptions.CodeCompletionDot)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw = KeywordChecker.TestForKeyword(editor.Document.TextContent, editor.ActiveTextAreaControl.TextArea.Caret.Offset - 1);
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.IsDefinitionIdentifierAfterKeyword(keyw))
|
||||
if (CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IsDefinitionIdentifierAfterKeyword(keyw))
|
||||
return false;
|
||||
|
||||
// если не первый символ выражения (предыдущий тоже буква или "_"), то не открываем новое окно
|
||||
|
|
@ -221,7 +216,6 @@ namespace VisualPascalABC
|
|||
{
|
||||
if (mainForm.UserOptions.AllowCodeFormatting)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.currentParser == null) return false;
|
||||
string bracket = CodeCompletion.CodeCompletionController.currentParser.LanguageInformation.GetBodyStartBracket();
|
||||
string end_bracket = CodeCompletion.CodeCompletionController.currentParser.LanguageInformation.GetBodyEndBracket();
|
||||
if (bracket != null)
|
||||
|
|
|
|||
|
|
@ -75,11 +75,7 @@ namespace VisualPascalABC
|
|||
|
||||
public void RegisterFileForParsing(string FileName)
|
||||
{
|
||||
if (Languages.Facade.LanguageProvider.Instance.HasLanguageForExtension(FileName))
|
||||
{
|
||||
filesToParse[FileName] = true;
|
||||
CodeCompletion.CodeCompletionController.SetLanguage(FileName);
|
||||
}
|
||||
filesToParse[FileName] = true;
|
||||
}
|
||||
|
||||
public void CloseFile(string FileName)
|
||||
|
|
|
|||
|
|
@ -125,12 +125,12 @@ namespace VisualPascalABC
|
|||
private string construct_header(string meth, CodeCompletion.ProcScope ps, int tabCount)
|
||||
{
|
||||
//if (CodeCompletion.CodeCompletionController.currentParser != null)
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.ConstructHeader(meth, ps, tabCount);
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.ConstructHeader(meth, ps, tabCount);
|
||||
}
|
||||
|
||||
private string construct_header(CodeCompletion.ProcRealization ps, int tabCount)
|
||||
{
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.ConstructHeader(ps, tabCount);
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.ConstructHeader(ps, tabCount);
|
||||
}
|
||||
|
||||
public CodeCompletion.SymScope FindScopeByLocation(string fileName, int line, int col)
|
||||
|
|
@ -294,8 +294,8 @@ namespace VisualPascalABC
|
|||
|
||||
public string FindExpression(int off, string Text, int line, int col)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser != null)
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpression(off, Text, line, col, out keyword);
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindExpression(off, Text, line, col, out keyword);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -324,14 +324,14 @@ namespace VisualPascalABC
|
|||
try
|
||||
{
|
||||
|
||||
ILanguageInformation languageInformation = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation;
|
||||
ILanguage currentLanguage = CodeCompletion.CodeCompletionController.CurrentLanguage;
|
||||
|
||||
List<string> keywords;
|
||||
|
||||
bool isTypeAfterKeyword = false;
|
||||
|
||||
// если по смыслу должен вводиться тип данных
|
||||
if (languageInformation.IsTypeAfterKeyword(keyw))
|
||||
if (currentLanguage.LanguageIntellisenseSupport.IsTypeAfterKeyword(keyw))
|
||||
{
|
||||
keywords = CodeCompletion.CodeCompletionNameHelper.Helper.GetTypeKeywords();
|
||||
isTypeAfterKeyword = true;
|
||||
|
|
@ -344,7 +344,7 @@ namespace VisualPascalABC
|
|||
bool isNamespaceAfterKeyword = false;
|
||||
|
||||
// конструкция типа "uses"
|
||||
if (languageInformation.IsNamespaceAfterKeyword(keyw))
|
||||
if (currentLanguage.LanguageIntellisenseSupport.IsNamespaceAfterKeyword(keyw))
|
||||
{
|
||||
isNamespaceAfterKeyword = true;
|
||||
}
|
||||
|
|
@ -358,11 +358,9 @@ namespace VisualPascalABC
|
|||
|
||||
if (symInfos != null)
|
||||
{
|
||||
bool languageCaseSensitive = LanguageProvider.Instance.SelectLanguageByExtension(FileName).CaseSensitive;
|
||||
currentLanguage.LanguageIntellisenseSupport.RenameOrExcludeSpecialNames(symInfos);
|
||||
|
||||
languageInformation.RenameOrExcludeSpecialNames(symInfos);
|
||||
|
||||
AddCompletionDatasByFirstForSymInfos(resultList, charTyped, symInfos, languageCaseSensitive);
|
||||
AddCompletionDatasByFirstForSymInfos(resultList, charTyped, symInfos, currentLanguage.CaseSensitive);
|
||||
|
||||
//resultList.Sort();
|
||||
//defaultCompletionElement = resultList[0] as DefaultCompletionData;
|
||||
|
|
@ -506,7 +504,7 @@ namespace VisualPascalABC
|
|||
};
|
||||
|
||||
string expressionText = GetExpressionTextForCompletionData(off, text, line, col,
|
||||
currentLanguage.LanguageInformation, in context, out var insidePatternWithDots, out var ctrlOrShiftSpaceAfterDot, out var pattern);
|
||||
currentLanguage.LanguageIntellisenseSupport, in context, out var insidePatternWithDots, out var ctrlOrShiftSpaceAfterDot, out var pattern);
|
||||
|
||||
// добавляем ключевые слова в случае "ctrl + space", нажатых в "пустом" месте
|
||||
if (!ctrlOrShiftSpaceAfterDot && context.ctrlSpace && string.IsNullOrEmpty(pattern))
|
||||
|
|
@ -537,7 +535,7 @@ namespace VisualPascalABC
|
|||
|
||||
if (symInfos != null)
|
||||
{
|
||||
currentLanguage.LanguageInformation.RenameOrExcludeSpecialNames(symInfos);
|
||||
currentLanguage.LanguageIntellisenseSupport.RenameOrExcludeSpecialNames(symInfos);
|
||||
|
||||
AddCompletionDatasForSymInfos(resultList, currentLanguage.CaseSensitive, symInfos, selectedSymInfo, lastUsedMember);
|
||||
}
|
||||
|
|
@ -689,7 +687,7 @@ namespace VisualPascalABC
|
|||
/// <summary>
|
||||
/// Получение текста выражения, введенного пользователем перед нажатием "триггерной" клавиши
|
||||
/// </summary>
|
||||
private string GetExpressionTextForCompletionData(int off, string text, int line, int col, ILanguageInformation languageInformation, in ActionContext context, out bool insidePatternWithDots, out bool ctrlOrShiftSpaceAfterDot, out string pattern)
|
||||
private string GetExpressionTextForCompletionData(int off, string text, int line, int col, ILanguageIntellisenseSupport languageIntellisenseSupport, in ActionContext context, out bool insidePatternWithDots, out bool ctrlOrShiftSpaceAfterDot, out string pattern)
|
||||
{
|
||||
|
||||
string expressionText = null;
|
||||
|
|
@ -700,7 +698,7 @@ namespace VisualPascalABC
|
|||
if (context.ctrlSpace || context.shiftSpace)
|
||||
{
|
||||
|
||||
pattern = languageInformation.FindPattern(off, text, out var isPattern);
|
||||
pattern = languageIntellisenseSupport.FindPattern(off, text, out var isPattern);
|
||||
|
||||
// в конце выражения точка
|
||||
if (!isPattern && text[off - 1] == '.')
|
||||
|
|
@ -718,7 +716,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else if (context.spaceAfterNew)
|
||||
{
|
||||
expressionText = languageInformation.SkipNew(off - 1, text, ref keyword);
|
||||
expressionText = languageIntellisenseSupport.SkipNew(off - 1, text, ref keyword);
|
||||
}
|
||||
else if (context.dotPressed) // keywordKind != KeywordKind.Uses
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,13 +3,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using ICSharpCode.TextEditor;
|
||||
using ICSharpCode.TextEditor.Document;
|
||||
using ICSharpCode.TextEditor.Gui.CompletionWindow;
|
||||
|
||||
namespace VisualPascalABC
|
||||
{
|
||||
|
|
@ -19,11 +15,17 @@ namespace VisualPascalABC
|
|||
|
||||
public static void DefinitionByMouseClickManager_TextAreaMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return;
|
||||
|
||||
makeWordUnderline(sender, e);
|
||||
}
|
||||
|
||||
public static void DefinitionByMouseClickManager_TextAreaMouseDown(object sender, EventArgs e)
|
||||
{
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return;
|
||||
|
||||
TextArea textArea = (TextArea)sender;
|
||||
if (Control.ModifierKeys == Keys.Control && textArea.SelectionManager.SelectionCollection.Count == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ namespace VisualPascalABC
|
|||
|
||||
private string FindExpression(int off, string Text, int line, int col)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser != null)
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpressionForMethod(off, Text, line, col, pressed_key, ref num_param);
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindExpressionForMethod(off, Text, line, col, pressed_key, ref num_param);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
if (setupOnlyOnce && this.textArea != null)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.IsMethodCallParameterSeparator(pressed_key))
|
||||
if (CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IsMethodCallParameterSeparator(pressed_key))
|
||||
{
|
||||
FindExpression(textArea.Caret.Offset, textArea.Document.TextContent.Substring(0, textArea.Caret.Offset),
|
||||
textArea.Caret.Line, textArea.Caret.Column);
|
||||
|
|
@ -71,9 +71,9 @@ namespace VisualPascalABC
|
|||
if (dconv != null)
|
||||
{
|
||||
//if (pressed_key == '(' || pressed_key == ',')
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.IsOpenBracketForMethodCall(pressed_key) || CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.IsMethodCallParameterSeparator(pressed_key))
|
||||
if (CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IsOpenBracketForMethodCall(pressed_key) || CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IsMethodCallParameterSeparator(pressed_key))
|
||||
methods = dconv.GetNameOfMethod(e, expr, line, col, num_param, ref defaultIndex, cur_param_num, out param_count);
|
||||
else if (CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.IsOpenBracketForIndex(pressed_key))
|
||||
else if (CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IsOpenBracketForIndex(pressed_key))
|
||||
methods = dconv.GetIndex(e, line, col);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ using System.Windows.Forms;
|
|||
using ICSharpCode.TextEditor;
|
||||
using ICSharpCode.TextEditor.Document;
|
||||
using ICSharpCode.TextEditor.Gui.CompletionWindow;
|
||||
using PascalABCCompiler.Parsers;
|
||||
|
||||
namespace VisualPascalABC
|
||||
{
|
||||
|
|
@ -29,9 +28,9 @@ namespace VisualPascalABC
|
|||
|
||||
//string expr = FindFullExpression(doc.TextContent, seg.Offset + logicPos.X,e.LogicalPosition.Line,e.LogicalPosition.Column);
|
||||
|
||||
IParser parser = CodeCompletion.CodeCompletionController.CurrentParser;
|
||||
var currentLanguage = CodeCompletion.CodeCompletionController.CurrentLanguage;
|
||||
|
||||
string expr = parser.LanguageInformation.FindExpressionFromAnyPosition(
|
||||
string expr = currentLanguage.LanguageIntellisenseSupport.FindExpressionFromAnyPosition(
|
||||
lineSegment.Offset + logicPos.X, doc.TextContent, e.LogicalPosition.Line, e.LogicalPosition.Column, out var keyw, out var exprWithoutBrackets);
|
||||
|
||||
// пока непонятно, когда такое может быть EVA
|
||||
|
|
@ -44,25 +43,25 @@ namespace VisualPascalABC
|
|||
List<PascalABCCompiler.Errors.Error> Errors = new List<PascalABCCompiler.Errors.Error>();
|
||||
List<PascalABCCompiler.Errors.CompilerWarning> Warnings = new List<PascalABCCompiler.Errors.CompilerWarning>();
|
||||
|
||||
PascalABCCompiler.SyntaxTree.expression expressionTree = parser.GetExpression("test" + Path.GetExtension(fileName),
|
||||
PascalABCCompiler.SyntaxTree.expression expressionTree = currentLanguage.Parser.GetExpression("test" + Path.GetExtension(fileName),
|
||||
expr, Errors, Warnings);
|
||||
|
||||
// Пока добавили проверку, что анализируем Паскаль EVA
|
||||
if (Errors.Count > 0 && parser == Languages.Facade.LanguageProvider.Instance.MainLanguage.Parser)
|
||||
if (Errors.Count > 0 && currentLanguage == Languages.Facade.LanguageProvider.Instance.MainLanguage)
|
||||
{
|
||||
string s = expr.TrimStart();
|
||||
if (s.Length > 0 && s[0] == '^')
|
||||
{
|
||||
Errors.Clear();
|
||||
exprWithoutBrackets = exprWithoutBrackets.TrimStart().Substring(1);
|
||||
expressionTree = parser.GetExpression("test" + Path.GetExtension(fileName), s.Substring(1), Errors, Warnings);
|
||||
expressionTree = currentLanguage.Parser.GetExpression("test" + Path.GetExtension(fileName), s.Substring(1), Errors, Warnings);
|
||||
}
|
||||
}
|
||||
|
||||
List<PascalABCCompiler.Errors.Error> Errors2 = new List<PascalABCCompiler.Errors.Error>();
|
||||
|
||||
// проверка для выражения без скобок
|
||||
PascalABCCompiler.SyntaxTree.expression expressionTree2 = parser.GetExpression("test" + Path.GetExtension(fileName), exprWithoutBrackets, Errors2, Warnings);
|
||||
PascalABCCompiler.SyntaxTree.expression expressionTree2 = currentLanguage.Parser.GetExpression("test" + Path.GetExtension(fileName), exprWithoutBrackets, Errors2, Warnings);
|
||||
|
||||
// если не получается, то сразу возврат
|
||||
if (expressionTree2 == null || Errors2.Count > 0)
|
||||
|
|
@ -118,7 +117,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
if (!VisualPABCSingleton.MainForm.UserOptions.CodeCompletionHint)
|
||||
return;
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null)
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return;
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ namespace VisualPascalABC
|
|||
public bool IsRunning = false;
|
||||
public string ExeFileName;
|
||||
public bool ShowDebugTabs=true;
|
||||
public PascalABCCompiler.Parsers.IParser parser = null;
|
||||
public Languages.Facade.ILanguage language = null;
|
||||
EventHandler<EventArgs> debuggerStateEvent;
|
||||
|
||||
public DebugHelper()
|
||||
|
|
@ -465,7 +465,7 @@ namespace VisualPascalABC
|
|||
this.FullFileName = Path.Combine(Path.GetDirectoryName(fileName), this.FileName);
|
||||
this.ExeFileName = fileName;
|
||||
CurrentLine = 0;
|
||||
this.parser = Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtensionSafe(FullFileName)?.Parser;
|
||||
this.language = Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtension(FullFileName);
|
||||
this.PrevFullFileName = FullFileName;
|
||||
AssemblyHelper.LoadAssembly(fileName);
|
||||
dbg.ProcessStarted += debugProcessStarted;
|
||||
|
|
@ -534,7 +534,7 @@ namespace VisualPascalABC
|
|||
//ChangeLocalVars(e.Process);
|
||||
//if (e.Process.IsPaused)
|
||||
WorkbenchServiceFactory.DebuggerOperationsService.RefreshPad(new FunctionItem(e.Process.SelectedFunction).SubItems);
|
||||
workbench.WidgetController.SetStartDebugEnabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunEnabled();
|
||||
if (currentFunction != e.Process.SelectedFunction)
|
||||
{
|
||||
if (WorkbenchServiceFactory.Workbench.DisassemblyWindow.IsVisible)
|
||||
|
|
@ -601,7 +601,7 @@ namespace VisualPascalABC
|
|||
|
||||
private void debuggedProcess_Expired(object sender, EventArgs e)
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugEnabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunEnabled();
|
||||
}
|
||||
|
||||
private void debuggedProcess_ExceptionThrown(object sender, ExceptionEventArgs e)
|
||||
|
|
@ -666,7 +666,7 @@ namespace VisualPascalABC
|
|||
workbench.ServiceContainer.EditorService.SetEditorDisabled(false);
|
||||
//RemoveMarker(frm.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.Document);
|
||||
evaluator = null;
|
||||
parser= null;
|
||||
language= null;
|
||||
FileName = null;
|
||||
handle = 0;
|
||||
ExeFileName = null;
|
||||
|
|
@ -694,7 +694,7 @@ namespace VisualPascalABC
|
|||
workbench.WidgetController.SetDebugTabsVisible(true);
|
||||
workbench.WidgetController.SetPlayButtonsVisible(true);
|
||||
workbench.WidgetController.SetDebugStopEnabled();//e.Process.LogMessage += messageEventProc;
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
workbench.WidgetController.ChangeStartDebugNameOnContinue();
|
||||
workbench.WidgetController.EnableCodeCompletionToolTips(false);
|
||||
workbench.WidgetController.SetAddExprMenuVisible(true);
|
||||
|
|
@ -1239,7 +1239,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
sb.Insert(0, '.');
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw = PascalABCCompiler.Parsers.KeywordKind.None;
|
||||
string s = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.
|
||||
string s = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.
|
||||
FindExpression(i, text, 0, 0, out keyw);
|
||||
if (s != null)
|
||||
{
|
||||
|
|
@ -1598,7 +1598,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugEnabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunEnabled();
|
||||
dbg.Processes[0].Terminate();
|
||||
}
|
||||
catch (System.Exception e)
|
||||
|
|
@ -1614,7 +1614,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugEnabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunEnabled();
|
||||
dbg.Processes[0].Break();
|
||||
}
|
||||
catch (System.Exception e)
|
||||
|
|
@ -1680,7 +1680,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
if (debuggedProcess.SelectedFunction.Name == ".cctor")
|
||||
{
|
||||
var sequencePoints = debuggedProcess.SelectedFunction.symMethod.SequencePoints;
|
||||
|
|
@ -1708,7 +1708,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
dbg.Processes[0].Continue();
|
||||
CurrentLineBookmark.Remove();
|
||||
}
|
||||
|
|
@ -1725,7 +1725,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
stepin_stmt = dbg.Processes[0].NextStatement;
|
||||
dbg.Processes[0].StepInto();
|
||||
CurrentLineBookmark.Remove();
|
||||
|
|
@ -1745,7 +1745,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
if (IsRunning)
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
dbg.Processes[0].StepOut();
|
||||
CurrentLineBookmark.Remove();
|
||||
}
|
||||
|
|
@ -1765,7 +1765,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
//cur_brpt = dbg.AddBreakpoint(new SourcecodeSegment((frm.CurrentTabPage.ag as CodeFileDocumentControl).file_name,(frm.CurrentTabPage.ag as CodeFileDocumentControl).TextEditor.ActiveTextAreaControl.Caret.Line + 1,(frm.CurrentTabPage.Tag as CodeFileDocumentControl).TextEditor.ActiveTextAreaControl.Caret.Column + 1,
|
||||
// (frm.CurrentTabPage.ag as CodeFileDocumentControl).TextEditor.ActiveTextAreaControl.Caret.Column+100), true);
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
currentBreakpoint = dbg.AddBreakpoint(WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.FileName, WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.Caret.Line + 1);
|
||||
AddGoToBreakPoint(currentBreakpoint);
|
||||
Status = DebugStatus.None;
|
||||
|
|
|
|||
|
|
@ -717,8 +717,8 @@ namespace VisualPascalABC
|
|||
}
|
||||
else
|
||||
if (val.IsNull)
|
||||
if (WorkbenchServiceFactory.DebuggerManager.parser != null)
|
||||
return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Null);
|
||||
if (WorkbenchServiceFactory.DebuggerManager.language != null)
|
||||
return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Null);
|
||||
else
|
||||
return "nil";
|
||||
else
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ namespace VisualPascalABC
|
|||
public static string WrapTypeName(DebugType type)
|
||||
{
|
||||
if (type.IsArray)
|
||||
if (WorkbenchServiceFactory.DebuggerManager.parser != null)
|
||||
return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetArrayDescription(WrapTypeName(type.GetElementType()), type.GetArrayRank());
|
||||
if (WorkbenchServiceFactory.DebuggerManager.language != null)
|
||||
return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetArrayDescription(WrapTypeName(type.GetElementType()), type.GetArrayRank());
|
||||
else
|
||||
return "array of " + WrapTypeName(type.GetElementType());
|
||||
return internalWrapTypeName(type.FullName);
|
||||
|
|
@ -182,23 +182,23 @@ namespace VisualPascalABC
|
|||
|
||||
private static string internalWrapTypeName(string name)
|
||||
{
|
||||
if (WorkbenchServiceFactory.DebuggerManager.parser != null)
|
||||
if (WorkbenchServiceFactory.DebuggerManager.language != null)
|
||||
switch (name)
|
||||
{
|
||||
case "System.Boolean": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(bool));
|
||||
case "System.Int32": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(int));
|
||||
case "System.Byte": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(byte));
|
||||
case "System.Double": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(double));
|
||||
case "System.String": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(string));
|
||||
case "System.Char": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(char));
|
||||
case "System.SByte": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(sbyte));
|
||||
case "System.Int16": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(short));
|
||||
case "System.UInt16": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(ushort));
|
||||
case "System.UInt32": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(uint));
|
||||
case "System.Int64": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(long));
|
||||
case "System.UInt64": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(ulong));
|
||||
case "System.Float32": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(float));
|
||||
case "System.IntPtr": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(Type.GetType("System.Void*"));
|
||||
case "System.Boolean": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(bool));
|
||||
case "System.Int32": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(int));
|
||||
case "System.Byte": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(byte));
|
||||
case "System.Double": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(double));
|
||||
case "System.String": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(string));
|
||||
case "System.Char": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(char));
|
||||
case "System.SByte": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(sbyte));
|
||||
case "System.Int16": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(short));
|
||||
case "System.UInt16": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(ushort));
|
||||
case "System.UInt32": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(uint));
|
||||
case "System.Int64": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(long));
|
||||
case "System.UInt64": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(ulong));
|
||||
case "System.Float32": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(float));
|
||||
case "System.IntPtr": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(Type.GetType("System.Void*"));
|
||||
default: return name;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ namespace VisualPascalABC
|
|||
|
||||
void tsIntellisense_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
if (UserOptions.AllowCodeCompletion)
|
||||
if (UserOptions.AllowCodeCompletion && CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
{
|
||||
//GotoAction ga = new GotoAction();
|
||||
TextArea ta = CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.TextArea;
|
||||
|
|
@ -474,18 +474,47 @@ namespace VisualPascalABC
|
|||
//this.cmFindAllReferences.Enabled = ga.CanFindReferences(ta);
|
||||
this.miGenerateRealization.Enabled = CodeCompletionActionsManager.CanGenerateRealization(ta);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisableIntellisenseDropDownOptions();
|
||||
}
|
||||
}
|
||||
|
||||
private void OpeningContextMenu(object sender, CancelEventArgs args)
|
||||
{
|
||||
GotoAction ga = new GotoAction();
|
||||
TextArea ta = CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.TextArea;
|
||||
this.cmGotoDefinition.Enabled = CodeCompletionActionsManager.CanGoTo(ta);
|
||||
this.cmGotoRealization.Enabled = CodeCompletionActionsManager.CanGoToRealization(ta);
|
||||
this.cmFindAllReferences.Enabled = CodeCompletionActionsManager.CanFindReferences(ta);
|
||||
this.cmGenerateRealization.Enabled = CodeCompletionActionsManager.CanGenerateRealization(ta);
|
||||
this.cmRename.Enabled = CodeCompletionActionsManager.CanGoTo(ta);
|
||||
}
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
{
|
||||
// GotoAction ga = new GotoAction();
|
||||
TextArea ta = CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.TextArea;
|
||||
|
||||
this.cmGotoDefinition.Enabled = CodeCompletionActionsManager.CanGoTo(ta);
|
||||
this.cmGotoRealization.Enabled = CodeCompletionActionsManager.CanGoToRealization(ta);
|
||||
this.cmFindAllReferences.Enabled = CodeCompletionActionsManager.CanFindReferences(ta);
|
||||
this.cmGenerateRealization.Enabled = CodeCompletionActionsManager.CanGenerateRealization(ta);
|
||||
this.cmRename.Enabled = CodeCompletionActionsManager.CanGoTo(ta);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisableIntellisenseContextMenuOptions();
|
||||
}
|
||||
}
|
||||
|
||||
private void DisableIntellisenseContextMenuOptions()
|
||||
{
|
||||
this.cmGotoDefinition.Enabled = false;
|
||||
this.cmGotoRealization.Enabled = false;
|
||||
this.cmFindAllReferences.Enabled = false;
|
||||
this.cmGenerateRealization.Enabled = false;
|
||||
this.cmRename.Enabled = false;
|
||||
}
|
||||
|
||||
private void DisableIntellisenseDropDownOptions()
|
||||
{
|
||||
this.tsGotoDefinition.Enabled = false;
|
||||
this.tsGotoRealization.Enabled = false;
|
||||
this.tsFindAllReferences.Enabled = false;
|
||||
this.miGenerateRealization.Enabled = false;
|
||||
}
|
||||
|
||||
private void ClosingContextMenu(object sender, CancelEventArgs args)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -114,11 +114,11 @@ namespace VisualPascalABC
|
|||
string full_file_name = Path.Combine(Path.GetDirectoryName(ProjectFactory.Instance.CurrentProject.Path),frm.FileName);
|
||||
StreamWriter sw = File.CreateText(full_file_name);
|
||||
|
||||
ILanguageInformation languageInfo = Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtension(frm.FileName).LanguageInformation;
|
||||
var languageIntellisenseSupport = Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtension(frm.FileName).LanguageIntellisenseSupport;
|
||||
|
||||
if (frm.GetFileFilter() == FileType.Unit)
|
||||
{
|
||||
sw.Write(languageInfo.GetUnitTemplate(Path.GetFileNameWithoutExtension(frm.FileName)));
|
||||
sw.Write(languageIntellisenseSupport.GetUnitTemplate(Path.GetFileNameWithoutExtension(frm.FileName)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace VisualPascalABC
|
|||
public string Compile(PascalABCCompiler.IProjectInfo project, bool rebuild, string RuntimeServicesModule, bool ForRun, bool RunWithEnvironment)
|
||||
{
|
||||
ProjectService.SaveProject();
|
||||
Workbench.WidgetController.CompilingButtonsEnabled = false;
|
||||
Workbench.WidgetController.CompilingAndRunButtonsEnabled = false;
|
||||
Workbench.CompilerConsoleWindow.ClearConsole();
|
||||
CompilerOptions1.SourceFileName = project.Path;
|
||||
CompilerOptions1.OutputDirectory = project.OutputDirectory;
|
||||
|
|
@ -98,7 +98,7 @@ namespace VisualPascalABC
|
|||
|
||||
public string Compile(string FileName, bool rebuild, string RuntimeServicesModule, bool ForRun, bool RunWithEnvironment)
|
||||
{
|
||||
Workbench.WidgetController.CompilingButtonsEnabled = false;
|
||||
Workbench.WidgetController.CompilingAndRunButtonsEnabled = false;
|
||||
|
||||
var UserOptions = Workbench.UserOptions;
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,8 @@ namespace VisualPascalABC
|
|||
}
|
||||
//CloseButtonsEnabled = OpenDocuments.Count > 1;
|
||||
ChangedSelectedTab();
|
||||
if (FileName != null) // SS 09.08.08
|
||||
if (FileName != null // SS 09.08.08
|
||||
&& CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
WorkbenchServiceFactory.CodeCompletionParserController.RegisterFileForParsing(FileName);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace VisualPascalABC
|
|||
case "string":
|
||||
return false;
|
||||
}
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
List<Position> poses = CodeCompletionActionsManager.GetDefinitionPosition(CurrentSyntaxEditor.TextEditor.ActiveTextAreaControl.TextArea, true);
|
||||
if (poses == null || poses.Count == 0) return false;
|
||||
foreach (Position pos in poses)
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ namespace VisualPascalABC
|
|||
if (ProjectFactory.Instance.ProjectLoaded)
|
||||
tabPage = DocumentService.GetTabPageForMainFile();
|
||||
if (attachdbg && !Workbench.UserOptions.AlwaysAttachDebuggerAtStart)
|
||||
fictive_attach = !startWithGoto && !needFirstBreakpoint && !DebuggerManager.HasBreakpoints();
|
||||
fictive_attach = !startWithGoto && !needFirstBreakpoint && !DebuggerManager.HasBreakpoints() || !CodeCompletion.CodeCompletionController.IntellisenseAvailable();
|
||||
WorkbenchServiceFactory.OperationsService.ClearOutputTextBoxForTabPage(tabPage);
|
||||
Workbench.ErrorsListWindow.ClearErrorList();
|
||||
DesignerService.GenerateAllDesignersCode();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace VisualPascalABC
|
|||
void ButtonsEnableDisable_RunStart()
|
||||
{
|
||||
Workbench.WidgetController.SetStopEnabled(true);
|
||||
Workbench.WidgetController.SetCompilingButtonsEnabled(false);
|
||||
Workbench.WidgetController.SetCompilingAndRunButtonsEnabled(false);
|
||||
Workbench.WidgetController.SetDebugButtonsEnabled(false);
|
||||
Workbench.WidgetController.SetOptionsEnabled(false);
|
||||
}
|
||||
|
|
@ -35,8 +35,9 @@ namespace VisualPascalABC
|
|||
void ButtonsEnableDisable_RunStop()
|
||||
{
|
||||
Workbench.WidgetController.SetStopEnabled(false);
|
||||
Workbench.WidgetController.SetCompilingButtonsEnabled(true);
|
||||
Workbench.WidgetController.SetDebugButtonsEnabled(true);
|
||||
Workbench.WidgetController.SetCompilingAndRunButtonsEnabled(true);
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
Workbench.WidgetController.SetDebugButtonsEnabled(true);
|
||||
Workbench.WidgetController.SetOptionsEnabled(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ namespace VisualPascalABC
|
|||
internal List<DockContent> BottomDockContent = new List<DockContent>();
|
||||
List<DockContent> VisibleBottomContent = new List<DockContent>();
|
||||
|
||||
public bool CompilingButtonsEnabled
|
||||
public bool CompilingAndRunButtonsEnabled
|
||||
{
|
||||
get { return miRun.Enabled; }
|
||||
set { SetCompilingButtonsEnabled(value); }
|
||||
set { SetCompilingAndRunButtonsEnabled(value); }
|
||||
}
|
||||
|
||||
bool SaveButtonsEnabled
|
||||
|
|
@ -100,16 +100,17 @@ namespace VisualPascalABC
|
|||
set { miNavigForw.Enabled = tsNavigForw.Enabled = value; }
|
||||
}
|
||||
|
||||
public void SetDedugButtonsEnabled(bool Enabled)
|
||||
/// <summary>
|
||||
/// Активировать/Деактивировать все кнопки, относящиеся к дебагу.
|
||||
/// </summary>
|
||||
public void SetDebugButtonsEnabled(bool Enabled)
|
||||
{
|
||||
StepIntoButton.Enabled = StepOverButton.Enabled = StartDebugButton.Enabled =
|
||||
mDEBUGSTARTToolStripMenuItem.Enabled = mSTEPOVERToolStripMenuItem.Enabled = mSTEPINToolStripMenuItem.Enabled = mRUNTOCURToolStripMenuItem.Enabled = Enabled;
|
||||
|
||||
mDEBUGSTARTToolStripMenuItem.Enabled = mSTEPOVERToolStripMenuItem.Enabled =
|
||||
mSTEPINToolStripMenuItem.Enabled = mRUNTOCURToolStripMenuItem.Enabled = Enabled;
|
||||
//toolStrip1.Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool BottomDockContentVisible
|
||||
{
|
||||
get
|
||||
|
|
@ -317,7 +318,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
}
|
||||
|
||||
public void SetCompilingButtonsEnabled(bool Enabled)
|
||||
public void SetCompilingAndRunButtonsEnabled(bool Enabled)
|
||||
{
|
||||
if (Enabled)
|
||||
{
|
||||
|
|
@ -388,7 +389,7 @@ namespace VisualPascalABC
|
|||
|
||||
public void SetDebugStopEnabled()
|
||||
{
|
||||
SetCompilingButtonsEnabled(false);
|
||||
SetCompilingAndRunButtonsEnabled(false);
|
||||
this.mDEBUGSTOPToolStripMenuItem.Enabled = true;
|
||||
this.mDEBUGENDToolStripMenuItem.Enabled = true;
|
||||
this.mSTEPToolStripMenuItem.Enabled = true;
|
||||
|
|
@ -412,7 +413,7 @@ namespace VisualPascalABC
|
|||
this.mDEBUGSTARTToolStripMenuItem.Text = Form1StringResources.Get("M_DEBUGSTART");
|
||||
}
|
||||
|
||||
public void SetStartDebugDisabled()
|
||||
public void SetStartDebugAndRunDisabled()
|
||||
{
|
||||
this.mDEBUGSTARTToolStripMenuItem.Enabled = false;
|
||||
this.StartDebugButton.Enabled = false;
|
||||
|
|
@ -429,7 +430,10 @@ namespace VisualPascalABC
|
|||
SaveDebugContext();
|
||||
}
|
||||
|
||||
public void SetStartDebugEnabled()
|
||||
/// <summary>
|
||||
/// Активирует кнопки для Debug и запуска программы
|
||||
/// </summary>
|
||||
public void SetStartDebugAndRunEnabled()
|
||||
{
|
||||
this.mDEBUGSTARTToolStripMenuItem.Enabled = true;
|
||||
this.StartDebugButton.Enabled = true;
|
||||
|
|
@ -439,6 +443,7 @@ namespace VisualPascalABC
|
|||
this.StepOverButton.Enabled = true;
|
||||
this.mRUNTOCURToolStripMenuItem.Enabled = true;
|
||||
this.mSTEPToolStripMenuItem.Enabled = true;
|
||||
|
||||
this.miRun.Enabled = true;
|
||||
this.StartButton.Enabled = true;
|
||||
ChangeDebugButtons(false);
|
||||
|
|
@ -453,7 +458,7 @@ namespace VisualPascalABC
|
|||
this.StepOutButton.Enabled = false;
|
||||
if (!(clicked_stop_debug_in_menu && WorkbenchServiceFactory.RunService.IsRun() && debuggedPage != ActiveCodeFileDocument))
|
||||
{
|
||||
SetCompilingButtonsEnabled(true);
|
||||
SetCompilingAndRunButtonsEnabled(true);
|
||||
this.stopButton.Enabled = false;
|
||||
this.miStop.Enabled = false;
|
||||
}
|
||||
|
|
@ -510,42 +515,17 @@ namespace VisualPascalABC
|
|||
}
|
||||
}
|
||||
|
||||
public void SetDebugButtonsEnabled(bool val)
|
||||
/// <summary>
|
||||
/// Активировать/Деактивировать все кнопки, относящиеся к форматированию кода
|
||||
/// </summary>
|
||||
private void SetFormatButtonsEnabled(bool enabled)
|
||||
{
|
||||
if (val)
|
||||
{
|
||||
this.mDEBUGSTOPToolStripMenuItem.Enabled = false;
|
||||
this.mDEBUGSTARTToolStripMenuItem.Enabled = false;
|
||||
this.StartDebugButton.Enabled = true;
|
||||
this.StopDebugButton.Enabled = true;
|
||||
this.StepOutButton.Enabled = false;
|
||||
this.StepOverButton.Enabled = true;
|
||||
this.StepIntoButton.Enabled = true;
|
||||
this.mDEBUGSTARTToolStripMenuItem.Enabled = true;
|
||||
this.mSTEPINToolStripMenuItem.Enabled = true;
|
||||
this.mSTEPOVERToolStripMenuItem.Enabled = true;
|
||||
this.mSTEPToolStripMenuItem.Enabled = false;
|
||||
this.mRUNTOCURToolStripMenuItem.Enabled = true;
|
||||
this.miRun.Enabled = true;
|
||||
this.StartButton.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.mDEBUGSTOPToolStripMenuItem.Enabled = false;
|
||||
this.mSTEPToolStripMenuItem.Enabled = false;
|
||||
this.StartDebugButton.Enabled = false;
|
||||
this.StopDebugButton.Enabled = false;
|
||||
this.StepOutButton.Enabled = false;
|
||||
this.StepOverButton.Enabled = false;
|
||||
this.StepIntoButton.Enabled = false;
|
||||
this.mDEBUGSTARTToolStripMenuItem.Enabled = false;
|
||||
this.mSTEPINToolStripMenuItem.Enabled = false;
|
||||
this.mSTEPOVERToolStripMenuItem.Enabled = false;
|
||||
this.mRUNTOCURToolStripMenuItem.Enabled = false;
|
||||
this.mSTEPToolStripMenuItem.Enabled = false;
|
||||
this.miRun.Enabled = false;
|
||||
this.StartButton.Enabled = false;
|
||||
}
|
||||
tsFormat.Enabled = mFORMATToolStripMenuItem.Enabled = cmFormat.Enabled = enabled;
|
||||
}
|
||||
|
||||
private void SetRunButtonsEnabled(bool enabled)
|
||||
{
|
||||
miRun.Enabled = StartButton.Enabled = enabled;
|
||||
}
|
||||
|
||||
bool mDEBUGSTOPToolStripMenuItem_Enabled;
|
||||
|
|
|
|||
|
|
@ -398,8 +398,19 @@ namespace VisualPascalABC
|
|||
CurrentWebBrowserControl = null;
|
||||
SetFocusToEditor();
|
||||
}
|
||||
|
||||
CodeCompletion.CodeCompletionController.SetLanguage(CurrentCodeFileDocument.FileName);
|
||||
|
||||
bool intellisenseAvailable = CodeCompletion.CodeCompletionController.IntellisenseAvailable();
|
||||
|
||||
SetFormatButtonsEnabled(intellisenseAvailable);
|
||||
|
||||
if (!intellisenseAvailable)
|
||||
SetDebugButtonsEnabled(false); // активация кнопок произойдет ниже, если возможно
|
||||
|
||||
if (BakSelectedTab == CurrentCodeFileDocument)
|
||||
return;
|
||||
|
||||
LastSelectedTab = BakSelectedTab;
|
||||
BakSelectedTab = CurrentCodeFileDocument;
|
||||
|
||||
|
|
@ -420,8 +431,6 @@ namespace VisualPascalABC
|
|||
OutputWindow.outputTextBox = OutputTextBoxs[CurrentCodeFileDocument];
|
||||
}
|
||||
|
||||
CodeCompletion.CodeCompletionController.SetLanguage(CurrentCodeFileDocument.FileName);
|
||||
|
||||
SetFocusToEditor();
|
||||
bool run = WorkbenchServiceFactory.RunService.IsRun(CurrentEXEFileName);
|
||||
WorkbenchServiceFactory.DebuggerManager.SetAsPossibleDebugPage(CurrentCodeFileDocument);
|
||||
|
|
@ -435,16 +444,16 @@ namespace VisualPascalABC
|
|||
if (VisualEnvironmentCompiler != null)
|
||||
if (!debug)
|
||||
{
|
||||
SetCompilingButtonsEnabled(!run && VisualEnvironmentCompiler.compilerLoaded);
|
||||
SetDebugButtonsEnabled(!run && VisualEnvironmentCompiler.compilerLoaded);
|
||||
SetCompilingAndRunButtonsEnabled(!run && VisualEnvironmentCompiler.compilerLoaded);
|
||||
SetDebugButtonsEnabled(intellisenseAvailable && !run && VisualEnvironmentCompiler.compilerLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCompilingButtonsEnabled(!debug);
|
||||
SetCompilingAndRunButtonsEnabled(!debug);
|
||||
SetDebugButtonsAsByDebug();
|
||||
}
|
||||
else
|
||||
SetCompilingButtonsEnabled(false);
|
||||
SetCompilingAndRunButtonsEnabled(false);
|
||||
SaveButtonsEnabled = CurrentCodeFileDocument.DocumentChanged;
|
||||
UpdateUndoRedoEnabled();
|
||||
UpdateCutCopyButtonsEnabled();
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@ namespace ICSharpCode.TextEditor.Util
|
|||
if (param_num == -1)
|
||||
return;
|
||||
|
||||
var languageInfo = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation;
|
||||
var languageIntellisenseSupport = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport;
|
||||
|
||||
int startIndex = basicDescription.IndexOf("(", basicDescription.IndexOf("(" + PascalABCCompiler.StringResources.Get("CODE_COMPLETION_EXTENSION")) + 1) + 1;
|
||||
|
||||
int paranthesisIndex = languageInfo.FindClosingParenthesis(basicDescription.Substring(startIndex), ')');
|
||||
int paranthesisIndex = languageIntellisenseSupport.FindClosingParenthesis(basicDescription.Substring(startIndex), ')');
|
||||
|
||||
if (paranthesisIndex == -1)
|
||||
return;
|
||||
|
|
@ -83,7 +83,7 @@ namespace ICSharpCode.TextEditor.Util
|
|||
|
||||
if (bold_beg != 0)
|
||||
{
|
||||
int paramDelimIndex = languageInfo.FindParamDelim(basicDescription.Substring(bold_beg), 1);
|
||||
int paramDelimIndex = languageIntellisenseSupport.FindParamDelim(basicDescription.Substring(bold_beg), 1);
|
||||
|
||||
if (paramDelimIndex == -1)
|
||||
{
|
||||
|
|
@ -104,7 +104,7 @@ namespace ICSharpCode.TextEditor.Util
|
|||
{
|
||||
string paramDescription = basicDescription.Substring(startIndex, paranthesisIndex);
|
||||
|
||||
if (languageInfo.IsParams(paramDescription))
|
||||
if (languageIntellisenseSupport.IsParams(paramDescription))
|
||||
{
|
||||
bold_beg = startIndex;
|
||||
bold_len = paranthesisIndex;
|
||||
|
|
@ -114,15 +114,15 @@ namespace ICSharpCode.TextEditor.Util
|
|||
{
|
||||
string descriptionAfterBracket = basicDescription.Substring(startIndex);
|
||||
|
||||
int paramDelimIndex = languageInfo.FindParamDelim(descriptionAfterBracket, paramsCount - 1);
|
||||
int paramDelimIndex = languageIntellisenseSupport.FindParamDelim(descriptionAfterBracket, paramsCount - 1);
|
||||
|
||||
if (paramDelimIndex != -1)
|
||||
{
|
||||
int paramDelimLength = languageInfo.ParameterDelimiter.Length;
|
||||
int paramDelimLength = languageIntellisenseSupport.ParameterDelimiter.Length;
|
||||
|
||||
string paramDescription = descriptionAfterBracket.Substring(paramDelimIndex + paramDelimLength, paranthesisIndex - paramDelimIndex - paramDelimLength);
|
||||
|
||||
if (languageInfo.IsParams(paramDescription))
|
||||
if (languageIntellisenseSupport.IsParams(paramDescription))
|
||||
{
|
||||
bold_beg = paramDelimIndex + startIndex + paramDelimLength;
|
||||
bold_len = end_sk - bold_beg;
|
||||
|
|
@ -132,12 +132,12 @@ namespace ICSharpCode.TextEditor.Util
|
|||
}
|
||||
else
|
||||
{
|
||||
int paramDelimIndex = languageInfo.FindParamDelim(basicDescription.Substring(startIndex), param_num - 1);
|
||||
int paramDelimIndex = languageIntellisenseSupport.FindParamDelim(basicDescription.Substring(startIndex), param_num - 1);
|
||||
|
||||
if (paramDelimIndex != -1)
|
||||
{
|
||||
bold_beg = paramDelimIndex + startIndex + languageInfo.ParameterDelimiter.Length;
|
||||
int secondParamDelimIndex = languageInfo.FindParamDelim(basicDescription.Substring(startIndex), param_num);
|
||||
bold_beg = paramDelimIndex + startIndex + languageIntellisenseSupport.ParameterDelimiter.Length;
|
||||
int secondParamDelimIndex = languageIntellisenseSupport.FindParamDelim(basicDescription.Substring(startIndex), param_num);
|
||||
|
||||
if (secondParamDelimIndex == -1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace VisualPascalABC
|
|||
private System.Threading.Thread MainProgramThread = System.Threading.Thread.CurrentThread;
|
||||
private System.Threading.Thread StartingThread;
|
||||
public delegate void SetFlagDelegate(bool flag);
|
||||
private SetFlagDelegate SetCompilingButtonsEnabled;
|
||||
private SetFlagDelegate SetCompilingAndRunButtonsEnabled;
|
||||
private SetFlagDelegate SetDebugButtonsEnabled;
|
||||
public delegate void SetTextDelegate(string text);
|
||||
public delegate string ConvertUnitText(string FileName, string text); // Это пока только для шифрованного Tasks. В остальных случаях он нулевой
|
||||
|
|
@ -67,7 +67,7 @@ namespace VisualPascalABC
|
|||
Dictionary<string, CodeFileDocumentControl> OpenDocuments;
|
||||
|
||||
public VisualEnvironmentCompiler(InvokeDegegate beginInvoke,
|
||||
SetFlagDelegate setCompilingButtonsEnabled, SetFlagDelegate setCompilingDebugEnabled, SetTextDelegate setStateText,
|
||||
SetFlagDelegate setCompilingAndRunButtonsEnabled, SetFlagDelegate setCompilingDebugEnabled, SetTextDelegate setStateText,
|
||||
SetTextDelegate addTextToCompilerMessages, ToolStripMenuItem pluginsMenuItem,
|
||||
ToolStrip pluginsToolStrip, ExecuteSourceLocationActionDelegate ExecuteSLAction,
|
||||
ExecuteVisualEnvironmentCompilerActionDelegate ExecuteVECAction,
|
||||
|
|
@ -77,7 +77,7 @@ namespace VisualPascalABC
|
|||
this.StandartDirectories = StandartDirectories;
|
||||
this.ErrorsManager = ErrorsManager;
|
||||
this.ChangeVisualEnvironmentState += onChangeVisualEnvironmentState;
|
||||
SetCompilingButtonsEnabled = setCompilingButtonsEnabled;
|
||||
SetCompilingAndRunButtonsEnabled = setCompilingAndRunButtonsEnabled;
|
||||
SetDebugButtonsEnabled = setCompilingDebugEnabled;
|
||||
SetStateText = setStateText;
|
||||
AddTextToCompilerMessages = addTextToCompilerMessages;
|
||||
|
|
@ -351,7 +351,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
case PascalABCCompiler.CompilerState.CompilationStarting:
|
||||
RusName = VECStringResources.Get("STATE_START_COMPILING_ASSEMBLY{0}");
|
||||
SetCompilingButtonsEnabled(false);
|
||||
SetCompilingAndRunButtonsEnabled(false);
|
||||
ParsedFiles.Clear();
|
||||
break;
|
||||
case PascalABCCompiler.CompilerState.BeginCompileFile: RusName = VECStringResources.Get("STATE_BEGINCOMPILEFILE{0}"); break;
|
||||
|
|
@ -397,21 +397,22 @@ namespace VisualPascalABC
|
|||
//if (!ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPlugins)))
|
||||
// LoadPlugins(null);
|
||||
|
||||
SetCompilingButtonsEnabled(true);
|
||||
SetDebugButtonsEnabled(true);
|
||||
SetCompilingAndRunButtonsEnabled(true);
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
SetDebugButtonsEnabled(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Compiler == sender)
|
||||
{
|
||||
SetCompilingButtonsEnabled(true);
|
||||
SetCompilingAndRunButtonsEnabled(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PascalABCCompiler.CompilerState.Reloading:
|
||||
if (Compiler == sender)
|
||||
SetCompilingButtonsEnabled(false);
|
||||
SetCompilingAndRunButtonsEnabled(false);
|
||||
RusName = VECStringResources.Get("STATE_RELOADING");
|
||||
break;
|
||||
case PascalABCCompiler.CompilerState.CompilationFinished:
|
||||
|
|
|
|||
|
|
@ -318,6 +318,7 @@ namespace VisualPascalABC
|
|||
this.StepOutButton.Visible = false;
|
||||
PlayPauseButtonsVisibleInPanel = PlayPauseButtonsVisibleInPanel;
|
||||
SetDebugButtonsEnabled(false);
|
||||
SetRunButtonsEnabled(false);
|
||||
}
|
||||
|
||||
// Для Linux сделать все Debug-кнопки неактивными
|
||||
|
|
@ -408,7 +409,7 @@ namespace VisualPascalABC
|
|||
|
||||
RunManager RunnerManager = (WorkbenchServiceFactory.RunService as WorkbenchRunService).RunnerManager;
|
||||
VisualEnvironmentCompiler = new VisualEnvironmentCompiler(
|
||||
this.BeginInvoke, SetCompilingButtonsEnabled, SetDedugButtonsEnabled, SetStateText,
|
||||
this.BeginInvoke, SetCompilingAndRunButtonsEnabled, SetDebugButtonsEnabled, SetStateText,
|
||||
AddTextToCompilerMessagesSync, miPlugins, toolStrip1,
|
||||
ExecuteSourceLocationAction, ExecuteVisualEnvironmentCompilerAction, ErrorsManager, RunnerManager,
|
||||
WorkbenchServiceFactory.DebuggerManager, UserOptions, WorkbenchStorage.StandartDirectories, OpenDocuments, this);
|
||||
|
|
@ -493,10 +494,10 @@ namespace VisualPascalABC
|
|||
WorkbenchServiceFactory.FileService.OpenFile(FileNameToWait, null);
|
||||
}
|
||||
SetStopEnabled(false);
|
||||
CompilingButtonsEnabled = CloseButtonsEnabled = SaveAllButtonsEnabled = SaveButtonsEnabled = false;
|
||||
CompilingAndRunButtonsEnabled = CloseButtonsEnabled = SaveAllButtonsEnabled = SaveButtonsEnabled = false;
|
||||
if (DebuggerVisible)
|
||||
SetDedugButtonsEnabled(false);
|
||||
SetCompilingButtonsEnabled(false);
|
||||
SetDebugButtonsEnabled(false);
|
||||
SetCompilingAndRunButtonsEnabled(false);
|
||||
|
||||
HelpFileName = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.HelpFileName, WorkbenchStorage.StandartDirectories);
|
||||
DotNetHelpFileName = PascalABCCompiler.Tools.ReplaceAllKeys(Constants.DotNetHelpFileName, WorkbenchStorage.StandartDirectories);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static void Rename(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
IDocument doc = textArea.Document;
|
||||
string textContent = doc.TextContent;
|
||||
ccp = new CodeCompletionProvider();
|
||||
|
|
@ -60,7 +60,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static void RenameUnit(string FileName, string new_val)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
ccp = new CodeCompletionProvider();
|
||||
IDocument doc = null;
|
||||
CodeCompletion.CodeCompletionController controller = new CodeCompletion.CodeCompletionController();
|
||||
|
|
@ -120,10 +120,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static List<Position> GetDefinitionPosition(TextArea textArea, bool only_check)
|
||||
{
|
||||
IParser parser = CodeCompletion.CodeCompletionController.CurrentParser;
|
||||
|
||||
if (parser == null)
|
||||
return new List<Position>();
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return new List<Position>();
|
||||
|
||||
IDocument doc = textArea.Document;
|
||||
string textContent = doc.TextContent;
|
||||
|
|
@ -136,7 +133,7 @@ namespace VisualPascalABC
|
|||
|
||||
|
||||
// Проверка, что компилируем Паскаль временно EVA 10.11.2024
|
||||
if (parser == Languages.Facade.LanguageProvider.Instance.SelectLanguageByName(StringConstants.pascalLanguageName).Parser)
|
||||
if (CodeCompletion.CodeCompletionController.CurrentLanguage == Languages.Facade.LanguageProvider.Instance.MainLanguage)
|
||||
{
|
||||
if (expressionResult != full_expr && full_expr.StartsWith("("))
|
||||
return new List<Position>();
|
||||
|
|
@ -157,7 +154,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static List<Position> GetRealizationPosition(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return new List<Position>();
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return new List<Position>();
|
||||
IDocument doc = textArea.Document;
|
||||
string textContent = doc.TextContent;
|
||||
ccp = new CodeCompletionProvider();
|
||||
|
|
@ -171,7 +168,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static List<SymbolsViewerSymbol> FindReferences(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return new List<SymbolsViewerSymbol>();
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return new List<SymbolsViewerSymbol>();
|
||||
ccp = new CodeCompletionProvider();
|
||||
string full_expr;
|
||||
string expressionResult = FindFullExpression(textArea.Document.TextContent, textArea, out ccp.keyword, out full_expr);
|
||||
|
|
@ -180,7 +177,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static void GotoRealization(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
position = GetRealizationPosition(textArea);
|
||||
if (position == null || position.Count == 0) return;
|
||||
if (position.Count == 1)
|
||||
|
|
@ -209,7 +206,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static bool CanGoTo(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
List<Position> poses = GetDefinitionPosition(textArea, true);
|
||||
if (poses == null || poses.Count == 0) return false;
|
||||
foreach (Position pos in poses)
|
||||
|
|
@ -222,7 +219,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static bool CanGoToRealization(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
List<Position> poses = GetRealizationPosition(textArea);
|
||||
if (poses == null || poses.Count == 0) return false;
|
||||
foreach (Position pos in poses)
|
||||
|
|
@ -237,7 +234,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
ccp = new CodeCompletionProvider();
|
||||
string full_expr;
|
||||
string expressionResult = FindFullExpression(textArea.Document.TextContent, textArea, out ccp.keyword, out full_expr);
|
||||
|
|
@ -258,7 +255,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
ccp = new CodeCompletionProvider();
|
||||
Position pos = new Position();
|
||||
//string text = "procedure Test(a : integer);\n begin \n x := 1; \n end;";//ccp.GetRealizationTextToAdd(out pos);
|
||||
|
|
@ -275,7 +272,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
ccp = new CodeCompletionProvider();
|
||||
Position pos = new Position();
|
||||
//string text = "procedure Test(a : integer);\n begin \n x := 1; \n end;";//ccp.GetRealizationTextToAdd(out pos);
|
||||
|
|
@ -298,7 +295,7 @@ namespace VisualPascalABC
|
|||
private static TextArea _textArea;
|
||||
public static void GenerateOverridableMethods(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
ccp = new CodeCompletionProvider();
|
||||
_textArea = textArea;
|
||||
int off = textArea.Caret.Offset;
|
||||
|
|
@ -328,7 +325,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static void GenerateClassOrMethodRealization(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
ccp = new CodeCompletionProvider();
|
||||
Position pos = new Position();
|
||||
//string text = "procedure Test(a : integer);\n begin \n x := 1; \n end;";//ccp.GetRealizationTextToAdd(out pos);
|
||||
|
|
@ -458,12 +455,12 @@ namespace VisualPascalABC
|
|||
|
||||
public static bool GenerateCommentTemplate(TextArea textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
ccp = new CodeCompletionProvider();
|
||||
//if (!should_insert_comment(textArea))
|
||||
// return false;
|
||||
string lineText = get_next_line(textArea);
|
||||
string addit = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.GetDocumentTemplate(
|
||||
string addit = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.GetDocumentTemplate(
|
||||
lineText, textArea.Document.TextContent, textArea.Caret.Line, textArea.Caret.Column, textArea.Caret.Offset);
|
||||
if (addit == null)
|
||||
return false;
|
||||
|
|
@ -505,7 +502,7 @@ namespace VisualPascalABC
|
|||
|
||||
public static void GotoDefinition(TextArea _textArea)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return;
|
||||
position = GetDefinitionPosition(_textArea, false);
|
||||
if (position == null) return;
|
||||
if (position.Count == 1)
|
||||
|
|
@ -543,9 +540,9 @@ namespace VisualPascalABC
|
|||
keyw = PascalABCCompiler.Parsers.KeywordKind.None;
|
||||
string expr_without_brackets = null;
|
||||
full_expr = null;
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser != null)
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
{
|
||||
full_expr = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpressionFromAnyPosition(_textArea.Caret.Offset, Text, _textArea.Caret.Line, _textArea.Caret.Column, out keyw, out expr_without_brackets);
|
||||
full_expr = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindExpressionFromAnyPosition(_textArea.Caret.Offset, Text, _textArea.Caret.Line, _textArea.Caret.Column, out keyw, out expr_without_brackets);
|
||||
return expr_without_brackets;
|
||||
}
|
||||
return null;
|
||||
|
|
@ -553,7 +550,7 @@ namespace VisualPascalABC
|
|||
|
||||
private static string FindOnlyIdent(string Text, TextArea _textArea, ref string name)
|
||||
{
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindOnlyIdentifier(_textArea.Caret.Offset, Text, _textArea.Caret.Line, _textArea.Caret.Column, ref name);
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindOnlyIdentifier(_textArea.Caret.Offset, Text, _textArea.Caret.Line, _textArea.Caret.Column, ref name);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -605,7 +602,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
public override void Execute(TextArea textArea)
|
||||
{
|
||||
if (WorkbenchServiceFactory.DebuggerManager.IsRunning)
|
||||
if (WorkbenchServiceFactory.DebuggerManager.IsRunning || !CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return;
|
||||
WorkbenchServiceFactory.Workbench.ErrorsListWindow.ClearErrorList();
|
||||
VisualPABCSingleton.MainForm.CurrentCodeFileDocument.DeselectAll();
|
||||
|
|
@ -615,12 +612,14 @@ namespace VisualPascalABC
|
|||
// MainForm.VisualEnvironmentCompiler.Compiler.ParsersController.Compile(
|
||||
// file_name, TextEditor.Text, null, Errors, PascalABCCompiler.Parsers.ParseMode.Normal);
|
||||
string text = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.SourceFilesProvider(VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName, PascalABCCompiler.SourceFileOperation.GetText) as string;
|
||||
|
||||
PascalABCCompiler.SyntaxTree.compilation_unit cu =
|
||||
Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtensionSafe(VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName)?.Parser.GetCompilationUnitForFormatter(
|
||||
CodeCompletion.CodeCompletionController.CurrentLanguage.Parser.GetCompilationUnitForFormatter(
|
||||
VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName,
|
||||
text, //VisualPascalABC.Form1.Form1_object._currentCodeFileDocument.TextEditor.Text,
|
||||
Errors,
|
||||
new List<PascalABCCompiler.Errors.CompilerWarning>());
|
||||
|
||||
if (Errors.Count == 0)
|
||||
{
|
||||
string formattedText = cf.FormatTree(text, cu, textArea.Caret.Line + 1, textArea.Caret.Column + 1);
|
||||
|
|
@ -682,7 +681,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
if (!WorkbenchServiceFactory.Workbench.UserOptions.CodeCompletionDot)
|
||||
return;
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return;
|
||||
if (CodeCompletion.CodeCompletionController.CurrentLanguage == null) return;
|
||||
CodeCompletionProvider completionDataProvider = new CodeCompletionProvider();
|
||||
|
||||
bool is_pattern = false;
|
||||
|
|
@ -690,7 +689,7 @@ namespace VisualPascalABC
|
|||
|
||||
is_begin = true;
|
||||
|
||||
completionDataProvider.preSelection = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindPattern(off, text, out is_pattern);
|
||||
completionDataProvider.preSelection = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindPattern(off, text, out is_pattern);
|
||||
|
||||
if (!is_pattern && off > 0 && text[off - 1] == '.')
|
||||
key = '_';//was '$'
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ namespace VisualPascalABC
|
|||
{
|
||||
public static PascalABCCompiler.Parsers.KeywordKind TestForKeyword(string Text, int i)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser != null && CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation !=null)
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.TestForKeyword(Text, i);
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.TestForKeyword(Text, i);
|
||||
return PascalABCCompiler.Parsers.KeywordKind.None;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
if (!WorkbenchServiceFactory.Workbench.UserOptions.AllowCodeCompletion || !VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.compilerLoaded)
|
||||
return false;
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
if (codeCompletionWindow != null)
|
||||
{
|
||||
// If completion window is open and wants to handle the key, don't let the text area
|
||||
|
|
@ -93,8 +93,6 @@ namespace VisualPascalABC
|
|||
}
|
||||
if (key == '.')
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null)
|
||||
return false;
|
||||
if (!string.IsNullOrEmpty(WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.SelectionManager.SelectedText))
|
||||
{
|
||||
WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.Caret.Position = WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.SelectionManager.SelectionCollection[0].StartPosition;
|
||||
|
|
@ -124,7 +122,6 @@ namespace VisualPascalABC
|
|||
}
|
||||
else if (key == '(' || key == '[' || key == ',')
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (VisualPABCSingleton.MainForm.UserOptions.CodeCompletionParams)
|
||||
{
|
||||
ICSharpCode.TextEditor.Gui.InsightWindow.IInsightDataProvider idp = new DefaultInsightDataProvider(-1, false, key);
|
||||
|
|
@ -147,7 +144,6 @@ namespace VisualPascalABC
|
|||
}
|
||||
else if (key == ' ')
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (VisualPABCSingleton.MainForm.UserOptions.CodeCompletionDot)
|
||||
{
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw = KeywordChecker.TestForKeyword(editor.Document.TextContent, editor.ActiveTextAreaControl.TextArea.Caret.Offset - 1);
|
||||
|
|
@ -173,7 +169,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
else if (key == '\n')
|
||||
{
|
||||
if (VisualPABCSingleton.MainForm.UserOptions.AllowCodeCompletion && CodeCompletion.CodeCompletionController.CurrentParser != null)
|
||||
if (VisualPABCSingleton.MainForm.UserOptions.AllowCodeCompletion)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -194,9 +190,8 @@ namespace VisualPascalABC
|
|||
{
|
||||
if (VisualPABCSingleton.MainForm.UserOptions.CodeCompletionDot)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw = KeywordChecker.TestForKeyword(editor.Document.TextContent, editor.ActiveTextAreaControl.TextArea.Caret.Offset - 1);
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.IsDefinitionIdentifierAfterKeyword(keyw))
|
||||
if (CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IsDefinitionIdentifierAfterKeyword(keyw))
|
||||
return false;
|
||||
|
||||
// если не первый символ выражения (предыдущий тоже буква или "_"), то не открываем новое окно
|
||||
|
|
|
|||
|
|
@ -76,11 +76,7 @@ namespace VisualPascalABC
|
|||
|
||||
public void RegisterFileForParsing(string FileName)
|
||||
{
|
||||
if (Languages.Facade.LanguageProvider.Instance.HasLanguageForExtension(FileName))
|
||||
{
|
||||
filesToParse[FileName] = true;
|
||||
CodeCompletion.CodeCompletionController.SetLanguage(FileName);
|
||||
}
|
||||
filesToParse[FileName] = true;
|
||||
}
|
||||
|
||||
public void CloseFile(string FileName)
|
||||
|
|
|
|||
|
|
@ -126,12 +126,12 @@ namespace VisualPascalABC
|
|||
private string construct_header(string meth, CodeCompletion.ProcScope ps, int tabCount)
|
||||
{
|
||||
//if (CodeCompletion.CodeCompletionController.currentParser != null)
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.ConstructHeader(meth, ps, tabCount);
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.ConstructHeader(meth, ps, tabCount);
|
||||
}
|
||||
|
||||
private string construct_header(CodeCompletion.ProcRealization ps, int tabCount)
|
||||
{
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.ConstructHeader(ps, tabCount);
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.ConstructHeader(ps, tabCount);
|
||||
}
|
||||
|
||||
public CodeCompletion.SymScope FindScopeByLocation(string fileName, int line, int col)
|
||||
|
|
@ -295,8 +295,8 @@ namespace VisualPascalABC
|
|||
|
||||
public string FindExpression(int off, string Text, int line, int col)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser != null)
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpression(off, Text, line, col, out keyword);
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindExpression(off, Text, line, col, out keyword);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -325,14 +325,14 @@ namespace VisualPascalABC
|
|||
try
|
||||
{
|
||||
|
||||
ILanguageInformation languageInformation = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation;
|
||||
ILanguage currentLanguage = CodeCompletion.CodeCompletionController.CurrentLanguage;
|
||||
|
||||
List<string> keywords;
|
||||
|
||||
bool isTypeAfterKeyword = false;
|
||||
|
||||
// если по смыслу должен вводиться тип данных
|
||||
if (languageInformation.IsTypeAfterKeyword(keyw))
|
||||
if (currentLanguage.LanguageIntellisenseSupport.IsTypeAfterKeyword(keyw))
|
||||
{
|
||||
keywords = CodeCompletion.CodeCompletionNameHelper.Helper.GetTypeKeywords();
|
||||
isTypeAfterKeyword = true;
|
||||
|
|
@ -345,7 +345,7 @@ namespace VisualPascalABC
|
|||
bool isNamespaceAfterKeyword = false;
|
||||
|
||||
// конструкция типа "uses"
|
||||
if (languageInformation.IsNamespaceAfterKeyword(keyw))
|
||||
if (currentLanguage.LanguageIntellisenseSupport.IsNamespaceAfterKeyword(keyw))
|
||||
{
|
||||
isNamespaceAfterKeyword = true;
|
||||
}
|
||||
|
|
@ -359,11 +359,9 @@ namespace VisualPascalABC
|
|||
|
||||
if (symInfos != null)
|
||||
{
|
||||
bool languageCaseSensitive = LanguageProvider.Instance.SelectLanguageByExtension(FileName).CaseSensitive;
|
||||
currentLanguage.LanguageIntellisenseSupport.RenameOrExcludeSpecialNames(symInfos);
|
||||
|
||||
languageInformation.RenameOrExcludeSpecialNames(symInfos);
|
||||
|
||||
AddCompletionDatasByFirstForSymInfos(resultList, charTyped, symInfos, languageCaseSensitive);
|
||||
AddCompletionDatasByFirstForSymInfos(resultList, charTyped, symInfos, currentLanguage.CaseSensitive);
|
||||
|
||||
//resultList.Sort();
|
||||
//defaultCompletionElement = resultList[0] as DefaultCompletionData;
|
||||
|
|
@ -507,7 +505,7 @@ namespace VisualPascalABC
|
|||
};
|
||||
|
||||
string expressionText = GetExpressionTextForCompletionData(off, text, line, col,
|
||||
currentLanguage.LanguageInformation, in context, out var insidePatternWithDots, out var ctrlOrShiftSpaceAfterDot, out var pattern);
|
||||
currentLanguage.LanguageIntellisenseSupport, in context, out var insidePatternWithDots, out var ctrlOrShiftSpaceAfterDot, out var pattern);
|
||||
|
||||
// добавляем ключевые слова в случае "ctrl + space", нажатых в "пустом" месте
|
||||
if (!ctrlOrShiftSpaceAfterDot && context.ctrlSpace && string.IsNullOrEmpty(pattern))
|
||||
|
|
@ -538,7 +536,7 @@ namespace VisualPascalABC
|
|||
|
||||
if (symInfos != null)
|
||||
{
|
||||
currentLanguage.LanguageInformation.RenameOrExcludeSpecialNames(symInfos);
|
||||
currentLanguage.LanguageIntellisenseSupport.RenameOrExcludeSpecialNames(symInfos);
|
||||
|
||||
AddCompletionDatasForSymInfos(resultList, currentLanguage.CaseSensitive, symInfos, selectedSymInfo, lastUsedMember);
|
||||
}
|
||||
|
|
@ -690,7 +688,7 @@ namespace VisualPascalABC
|
|||
/// <summary>
|
||||
/// Получение текста выражения, введенного пользователем перед нажатием "триггерной" клавиши
|
||||
/// </summary>
|
||||
private string GetExpressionTextForCompletionData(int off, string text, int line, int col, ILanguageInformation languageInformation, in ActionContext context, out bool insidePatternWithDots, out bool ctrlOrShiftSpaceAfterDot, out string pattern)
|
||||
private string GetExpressionTextForCompletionData(int off, string text, int line, int col, ILanguageIntellisenseSupport languageInformation, in ActionContext context, out bool insidePatternWithDots, out bool ctrlOrShiftSpaceAfterDot, out string pattern)
|
||||
{
|
||||
|
||||
string expressionText = null;
|
||||
|
|
|
|||
|
|
@ -19,11 +19,17 @@ namespace VisualPascalABC
|
|||
|
||||
public static void DefinitionByMouseClickManager_TextAreaMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return;
|
||||
|
||||
makeWordUnderline(sender, e);
|
||||
}
|
||||
|
||||
public static void DefinitionByMouseClickManager_TextAreaMouseDown(object sender, EventArgs e)
|
||||
{
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return;
|
||||
|
||||
TextArea textArea = (TextArea)sender;
|
||||
if (Control.ModifierKeys == Keys.Control && textArea.SelectionManager.SelectionCollection.Count == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ namespace VisualPascalABC
|
|||
|
||||
private string FindExpression(int off, string Text, int line, int col)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser != null)
|
||||
return CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpressionForMethod(off, Text, line, col, pressed_key, ref num_param);
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.FindExpressionForMethod(off, Text, line, col, pressed_key, ref num_param);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
if (setupOnlyOnce && this.textArea != null)
|
||||
{
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.IsMethodCallParameterSeparator(pressed_key))
|
||||
if (CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IsMethodCallParameterSeparator(pressed_key))
|
||||
{
|
||||
FindExpression(textArea.Caret.Offset, textArea.Document.TextContent.Substring(0, textArea.Caret.Offset),
|
||||
textArea.Caret.Line, textArea.Caret.Column);
|
||||
|
|
@ -71,9 +71,9 @@ namespace VisualPascalABC
|
|||
if (dconv != null)
|
||||
{
|
||||
//if (pressed_key == '(' || pressed_key == ',')
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.IsOpenBracketForMethodCall(pressed_key) || CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.IsMethodCallParameterSeparator(pressed_key))
|
||||
if (CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IsOpenBracketForMethodCall(pressed_key) || CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IsMethodCallParameterSeparator(pressed_key))
|
||||
methods = dconv.GetNameOfMethod(e, expr, line, col, num_param, ref defaultIndex, cur_param_num, out param_count);
|
||||
else if (CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.IsOpenBracketForIndex(pressed_key))
|
||||
else if (CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.IsOpenBracketForIndex(pressed_key))
|
||||
methods = dconv.GetIndex(e, line, col);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ using System.Windows.Forms;
|
|||
using ICSharpCode.TextEditor;
|
||||
using ICSharpCode.TextEditor.Document;
|
||||
using ICSharpCode.TextEditor.Gui.CompletionWindow;
|
||||
using PascalABCCompiler.Parsers;
|
||||
|
||||
namespace VisualPascalABC
|
||||
{
|
||||
|
|
@ -29,9 +28,9 @@ namespace VisualPascalABC
|
|||
|
||||
//string expr = FindFullExpression(doc.TextContent, seg.Offset + logicPos.X,e.LogicalPosition.Line,e.LogicalPosition.Column);
|
||||
|
||||
IParser parser = CodeCompletion.CodeCompletionController.CurrentParser;
|
||||
var currentLanguage = CodeCompletion.CodeCompletionController.CurrentLanguage;
|
||||
|
||||
string expr = parser.LanguageInformation.FindExpressionFromAnyPosition(
|
||||
string expr = currentLanguage.LanguageIntellisenseSupport.FindExpressionFromAnyPosition(
|
||||
lineSegment.Offset + logicPos.X, doc.TextContent, e.LogicalPosition.Line, e.LogicalPosition.Column, out var keyw, out var exprWithoutBrackets);
|
||||
|
||||
// пока непонятно, когда такое может быть EVA
|
||||
|
|
@ -44,25 +43,25 @@ namespace VisualPascalABC
|
|||
List<PascalABCCompiler.Errors.Error> Errors = new List<PascalABCCompiler.Errors.Error>();
|
||||
List<PascalABCCompiler.Errors.CompilerWarning> Warnings = new List<PascalABCCompiler.Errors.CompilerWarning>();
|
||||
|
||||
PascalABCCompiler.SyntaxTree.expression expressionTree = parser.GetExpression("test" + Path.GetExtension(fileName),
|
||||
PascalABCCompiler.SyntaxTree.expression expressionTree = currentLanguage.Parser.GetExpression("test" + Path.GetExtension(fileName),
|
||||
expr, Errors, Warnings);
|
||||
|
||||
// Пока добавили проверку, что анализируем Паскаль EVA
|
||||
if (Errors.Count > 0 && parser == Languages.Facade.LanguageProvider.Instance.MainLanguage.Parser)
|
||||
if (Errors.Count > 0 && currentLanguage == Languages.Facade.LanguageProvider.Instance.MainLanguage)
|
||||
{
|
||||
string s = expr.TrimStart();
|
||||
if (s.Length > 0 && s[0] == '^')
|
||||
{
|
||||
Errors.Clear();
|
||||
exprWithoutBrackets = exprWithoutBrackets.TrimStart().Substring(1);
|
||||
expressionTree = parser.GetExpression("test" + Path.GetExtension(fileName), s.Substring(1), Errors, Warnings);
|
||||
expressionTree = currentLanguage.Parser.GetExpression("test" + Path.GetExtension(fileName), s.Substring(1), Errors, Warnings);
|
||||
}
|
||||
}
|
||||
|
||||
List<PascalABCCompiler.Errors.Error> Errors2 = new List<PascalABCCompiler.Errors.Error>();
|
||||
|
||||
// проверка для выражения без скобок
|
||||
PascalABCCompiler.SyntaxTree.expression expressionTree2 = parser.GetExpression("test" + Path.GetExtension(fileName), exprWithoutBrackets, Errors2, Warnings);
|
||||
PascalABCCompiler.SyntaxTree.expression expressionTree2 = currentLanguage.Parser.GetExpression("test" + Path.GetExtension(fileName), exprWithoutBrackets, Errors2, Warnings);
|
||||
|
||||
// если не получается, то сразу возврат
|
||||
if (expressionTree2 == null || Errors2.Count > 0)
|
||||
|
|
@ -123,7 +122,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
if (!VisualPABCSingleton.MainForm.UserOptions.CodeCompletionHint)
|
||||
return;
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null)
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
return;
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ namespace VisualPascalABC
|
|||
public bool IsRunning = false;
|
||||
public string ExeFileName;
|
||||
public bool ShowDebugTabs=true;
|
||||
public PascalABCCompiler.Parsers.IParser parser = null;
|
||||
public Languages.Facade.ILanguage language = null;
|
||||
EventHandler<EventArgs> debuggerStateEvent;
|
||||
private Mono.Debugging.Soft.SoftDebuggerSession monoDebuggerSession;
|
||||
private Mono.Debugging.Client.StackFrame stackFrame;
|
||||
|
|
@ -485,7 +485,7 @@ namespace VisualPascalABC
|
|||
this.FullFileName = Path.Combine(Path.GetDirectoryName(fileName), this.FileName);
|
||||
this.ExeFileName = fileName;
|
||||
CurrentLine = 0;
|
||||
this.parser = Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtensionSafe(FullFileName)?.Parser;
|
||||
this.language = Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtension(FullFileName);
|
||||
this.PrevFullFileName = FullFileName;
|
||||
AssemblyHelper.LoadAssembly(fileName);
|
||||
//dbg.ProcessStarted += debugProcessStarted;
|
||||
|
|
@ -509,7 +509,7 @@ namespace VisualPascalABC
|
|||
this.FullFileName = Path.Combine(Path.GetDirectoryName(fileName), this.FileName);
|
||||
this.ExeFileName = fileName;
|
||||
CurrentLine = 0;
|
||||
this.parser = Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtensionSafe(FullFileName)?.Parser;
|
||||
this.language = Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtension(FullFileName);
|
||||
this.PrevFullFileName = FullFileName;
|
||||
AssemblyHelper.LoadAssembly(fileName);
|
||||
|
||||
|
|
@ -541,7 +541,7 @@ namespace VisualPascalABC
|
|||
workbench.WidgetController.SetDebugTabsVisible(true);
|
||||
workbench.WidgetController.SetPlayButtonsVisible(true);
|
||||
workbench.WidgetController.SetDebugStopEnabled();//e.Process.LogMessage += messageEventProc;
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
workbench.WidgetController.ChangeStartDebugNameOnContinue();
|
||||
workbench.WidgetController.EnableCodeCompletionToolTips(false);
|
||||
workbench.WidgetController.SetAddExprMenuVisible(true);
|
||||
|
|
@ -597,7 +597,7 @@ namespace VisualPascalABC
|
|||
workbench.ServiceContainer.EditorService.SetEditorDisabled(false);
|
||||
//RemoveMarker(frm.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.Document);
|
||||
evaluator = null;
|
||||
parser = null;
|
||||
language = null;
|
||||
FileName = null;
|
||||
handle = 0;
|
||||
ExeFileName = null;
|
||||
|
|
@ -642,7 +642,7 @@ namespace VisualPascalABC
|
|||
if (evaluator != null)
|
||||
evaluator.SetCurrentMonoFrame(monoDebuggerSession, stackFrame);
|
||||
JumpToCurrentLine();
|
||||
workbench.WidgetController.SetStartDebugEnabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunEnabled();
|
||||
WorkbenchServiceFactory.DebuggerOperationsService.RefreshPad(new FunctionItem(stackFrame).SubItems);
|
||||
}
|
||||
|
||||
|
|
@ -662,7 +662,7 @@ namespace VisualPascalABC
|
|||
if (evaluator != null)
|
||||
evaluator.SetCurrentMonoFrame(monoDebuggerSession, stackFrame);
|
||||
JumpToCurrentLine();
|
||||
workbench.WidgetController.SetStartDebugEnabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunEnabled();
|
||||
}
|
||||
|
||||
Function currentFunction;
|
||||
|
|
@ -785,7 +785,7 @@ namespace VisualPascalABC
|
|||
|
||||
private void debuggedProcess_Expired(object sender, EventArgs e)
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugEnabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunEnabled();
|
||||
}
|
||||
|
||||
private void debuggedProcess_ExceptionThrown(object sender, ExceptionEventArgs e)
|
||||
|
|
@ -850,7 +850,7 @@ namespace VisualPascalABC
|
|||
workbench.ServiceContainer.EditorService.SetEditorDisabled(false);
|
||||
//RemoveMarker(frm.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.Document);
|
||||
evaluator = null;
|
||||
parser= null;
|
||||
language= null;
|
||||
FileName = null;
|
||||
handle = 0;
|
||||
ExeFileName = null;
|
||||
|
|
@ -894,7 +894,7 @@ namespace VisualPascalABC
|
|||
workbench.WidgetController.SetDebugTabsVisible(true);
|
||||
workbench.WidgetController.SetPlayButtonsVisible(true);
|
||||
workbench.WidgetController.SetDebugStopEnabled();//e.Process.LogMessage += messageEventProc;
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
workbench.WidgetController.ChangeStartDebugNameOnContinue();
|
||||
workbench.WidgetController.EnableCodeCompletionToolTips(false);
|
||||
workbench.WidgetController.SetAddExprMenuVisible(true);
|
||||
|
|
@ -1466,7 +1466,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
sb.Insert(0, '.');
|
||||
PascalABCCompiler.Parsers.KeywordKind keyw = PascalABCCompiler.Parsers.KeywordKind.None;
|
||||
string s = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.
|
||||
string s = CodeCompletion.CodeCompletionController.CurrentLanguage.LanguageIntellisenseSupport.
|
||||
FindExpression(i, text, 0, 0, out keyw);
|
||||
if (s != null)
|
||||
{
|
||||
|
|
@ -2011,7 +2011,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugEnabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunEnabled();
|
||||
dbg.Processes[0].Terminate();
|
||||
}
|
||||
catch (System.Exception e)
|
||||
|
|
@ -2027,7 +2027,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugEnabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunEnabled();
|
||||
dbg.Processes[0].Break();
|
||||
}
|
||||
catch (System.Exception e)
|
||||
|
|
@ -2093,7 +2093,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
|
||||
CurrentLineBookmark.Remove();
|
||||
monoDebuggerSession.NextLine();
|
||||
|
|
@ -2114,7 +2114,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
monoDebuggerSession.Continue();
|
||||
CurrentLineBookmark.Remove();
|
||||
}
|
||||
|
|
@ -2134,7 +2134,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
try
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
stepin_stmt = monoDebuggerSession.ActiveThread.Backtrace.GetFrame(0).SourceLocation;
|
||||
monoDebuggerSession.StepLine();
|
||||
CurrentLineBookmark.Remove();
|
||||
|
|
@ -2157,7 +2157,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
if (IsRunning)
|
||||
{
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
monoDebuggerSession.StepOut();
|
||||
CurrentLineBookmark.Remove();
|
||||
}
|
||||
|
|
@ -2177,7 +2177,7 @@ namespace VisualPascalABC
|
|||
{
|
||||
//cur_brpt = dbg.AddBreakpoint(new SourcecodeSegment((frm.CurrentTabPage.ag as CodeFileDocumentControl).file_name,(frm.CurrentTabPage.ag as CodeFileDocumentControl).TextEditor.ActiveTextAreaControl.Caret.Line + 1,(frm.CurrentTabPage.Tag as CodeFileDocumentControl).TextEditor.ActiveTextAreaControl.Caret.Column + 1,
|
||||
// (frm.CurrentTabPage.ag as CodeFileDocumentControl).TextEditor.ActiveTextAreaControl.Caret.Column+100), true);
|
||||
workbench.WidgetController.SetStartDebugDisabled();
|
||||
workbench.WidgetController.SetStartDebugAndRunDisabled();
|
||||
currentBreakpoint = monoDebuggerSession.Breakpoints.Add(WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.FileName, WorkbenchServiceFactory.DocumentService.CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.Caret.Line + 1);
|
||||
AddGoToBreakPoint(currentBreakpoint);
|
||||
Status = DebugStatus.None;
|
||||
|
|
|
|||
|
|
@ -132,8 +132,8 @@ namespace VisualPascalABC
|
|||
public static string WrapTypeName(DebugType type)
|
||||
{
|
||||
if (type.IsArray)
|
||||
if (WorkbenchServiceFactory.DebuggerManager.parser != null)
|
||||
return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetArrayDescription(WrapTypeName(type.GetElementType()), type.GetArrayRank());
|
||||
if (WorkbenchServiceFactory.DebuggerManager.language != null)
|
||||
return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetArrayDescription(WrapTypeName(type.GetElementType()), type.GetArrayRank());
|
||||
else
|
||||
return "array of " + WrapTypeName(type.GetElementType());
|
||||
return internalWrapTypeName(type.FullName);
|
||||
|
|
@ -192,23 +192,23 @@ namespace VisualPascalABC
|
|||
|
||||
private static string internalWrapTypeName(string name)
|
||||
{
|
||||
if (WorkbenchServiceFactory.DebuggerManager.parser != null)
|
||||
if (WorkbenchServiceFactory.DebuggerManager.language != null)
|
||||
switch (name)
|
||||
{
|
||||
case "System.Boolean": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(bool));
|
||||
case "System.Int32": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(int));
|
||||
case "System.Byte": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(byte));
|
||||
case "System.Double": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(double));
|
||||
case "System.String": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(string));
|
||||
case "System.Char": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(char));
|
||||
case "System.SByte": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(sbyte));
|
||||
case "System.Int16": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(short));
|
||||
case "System.UInt16": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(ushort));
|
||||
case "System.UInt32": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(uint));
|
||||
case "System.Int64": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(long));
|
||||
case "System.UInt64": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(ulong));
|
||||
case "System.Float32": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(typeof(float));
|
||||
case "System.IntPtr": return WorkbenchServiceFactory.DebuggerManager.parser.LanguageInformation.GetShortTypeName(Type.GetType("System.Void*"));
|
||||
case "System.Boolean": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(bool));
|
||||
case "System.Int32": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(int));
|
||||
case "System.Byte": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(byte));
|
||||
case "System.Double": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(double));
|
||||
case "System.String": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(string));
|
||||
case "System.Char": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(char));
|
||||
case "System.SByte": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(sbyte));
|
||||
case "System.Int16": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(short));
|
||||
case "System.UInt16": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(ushort));
|
||||
case "System.UInt32": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(uint));
|
||||
case "System.Int64": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(long));
|
||||
case "System.UInt64": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(ulong));
|
||||
case "System.Float32": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(typeof(float));
|
||||
case "System.IntPtr": return WorkbenchServiceFactory.DebuggerManager.language.LanguageIntellisenseSupport.GetShortTypeName(Type.GetType("System.Void*"));
|
||||
default: return name;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ namespace VisualPascalABC
|
|||
|
||||
void tsIntellisense_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
if (UserOptions.AllowCodeCompletion)
|
||||
if (UserOptions.AllowCodeCompletion && CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
{
|
||||
//GotoAction ga = new GotoAction();
|
||||
TextArea ta = CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.TextArea;
|
||||
|
|
@ -470,21 +470,50 @@ namespace VisualPascalABC
|
|||
this.tsGotoRealization.Enabled = CodeCompletionActionsManager.CanGoToRealization(ta);
|
||||
this.tsFindAllReferences.Enabled = CodeCompletionActionsManager.CanFindReferences(ta);
|
||||
//this.cmFindAllReferences.Enabled = ga.CanFindReferences(ta);
|
||||
this.miGenerateRealization.Enabled = CodeCompletionActionsManager.CanGenerateRealization(ta);
|
||||
this.miGenerateRealization.Enabled = CodeCompletionActionsManager.CanGenerateRealization(ta);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisableIntellisenseDropDownOptions();
|
||||
}
|
||||
}
|
||||
|
||||
private void OpeningContextMenu(object sender, CancelEventArgs args)
|
||||
{
|
||||
GotoAction ga = new GotoAction();
|
||||
TextArea ta = CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.TextArea;
|
||||
this.cmGotoDefinition.Enabled = CodeCompletionActionsManager.CanGoTo(ta);
|
||||
this.cmGotoRealization.Enabled = CodeCompletionActionsManager.CanGoToRealization(ta);
|
||||
this.cmFindAllReferences.Enabled = CodeCompletionActionsManager.CanFindReferences(ta);
|
||||
this.cmGenerateRealization.Enabled = CodeCompletionActionsManager.CanGenerateRealization(ta);
|
||||
this.cmRename.Enabled = CodeCompletionActionsManager.CanGoTo(ta);
|
||||
}
|
||||
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
{
|
||||
// GotoAction ga = new GotoAction();
|
||||
TextArea ta = CurrentCodeFileDocument.TextEditor.ActiveTextAreaControl.TextArea;
|
||||
|
||||
this.cmGotoDefinition.Enabled = CodeCompletionActionsManager.CanGoTo(ta);
|
||||
this.cmGotoRealization.Enabled = CodeCompletionActionsManager.CanGoToRealization(ta);
|
||||
this.cmFindAllReferences.Enabled = CodeCompletionActionsManager.CanFindReferences(ta);
|
||||
this.cmGenerateRealization.Enabled = CodeCompletionActionsManager.CanGenerateRealization(ta);
|
||||
this.cmRename.Enabled = CodeCompletionActionsManager.CanGoTo(ta);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisableIntellisenseContextMenuOptions();
|
||||
}
|
||||
}
|
||||
|
||||
private void DisableIntellisenseContextMenuOptions()
|
||||
{
|
||||
this.cmGotoDefinition.Enabled = false;
|
||||
this.cmGotoRealization.Enabled = false;
|
||||
this.cmFindAllReferences.Enabled = false;
|
||||
this.cmGenerateRealization.Enabled = false;
|
||||
this.cmRename.Enabled = false;
|
||||
}
|
||||
|
||||
private void DisableIntellisenseDropDownOptions()
|
||||
{
|
||||
this.tsGotoDefinition.Enabled = false;
|
||||
this.tsGotoRealization.Enabled = false;
|
||||
this.tsFindAllReferences.Enabled = false;
|
||||
this.miGenerateRealization.Enabled = false;
|
||||
}
|
||||
|
||||
private void ClosingContextMenu(object sender, CancelEventArgs args)
|
||||
{
|
||||
this.cmRename.Enabled = true;
|
||||
|
|
|
|||
|
|
@ -99,11 +99,11 @@ namespace VisualPascalABC
|
|||
string full_file_name = Path.Combine(Path.GetDirectoryName(ProjectFactory.Instance.CurrentProject.Path),frm.FileName);
|
||||
StreamWriter sw = File.CreateText(full_file_name);
|
||||
|
||||
ILanguageInformation languageInfo = Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtension(frm.FileName).LanguageInformation;
|
||||
var languageIntellisenseSupport = Languages.Facade.LanguageProvider.Instance.SelectLanguageByExtension(frm.FileName).LanguageIntellisenseSupport;
|
||||
|
||||
if (frm.GetFileFilter() == FileType.Unit)
|
||||
{
|
||||
sw.Write(languageInfo.GetUnitTemplate(Path.GetFileNameWithoutExtension(frm.FileName)));
|
||||
sw.Write(languageIntellisenseSupport.GetUnitTemplate(Path.GetFileNameWithoutExtension(frm.FileName)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace VisualPascalABC
|
|||
public string Compile(PascalABCCompiler.IProjectInfo project, bool rebuild, string RuntimeServicesModule, bool ForRun, bool RunWithEnvironment)
|
||||
{
|
||||
ProjectService.SaveProject();
|
||||
Workbench.WidgetController.CompilingButtonsEnabled = false;
|
||||
Workbench.WidgetController.CompilingAndRunButtonsEnabled = false;
|
||||
Workbench.CompilerConsoleWindow.ClearConsole();
|
||||
CompilerOptions1.SourceFileName = project.Path;
|
||||
CompilerOptions1.OutputDirectory = project.OutputDirectory;
|
||||
|
|
@ -98,7 +98,7 @@ namespace VisualPascalABC
|
|||
|
||||
public string Compile(string FileName, bool rebuild, string RuntimeServicesModule, bool ForRun, bool RunWithEnvironment)
|
||||
{
|
||||
Workbench.WidgetController.CompilingButtonsEnabled = false;
|
||||
Workbench.WidgetController.CompilingAndRunButtonsEnabled = false;
|
||||
|
||||
var UserOptions = Workbench.UserOptions;
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ namespace VisualPascalABC
|
|||
}
|
||||
//CloseButtonsEnabled = OpenDocuments.Count > 1;
|
||||
ChangedSelectedTab();
|
||||
if (FileName != null) // SS 09.08.08
|
||||
if (FileName != null // SS 09.08.08
|
||||
&& CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
WorkbenchServiceFactory.CodeCompletionParserController.RegisterFileForParsing(FileName);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace VisualPascalABC
|
|||
case "string":
|
||||
return false;
|
||||
}
|
||||
if (CodeCompletion.CodeCompletionController.CurrentParser == null) return false;
|
||||
if (!CodeCompletion.CodeCompletionController.IntellisenseAvailable()) return false;
|
||||
List<Position> poses = CodeCompletionActionsManager.GetDefinitionPosition(CurrentSyntaxEditor.TextEditor.ActiveTextAreaControl.TextArea, true);
|
||||
if (poses == null || poses.Count == 0) return false;
|
||||
foreach (Position pos in poses)
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ namespace VisualPascalABC
|
|||
if (ProjectFactory.Instance.ProjectLoaded)
|
||||
tabPage = DocumentService.GetTabPageForMainFile();
|
||||
if (attachdbg && !Workbench.UserOptions.AlwaysAttachDebuggerAtStart)
|
||||
fictive_attach = !startWithGoto && !needFirstBreakpoint && !DebuggerManager.HasBreakpoints();
|
||||
fictive_attach = !startWithGoto && !needFirstBreakpoint && !DebuggerManager.HasBreakpoints() || !CodeCompletion.CodeCompletionController.IntellisenseAvailable();
|
||||
WorkbenchServiceFactory.OperationsService.ClearOutputTextBoxForTabPage(tabPage);
|
||||
Workbench.ErrorsListWindow.ClearErrorList();
|
||||
//DesignerService.GenerateAllDesignersCode();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace VisualPascalABC
|
|||
void ButtonsEnableDisable_RunStart()
|
||||
{
|
||||
Workbench.WidgetController.SetStopEnabled(true);
|
||||
Workbench.WidgetController.SetCompilingButtonsEnabled(false);
|
||||
Workbench.WidgetController.SetCompilingAndRunButtonsEnabled(false);
|
||||
Workbench.WidgetController.SetDebugButtonsEnabled(false);
|
||||
Workbench.WidgetController.SetOptionsEnabled(false);
|
||||
}
|
||||
|
|
@ -35,8 +35,9 @@ namespace VisualPascalABC
|
|||
void ButtonsEnableDisable_RunStop()
|
||||
{
|
||||
Workbench.WidgetController.SetStopEnabled(false);
|
||||
Workbench.WidgetController.SetCompilingButtonsEnabled(true);
|
||||
Workbench.WidgetController.SetDebugButtonsEnabled(true);
|
||||
Workbench.WidgetController.SetCompilingAndRunButtonsEnabled(true);
|
||||
if (CodeCompletion.CodeCompletionController.IntellisenseAvailable())
|
||||
Workbench.WidgetController.SetDebugButtonsEnabled(true);
|
||||
Workbench.WidgetController.SetOptionsEnabled(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ namespace VisualPascalABC
|
|||
internal List<DockContent> BottomDockContent = new List<DockContent>();
|
||||
List<DockContent> VisibleBottomContent = new List<DockContent>();
|
||||
|
||||
public bool CompilingButtonsEnabled
|
||||
public bool CompilingAndRunButtonsEnabled
|
||||
{
|
||||
get { return miRun.Enabled; }
|
||||
set { SetCompilingButtonsEnabled(value); }
|
||||
set { SetCompilingAndRunButtonsEnabled(value); }
|
||||
}
|
||||
|
||||
bool SaveButtonsEnabled
|
||||
|
|
@ -100,18 +100,18 @@ namespace VisualPascalABC
|
|||
set { miNavigForw.Enabled = tsNavigForw.Enabled = value; }
|
||||
}
|
||||
|
||||
public void SetDedugButtonsEnabled(bool Enabled)
|
||||
/// <summary>
|
||||
/// Активировать/Деактивировать все кнопки, относящиеся к дебагу.
|
||||
/// </summary>
|
||||
public void SetDebugButtonsEnabled(bool Enabled)
|
||||
{
|
||||
if (!DebuggerVisible)
|
||||
return;
|
||||
|
||||
StepIntoButton.Enabled = StepOverButton.Enabled = StartDebugButton.Enabled =
|
||||
mDEBUGSTARTToolStripMenuItem.Enabled = mSTEPOVERToolStripMenuItem.Enabled = mSTEPINToolStripMenuItem.Enabled = mRUNTOCURToolStripMenuItem.Enabled = Enabled;
|
||||
|
||||
mDEBUGSTARTToolStripMenuItem.Enabled = mSTEPOVERToolStripMenuItem.Enabled =
|
||||
mSTEPINToolStripMenuItem.Enabled = mRUNTOCURToolStripMenuItem.Enabled = Enabled;
|
||||
//toolStrip1.Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool BottomDockContentVisible
|
||||
{
|
||||
|
|
@ -322,7 +322,7 @@ namespace VisualPascalABC
|
|||
}
|
||||
}
|
||||
|
||||
public void SetCompilingButtonsEnabled(bool Enabled)
|
||||
public void SetCompilingAndRunButtonsEnabled(bool Enabled)
|
||||
{
|
||||
if (Enabled)
|
||||
{
|
||||
|
|
@ -393,7 +393,7 @@ namespace VisualPascalABC
|
|||
|
||||
public void SetDebugStopEnabled()
|
||||
{
|
||||
SetCompilingButtonsEnabled(false);
|
||||
SetCompilingAndRunButtonsEnabled(false);
|
||||
this.mDEBUGSTOPToolStripMenuItem.Enabled = true;
|
||||
this.mDEBUGENDToolStripMenuItem.Enabled = true;
|
||||
this.mSTEPToolStripMenuItem.Enabled = true;
|
||||
|
|
@ -417,7 +417,7 @@ namespace VisualPascalABC
|
|||
this.mDEBUGSTARTToolStripMenuItem.Text = Form1StringResources.Get("M_DEBUGSTART");
|
||||
}
|
||||
|
||||
public void SetStartDebugDisabled()
|
||||
public void SetStartDebugAndRunDisabled()
|
||||
{
|
||||
this.mDEBUGSTARTToolStripMenuItem.Enabled = false;
|
||||
this.StartDebugButton.Enabled = false;
|
||||
|
|
@ -434,7 +434,10 @@ namespace VisualPascalABC
|
|||
SaveDebugContext();
|
||||
}
|
||||
|
||||
public void SetStartDebugEnabled()
|
||||
/// <summary>
|
||||
/// Активирует кнопки для Debug и запуска программы
|
||||
/// </summary>
|
||||
public void SetStartDebugAndRunEnabled()
|
||||
{
|
||||
this.mDEBUGSTARTToolStripMenuItem.Enabled = true;
|
||||
this.StartDebugButton.Enabled = true;
|
||||
|
|
@ -444,6 +447,7 @@ namespace VisualPascalABC
|
|||
this.StepOverButton.Enabled = true;
|
||||
this.mRUNTOCURToolStripMenuItem.Enabled = true;
|
||||
this.mSTEPToolStripMenuItem.Enabled = true;
|
||||
|
||||
this.miRun.Enabled = true;
|
||||
this.StartButton.Enabled = true;
|
||||
ChangeDebugButtons(false);
|
||||
|
|
@ -458,7 +462,7 @@ namespace VisualPascalABC
|
|||
this.StepOutButton.Enabled = false;
|
||||
if (!(clicked_stop_debug_in_menu && WorkbenchServiceFactory.RunService.IsRun() && debuggedPage != ActiveCodeFileDocument))
|
||||
{
|
||||
SetCompilingButtonsEnabled(true);
|
||||
SetCompilingAndRunButtonsEnabled(true);
|
||||
this.stopButton.Enabled = false;
|
||||
this.miStop.Enabled = false;
|
||||
}
|
||||
|
|
@ -518,44 +522,17 @@ namespace VisualPascalABC
|
|||
}
|
||||
}
|
||||
|
||||
public void SetDebugButtonsEnabled(bool val)
|
||||
/// <summary>
|
||||
/// Активировать/Деактивировать все кнопки, относящиеся к форматированию кода
|
||||
/// </summary>
|
||||
private void SetFormatButtonsEnabled(bool enabled)
|
||||
{
|
||||
if (!DebuggerVisible)
|
||||
return;
|
||||
if (val)
|
||||
{
|
||||
this.mDEBUGSTOPToolStripMenuItem.Enabled = false;
|
||||
this.mDEBUGSTARTToolStripMenuItem.Enabled = false;
|
||||
this.StartDebugButton.Enabled = true;
|
||||
this.StopDebugButton.Enabled = true;
|
||||
this.StepOutButton.Enabled = false;
|
||||
this.StepOverButton.Enabled = true;
|
||||
this.StepIntoButton.Enabled = true;
|
||||
this.mDEBUGSTARTToolStripMenuItem.Enabled = true;
|
||||
this.mSTEPINToolStripMenuItem.Enabled = true;
|
||||
this.mSTEPOVERToolStripMenuItem.Enabled = true;
|
||||
this.mSTEPToolStripMenuItem.Enabled = false;
|
||||
this.mRUNTOCURToolStripMenuItem.Enabled = true;
|
||||
this.miRun.Enabled = true;
|
||||
this.StartButton.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.mDEBUGSTOPToolStripMenuItem.Enabled = false;
|
||||
this.mSTEPToolStripMenuItem.Enabled = false;
|
||||
this.StartDebugButton.Enabled = false;
|
||||
this.StopDebugButton.Enabled = false;
|
||||
this.StepOutButton.Enabled = false;
|
||||
this.StepOverButton.Enabled = false;
|
||||
this.StepIntoButton.Enabled = false;
|
||||
this.mDEBUGSTARTToolStripMenuItem.Enabled = false;
|
||||
this.mSTEPINToolStripMenuItem.Enabled = false;
|
||||
this.mSTEPOVERToolStripMenuItem.Enabled = false;
|
||||
this.mRUNTOCURToolStripMenuItem.Enabled = false;
|
||||
this.mSTEPToolStripMenuItem.Enabled = false;
|
||||
this.miRun.Enabled = false;
|
||||
this.StartButton.Enabled = false;
|
||||
}
|
||||
tsFormat.Enabled = mFORMATToolStripMenuItem.Enabled = cmFormat.Enabled = enabled;
|
||||
}
|
||||
|
||||
private void SetRunButtonsEnabled(bool enabled)
|
||||
{
|
||||
miRun.Enabled = StartButton.Enabled = enabled;
|
||||
}
|
||||
|
||||
bool mDEBUGSTOPToolStripMenuItem_Enabled;
|
||||
|
|
|
|||
|
|
@ -410,8 +410,19 @@ namespace VisualPascalABC
|
|||
CurrentWebBrowserControl = null;
|
||||
SetFocusToEditor();
|
||||
}
|
||||
|
||||
CodeCompletion.CodeCompletionController.SetLanguage(CurrentCodeFileDocument.FileName);
|
||||
|
||||
bool intellisenseAvailable = CodeCompletion.CodeCompletionController.IntellisenseAvailable();
|
||||
|
||||
SetFormatButtonsEnabled(intellisenseAvailable);
|
||||
|
||||
if (!intellisenseAvailable)
|
||||
SetDebugButtonsEnabled(false); // активация кнопок произойдет ниже, если возможно
|
||||
|
||||
if (BakSelectedTab == CurrentCodeFileDocument)
|
||||
return;
|
||||
|
||||
LastSelectedTab = BakSelectedTab;
|
||||
BakSelectedTab = CurrentCodeFileDocument;
|
||||
|
||||
|
|
@ -432,8 +443,6 @@ namespace VisualPascalABC
|
|||
OutputWindow.outputTextBox = OutputTextBoxs[CurrentCodeFileDocument];
|
||||
}
|
||||
|
||||
CodeCompletion.CodeCompletionController.SetLanguage(CurrentCodeFileDocument.FileName);
|
||||
|
||||
SetFocusToEditor();
|
||||
bool run = WorkbenchServiceFactory.RunService.IsRun(CurrentEXEFileName);
|
||||
WorkbenchServiceFactory.DebuggerManager.SetAsPossibleDebugPage(CurrentCodeFileDocument);
|
||||
|
|
@ -447,16 +456,16 @@ namespace VisualPascalABC
|
|||
if (VisualEnvironmentCompiler != null)
|
||||
if (!debug)
|
||||
{
|
||||
SetCompilingButtonsEnabled(!run && VisualEnvironmentCompiler.compilerLoaded);
|
||||
SetDebugButtonsEnabled(!run && VisualEnvironmentCompiler.compilerLoaded);
|
||||
SetCompilingAndRunButtonsEnabled(!run && VisualEnvironmentCompiler.compilerLoaded);
|
||||
SetDebugButtonsEnabled(intellisenseAvailable && !run && VisualEnvironmentCompiler.compilerLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCompilingButtonsEnabled(!debug);
|
||||
SetCompilingAndRunButtonsEnabled(!debug);
|
||||
SetDebugButtonsAsByDebug();
|
||||
}
|
||||
else
|
||||
SetCompilingButtonsEnabled(false);
|
||||
SetCompilingAndRunButtonsEnabled(false);
|
||||
SaveButtonsEnabled = CurrentCodeFileDocument.DocumentChanged;
|
||||
UpdateUndoRedoEnabled();
|
||||
UpdateCutCopyButtonsEnabled();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
### Шаг 1
|
||||
Необходимо создать папку, называющуюся так же, как Ваш язык в папке *AdditionalLanguages*, расположенной в корне репозитория. Далее создать в ней два обязательных проекта. Это проект парсера Вашего языка, а также проект, содержащий класс Вашего языка (унаследованный от класса `BaseLanguage`, находящегося в стандартном проекте `LanguageIntegrator`) и класс "базы данных" языка (унаследованный от класса `BaseLanguageInformation` из проекта `ParserTools`).
|
||||
Необходимо создать папку, называющуюся так же, как Ваш язык в папке *AdditionalLanguages*, расположенной в корне репозитория. Далее создать в ней два обязательных проекта. Это проект парсера Вашего языка, а также проект, содержащий класс Вашего языка (унаследованный от класса `BaseLanguage`, находящегося в стандартном проекте `LanguageIntegrator`) и класс "базы данных" языка (унаследованный от класса `DefaultLanguageInformation` или напрямую от интерфейса `ILanguageInformation` из проекта `ParserTools`).
|
||||
|
||||
Для совместимости целевой платформой Ваших проектов должна быть *.NET Framework 4.0*. В свойствах проекта и для Release, и для Debug версии должен быть выбран выходной путь `..\..\..\bin\`.
|
||||
|
||||
|
|
@ -9,30 +9,32 @@
|
|||
### Шаг 2
|
||||
В проекты Вы добавляете все необходимые для работы ссылки. Вам точно понадобятся ссылки на проекты `ParserTools`, `Errors`, `SyntaxTree` в проекте Вашего парсера и на проекты `LanguageIntegrator`, `ParserTools`, `SyntaxTree` в проекте с наследником `BaseLanguage`.
|
||||
### Шаг 3
|
||||
Вам нужно унаследовать Ваш парсер (который является оберткой над GPPG парсером) от класса `BaseParser`, либо напрямую реализовать интерфейс `IParser`, если Вы не хотите пользоваться функциональностью из `BaseParser`.
|
||||
Вам нужно унаследовать Ваш парсер (который является оберткой над GPPG парсером) от класса `BaseParser`, либо от класса `SimpleParser`, если Вы не хотите на начальном этапе реализовывать методы парсера для поддержки Intellisense.
|
||||
|
||||
Класс `BaseParser` содержит абстрактные методы, обязательные к реализации, самый главный из которых называется `BuildTreeInNormalMode`. Он отвечает за построение синтаксического дерева программы при обычном процессе компиляции. Остальные методы относятся к *Intellisense* и их реализация может быть пустой на первое время.
|
||||
Класс `BaseParser` содержит абстрактные методы, обязательные к реализации, самый главный из которых называется `BuildTreeInNormalMode`. Он отвечает за построение синтаксического дерева программы при обычном процессе компиляции. Остальные методы в основном относятся к *Intellisense*.
|
||||
|
||||
Для реализации `BuildTreeInNormalMode` Вам потребуется вызвать в этом методе сгенерированный GPPG парсер Вашего языка. Возвращаемое значение должно быть корнем полученного в результате парсинга синтаксического дерева.
|
||||
|
||||
Для реализации парсера Вы можете также использовать такие базовые абстрактные классы как `BaseKeywords` и `BaseParserTools`.
|
||||
|
||||
### Шаг 4
|
||||
Для реализации методов в наследнике `BaseLanguageInformation` на первое время можно взять методы из `PascalABCLanguageInformation`, они используются в системе *Intellisense*. Но Вам также нужно задать следующие параметры языка:
|
||||
Для реализации свойств в наследнике `DefaultLanguageInformation` Вам нужно задать следующие параметры языка:
|
||||
1) имя языка, версия языка, строка с указанием авторских прав
|
||||
2) расширения файлов Вашего языка
|
||||
3) имена стандартных модулей языка
|
||||
4) чувствительность к регистру
|
||||
и т. д.
|
||||
Обращайте внимание на документирующие комментарии к свойствам.
|
||||
|
||||
### Шаг 5
|
||||
В сделанном Вами наследнике `BaseLanguage` Вы пишете конструктор, который передает в `base()` следующие параметры:
|
||||
1) класс "базы данных" языка, хранящий информацию в основном необходимую для Intellisense (наследник `BaseLanguageInformation`).
|
||||
2) парсер Вашего языка (наследник `BaseParser`)
|
||||
3) парсер XML-комментариев (если его нет, то можно передавать `null`)
|
||||
4) список преобразователей синтаксического дерева с одним обязательным элементом (для него можно взять стандартную базовую версию под названием `DefaultSyntaxTreeConverter`)
|
||||
1) класс "базы данных" языка, хранящий информацию в основном необходимую для Intellisense (наследник `DefaultLanguageInformation`).
|
||||
2) класс с методами для поддержки Intellisense (если его нет, можно передавать `null`)
|
||||
3) парсер Вашего языка (наследник `BaseParser`)
|
||||
4) парсер XML-комментариев (если его нет, то можно передавать `null`)
|
||||
5) список преобразователей синтаксического дерева с одним обязательным элементом (для него можно взять стандартную базовую версию под названием `DefaultSyntaxTreeConverter`)
|
||||
|
||||
Также Вы реализуете метод `SetSemanticConstants`, в котором задаете необходимые параметры (значения переменных) из файла *SemanticRulesConstants.cs* (проект TreeConverter).
|
||||
При необходимости Вы можете переопределить метод `SetSemanticConstants`, в котором нужно задавать необходимые параметры (значения переменных) из файла *SemanticRulesConstants.cs* (проект TreeConverter). Для простого языка этого может не потребоваться.
|
||||
|
||||
И наконец, реализуете метод `SetSyntaxTreeToSemanticTreeConverter`, в котором создаете новый экземпляр преобразователя синтаксического дерева в семантическое (присваиваете его свойству `SyntaxTreeToSemanticTreeConverter`). Для простых языков в качестве преобразователя можно присваивать
|
||||
экземпляр класса `syntax_tree_visitor`, получив его следующим образом: `LanguageProvider.Instance.MainLanguage.SyntaxTreeToSemanticTreeConverter`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue