Поправил контекст тьюплов для автоформатирования
This commit is contained in:
parent
eb5be8e83f
commit
d933ae1f2c
|
|
@ -2,7 +2,7 @@
|
|||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: SSM
|
||||
// DateTime: 18.01.2016 8:09:32
|
||||
// DateTime: 19.01.2016 22:49:35
|
||||
// UserName: ?????????
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
|
|
|
|||
|
|
@ -301,8 +301,12 @@ uses_clause
|
|||
{
|
||||
$$ = null;
|
||||
}
|
||||
| tkUses used_units_list tkSemiColon
|
||||
| tkUses used_units_list tkSemiColon
|
||||
{
|
||||
//if ($1 == null)
|
||||
//$1 = new uses_closure($3 as uses_list,@$);
|
||||
//else ($1 as uses_closure).Add($3 as uses_list,@$);
|
||||
//$$ = $1;
|
||||
$$ = $2;
|
||||
$$.source_context = @$;
|
||||
}
|
||||
|
|
@ -3430,7 +3434,7 @@ func_decl_lambda
|
|||
parsertools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",@5);
|
||||
|
||||
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
|
||||
$$ = new method_call(new dot_node("Tuple","Create"),$4 as expression_list,@$);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// GPPG version 1.3.6
|
||||
// Machine: SSM
|
||||
// DateTime: 18.01.2016 8:09:33
|
||||
// DateTime: 19.01.2016 22:49:35
|
||||
// UserName: ?????????
|
||||
// Input file <ABCPascal.y>
|
||||
|
||||
|
|
@ -2321,6 +2321,10 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
|
|||
break;
|
||||
case 36: // uses_clause -> tkUses, used_units_list, tkSemiColon
|
||||
{
|
||||
//if ($1 == null)
|
||||
//$1 = new uses_closure($3 as uses_list,@$);
|
||||
//else ($1 as uses_closure).Add($3 as uses_list,@$);
|
||||
//$$ = $1;
|
||||
CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn;
|
||||
CurrentSemanticValue.stn.source_context = CurrentLocationSpan;
|
||||
}
|
||||
|
|
@ -5390,7 +5394,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
|
|||
parsertools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",LocationStack[LocationStack.Depth-4]);
|
||||
|
||||
if (parsertools.build_tree_for_formatter)
|
||||
CurrentSemanticValue.ex = new tuple_node_for_formatter(ValueStack[ValueStack.Depth-5].stn as expression_list);
|
||||
CurrentSemanticValue.ex = new tuple_node_for_formatter(ValueStack[ValueStack.Depth-5].stn as expression_list,CurrentLocationSpan);
|
||||
else
|
||||
CurrentSemanticValue.ex = new method_call(new dot_node("Tuple","Create"),ValueStack[ValueStack.Depth-5].stn as expression_list,CurrentLocationSpan);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ script=
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1047,6 +1047,11 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
DefaultVisit(_tuple_node_for_formatter);
|
||||
}
|
||||
|
||||
public virtual void visit(uses_closure _uses_closure)
|
||||
{
|
||||
DefaultVisit(_uses_closure);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1669,6 +1669,14 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
}
|
||||
|
||||
public virtual void pre_do_visit(uses_closure _uses_closure)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void post_do_visit(uses_closure _uses_closure)
|
||||
{
|
||||
}
|
||||
|
||||
public override void visit(syntax_tree_node _syntax_tree_node)
|
||||
{
|
||||
DefaultVisit(_syntax_tree_node);
|
||||
|
|
@ -3455,6 +3463,15 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
visit(tuple_node_for_formatter.el);
|
||||
post_do_visit(_tuple_node_for_formatter);
|
||||
}
|
||||
|
||||
public override void visit(uses_closure _uses_closure)
|
||||
{
|
||||
DefaultVisit(_uses_closure);
|
||||
pre_do_visit(_uses_closure);
|
||||
for (int i = 0; i < listunitsections.Count; i++)
|
||||
visit(uses_closure.listunitsections[i]);
|
||||
post_do_visit(_uses_closure);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -436,6 +436,8 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
return new addressed_value_list();
|
||||
case 207:
|
||||
return new tuple_node_for_formatter();
|
||||
case 208:
|
||||
return new uses_closure();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -3692,6 +3694,30 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
_tuple_node_for_formatter.el = _read_node() as expression_list;
|
||||
}
|
||||
|
||||
|
||||
public void visit(uses_closure _uses_closure)
|
||||
{
|
||||
read_uses_closure(_uses_closure);
|
||||
}
|
||||
|
||||
public void read_uses_closure(uses_closure _uses_closure)
|
||||
{
|
||||
read_syntax_tree_node(_uses_closure);
|
||||
if (br.ReadByte() == 0)
|
||||
{
|
||||
_uses_closure.listunitsections = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_uses_closure.listunitsections = new List<uses_list>();
|
||||
Int32 ssyy_count = br.ReadInt32();
|
||||
for(Int32 ssyy_i = 0; ssyy_i < ssyy_count; ssyy_i++)
|
||||
{
|
||||
_uses_closure.listunitsections.Add(_read_node() as uses_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5797,6 +5797,39 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void visit(uses_closure _uses_closure)
|
||||
{
|
||||
bw.Write((Int16)208);
|
||||
write_uses_closure(_uses_closure);
|
||||
}
|
||||
|
||||
public void write_uses_closure(uses_closure _uses_closure)
|
||||
{
|
||||
write_syntax_tree_node(_uses_closure);
|
||||
if (_uses_closure.listunitsections == null)
|
||||
{
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
bw.Write(_uses_closure.listunitsections.Count);
|
||||
for(Int32 ssyy_i = 0; ssyy_i < _uses_closure.listunitsections.Count; ssyy_i++)
|
||||
{
|
||||
if (_uses_closure.listunitsections[ssyy_i] == null)
|
||||
{
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
_uses_closure.listunitsections[ssyy_i].visit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27386,6 +27386,123 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
[Serializable]
|
||||
public partial class uses_closure : syntax_tree_node
|
||||
{
|
||||
|
||||
///<summary>
|
||||
///Конструктор без параметров.
|
||||
///</summary>
|
||||
public uses_closure()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public uses_closure(List<uses_list> _listunitsections)
|
||||
{
|
||||
this._listunitsections=_listunitsections;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public uses_closure(List<uses_list> _listunitsections,SourceContext sc)
|
||||
{
|
||||
this._listunitsections=_listunitsections;
|
||||
source_context = sc;
|
||||
}
|
||||
|
||||
protected List<uses_list> _listunitsections=new List<uses_list>();
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public List<uses_list> listunitsections
|
||||
{
|
||||
get
|
||||
{
|
||||
return _listunitsections;
|
||||
}
|
||||
set
|
||||
{
|
||||
_listunitsections=value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///<summary>
|
||||
///Свойство для получения количества всех подузлов без элементов поля типа List
|
||||
///</summary>
|
||||
public override Int32 subnodes_without_list_elements_count
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
///Свойство для получения количества всех подузлов. Подузлом также считается каждый элемент поля типа List
|
||||
///</summary>
|
||||
public override Int32 subnodes_count
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0 + (listunitsections == null ? 0 : listunitsections.Count);
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
///Индексатор для получения всех подузлов
|
||||
///</summary>
|
||||
public override syntax_tree_node this[Int32 ind]
|
||||
{
|
||||
get
|
||||
{
|
||||
if(subnodes_count == 0 || ind < 0 || ind > subnodes_count-1)
|
||||
throw new IndexOutOfRangeException();
|
||||
Int32 index_counter=ind - 0;
|
||||
if(listunitsections != null)
|
||||
{
|
||||
if(index_counter < listunitsections.Count)
|
||||
{
|
||||
return listunitsections[index_counter];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(subnodes_count == 0 || ind < 0 || ind > subnodes_count-1)
|
||||
throw new IndexOutOfRangeException();
|
||||
Int32 index_counter=ind - 0;
|
||||
if(listunitsections != null)
|
||||
{
|
||||
if(index_counter < listunitsections.Count)
|
||||
{
|
||||
listunitsections[index_counter]= (uses_list)value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
///Метод для обхода дерева посетителем
|
||||
///</summary>
|
||||
///<param name="visitor">Объект-посетитель.</param>
|
||||
///<returns>Return value is void</returns>
|
||||
public override void visit(IVisitor visitor)
|
||||
{
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1663,5 +1663,21 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
public partial class uses_closure
|
||||
{
|
||||
public uses_closure(uses_list st, SourceContext sc)
|
||||
{
|
||||
Add(st, sc);
|
||||
}
|
||||
public uses_closure Add(uses_list ul, SourceContext sc = null)
|
||||
{
|
||||
listunitsections.Add(ul);
|
||||
if (sc != null)
|
||||
source_context = sc;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1252,6 +1252,12 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
///<param name="_tuple_node_for_formatter">Node to visit</param>
|
||||
///<returns> Return value is void </returns>
|
||||
void visit(tuple_node_for_formatter _tuple_node_for_formatter);
|
||||
///<summary>
|
||||
///Method to visit uses_closure.
|
||||
///</summary>
|
||||
///<param name="_uses_closure">Node to visit</param>
|
||||
///<returns> Return value is void </returns>
|
||||
void visit(uses_closure _uses_closure);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1574,16 +1574,19 @@ function ReadSeqString(const prompt: string; n: integer): sequence of string;
|
|||
// -----------------------------------------------------
|
||||
// Tuples
|
||||
// -----------------------------------------------------
|
||||
/// Возвращает кортеж из 2 элементов
|
||||
function Rec<T1,T2>(x1: T1; x2: T2): Tuple<T1,T2>;
|
||||
/// Возвращает кортеж из 3 элементов
|
||||
function Rec<T1,T2,T3>(x1: T1; x2: T2; x3: T3): Tuple<T1,T2,T3>;
|
||||
/// Возвращает кортеж из 4 элементов
|
||||
function Rec<T1,T2,T3,T4>(x1: T1; x2: T2; x3: T3; x4: T4): Tuple<T1,T2,T3,T4>;
|
||||
/// Возвращает кортеж из 5 элементов
|
||||
function Rec<T1,T2,T3,T4,T5>(x1: T1; x2: T2; x3: T3; x4: T4; x5: T5): Tuple<T1,T2,T3,T4,T5>;
|
||||
/// Возвращает кортеж из 6 элементов
|
||||
function Rec<T1,T2,T3,T4,T5,T6>(x1: T1; x2: T2; x3: T3; x4: T4; x5: T5; x6: T6): Tuple<T1,T2,T3,T4,T5,T6>;
|
||||
///- function Rec(x1: T1, x2: T2,...): (T1,T2,...);
|
||||
/// Возвращает кортеж из элементов разных типов
|
||||
function Rec<T1,T2>(x1: T1; x2: T2): System.Tuple<T1,T2>;
|
||||
///--
|
||||
function Rec<T1,T2,T3>(x1: T1; x2: T2; x3: T3): (T1,T2,T3);
|
||||
///--
|
||||
function Rec<T1,T2,T3,T4>(x1: T1; x2: T2; x3: T3; x4: T4): (T1,T2,T3,T4);
|
||||
///--
|
||||
function Rec<T1,T2,T3,T4,T5>(x1: T1; x2: T2; x3: T3; x4: T4; x5: T5): (T1,T2,T3,T4,T5);
|
||||
///--
|
||||
function Rec<T1,T2,T3,T4,T5,T6>(x1: T1; x2: T2; x3: T3; x4: T4; x5: T5; x6: T6): (T1,T2,T3,T4,T5,T6);
|
||||
///--
|
||||
function Rec<T1,T2,T3,T4,T5,T6,T7>(x1: T1; x2: T2; x3: T3; x4: T4; x5: T5; x6: T6; x7: T7): (T1,T2,T3,T4,T5,T6,T7);
|
||||
// -----------------------------------------------------
|
||||
// Dict, SSet, HSet, Lst
|
||||
// -----------------------------------------------------
|
||||
|
|
@ -3724,31 +3727,36 @@ begin
|
|||
end;
|
||||
|
||||
|
||||
function Rec<T1,T2>(x1: T1; x2: T2): Tuple<T1,T2>;
|
||||
function Rec<T1,T2>(x1: T1; x2: T2): System.Tuple<T1,T2>;
|
||||
begin
|
||||
Result := Tuple.Create(x1,x2);
|
||||
end;
|
||||
|
||||
function Rec<T1,T2,T3>(x1: T1; x2: T2; x3: T3): Tuple<T1,T2,T3>;
|
||||
function Rec<T1,T2,T3>(x1: T1; x2: T2; x3: T3): (T1,T2,T3);
|
||||
begin
|
||||
Result := Tuple.Create(x1,x2,x3);
|
||||
end;
|
||||
|
||||
function Rec<T1,T2,T3,T4>(x1: T1; x2: T2; x3: T3; x4: T4): Tuple<T1,T2,T3,T4>;
|
||||
function Rec<T1,T2,T3,T4>(x1: T1; x2: T2; x3: T3; x4: T4): (T1,T2,T3,T4);
|
||||
begin
|
||||
Result := Tuple.Create(x1,x2,x3,x4);
|
||||
end;
|
||||
|
||||
function Rec<T1,T2,T3,T4,T5>(x1: T1; x2: T2; x3: T3; x4: T4; x5: T5): Tuple<T1,T2,T3,T4,T5>;
|
||||
function Rec<T1,T2,T3,T4,T5>(x1: T1; x2: T2; x3: T3; x4: T4; x5: T5): (T1,T2,T3,T4,T5);
|
||||
begin
|
||||
Result := Tuple.Create(x1,x2,x3,x4,x5);
|
||||
end;
|
||||
|
||||
function Rec<T1,T2,T3,T4,T5,T6>(x1: T1; x2: T2; x3: T3; x4: T4; x5: T5; x6: T6): Tuple<T1,T2,T3,T4,T5,T6>;
|
||||
function Rec<T1,T2,T3,T4,T5,T6>(x1: T1; x2: T2; x3: T3; x4: T4; x5: T5; x6: T6): (T1,T2,T3,T4,T5,T6);
|
||||
begin
|
||||
Result := Tuple.Create(x1,x2,x3,x4,x5,x6);
|
||||
end;
|
||||
|
||||
function Rec<T1,T2,T3,T4,T5,T6,T7>(x1: T1; x2: T2; x3: T3; x4: T4; x5: T5; x6: T6; x7: T7): (T1,T2,T3,T4,T5,T6,T7);
|
||||
begin
|
||||
Result := Tuple.Create(x1,x2,x3,x4,x5,x6,x7);
|
||||
end;
|
||||
|
||||
function System.Collections.Generic.IDictionary<Key,Value>.Get(K: Key): Value;
|
||||
begin
|
||||
var b := Self.TryGetValue(K,Result);
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1576,7 +1576,7 @@ function ReadSeqString(const prompt: string; n: integer): sequence of string;
|
|||
// -----------------------------------------------------
|
||||
///- function Rec(x1: T1, x2: T2,...): (T1,T2,...);
|
||||
/// Возвращает кортеж из элементов разных типов
|
||||
function Rec<T1,T2>(x1: T1; x2: T2): (T1,T2);
|
||||
function Rec<T1,T2>(x1: T1; x2: T2): System.Tuple<T1,T2>;
|
||||
///--
|
||||
function Rec<T1,T2,T3>(x1: T1; x2: T2; x3: T3): (T1,T2,T3);
|
||||
///--
|
||||
|
|
@ -3727,7 +3727,7 @@ begin
|
|||
end;
|
||||
|
||||
|
||||
function Rec<T1,T2>(x1: T1; x2: T2): (T1,T2);
|
||||
function Rec<T1,T2>(x1: T1; x2: T2): System.Tuple<T1,T2>;
|
||||
begin
|
||||
Result := Tuple.Create(x1,x2);
|
||||
end;
|
||||
|
|
|
|||
Loading…
Reference in a new issue