This commit is contained in:
parent
342364fb3d
commit
7a48484a41
|
|
@ -350,6 +350,15 @@ namespace CodeCompletion
|
|||
return PascalABCCompiler.Parsers.KeywordKind.None;
|
||||
}
|
||||
|
||||
public bool IsKeyword(string name)
|
||||
{
|
||||
if (CodeCompletionController.CurrentParser != null)
|
||||
{
|
||||
return CodeCompletionController.CurrentParser.LanguageInformation.IsKeyword(name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public string[] GetKeywords()
|
||||
{
|
||||
if (CodeCompletionController.CurrentParser != null)
|
||||
|
|
|
|||
|
|
@ -137,6 +137,11 @@ namespace PascalABCCompiler.Parsers
|
|||
keywords.Values.CopyTo(keywords_array, 2);
|
||||
type_keywords_array = type_keys.ToArray();
|
||||
}
|
||||
|
||||
public bool IsKeyword(string value)
|
||||
{
|
||||
return keywords.ContainsKey(value.ToLower());
|
||||
}
|
||||
|
||||
public virtual string BodyStartBracket
|
||||
{
|
||||
|
|
@ -3691,7 +3696,7 @@ namespace PascalABCCompiler.Parsers
|
|||
i++;
|
||||
if (i < Text.Length && Text[i] != ' ' && !char.IsControl(Text[i]))
|
||||
{
|
||||
while (i < Text.Length && (Char.IsLetterOrDigit(Text[i]) || Text[i] == '_'))
|
||||
while (i < Text.Length && (Char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&'))
|
||||
{
|
||||
sb.Append(Text[i]);//.Append(Text[i]);
|
||||
i++;
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ namespace PascalABCCompiler.Parsers
|
|||
string SkipNew(int off, string Text, ref KeywordKind keyw);
|
||||
//char GetParameterDelimiter();
|
||||
string GetCompiledTypeRepresentation(Type t, System.Reflection.MemberInfo mi, ref int line, ref int col);
|
||||
bool IsKeyword(string value);
|
||||
string[] Keywords
|
||||
{
|
||||
get;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ namespace VisualPascalABC
|
|||
int addit = 0;
|
||||
PascalABCCompiler.SourceLocation tmp = new PascalABCCompiler.SourceLocation(null, 0, 0, 0, 0);
|
||||
string file_name = null;
|
||||
if (CodeCompletion.CodeCompletionNameHelper.Helper.IsKeyword(new_val))
|
||||
new_val = "&" + new_val;
|
||||
foreach (SymbolsViewerSymbol svs in refers)
|
||||
{
|
||||
if (svs.SourceLocation.BeginPosition.Line != tmp.BeginPosition.Line)
|
||||
|
|
@ -54,6 +56,7 @@ namespace VisualPascalABC
|
|||
TextLocation tl_beg = new TextLocation(svs.SourceLocation.BeginPosition.Column - 1 + addit, svs.SourceLocation.BeginPosition.Line - 1);
|
||||
//TextLocation tl_end = new TextLocation(svs.SourceLocation.EndPosition.Line,svs.SourceLocation.EndPosition.Column);
|
||||
int offset = doc.PositionToOffset(tl_beg);
|
||||
|
||||
addit += new_val.Length - name.Length;
|
||||
doc.Replace(offset, name.Length, new_val);
|
||||
doc.CommitUpdate();
|
||||
|
|
|
|||
|
|
@ -211,11 +211,12 @@ namespace VisualPascalABC
|
|||
rf = new RenameForm();
|
||||
Form1StringResources.SetTextForAllControls(rf);
|
||||
}
|
||||
rf.EditValue = name.Trim(' ');
|
||||
rf.EditValue = name.Trim(' ').Replace("&", "");
|
||||
DialogResult dr = rf.ShowDialog();
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
new_val = rf.EditValue;
|
||||
|
||||
List<SymbolsViewerSymbol> refers = FindReferences(expr, fileName, line, column, true);
|
||||
if (refers == null) return null;
|
||||
return refers;
|
||||
|
|
|
|||
Loading…
Reference in a new issue