Сделал &System для генерации синтаксических узлов на семантическом уровне чтобы пропускать поиск в модулях и искать сразу в .NET
This commit is contained in:
parent
ea42f4f907
commit
bbae062980
|
|
@ -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: SSM
|
// Machine: SSM
|
||||||
// DateTime: 20.01.2016 7:56:03
|
// DateTime: 21.01.2016 15:14:11
|
||||||
// UserName: ?????????
|
// UserName: ?????????
|
||||||
// GPLEX input file <ABCPascal.lex>
|
// GPLEX input file <ABCPascal.lex>
|
||||||
// GPLEX frame file <embedded resource>
|
// GPLEX frame file <embedded resource>
|
||||||
|
|
|
||||||
|
|
@ -3445,7 +3445,10 @@ func_decl_lambda
|
||||||
if (parsertools.build_tree_for_formatter)
|
if (parsertools.build_tree_for_formatter)
|
||||||
$$ = new tuple_node_for_formatter($4 as expression_list,@$);
|
$$ = new tuple_node_for_formatter($4 as expression_list,@$);
|
||||||
else
|
else
|
||||||
$$ = new method_call(new dot_node("Tuple","Create"),$4 as expression_list,@$);
|
{
|
||||||
|
var dn = new dot_node(new dot_node(new ident("?System"),new ident("Tuple")),new ident("Create",@$));
|
||||||
|
$$ = new method_call(dn,$4 as expression_list,@$);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // It is a lambda-expression. Expressions in parameters must be identifiers.
|
else // It is a lambda-expression. Expressions in parameters must be identifiers.
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// GPPG version 1.3.6
|
// GPPG version 1.3.6
|
||||||
// Machine: SSM
|
// Machine: SSM
|
||||||
// DateTime: 20.01.2016 7:56:03
|
// DateTime: 21.01.2016 15:14:12
|
||||||
// UserName: ?????????
|
// UserName: ?????????
|
||||||
// Input file <ABCPascal.y>
|
// Input file <ABCPascal.y>
|
||||||
|
|
||||||
|
|
@ -5405,7 +5405,10 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
|
||||||
if (parsertools.build_tree_for_formatter)
|
if (parsertools.build_tree_for_formatter)
|
||||||
CurrentSemanticValue.ex = new tuple_node_for_formatter(ValueStack[ValueStack.Depth-5].stn as expression_list,CurrentLocationSpan);
|
CurrentSemanticValue.ex = new tuple_node_for_formatter(ValueStack[ValueStack.Depth-5].stn as expression_list,CurrentLocationSpan);
|
||||||
else
|
else
|
||||||
CurrentSemanticValue.ex = new method_call(new dot_node("Tuple","Create"),ValueStack[ValueStack.Depth-5].stn as expression_list,CurrentLocationSpan);
|
{
|
||||||
|
var dn = new dot_node(new dot_node(new ident("?System"),new ident("Tuple")),new ident("Create",CurrentLocationSpan));
|
||||||
|
CurrentSemanticValue.ex = new method_call(dn,ValueStack[ValueStack.Depth-5].stn as expression_list,CurrentLocationSpan);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // It is a lambda-expression. Expressions in parameters must be identifiers.
|
else // It is a lambda-expression. Expressions in parameters must be identifiers.
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -106,5 +106,6 @@ script=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -975,11 +975,17 @@ namespace PascalABCCompiler.SyntaxTree
|
||||||
|
|
||||||
public partial class dot_node
|
public partial class dot_node
|
||||||
{
|
{
|
||||||
public dot_node (ident left, ident right)
|
public dot_node(ident left, ident right)
|
||||||
{
|
{
|
||||||
this.left = left;
|
this.left = left;
|
||||||
this.right = right;
|
this.right = right;
|
||||||
}
|
}
|
||||||
|
public dot_node(ident left, ident right, SourceContext sc)
|
||||||
|
{
|
||||||
|
this.left = left;
|
||||||
|
this.right = right;
|
||||||
|
this.source_context = sc;
|
||||||
|
}
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return left.ToString() + "." + right.ToString();
|
return left.ToString() + "." + right.ToString();
|
||||||
|
|
|
||||||
10
TestSuite/QuestionSystem.pas
Normal file
10
TestSuite/QuestionSystem.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
var System: integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
var t := (1,2,3);
|
||||||
|
Print(t);
|
||||||
|
var f: (integer,integer)->integer;
|
||||||
|
var p: integer -> ();
|
||||||
|
var t1: (integer,integer);
|
||||||
|
var s: sequence of integer;
|
||||||
|
end.
|
||||||
|
|
@ -995,7 +995,13 @@ namespace SymbolTable
|
||||||
int Area=scope.ScopeNum;
|
int Area=scope.ScopeNum;
|
||||||
Scope[] used_units=null;
|
Scope[] used_units=null;
|
||||||
int tn=HashTable.Find(Name); //найдем имя в хеше
|
int tn=HashTable.Find(Name); //найдем имя в хеше
|
||||||
if (tn<0 || scope is DotNETScope)//если нет такого ищем в областях .NET
|
|
||||||
|
// SSM 21.01.16
|
||||||
|
if (Name.StartsWith("?")) // это значит, надо искать в областях .NET
|
||||||
|
Name = Name.Substring(1); // съели ? и ищем т.к. tn<0
|
||||||
|
// end SSM
|
||||||
|
|
||||||
|
if (tn<0 || scope is DotNETScope)//если нет такого ищем в областях .NET
|
||||||
{
|
{
|
||||||
//ssyy
|
//ssyy
|
||||||
int NextUnitArea = -2;
|
int NextUnitArea = -2;
|
||||||
|
|
@ -1130,7 +1136,7 @@ namespace SymbolTable
|
||||||
//иначе ищем дальше
|
//иначе ищем дальше
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (ScopeTable[CurrentArea] is WithScope)//мы очутились в Width
|
if (ScopeTable[CurrentArea] is WithScope)//мы очутились в With
|
||||||
{
|
{
|
||||||
ai = AreaList.IndexOf(CurrentArea);
|
ai = AreaList.IndexOf(CurrentArea);
|
||||||
if (ai >= 0) //что-то нашли!
|
if (ai >= 0) //что-то нашли!
|
||||||
|
|
|
||||||
|
|
@ -3287,7 +3287,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
}
|
}
|
||||||
|
|
||||||
var l = new List<ident>();
|
var l = new List<ident>();
|
||||||
l.Add(new ident("System"));
|
l.Add(new ident("?System"));
|
||||||
l.Add(new ident("Tuple"));
|
l.Add(new ident("Tuple"));
|
||||||
|
|
||||||
var tp = new template_param_list(lt);
|
var tp = new template_param_list(lt);
|
||||||
|
|
@ -13917,30 +13917,6 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
|
|
||||||
public override void visit(SyntaxTree.indexer _indexer)
|
public override void visit(SyntaxTree.indexer _indexer)
|
||||||
{
|
{
|
||||||
// SSM 09.01.16 Tuple t[i]
|
|
||||||
/*var ee = convert_strong(_indexer.dereferencing_value); // Это не работает - конкурирует со следующими вызовами. Нельзя такое вызывать дважды. Вообще, надо сделать функцию, которая возвращает по выражению тип
|
|
||||||
|
|
||||||
var ent = ee.type as compiled_type_node;
|
|
||||||
|
|
||||||
if (ent != null)
|
|
||||||
{
|
|
||||||
var t = ent.compiled_type;
|
|
||||||
if (t.FullName.StartsWith("System.Tuple"))
|
|
||||||
{
|
|
||||||
expression eee = _indexer.indexes.expressions[0];
|
|
||||||
var cn = convert_strong_to_constant_node(eee);
|
|
||||||
var v = cn as int_const_node;
|
|
||||||
|
|
||||||
if (v != null)
|
|
||||||
{
|
|
||||||
var dn = new dot_node(_indexer.dereferencing_value, new ident("Item" + (v.constant_value + 1).ToString(), eee.source_context));
|
|
||||||
visit(dn);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
// end SSM 09.01.16 Tuple t[i]
|
|
||||||
|
|
||||||
//lroman
|
//lroman
|
||||||
if (_indexer.dereferencing_value is closure_substituting_node)
|
if (_indexer.dereferencing_value is closure_substituting_node)
|
||||||
{
|
{
|
||||||
|
|
@ -18328,7 +18304,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
{
|
{
|
||||||
// SSM 11/05/15 sugared node
|
// SSM 11/05/15 sugared node
|
||||||
var l = new List<ident>();
|
var l = new List<ident>();
|
||||||
l.Add(new ident("System"));
|
l.Add(new ident("?System"));
|
||||||
l.Add(new ident("Collections"));
|
l.Add(new ident("Collections"));
|
||||||
l.Add(new ident("Generic"));
|
l.Add(new ident("Generic"));
|
||||||
l.Add(new ident("IEnumerable"));
|
l.Add(new ident("IEnumerable"));
|
||||||
|
|
@ -18340,7 +18316,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
if (_modern_proc_type.res != null)
|
if (_modern_proc_type.res != null)
|
||||||
{
|
{
|
||||||
var l = new List<ident>();
|
var l = new List<ident>();
|
||||||
l.Add(new ident("System"));
|
l.Add(new ident("?System"));
|
||||||
l.Add(new ident("Func"));
|
l.Add(new ident("Func"));
|
||||||
var t = new template_param_list();
|
var t = new template_param_list();
|
||||||
if (_modern_proc_type.aloneparam != null)
|
if (_modern_proc_type.aloneparam != null)
|
||||||
|
|
@ -18369,7 +18345,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
else if (_modern_proc_type.aloneparam != null || _modern_proc_type.el != null)
|
else if (_modern_proc_type.aloneparam != null || _modern_proc_type.el != null)
|
||||||
{
|
{
|
||||||
var l = new List<ident>();
|
var l = new List<ident>();
|
||||||
l.Add(new ident("System"));
|
l.Add(new ident("?System"));
|
||||||
l.Add(new ident("Action"));
|
l.Add(new ident("Action"));
|
||||||
var t = new template_param_list();
|
var t = new template_param_list();
|
||||||
if (_modern_proc_type.aloneparam != null)
|
if (_modern_proc_type.aloneparam != null)
|
||||||
|
|
@ -18398,7 +18374,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var l = new List<ident>();
|
var l = new List<ident>();
|
||||||
l.Add(new ident("System"));
|
l.Add(new ident("?System"));
|
||||||
l.Add(new ident("Action"));
|
l.Add(new ident("Action"));
|
||||||
var ntr = new named_type_reference(l);
|
var ntr = new named_type_reference(l);
|
||||||
visit(ntr);
|
visit(ntr);
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in a new issue