Intellisense |1,2,3|.

This commit is contained in:
Mikhalkovich Stanislav 2021-07-05 23:33:44 +03:00
parent 37091e3936
commit a489e63bc8
10 changed files with 105 additions and 62 deletions

View file

@ -1,6 +1,7 @@
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using PascalABCCompiler.SyntaxTree; using PascalABCCompiler.SyntaxTree;
@ -2023,7 +2024,14 @@ namespace CodeCompletion
public override void visit(array_const_new acn) public override void visit(array_const_new acn)
{ {
acn.elements.expressions[0].visit(this);
var rr = this.returned_scope;
//var nn = new new_expr((syntax_type, plist, true, new SyntaxTree.array_const(acn.elements, acn.elements.source_context), acn.source_context);
//var nn = new new_expr($2, el, true, $6 as array_const, @$);
var dn = new dot_node(new ident("PABCSystem"), new ident("Arr"), acn.source_context);
var el = new expression_list(acn.elements.expressions[0], acn.source_context);
var nn = new method_call(dn, el, acn.source_context);
visit(nn);
} }
} }
} }

View file

@ -3543,7 +3543,20 @@ namespace CodeCompletion
public override SymInfo[] GetNames(ExpressionVisitor ev, PascalABCCompiler.Parsers.KeywordKind keyword, bool called_in_base) public override SymInfo[] GetNames(ExpressionVisitor ev, PascalABCCompiler.Parsers.KeywordKind keyword, bool called_in_base)
{ {
if (is_dynamic_arr || IsMultiDynArray)
{
List<SymInfo> syms = new List<SymInfo>();
syms.AddRange(base.GetNames(ev, keyword, called_in_base));
if (!IsMultiDynArray && implemented_interfaces != null)
{
foreach (TypeScope ts in implemented_interfaces)
syms.AddRange(ts.GetNamesAsInObject(ev));
}
return syms.ToArray();
}
return new SymInfo[0]; return new SymInfo[0];
//return new SymInfo[0];
//return base.GetNames(ev, keyword, called_in_base);
} }
//u staticheskogo massiva prinimaem, chto net metodov i sv-v, u dinam. est //u staticheskogo massiva prinimaem, chto net metodov i sv-v, u dinam. est

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3"; public const string Major = "3";
public const string Minor = "8"; public const string Minor = "8";
public const string Build = "0"; public const string Build = "0";
public const string Revision = "2918"; public const string Revision = "2919";
public const string MainVersion = Major + "." + Minor; public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%COREVERSION%=0
%REVISION%=2918
%MINOR%=8 %MINOR%=8
%REVISION%=2919
%COREVERSION%=0
%MAJOR%=3 %MAJOR%=3

View file

@ -2923,57 +2923,78 @@ namespace PascalABCCompiler.Parsers
break; break;
case '[': case '[':
case '(': case '(':
if (kav.Count == 0) case '|':
if (ch == '|' && ((tokens.Count == 0) || (tokens.Peek()==']') || (tokens.Peek() == ')') || (tokens.Peek() == ',')))
// Закрывающий | - после него (tokens.Pop()) - пусто или ] ) ,
{ {
if (tokens.Count > 0) if (kav.Count == 0)
{
string tmps = sb.ToString().Trim(' ', '\r', '\t', '\n');
if (tmps.Length >= 1 && (char.IsLetter(tmps[0]) || tmps[0] == '_' || tmps[0] == '&' || tmps[0] == '?') && tokens.Count == 0)
end = true;
else
tokens.Push(ch);
}
if (!end)
{ {
tokens.Pop();
punkt_sym = true;
sb.Insert(0, ch); sb.Insert(0, ch);
if (ch == '(') punkt_sym = true;
{
int tmp = i--;
/*while (i >= 0 && (char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&'))
{
i--;
}*/
while (i >= 0 && (Text[i] == ' ' || char.IsControl(Text[i]) || Text[i] == '}'))
{
if (Text[i] != '}')
i--;
else
{
while (i >= 0 && Text[i] != '{') //propusk kommentariev
i--;
if (i >= 0)
i--;
}
}
if (i >= 0 && (char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&' || Text[i] == '?' && IsPunctuation(Text, i+1)))
{
bound = i + 1;
TestForKeyword(Text, i, ref bound, punkt_sym, out keyw);
if (keyw != KeywordKind.None && tokens.Count == 0)
{
end = true;
}
else bound = 0;
}
else if (i >= 0 && Text[i] == '\'') return "";
i = tmp;
}
} }
else
{
end = true;
if (ch == '[')
{
keyw = KeywordKind.SquareBracket;
}
}
} }
else sb.Insert(0, ch); punkt_sym = true; else
{
if (kav.Count == 0) // в т.ч. открывающий |
{
if (tokens.Count > 0)
{
tokens.Pop();
punkt_sym = true;
sb.Insert(0, ch);
if (ch == '(')
{
int tmp = i--;
/*while (i >= 0 && (char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&'))
{
i--;
}*/
while (i >= 0 && (Text[i] == ' ' || char.IsControl(Text[i]) || Text[i] == '}'))
{
if (Text[i] != '}')
i--;
else
{
while (i >= 0 && Text[i] != '{') //propusk kommentariev
i--;
if (i >= 0)
i--;
}
}
if (i >= 0 && (char.IsLetterOrDigit(Text[i]) || Text[i] == '_' || Text[i] == '&' || Text[i] == '?' && IsPunctuation(Text, i+1)))
{
bound = i + 1;
TestForKeyword(Text, i, ref bound, punkt_sym, out keyw);
if (keyw != KeywordKind.None && tokens.Count == 0)
{
end = true;
}
else bound = 0;
}
else if (i >= 0 && Text[i] == '\'') return "";
i = tmp;
}
}
else
{
end = true;
if (ch == '[')
{
keyw = KeywordKind.SquareBracket;
}
}
}
else sb.Insert(0, ch); punkt_sym = true;
}
break; break;
case '\'': case '\'':
if (kav.Count == 0) kav.Push(ch); else kav.Pop(); if (kav.Count == 0) kav.Push(ch); else kav.Pop();

View file

@ -1 +1 @@
3.8.0.2918 3.8.0.2919

View file

@ -1 +1 @@
!define VERSION '3.8.0.2918' !define VERSION '3.8.0.2919'

View file

@ -8687,16 +8687,16 @@ begin
Result := integer(a); Result := integer(a);
end; end;
function Chr(a: word): char;
begin
Result := Convert.ToChar(a);
end;
function Ord(a: char): word; function Ord(a: char): word;
begin begin
Result := word(a); Result := word(a);
end; end;
function Chr(a: word): char;
begin
Result := Convert.ToChar(a);
end;
function ChrUnicode(a: word): char; function ChrUnicode(a: word): char;
begin begin
Result := Convert.ToChar(a); Result := Convert.ToChar(a);

View file

@ -1348,6 +1348,7 @@ namespace PascalABCCompiler.TreeConverter
public enum MoreSpecific { Left, Right, None} public enum MoreSpecific { Left, Right, None}
// SSM 04/07/2021
public MoreSpecific compare_more_specific(function_node left_func, function_node right_func) public MoreSpecific compare_more_specific(function_node left_func, function_node right_func)
{ {
bool LeftIsMoreSpecific = false; bool LeftIsMoreSpecific = false;

View file

@ -8687,16 +8687,16 @@ begin
Result := integer(a); Result := integer(a);
end; end;
function Chr(a: word): char;
begin
Result := Convert.ToChar(a);
end;
function Ord(a: char): word; function Ord(a: char): word;
begin begin
Result := word(a); Result := word(a);
end; end;
function Chr(a: word): char;
begin
Result := Convert.ToChar(a);
end;
function ChrUnicode(a: word): char; function ChrUnicode(a: word): char;
begin begin
Result := Convert.ToChar(a); Result := Convert.ToChar(a);