build_tree_for_formatter
This commit is contained in:
parent
d6f77be48a
commit
1226bee7ea
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "0";
|
||||
public const string Build = "0";
|
||||
public const string Revision = "1143";
|
||||
public const string Revision = "1145";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%COREVERSION%=0
|
||||
%REVISION%=1143
|
||||
%REVISION%=1145
|
||||
%MINOR%=0
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: SSM
|
||||
// DateTime: 15.01.2016 21:15:29
|
||||
// DateTime: 18.01.2016 8:09:32
|
||||
// UserName: ?????????
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
|
|
@ -2070,7 +2070,7 @@ yylval = new Union();
|
|||
return (int)Tokens.tkHex;
|
||||
break;
|
||||
case 48:
|
||||
if (parsertools.build_tree_for_brackets)
|
||||
if (parsertools.build_tree_for_formatter)
|
||||
break;
|
||||
|
||||
parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ ALPHABET [^ a-zA-Z_0-9\r\n\t\'$#&,:.;@\+\-\*/=<>\^()\[\]\x01]
|
|||
}
|
||||
|
||||
{DIRECTIVE} {
|
||||
if (parsertools.build_tree_for_brackets)
|
||||
if (parsertools.build_tree_for_formatter)
|
||||
break;
|
||||
|
||||
parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
%type <stn> enumeration_id expr_l1_list
|
||||
%type <stn> enumeration_id_list
|
||||
%type <ex> const_simple_expr term typed_const typed_const_or_new expr const_expr elem range_expr const_elem array_const factor relop_expr expr_l1 simple_expr range_term range_factor
|
||||
%type <ex> external_directive_ident init_const_expr case_label variable var_reference
|
||||
%type <ex> external_directive_ident init_const_expr case_label variable var_reference
|
||||
%type <ob> for_cycle_type
|
||||
%type <ex> format_expr
|
||||
%type <stn> foreach_stmt
|
||||
|
|
@ -1949,19 +1949,19 @@ inclass_proc_func_decl_noclass
|
|||
| tkFunction func_name fp_list tkColon fptype optional_method_modificators1 tkAssign relop_expr tkSemiColon
|
||||
{
|
||||
$$ = SyntaxTreeBuilder.BuildShortFuncDefinition($3 as formal_parameters, $6 as procedure_attributes_list, $2 as method_name, $5 as type_definition, $8, @1.Merge(@6));
|
||||
if (parsertools.build_tree_for_brackets)
|
||||
if (parsertools.build_tree_for_formatter)
|
||||
$$ = new short_func_definition($$ as procedure_definition);
|
||||
}
|
||||
| tkFunction func_name fp_list optional_method_modificators1 tkAssign relop_expr tkSemiColon
|
||||
{
|
||||
$$ = SyntaxTreeBuilder.BuildShortFuncDefinition($3 as formal_parameters, $4 as procedure_attributes_list, $2 as method_name, null, $6, @1.Merge(@4));
|
||||
if (parsertools.build_tree_for_brackets)
|
||||
if (parsertools.build_tree_for_formatter)
|
||||
$$ = new short_func_definition($$ as procedure_definition);
|
||||
}
|
||||
| tkProcedure proc_name fp_list optional_method_modificators1 tkAssign stmt tkSemiColon
|
||||
{
|
||||
$$ = SyntaxTreeBuilder.BuildShortProcDefinition($3 as formal_parameters, $4 as procedure_attributes_list, $2 as method_name, $6 as statement, @1.Merge(@4));
|
||||
if (parsertools.build_tree_for_brackets)
|
||||
if (parsertools.build_tree_for_formatter)
|
||||
$$ = new short_func_definition($$ as procedure_definition);
|
||||
}
|
||||
;
|
||||
|
|
@ -2616,8 +2616,6 @@ expr
|
|||
{ $$ = $1; }
|
||||
| format_expr
|
||||
{ $$ = $1; }
|
||||
| func_decl_lambda
|
||||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
expr_l1
|
||||
|
|
@ -2906,6 +2904,8 @@ factor
|
|||
}
|
||||
| var_reference
|
||||
{ $$ = $1; }
|
||||
| func_decl_lambda
|
||||
{ $$ = $1; }
|
||||
;
|
||||
|
||||
literal_or_number
|
||||
|
|
@ -2967,7 +2967,7 @@ variable
|
|||
}
|
||||
| tkRoundOpen expr tkRoundClose
|
||||
{
|
||||
if (!parsertools.build_tree_for_brackets)
|
||||
if (!parsertools.build_tree_for_formatter)
|
||||
{
|
||||
$2.source_context = @$;
|
||||
$$ = $2;
|
||||
|
|
@ -3429,9 +3429,12 @@ func_decl_lambda
|
|||
if (($4 as expression_list).expressions.Count>7)
|
||||
parsertools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",@5);
|
||||
|
||||
$$ = new method_call(new dot_node("Tuple","Create"),$4 as expression_list,@$);
|
||||
if (parsertools.build_tree_for_formatter)
|
||||
$$ = new tuple_node_for_formatter($4 as expression_list);
|
||||
else
|
||||
$$ = new method_call(new dot_node("Tuple","Create"),$4 as expression_list,@$);
|
||||
}
|
||||
else // It is a lambda-expression. Expressions must be identifiers.
|
||||
else // It is a lambda-expression. Expressions in parameters must be identifiers.
|
||||
{
|
||||
var pair = $8 as pair_type_stlist;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace PascalABCSavParser
|
|||
// SSM: Errors инициализируется в другом месте - сюда только передается!
|
||||
public List<Error> errors;
|
||||
public System.Collections.Stack NodesStack; // SSM: для каких-то вспомогательных целей в двух правилах
|
||||
public bool build_tree_for_brackets = false;
|
||||
public bool build_tree_for_formatter = false;
|
||||
|
||||
public string CurrentFileName;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -90,6 +90,13 @@ script=
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
|||
{
|
||||
private List<Errors.Error> Errs;
|
||||
private string FileName;
|
||||
public bool build_tree_for_brackets = false;
|
||||
public bool build_tree_for_formatter = false;
|
||||
|
||||
public GPPGParserHelper(List<Errors.Error> Errs, string FileName)
|
||||
{
|
||||
|
|
@ -47,7 +47,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
|||
scanner.parsertools = parsertools;// передали parsertools в объект сканера
|
||||
|
||||
GPPGParser parser = new GPPGParser(scanner);
|
||||
parsertools.build_tree_for_brackets = build_tree_for_brackets;
|
||||
parsertools.build_tree_for_formatter = build_tree_for_formatter;
|
||||
parser.parsertools = parsertools; // передали parsertools в объект парсера
|
||||
|
||||
if (!parser.Parse())
|
||||
|
|
@ -253,7 +253,7 @@ namespace PascalABCCompiler.PascalABCNewParser
|
|||
{
|
||||
Errors.Clear();
|
||||
localparserhelper = new GPPGParserHelper(Errors, FileName);
|
||||
localparserhelper.build_tree_for_brackets = true;
|
||||
localparserhelper.build_tree_for_formatter = true;
|
||||
syntax_tree_node root = localparserhelper.Parse(Text);
|
||||
return root;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.0.0.1143'
|
||||
!define VERSION '3.0.0.1145'
|
||||
|
|
|
|||
|
|
@ -1042,6 +1042,11 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
DefaultVisit(_addressed_value_list);
|
||||
}
|
||||
|
||||
public virtual void visit(tuple_node_for_formatter _tuple_node_for_formatter)
|
||||
{
|
||||
DefaultVisit(_tuple_node_for_formatter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1661,6 +1661,14 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
}
|
||||
|
||||
public virtual void pre_do_visit(tuple_node_for_formatter _tuple_node_for_formatter)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void post_do_visit(tuple_node_for_formatter _tuple_node_for_formatter)
|
||||
{
|
||||
}
|
||||
|
||||
public override void visit(syntax_tree_node _syntax_tree_node)
|
||||
{
|
||||
DefaultVisit(_syntax_tree_node);
|
||||
|
|
@ -3439,6 +3447,14 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
visit(addressed_value_list.variables[i]);
|
||||
post_do_visit(_addressed_value_list);
|
||||
}
|
||||
|
||||
public override void visit(tuple_node_for_formatter _tuple_node_for_formatter)
|
||||
{
|
||||
DefaultVisit(_tuple_node_for_formatter);
|
||||
pre_do_visit(_tuple_node_for_formatter);
|
||||
visit(tuple_node_for_formatter.el);
|
||||
post_do_visit(_tuple_node_for_formatter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -434,6 +434,8 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
return new assign_tuple();
|
||||
case 206:
|
||||
return new addressed_value_list();
|
||||
case 207:
|
||||
return new tuple_node_for_formatter();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -3678,6 +3680,18 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void visit(tuple_node_for_formatter _tuple_node_for_formatter)
|
||||
{
|
||||
read_tuple_node_for_formatter(_tuple_node_for_formatter);
|
||||
}
|
||||
|
||||
public void read_tuple_node_for_formatter(tuple_node_for_formatter _tuple_node_for_formatter)
|
||||
{
|
||||
read_expression(_tuple_node_for_formatter);
|
||||
_tuple_node_for_formatter.el = _read_node() as expression_list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5776,6 +5776,27 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void visit(tuple_node_for_formatter _tuple_node_for_formatter)
|
||||
{
|
||||
bw.Write((Int16)207);
|
||||
write_tuple_node_for_formatter(_tuple_node_for_formatter);
|
||||
}
|
||||
|
||||
public void write_tuple_node_for_formatter(tuple_node_for_formatter _tuple_node_for_formatter)
|
||||
{
|
||||
write_expression(_tuple_node_for_formatter);
|
||||
if (_tuple_node_for_formatter.el == null)
|
||||
{
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
_tuple_node_for_formatter.el.visit(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27275,6 +27275,117 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
[Serializable]
|
||||
public partial class tuple_node_for_formatter : expression
|
||||
{
|
||||
|
||||
///<summary>
|
||||
///Конструктор без параметров.
|
||||
///</summary>
|
||||
public tuple_node_for_formatter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public tuple_node_for_formatter(expression_list _el)
|
||||
{
|
||||
this._el=_el;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public tuple_node_for_formatter(expression_list _el,SourceContext sc)
|
||||
{
|
||||
this._el=_el;
|
||||
source_context = sc;
|
||||
}
|
||||
|
||||
protected expression_list _el;
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public expression_list el
|
||||
{
|
||||
get
|
||||
{
|
||||
return _el;
|
||||
}
|
||||
set
|
||||
{
|
||||
_el=value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///<summary>
|
||||
///Свойство для получения количества всех подузлов без элементов поля типа List
|
||||
///</summary>
|
||||
public override Int32 subnodes_without_list_elements_count
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
///Свойство для получения количества всех подузлов. Подузлом также считается каждый элемент поля типа List
|
||||
///</summary>
|
||||
public override Int32 subnodes_count
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
///Индексатор для получения всех подузлов
|
||||
///</summary>
|
||||
public override syntax_tree_node this[Int32 ind]
|
||||
{
|
||||
get
|
||||
{
|
||||
if(subnodes_count == 0 || ind < 0 || ind > subnodes_count-1)
|
||||
throw new IndexOutOfRangeException();
|
||||
switch(ind)
|
||||
{
|
||||
case 0:
|
||||
return el;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(subnodes_count == 0 || ind < 0 || ind > subnodes_count-1)
|
||||
throw new IndexOutOfRangeException();
|
||||
switch(ind)
|
||||
{
|
||||
case 0:
|
||||
el = (expression_list)value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
///Метод для обхода дерева посетителем
|
||||
///</summary>
|
||||
///<param name="visitor">Объект-посетитель.</param>
|
||||
///<returns>Return value is void</returns>
|
||||
public override void visit(IVisitor visitor)
|
||||
{
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1246,6 +1246,12 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
///<param name="_addressed_value_list">Node to visit</param>
|
||||
///<returns> Return value is void </returns>
|
||||
void visit(addressed_value_list _addressed_value_list);
|
||||
///<summary>
|
||||
///Method to visit tuple_node_for_formatter.
|
||||
///</summary>
|
||||
///<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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue