Перенес проверку set array на уровень парсера
Немного поправил Intellisense по наведению для NewSet По точке там что то другое работает
This commit is contained in:
parent
874ddebad3
commit
8a9788e6f9
|
|
@ -1060,7 +1060,12 @@ namespace CodeCompletion
|
||||||
RestoreCurrentUsedAssemblies();
|
RestoreCurrentUsedAssemblies();
|
||||||
string description = ss.si.description;
|
string description = ss.si.description;
|
||||||
if (description != null)
|
if (description != null)
|
||||||
|
{
|
||||||
description = description.Replace("!#", "");
|
description = description.Replace("!#", "");
|
||||||
|
// Пусть здесь делаем все замены
|
||||||
|
// Для рекурсивных <<>> нужно писать собственный парсер
|
||||||
|
description = System.Text.RegularExpressions.Regex.Replace(description, @"NewSet<\s*(.*)\s*>", "set of $1");
|
||||||
|
}
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
RestoreCurrentUsedAssemblies();
|
RestoreCurrentUsedAssemblies();
|
||||||
|
|
|
||||||
|
|
@ -1264,10 +1264,18 @@ namespace CodeCompletion
|
||||||
method_call_cache[_method_call] = returned_scope;
|
method_call_cache[_method_call] = returned_scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void visit(pascal_set_constant _pascal_set_constant)
|
public override void visit(pascal_set_constant psc)
|
||||||
{
|
{
|
||||||
//throw new NotImplementedException();
|
//throw new NotImplementedException();
|
||||||
returned_scope = null;
|
// returned_scope = null;
|
||||||
|
|
||||||
|
var dn = new dot_node(new ident(StringConstants.pascalSystemUnitName), new ident("Arr"), psc.source_context);
|
||||||
|
var el = new expression_list(psc.values.expressions[0], psc.source_context);
|
||||||
|
var nn = new method_call(dn, el, psc.source_context);
|
||||||
|
var dn1 = new dot_node(new ident(StringConstants.pascalSystemUnitName), new ident("__NewSetCreatorInternal"), psc.source_context);
|
||||||
|
var el1 = new expression_list(nn, psc.source_context);
|
||||||
|
var nn1 = new method_call(dn1, el1, psc.source_context);
|
||||||
|
visit(nn1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void visit(array_const _array_const)
|
public override void visit(array_const _array_const)
|
||||||
|
|
@ -2048,7 +2056,7 @@ namespace CodeCompletion
|
||||||
public override void visit(array_const_new acn)
|
public override void visit(array_const_new acn)
|
||||||
{
|
{
|
||||||
acn.elements.expressions[0].visit(this);
|
acn.elements.expressions[0].visit(this);
|
||||||
var rr = this.returned_scope;
|
//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((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 nn = new new_expr($2, el, true, $6 as array_const, @$);
|
||||||
var dn = new dot_node(new ident(StringConstants.pascalSystemUnitName), new ident("Arr"), acn.source_context);
|
var dn = new dot_node(new ident(StringConstants.pascalSystemUnitName), new ident("Arr"), acn.source_context);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// This CSharp output file generated by Gardens Point LEX
|
// This CSharp output file generated by Gardens Point LEX
|
||||||
// Version: 1.1.3.301
|
// Version: 1.1.3.301
|
||||||
// Machine: LAPTOP-TE3HP881
|
// Machine: LAPTOP-TE3HP881
|
||||||
// DateTime: 14.12.2024 20:15:39
|
// DateTime: 15.12.2024 8:40:15
|
||||||
// UserName: miks
|
// UserName: miks
|
||||||
// GPLEX input file <ABCPascal.lex>
|
// GPLEX input file <ABCPascal.lex>
|
||||||
// GPLEX frame file <embedded resource>
|
// GPLEX frame file <embedded resource>
|
||||||
|
|
|
||||||
|
|
@ -992,15 +992,15 @@ pascal_set_const
|
||||||
: tkSquareOpen elem_list tkSquareClose
|
: tkSquareOpen elem_list tkSquareClose
|
||||||
{
|
{
|
||||||
// Если elem_list пуст или содержит диапазон, то это множество, иначе массив. С PascalABC.NET 3.10
|
// Если elem_list пуст или содержит диапазон, то это множество, иначе массив. С PascalABC.NET 3.10
|
||||||
/*var is_set = false;
|
var is_set = false;
|
||||||
var el = $2 as expression_list;
|
var el = $2 as expression_list;
|
||||||
if (el == null || el.Count == 0)
|
if (el == null || el.Count == 0)
|
||||||
is_set = true;
|
is_set = true;
|
||||||
else if (el.expressions.Count(x => x is diapason_expr_new) > 0)
|
else if (el.expressions.Count(x => x is diapason_expr_new) > 0)
|
||||||
is_set = true;
|
is_set = true;
|
||||||
if (is_set)*/
|
if (is_set)
|
||||||
$$ = new pascal_set_constant($2 as expression_list, @$);
|
$$ = new pascal_set_constant($2 as expression_list, @$);
|
||||||
//else $$ = new array_const_new($2 as expression_list, @$);
|
else $$ = new array_const_new($2 as expression_list, @$);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -2781,10 +2781,6 @@ unlabelled_stmt
|
||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
| proc_call
|
| proc_call
|
||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
/*| pascal_set_const tkPoint identifier
|
|
||||||
{
|
|
||||||
$$ = new dot_node($1 as addressed_value, $3 as addressed_value, @$);
|
|
||||||
}*/
|
|
||||||
| goto_stmt
|
| goto_stmt
|
||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
| compound_stmt
|
| compound_stmt
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// GPPG version 1.3.6
|
// GPPG version 1.3.6
|
||||||
// Machine: LAPTOP-TE3HP881
|
// Machine: LAPTOP-TE3HP881
|
||||||
// DateTime: 14.12.2024 20:15:40
|
// DateTime: 15.12.2024 8:40:16
|
||||||
// UserName: miks
|
// UserName: miks
|
||||||
// Input file <ABCPascal.y>
|
// Input file <ABCPascal.y>
|
||||||
|
|
||||||
|
|
@ -3670,15 +3670,15 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCCompiler.ParserTools
|
||||||
case 164: // pascal_set_const -> tkSquareOpen, elem_list, tkSquareClose
|
case 164: // pascal_set_const -> tkSquareOpen, elem_list, tkSquareClose
|
||||||
{
|
{
|
||||||
// <20>?сли elem_list п<>?с<>? или соде<D0B4>?жи<D0B6>? диапазон, <20>?о э<>?о множес<D0B5>?во, ина<D0BD>?е массив. С PascalABC.NET 3.10
|
// <20>?сли elem_list п<>?с<>? или соде<D0B4>?жи<D0B6>? диапазон, <20>?о э<>?о множес<D0B5>?во, ина<D0BD>?е массив. С PascalABC.NET 3.10
|
||||||
/*var is_set = false;
|
var is_set = false;
|
||||||
var el = $2 as expression_list;
|
var el = ValueStack[ValueStack.Depth-2].stn as expression_list;
|
||||||
if (el == null || el.Count == 0)
|
if (el == null || el.Count == 0)
|
||||||
is_set = true;
|
is_set = true;
|
||||||
else if (el.expressions.Count(x => x is diapason_expr_new) > 0)
|
else if (el.expressions.Count(x => x is diapason_expr_new) > 0)
|
||||||
is_set = true;
|
is_set = true;
|
||||||
if (is_set)*/
|
if (is_set)
|
||||||
CurrentSemanticValue.ex = new pascal_set_constant(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan);
|
CurrentSemanticValue.ex = new pascal_set_constant(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan);
|
||||||
//else $$ = new array_const_new($2 as expression_list, @$);
|
else CurrentSemanticValue.ex = new array_const_new(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 165: // const_set -> pascal_set_const
|
case 165: // const_set -> pascal_set_const
|
||||||
|
|
|
||||||
|
|
@ -389,5 +389,6 @@ script=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5233,7 +5233,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
public override void visit(SyntaxTree.pascal_set_constant _pascal_set_constant)
|
public override void visit(SyntaxTree.pascal_set_constant _pascal_set_constant)
|
||||||
{
|
{
|
||||||
// Если хоть одно - diapason_expr, то это множество иначе литеральный массив
|
// Если хоть одно - diapason_expr, то это множество иначе литеральный массив
|
||||||
if (_pascal_set_constant.values == null ||
|
/*if (_pascal_set_constant.values == null ||
|
||||||
_pascal_set_constant.values.expressions.Any(ex => ex is SyntaxTree.diapason_expr)
|
_pascal_set_constant.values.expressions.Any(ex => ex is SyntaxTree.diapason_expr)
|
||||||
)
|
)
|
||||||
{ // это множество
|
{ // это множество
|
||||||
|
|
@ -5244,7 +5244,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
array_const_new ac = new array_const_new(exl,exl.source_context);
|
array_const_new ac = new array_const_new(exl,exl.source_context);
|
||||||
visit(ac);
|
visit(ac);
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
// надо разбить на 2 списка констант
|
// надо разбить на 2 списка констант
|
||||||
expressions_list consts = new expressions_list();
|
expressions_list consts = new expressions_list();
|
||||||
expressions_list consts_diap = new expressions_list();
|
expressions_list consts_diap = new expressions_list();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue