public override void visit(for_node fn) { ProcessNode(fn.statements); var b = HasStatementVisitor<yield_node>.Has(fn); if (!b) return; var gt1 = goto_statement.New; var gt2 = goto_statement.New; var endtemp = new ident(newVarName()); var ass1 = new var_statement(fn.loop_variable, fn.type_name, fn.initial_value); var ass2 = new var_statement(endtemp, fn.type_name, fn.finish_value); var if0 = new if_node(bin_expr.Greater(fn.loop_variable, fn.finish_value), gt1); var lb2 = new labeled_statement(gt2.label, if0); var lb1 = new labeled_statement(gt1.label); var Inc = new procedure_call(new method_call(new ident("Inc"),new expression_list(fn.loop_variable))); ReplaceStatement(fn, SeqStatements(ass1,ass2,lb2, fn.statements, Inc, gt2, lb1)); // в declarations ближайшего блока добавить описание labels block bl = listNodes.FindLast(x => x is block) as block; bl.defs.Add(new label_definitions(gt1.label, gt2.label)); }
public override void visit(procedure_call pc) { var pcIdent = pc.func_name as ident; if (pcIdent != null) { var pcName = pcIdent.name.ToLower(); if (pcName == "break") { Replace(pc, this.GotoBreak); } else if (pcName == "continue") { Replace(pc, this.GotoContinue); } } }
public override void visit(procedure_call _procedure_call) { throw new NotImplementedException(); }
public void read_procedure_call(procedure_call _procedure_call) { read_statement(_procedure_call); _procedure_call.func_name = _read_node() as addressed_value; }
public void visit(procedure_call _procedure_call) { read_procedure_call(_procedure_call); }
/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //CreateNonTerminalObject /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// public Object CreateNonTerminalObject(int ReductionRuleIndex) { switch (ReductionRuleIndex) { case (int)RuleConstants.RULE_PROGRAM_TKDOT : //<program> ::= <block> 'tkDot' { program_module _program_module=new program_module(null,null,(block)LRParser.GetReductionSyntaxNode(0),null); _program_module.Language = LanguageId.PascalABCNET; parsertools.create_source_context(_program_module,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)),LRParser.GetReductionSyntaxNode(1)); return _program_module; } case (int)RuleConstants.RULE_BLOCK : //<block> ::= <opt_declarations> <statement> { block _block=new block((declarations)LRParser.GetReductionSyntaxNode(0),null); statement_list sl=null; if(LRParser.GetReductionSyntaxNode(1) is statement_list) sl = LRParser.GetReductionSyntaxNode(1) as statement_list; else { sl = new statement_list(); sl.subnodes.Add(LRParser.GetReductionSyntaxNode(1) as statement); if(!(LRParser.GetReductionSyntaxNode(1) is empty_statement)) parsertools.assign_source_context(sl,LRParser.GetReductionSyntaxNode(1)); } _block.program_code=sl; if(!(LRParser.GetReductionSyntaxNode(1) is empty_statement)) parsertools.create_source_context(_block,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _block; } case (int)RuleConstants.RULE_OPT_DECLARATIONS : //<opt_declarations> ::= <declarations> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_DECLARATIONS2 : //<opt_declarations> ::= //NONTERMINAL:<opt_declarations> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_DECLARATIONS : //<declarations> ::= <declaration> <empty> //TemplateList for declarations (create) { declarations _declarations=new declarations(); _declarations.source_context=((declaration)LRParser.GetReductionSyntaxNode(0)).source_context; _declarations.defs.Add((declaration)LRParser.GetReductionSyntaxNode(0)); return _declarations; } case (int)RuleConstants.RULE_DECLARATIONS2 : //<declarations> ::= <declarations> <empty> <declaration> //TemplateList for declarations (add) { declarations _declarations=(declarations)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_declarations,_declarations,LRParser.GetReductionSyntaxNode(2)); _declarations.defs.Add(LRParser.GetReductionSyntaxNode(2) as declaration); return _declarations; } case (int)RuleConstants.RULE_DECLARATION : //<declaration> ::= <constants> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_DECLARATION2 : //<declaration> ::= <variables> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_DECLARATION3 : //<declaration> ::= <proc_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONSTANTS_TKCONST_TKSEMICOLON : //<constants> ::= 'tkConst' <constdecl> 'tkSemiColon' parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_CONSTDECL : //<constdecl> ::= <constdef> <empty> //TemplateList for consts_definitions_list (create) { consts_definitions_list _consts_definitions_list=new consts_definitions_list(); _consts_definitions_list.source_context=((const_definition)LRParser.GetReductionSyntaxNode(0)).source_context; _consts_definitions_list.const_defs.Add((const_definition)LRParser.GetReductionSyntaxNode(0)); return _consts_definitions_list; } case (int)RuleConstants.RULE_CONSTDECL_TKCOMMA : //<constdecl> ::= <constdecl> 'tkComma' <constdef> //TemplateList for consts_definitions_list (add) { consts_definitions_list _consts_definitions_list=(consts_definitions_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_consts_definitions_list,_consts_definitions_list,LRParser.GetReductionSyntaxNode(2)); _consts_definitions_list.const_defs.Add(LRParser.GetReductionSyntaxNode(2) as const_definition); return _consts_definitions_list; } case (int)RuleConstants.RULE_CONSTDEF_TKIDENT_TKEQUAL_TKNUMBER : //<constdef> ::= 'tkIdent' 'tkEqual' 'tkNumber' { simple_const_definition _simple_const_definition=new simple_const_definition(); _simple_const_definition.const_name=(ident)LRParser.GetReductionSyntaxNode(0); _simple_const_definition.const_value=(expression)LRParser.GetReductionSyntaxNode(2); parsertools.create_source_context(_simple_const_definition,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _simple_const_definition; } case (int)RuleConstants.RULE_VARIABLES_TKVAR_TKSEMICOLON : //<variables> ::= 'tkVar' <vardecls> 'tkSemiColon' { variable_definitions _variable_definitions=new variable_definitions(); //var_def_statement vdf = new var_def_statement((ident_list)LRParser.GetReductionSyntaxNode(1),null,new int32_const(0),definition_attribute.None,false); foreach (ident id in ((ident_list)LRParser.GetReductionSyntaxNode(1)).idents) { ident_list idl=new ident_list(); idl.idents.Add(id); parsertools.create_source_context(idl,id,id); var_def_statement vdf = new var_def_statement(idl,null,new int32_const(0),definition_attribute.None,false); parsertools.create_source_context(vdf,id,id); _variable_definitions.var_definitions.Add(vdf); } parsertools.create_source_context(_variable_definitions,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _variable_definitions; } case (int)RuleConstants.RULE_VARDECLS_TKIDENT : //<vardecls> ::= 'tkIdent' <empty> //TemplateList for ident_list (create) { ident_list _ident_list=new ident_list(); _ident_list.source_context=((ident)LRParser.GetReductionSyntaxNode(0)).source_context; _ident_list.idents.Add((ident)LRParser.GetReductionSyntaxNode(0)); return _ident_list; } case (int)RuleConstants.RULE_VARDECLS_TKCOMMA_TKIDENT : //<vardecls> ::= <vardecls> 'tkComma' 'tkIdent' //TemplateList for ident_list (add) { ident_list _ident_list=(ident_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_ident_list,_ident_list,LRParser.GetReductionSyntaxNode(2)); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(2) as ident); return _ident_list; } case (int)RuleConstants.RULE_PROC_DECL_TKPROCEDURE_TKIDENT_TKSEMICOLON_TKSEMICOLON : //<proc_decl> ::= 'tkProcedure' 'tkIdent' 'tkSemiColon' <block> 'tkSemiColon' method_name mn = new method_name(null,(ident)LRParser.GetReductionSyntaxNode(1),null); procedure_header ph = new procedure_header(null,null,mn,false,false,null,null); procedure_definition pd = new procedure_definition(ph,(block)LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(mn,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(ph,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(pd,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return pd; case (int)RuleConstants.RULE_STATEMENT_TKIDENT_TKASSIGN : //<statement> ::= 'tkIdent' 'tkAssign' <simple_expr> { assign _assign=new assign(LRParser.GetReductionSyntaxNode(0) as addressed_value,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_assign,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _assign; } case (int)RuleConstants.RULE_STATEMENT_TKCALL_TKIDENT : //<statement> ::= 'tkCall' 'tkIdent' <opt_params_list> { procedure_call _procedure_call=new procedure_call(); method_call mc = new method_call(LRParser.GetReductionSyntaxNode(2) as expression_list); mc.dereferencing_value=(addressed_value)LRParser.GetReductionSyntaxNode(1); parsertools.create_source_context(mc,LRParser.GetReductionSyntaxNode(1),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1))); _procedure_call.func_name = mc; parsertools.create_source_context(_procedure_call,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1))); return _procedure_call; } case (int)RuleConstants.RULE_STATEMENT_TKWRITELN : //<statement> ::= 'tkWriteln' <simple_expr> { procedure_call pc = new procedure_call(); expression_list expr = new expression_list(); expr.expressions.Add((expression)LRParser.GetReductionSyntaxNode(1)); method_call mc = new method_call(expr); mc.dereferencing_value = new ident("writeln"); pc.func_name = mc; parsertools.create_source_context(mc.dereferencing_value,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(expr,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(mc,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(pc,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return pc; } case (int)RuleConstants.RULE_STATEMENT_TKREADLN_TKIDENT : //<statement> ::= 'tkReadln' 'tkIdent' { procedure_call pc = new procedure_call(); expression_list expr = new expression_list(); expr.expressions.Add((expression)LRParser.GetReductionSyntaxNode(1)); method_call mc = new method_call(expr); mc.dereferencing_value = new ident("readln"); pc.func_name = mc; parsertools.create_source_context(mc.dereferencing_value,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(expr,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(mc,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(pc,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return pc; } case (int)RuleConstants.RULE_STATEMENT_TKBEGIN_TKEND : //<statement> ::= 'tkBegin' <compound_statement> 'tkEnd' parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); ((statement_list)LRParser.GetReductionSyntaxNode(1)).left_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(0); ((statement_list)LRParser.GetReductionSyntaxNode(1)).right_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(2); return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_STATEMENT_TKIF_TKTHEN : //<statement> ::= 'tkIf' <expression> 'tkThen' <statement> { if_node _if_node=new if_node((expression)LRParser.GetReductionSyntaxNode(1),(statement)LRParser.GetReductionSyntaxNode(3),null); parsertools.create_source_context(_if_node,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2))); return _if_node; } case (int)RuleConstants.RULE_STATEMENT_TKWHILE_TKDO : //<statement> ::= 'tkWhile' <expression> 'tkDo' <statement> { while_node _while_node=new while_node((expression)LRParser.GetReductionSyntaxNode(1),(statement)LRParser.GetReductionSyntaxNode(3),WhileCycleType.While); parsertools.create_source_context(_while_node,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2))); return _while_node; } case (int)RuleConstants.RULE_STATEMENT : //<statement> ::= <empty> <empty> { empty_statement _empty_statement=new empty_statement(); return _empty_statement; } case (int)RuleConstants.RULE_OPT_PARAMS_LIST_TKROUNDOPEN_TKROUNDCLOSE : //<opt_params_list> ::= 'tkRoundOpen' <expr_list> 'tkRoundClose' return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_OPT_PARAMS_LIST : //<opt_params_list> ::= //NONTERMINAL:<opt_params_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_EXPR_LIST : //<expr_list> ::= <simple_expr> <empty> //TemplateList for expression_list (create) { expression_list _expression_list=new expression_list(); _expression_list.source_context=((expression)LRParser.GetReductionSyntaxNode(0)).source_context; _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); return _expression_list; } case (int)RuleConstants.RULE_EXPR_LIST_TKCOMMA : //<expr_list> ::= <expr_list> 'tkComma' <simple_expr> //TemplateList for expression_list (add) { expression_list _expression_list=(expression_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_expression_list,_expression_list,LRParser.GetReductionSyntaxNode(2)); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(2) as expression); return _expression_list; } case (int)RuleConstants.RULE_COMPOUND_STATEMENT : //<compound_statement> ::= <statement> <empty> { statement_list _statement_list=new statement_list(); _statement_list.subnodes.Add((statement)LRParser.GetReductionSyntaxNode(0)); parsertools.assign_source_context(_statement_list,LRParser.GetReductionSyntaxNode(0)); return _statement_list; } case (int)RuleConstants.RULE_COMPOUND_STATEMENT_TKSEMICOLON : //<compound_statement> ::= <compound_statement> 'tkSemiColon' <statement> { statement_list _statement_list; _statement_list=(statement_list)LRParser.GetReductionSyntaxNode(0); _statement_list.subnodes.Add((statement)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_statement_list,_statement_list,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1))); return _statement_list; } case (int)RuleConstants.RULE_EXPRESSION_TKODD : //<expression> ::= 'tkOdd' <simple_expr> { bin_expr _bin_expr=new bin_expr(new bin_expr((expression)LRParser.GetReductionSyntaxNode(1), new int32_const(2), Operators.ModulusRemainder),new int32_const(0),Operators.Equal); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _bin_expr; } case (int)RuleConstants.RULE_EXPRESSION : //<expression> ::= <simple_expr> <relop> <simple_expr> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_SIMPLE_EXPR : //<simple_expr> ::= <term> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_EXPR2 : //<simple_expr> ::= <simple_expr> <addop> <term> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_TERM : //<term> ::= <factor> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TERM2 : //<term> ::= <term> <mulop> <factor> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_FACTOR_TKIDENT : //<factor> ::= 'tkIdent' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FACTOR_TKNUMBER : //<factor> ::= 'tkNumber' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FACTOR_TKROUNDOPEN_TKROUNDCLOSE : //<factor> ::= 'tkRoundOpen' <expression> 'tkRoundClose' return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_RELOP_TKEQUAL : //<relop> ::= 'tkEqual' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_TKNOTEQUAL : //<relop> ::= 'tkNotEqual' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_TKLOWER : //<relop> ::= 'tkLower' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_TKLOWEREQUAL : //<relop> ::= 'tkLowerEqual' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_TKGREATER : //<relop> ::= 'tkGreater' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_TKGREATEREQUAL : //<relop> ::= 'tkGreaterEqual' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ADDOP_TKPLUS : //<addop> ::= 'tkPlus' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ADDOP_TKMINUS : //<addop> ::= 'tkMinus' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULOP_TKSTAR : //<mulop> ::= 'tkStar' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULOP_TKSLASH : //<mulop> ::= 'tkSlash' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EMPTY : //<empty> ::= //NONTERMINAL:<empty> ::= return null; //ENDNONTERMINAL } throw new RuleException("Unknown rule"); }
public void visit(procedure_call _procedure_call) { bw.Write((Int16)97); write_procedure_call(_procedure_call); }
public override void visit(procedure_call _procedure_call) { if (_procedure_call.func_name != null) _procedure_call.func_name.visit(this); }
public Object CreateNonTerminalObject(int ReductionRuleIndex) { switch (ReductionRuleIndex) { case (int)RuleConstants.RULE_MODULE_TKMODULE_TKMAINIDENT_TKWHERE : //<module> ::= 'tkModule' 'tkMainIdent' 'tkWhere' <reference> <imports> <body> <empty> { ident_list _ident_list = new ident_list(); _ident_list.idents.Add(new ident("LibForHaskell")); unit_or_namespace _unit_or_namespace = new unit_or_namespace(_ident_list); uses_list ul = (uses_list)LRParser.GetReductionSyntaxNode(4); if (ul == null) ul = new uses_list(); ul.units.Insert(0, _unit_or_namespace); //////////////// declarations _defs = new declarations(); for (int i = 0; i < _function_lambda_definitions.Count; i++) _defs.defs.Add((declaration)lambda((function_lambda_definition)_function_lambda_definitions[i])); for (int i = 0; i < _functions.Count; i++) { _defs.defs.Add((declaration)_functions[i]); int k = 1; while (k < _function_lambda_definitions_after.Count) { int j = k; while (j < _function_lambda_definitions_after.Count && ((procedure_definition)_functions[i]).proc_header.name.meth_name.name != (string)_function_lambda_definitions_after[j]) j += 2; if (j < _function_lambda_definitions_after.Count) { _defs.defs.Add((declaration)lambda((function_lambda_definition)_function_lambda_definitions_after[j - 1])); _function_lambda_definitions_after.RemoveAt(j); _function_lambda_definitions_after.RemoveAt(j - 1); } k = j; } } int kk = 1; while (kk < _function_lambda_definitions_after.Count) { int j = 0; while (j < _defs.defs.Count && ((procedure_definition)_defs.defs[j]).proc_header.name.meth_name.name != (string)_function_lambda_definitions_after[kk]) j++; if (j < _defs.defs.Count) { _defs.defs.Insert(j+1, (declaration)lambda((function_lambda_definition)_function_lambda_definitions_after[kk - 1])); _function_lambda_definitions_after.RemoveAt(kk); _function_lambda_definitions_after.RemoveAt(kk - 1); } else kk += 2; } //for (int i = 0; i < _function_lambda_definitions.Count; i++) //_defs.defs.Add(lambda((function_lambda_definition)_function_lambda_definitions[i])); for (int i = 0; i < let_where_funcs.Count; i++) _defs.defs.Add((procedure_definition)let_where_funcs[i]); block _block = new block(_defs, ((block)LRParser.GetReductionSyntaxNode(5)).program_code); /////////////////////////////////////// program_module _program_module = new program_module(null, ul, _block, null); _program_module.Language = LanguageId.PascalABCNET; parsertools.create_source_context(_program_module, parsertools.sc_not_null(null, ul, null, LRParser.GetReductionSyntaxNode(5)), LRParser.GetReductionSyntaxNode(5)); _functions.Clear(); _function_lambda_definitions.Clear(); func_name.Clear(); lambda_num = 0; list_method_calls.Clear(); list_method_calls_main.Clear(); list_return_funcs.Clear(); list_return_funcs_main.Clear(); list_params1.Clear(); list_method_calls_lambda.Clear(); last_list_method_calls.Clear(); last_list_method_calls_lambda.Clear(); last_function_lambda_definitions.Clear(); let_funcs1.Clear(); let_funcs_funcs.Clear(); let_func_last.Clear(); let_flag.Clear(); token_where_count = 0; let_where_funcs_main.Clear(); let_where_funcs.Clear(); token_where = 0; last_where_funcs.Clear(); let_where_list_params.Clear(); _function_lambda_definitions_main.Clear(); let_stack.Clear(); token_let = 0; lambda_stack.Clear(); return _program_module; } case (int)RuleConstants.RULE_MODULE : //<module> ::= <reference> <imports> <body> <empty> { ident_list _ident_list = new ident_list(); _ident_list.idents.Add(new ident("LibForHaskell")); unit_or_namespace _unit_or_namespace = new unit_or_namespace(_ident_list); uses_list ul = (uses_list)LRParser.GetReductionSyntaxNode(1); if (ul == null) ul = new uses_list(); ul.units.Insert(0, _unit_or_namespace); //////////////// declarations _defs = new declarations(); for (int i = 0; i < _function_lambda_definitions.Count; i++) _defs.defs.Add((declaration)lambda((function_lambda_definition)_function_lambda_definitions[i])); for (int i = 0; i < _functions.Count; i++) { _defs.defs.Add((declaration)_functions[i]); int k = 1; while (k < _function_lambda_definitions_after.Count) { int j = k; while (j < _function_lambda_definitions_after.Count && ((procedure_definition)_functions[i]).proc_header.name.meth_name.name != (string)_function_lambda_definitions_after[j]) j += 2; if (j < _function_lambda_definitions_after.Count) { _defs.defs.Add((declaration)lambda((function_lambda_definition)_function_lambda_definitions_after[j - 1])); _function_lambda_definitions_after.RemoveAt(j); _function_lambda_definitions_after.RemoveAt(j - 1); } k = j - 1; } } int kk = 1; while (kk < _function_lambda_definitions_after.Count) { int j = 0; while (j < _defs.defs.Count && ((procedure_definition)_defs.defs[j]).proc_header.name.meth_name.name != (string)_function_lambda_definitions_after[kk]) j++; if (j < _defs.defs.Count) { _defs.defs.Insert(j + 1, (declaration)lambda((function_lambda_definition)_function_lambda_definitions_after[kk - 1])); _function_lambda_definitions_after.RemoveAt(kk); _function_lambda_definitions_after.RemoveAt(kk - 1); } else kk += 2; } block _block = new block(_defs, ((block)LRParser.GetReductionSyntaxNode(2)).program_code); /////////////////////////////// program_module _program_module = new program_module(null, ul, (block)LRParser.GetReductionSyntaxNode(2), null); _program_module.Language = LanguageId.PascalABCNET; parsertools.create_source_context(_program_module, parsertools.sc_not_null(null, ul, null, LRParser.GetReductionSyntaxNode(2)), LRParser.GetReductionSyntaxNode(2)); _functions.Clear(); _function_lambda_definitions.Clear(); func_name.Clear(); lambda_num = 0; list_method_calls.Clear(); list_method_calls_main.Clear(); list_return_funcs.Clear(); list_return_funcs_main.Clear(); list_params1.Clear(); list_method_calls_lambda.Clear(); last_list_method_calls.Clear(); last_list_method_calls_lambda.Clear(); last_function_lambda_definitions.Clear(); let_funcs1.Clear(); let_funcs_funcs.Clear(); let_func_last.Clear(); let_flag.Clear(); let_where_funcs.Clear(); token_where_count = 0; let_where_funcs_main.Clear(); let_where_funcs.Clear(); token_where = 0; last_where_funcs.Clear(); let_where_list_params.Clear(); _function_lambda_definitions_main.Clear(); let_stack.Clear(); lambda_stack.Clear(); token_let = 0; return _program_module; } case (int)RuleConstants.RULE_MODULE_TKMODULE_TKIDENT_TKWHERE: //<module> ::= 'tkModule' 'tkIdent' 'tkWhere' <reference> <imports> <funcs> <empty> { ident_list _ident_list = new ident_list(); _ident_list.idents.Add(new ident("LibForHaskell")); unit_or_namespace _unit_or_namespace = new unit_or_namespace(_ident_list); uses_list ul = (uses_list)LRParser.GetReductionSyntaxNode(4); if (ul == null) ul = new uses_list(); ul.units.Insert(0, _unit_or_namespace); //////////////// declarations _defs = new declarations(); for (int i = 0; i < _function_lambda_definitions.Count; i++) _defs.defs.Add((declaration)lambda((function_lambda_definition)_function_lambda_definitions[i])); for (int i = 0; i < _functions.Count; i++) { _defs.defs.Add((declaration)_functions[i]); int k = 1; while (k < _function_lambda_definitions_after.Count) { int j = k; while (j < _function_lambda_definitions_after.Count && ((procedure_definition)_functions[i]).proc_header.name.meth_name.name != (string)_function_lambda_definitions_after[j]) j += 2; if (j < _function_lambda_definitions_after.Count) { _defs.defs.Add((declaration)lambda((function_lambda_definition)_function_lambda_definitions_after[j - 1])); _function_lambda_definitions_after.RemoveAt(j); _function_lambda_definitions_after.RemoveAt(j - 1); } k = j; } } int kk = 1; while (kk < _function_lambda_definitions_after.Count) { int j = 0; while (j < _defs.defs.Count && ((procedure_definition)_defs.defs[j]).proc_header.name.meth_name.name != (string)_function_lambda_definitions_after[kk]) j++; if (j < _defs.defs.Count) { _defs.defs.Insert(j + 1, (declaration)lambda((function_lambda_definition)_function_lambda_definitions_after[kk - 1])); _function_lambda_definitions_after.RemoveAt(kk); _function_lambda_definitions_after.RemoveAt(kk - 1); } else kk += 2; } //for (int i = 0; i < _function_lambda_definitions.Count; i++) //_defs.defs.Add(lambda((function_lambda_definition)_function_lambda_definitions[i])); for (int i = 0; i < let_where_funcs.Count; i++) _defs.defs.Add((procedure_definition)let_where_funcs[i]); //////////////////////////interface interface_node _interface_node = new interface_node(); _interface_node.uses_modules = ul; _interface_node.using_namespaces = null; _interface_node.interface_definitions = LRParser.GetReductionSyntaxNode(5) as declarations; ///////////////////////////unit_heading unit_name _unit_name = new unit_name((ident)LRParser.GetReductionSyntaxNode(1), UnitHeaderKeyword.Unit); initfinal_part _initfinal_part=new initfinal_part(); unit_module _unit_module = new unit_module(_unit_name, _interface_node, null, _initfinal_part.initialization_sect, _initfinal_part.finalization_sect); _unit_module.Language = LanguageId.PascalABCNET; _functions.Clear(); _function_lambda_definitions.Clear(); func_name.Clear(); lambda_num = 0; list_method_calls.Clear(); list_method_calls_main.Clear(); list_return_funcs.Clear(); list_return_funcs_main.Clear(); list_params1.Clear(); list_method_calls_lambda.Clear(); last_list_method_calls.Clear(); last_list_method_calls_lambda.Clear(); last_function_lambda_definitions.Clear(); let_funcs1.Clear(); let_funcs_funcs.Clear(); let_func_last.Clear(); let_flag.Clear(); token_where_count = 0; let_where_funcs_main.Clear(); let_where_funcs.Clear(); token_where = 0; last_where_funcs.Clear(); let_where_list_params.Clear(); _function_lambda_definitions_main.Clear(); let_stack.Clear(); token_let = 0; lambda_stack.Clear(); return _unit_module; } case (int)RuleConstants.RULE_REFERENCE : //<reference> ::= //NONTERMINAL:<reference> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_REFERENCE_TKREF_TKSTRING : //<reference> ::= 'tkRef' 'tkString' { token_info t1 = new token_info(); t1.text = ((ident)LRParser.GetReductionSyntaxNode(0)).name; t1.source_context = ((ident)LRParser.GetReductionSyntaxNode(0)).source_context; token_info t2 = new token_info(); t2.text = ((string_const)LRParser.GetReductionSyntaxNode(1)).Value; t2.source_context = ((string_const)LRParser.GetReductionSyntaxNode(1)).source_context; compiler_directive cd = new compiler_directive(t1, t2); parsertools.create_source_context(cd, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); CompilerDirectives.Add(cd); return null; } case (int)RuleConstants.RULE_IMPORTS : //<imports> ::= //NONTERMINAL:<imports> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_IMPORTS2 : //<imports> ::= <import> <empty> { uses_list _uses_list = new uses_list(); _uses_list.units.Add((unit_or_namespace)LRParser.GetReductionSyntaxNode(0)); return _uses_list; } case (int)RuleConstants.RULE_IMPORTS3: //<imports> ::= <imports> <empty> <import> { uses_list _uses_list = (uses_list)LRParser.GetReductionSyntaxNode(0); _uses_list.units.Add((unit_or_namespace)LRParser.GetReductionSyntaxNode(2)); return _uses_list; } case (int)RuleConstants.RULE_IMPORT_TKIMPORT_TKIDENT : //<import> ::= 'tkImport' 'tkIdent' { ident_list _ident_list = new ident_list(); _ident_list.source_context = ((ident)LRParser.GetReductionSyntaxNode(1)).source_context; _ident_list.idents.Add((ident)LRParser.GetReductionSyntaxNode(1)); unit_or_namespace _unit_or_namespace = new unit_or_namespace(_ident_list); parsertools.create_source_context(_unit_or_namespace,_ident_list, _ident_list); return _unit_or_namespace; } case (int)RuleConstants.RULE_BODY : //<body> ::= <main_func> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_BODY2 : //<body> ::= <funcs> <main_func> { token_info _token_info = new token_info(";"); _token_info.source_context = parsertools.GetTokenSourceContext(); block _block = new block((declarations)LRParser.GetReductionSyntaxNode(0), ((block)LRParser.GetReductionSyntaxNode(1)).program_code); parsertools.create_source_context(_block, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0), ((block)LRParser.GetReductionSyntaxNode(1)).program_code), _token_info); return _block; } case (int)RuleConstants.RULE_FUNCS : //<funcs> ::= <funcs_variants> <empty> { declarations _declarations = new declarations(); ArrayList funcs = (ArrayList)LRParser.GetReductionSyntaxNode(0); for (int i = 0;i < funcs.Count;i++) { _declarations.defs.Add((declaration)funcs[i]); parsertools.create_source_context(_declarations, parsertools.sc_not_null(_declarations, (declaration)funcs[i]), (declaration)funcs[i]); } param_value_list.Clear(); param_value_list_main.Clear(); body_variant_list.Clear(); body_variant_list_main.Clear(); guard_list.Clear(); guard_list_main.Clear(); list_params_main.Clear(); list_params.Clear(); list_param.Clear(); list_params_temp.Clear(); where_flag = false; decls_counts = 0; let_where_funcs.Clear(); return _declarations; } case (int)RuleConstants.RULE_FUNCS_VARIANTS : //<funcs_variants> ::= <variants> <empty> { param_value_list_main.Add(param_value_list.Clone()); body_variant_list_main.Add(body_variant_list.Clone()); list_method_calls_main.Add(list_method_calls.Clone()); guard_list_main.Add(guard_list.Clone()); list_params_main.Add(list_params.Clone()); list_params.Clear(); ArrayList funcs = new ArrayList(); for (int k = 0; k < func_name.Count; k++) { //////////////////////////head method_name _method_name = new method_name(null, (ident)func_name[k], null); parsertools.create_source_context(_method_name, func_name[k], func_name[k]); function_header _function_header = new function_header(); object rt = new object(); _function_header.name = _method_name; if (_function_header.name.meth_name is template_type_name) { _function_header.template_args = (_function_header.name.meth_name as template_type_name).template_args; ident id = new ident(_function_header.name.meth_name.name); parsertools.create_source_context(id, _function_header.name.meth_name, _function_header.name.meth_name); _function_header.name.meth_name = id; } ////////////////////////////////params formal_parameters _formal_parametres = new formal_parameters(); expression_list f = null; if (((ArrayList)param_value_list_main[k])[0] != null) { f = (expression_list)((ArrayList)param_value_list_main[k])[((ArrayList)param_value_list_main[k]).Count - 1]; string s = ""; for (int i = 0; i < ((ArrayList)param_value_list_main[k]).Count; i++) { for (int j = 0; j < ((expression_list)((ArrayList)param_value_list_main[k])[i]).expressions.Count; j++) if (((expression_list)((ArrayList)param_value_list_main[k])[i]).expressions[j] is ident) s += ((ident)((expression_list)((ArrayList)param_value_list_main[k])[i]).expressions[j]).name; } for (int i = 0; i < ((expression_list)((ArrayList)param_value_list_main[k])[((ArrayList)param_value_list_main[k]).Count - 1]).expressions.Count; i++) { ident_list _ident_list = new ident_list(); ident id = new ident(s + i.ToString()); _ident_list.source_context = id.source_context; _ident_list.idents.Add(id); named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference1, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference1); _formal_parametres.params_list.Add(_typed_parametres); } _function_header.parameters = _formal_parametres; } //////////////////////////type { named_type_reference _named_type_reference11 = new named_type_reference(); ident idtype11 = new ident("datatype"); _named_type_reference11.source_context = idtype11.source_context; _named_type_reference11.names.Add(idtype11); rt = _named_type_reference11; _function_header.return_type = (type_definition)_named_type_reference11; } _function_header.of_object = false; _function_header.class_keyword = false; token_info _token_info = new token_info("function"); _token_info.source_context = parsertools.GetTokenSourceContext(); parsertools.create_source_context(_function_header, _token_info, rt); //////////////////////////////////////block statement_list stmt_l = new statement_list(); statement last_if = null; ArrayList vars = new ArrayList(); if (((ArrayList)param_value_list_main[k])[0] != null) { bool flag = false; for (int i = ((ArrayList)body_variant_list_main[k]).Count - 1; i >= 0; i--) { expression_list pv = (expression_list)((ArrayList)param_value_list_main[k])[i]; statement body_part = (statement)((ArrayList)body_variant_list_main[k])[i]; expression guard = null; if (i < ((ArrayList)guard_list_main[k]).Count) guard = (expression)((ArrayList)guard_list_main[k])[i]; if_node _if_node = new if_node(null, body_part, last_if); parsertools.create_source_context(_if_node, null, parsertools.sc_not_null(body_part, last_if)); /////////// named_type_reference _named_type_reference111 = new named_type_reference(); ident idtype111 = new ident("datatype"); _named_type_reference111.source_context = idtype111.source_context; _named_type_reference111.names.Add(idtype111); expression_list el = new expression_list(); el.expressions.Add(new ident("true") as expression); literal lt; string text = "boolean"; lt = new string_const(text); el.expressions.Add(lt as expression); ///// named_type_reference ntr = _named_type_reference111; new_expr newexpr = new new_expr(ntr, el, false, null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference111)); /////////// expression last_expr = newexpr as expression; if (guard != null) last_expr = guard; for (int j = 0; j < _function_header.parameters.params_list.Count; j++) { typed_parameters tp = (typed_parameters)_function_header.parameters.params_list[j]; if (j < pv.expressions.Count && !(pv.expressions[j] is ident))//vstavka if (vyhod iz rekursii) { op_type_node _op_type_node = new op_type_node(Operators.Equal); _op_type_node.source_context = parsertools.GetTokenSourceContext(); bin_expr _bin_expr = new bin_expr(tp.idents.idents[0] as expression, (expression)pv.expressions[j], _op_type_node.type); parsertools.create_source_context(_bin_expr, tp.idents.idents[0], pv.expressions[j]); op_type_node _op_type_node1 = new op_type_node(Operators.LogicalAND); _op_type_node1.source_context = parsertools.GetTokenSourceContext(); bin_expr _bin_expr1 = new bin_expr(_bin_expr, last_expr, _op_type_node1.type); parsertools.create_source_context(_bin_expr1, _bin_expr, last_expr); last_expr = _bin_expr1; } } _if_node.condition = _ob(last_expr); ////novye peremennye statement_list _ass = new statement_list(); for (int j = 0; j < _function_header.parameters.params_list.Count; j++) { if (j < pv.expressions.Count && pv.expressions[j] is ident && ((ident)pv.expressions[j]).name != _function_header.parameters.params_list[j].idents.idents[0].name) { ident_list il = new ident_list(); il.idents.Add(new ident(((ident)pv.expressions[j]).name)); method_call mc = find_method_call(((ident)pv.expressions[j]).name, k); if (mc == null) { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); var_def_statement _var_def_statement = new var_def_statement(il, (type_definition)_named_type_reference1, null, definition_attribute.None, false); parsertools.create_source_context(_var_def_statement, il, _named_type_reference1); var_statement _var_statement = new var_statement(_var_def_statement); parsertools.create_source_context(_var_statement, null, _var_def_statement); //((statement_list)_if_node.then_body).subnodes.Insert(0, _var_statement);//obyavlenie peremennoy int ii = ((ArrayList)body_variant_list_main[k]).Count - 1; int jj = 0; bool b = false; expression_list exl = (expression_list)((ArrayList)param_value_list_main[k])[ii]; while (ii > i && !b) { jj = 0; while (jj < exl.expressions.Count && (!(exl.expressions[jj] is ident) || ((ident)exl.expressions[jj]).name != ((ident)pv.expressions[j]).name)) jj++; if (jj < exl.expressions.Count) b = true; ii--; if (ii > i) exl = (expression_list)((ArrayList)param_value_list_main[k])[ii]; } if (!b) { int kk = 0; while (kk < vars.Count && il.idents[0].name != ((var_statement)vars[kk]).var_def.vars.idents[0].name) kk++; if (kk >= vars.Count) vars.Add(_var_statement); } } else { bool b = false; int ii = ((ArrayList)body_variant_list_main[k]).Count - 1; int jj = 0; expression_list exl = (expression_list)((ArrayList)param_value_list_main[k])[ii]; while (ii > i && !b) { jj = 0; while (jj < exl.expressions.Count && (!(exl.expressions[jj] is ident) || ((ident)exl.expressions[jj]).name != ((ident)pv.expressions[j]).name)) jj++; if (jj < exl.expressions.Count) b = true; ii--; if (ii > i) exl = (expression_list)((ArrayList)param_value_list_main[k])[ii]; } if (!b) { _function_header.parameters.params_list[j].vars_type = func_type(mc.parameters.expressions.Count); stmt_l.subnodes.Add(var_st(((ident)pv.expressions[j]).name, func_type(mc.parameters.expressions.Count))); } } op_type_node _op_type_node2 = new op_type_node(Operators.Assignment); _op_type_node2.source_context = parsertools.GetTokenSourceContext(); assign _assign = new assign(il.idents[0] as addressed_value, _function_header.parameters.params_list[j].idents.idents[0] as expression, _op_type_node2.type); parsertools.create_source_context(_assign, il.idents[0], _function_header.parameters.params_list[j].idents.idents[0]); _ass.subnodes.Add(_assign); } } ///////////////////////////////////////list_param if (((ArrayList)list_params_main[k]).Count != 0 && i < ((ArrayList)list_params_main[k]).Count) { for (int ll = 0; ll < ((ArrayList)((ArrayList)list_params_main[k])[i]).Count; ll++) { //if (i == ((ArrayList)body_variant_list_main[k]).Count - 1) for (int l = 0; l < ((ArrayList)((ArrayList)((ArrayList)list_params_main[k])[i])[ll]).Count; l++) { ident_list il1 = new ident_list(); il1.idents.Add(new ident(((ident)((ArrayList)((ArrayList)((ArrayList)list_params_main[k])[i])[ll])[l]).name)); named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.names.Add(idtype1); var_def_statement _var_def_statement = new var_def_statement(il1, (type_definition)_named_type_reference1, null, definition_attribute.None, false); parsertools.create_source_context(_var_def_statement, il1, _named_type_reference1); var_statement _var_statement = new var_statement(_var_def_statement); //stmt_l.subnodes.Add(_var_statement); int j = 0; while (j < vars.Count && il1.idents[0].name != ((var_statement)vars[j]).var_def.vars.idents[0].name) j++; if (j >= vars.Count) vars.Add(_var_statement); } op_type_node _op_type_node = new op_type_node(Operators.Assignment); dot_node _dot_node = new dot_node(null, (addressed_value)(new ident("head"))); ident id = new ident(); for (int i1 = 0; i1 < ((ArrayList)((ArrayList)((ArrayList)list_params_main[k])[i])[ll]).Count; i1++) id.name += ((ident)((ArrayList)((ArrayList)((ArrayList)list_params_main[k])[i])[ll])[i1]).name; if (id.name != null) { _dot_node.left = (addressed_value)(id); object o = null; method_call _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node; assign _assign1 = new assign(((ident)((ArrayList)((ArrayList)((ArrayList)list_params_main[k])[i])[ll])[((ArrayList)((ArrayList)((ArrayList)list_params_main[k])[i])[ll]).Count - 1]) as addressed_value, _method_call as expression, _op_type_node.type); _ass.subnodes.Add(_assign1); /// for (int i1 = ((ArrayList)((ArrayList)((ArrayList)list_params_main[k])[i])[ll]).Count - 2; i1 > 0; i1--) { _dot_node = new dot_node((addressed_value)id, (addressed_value)(new ident("tail"))); for (int j1 = 0; j1 < ((ArrayList)((ArrayList)((ArrayList)list_params_main[k])[i])[ll]).Count - 2 - i1; j1++) { _dot_node = new dot_node(_dot_node, (addressed_value)(new ident("tail"))); } _dot_node = new dot_node(_dot_node, (addressed_value)(new ident("head"))); _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node; _assign1 = new assign(((ident)((ArrayList)((ArrayList)((ArrayList)list_params_main[k])[i])[ll])[i1]) as addressed_value, _method_call as expression, _op_type_node.type); _ass.subnodes.Add(_assign1); } _dot_node = new dot_node((addressed_value)id, (addressed_value)(new ident("tail"))); for (int j1 = 0; j1 < ((ArrayList)((ArrayList)((ArrayList)list_params_main[k])[i])[ll]).Count - 2; j1++) { _dot_node = new dot_node(_dot_node, (addressed_value)(new ident("tail"))); } _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node; _assign1 = new assign(((ident)((ArrayList)((ArrayList)((ArrayList)list_params_main[k])[i])[ll])[0]) as addressed_value, _method_call as expression, _op_type_node.type); _ass.subnodes.Add(_assign1); } } } /////////////////////////////////////////////////////////////////////// parsertools.create_source_context(_if_node, null, _if_node); last_if = new statement_list(); for (int ii = 0; ii < _ass.subnodes.Count; ii++) ((statement_list)last_if).subnodes.Add((assign)_ass.subnodes[ii]); ((statement_list)last_if).subnodes.Add(_if_node); } stmt_l.subnodes.Add(last_if); } else { stmt_l.subnodes.Add((statement)((ArrayList)body_variant_list_main[k])[0]); } ////////////////// block _block = new block(null, null); _block.defs = new declarations(); for (int l = 0; l < vars.Count; l++) _block.defs.defs.Add(vars[l] as var_statement); statement_list sl = null; if (stmt_l is statement_list) sl = stmt_l as statement_list; else { sl = new statement_list(); sl.subnodes.Add(stmt_l as statement); if (!(stmt_l is empty_statement)) parsertools.assign_source_context(sl, stmt_l); } _block.program_code = sl; ////////////////// ArrayList lamdas = find_lambda_funcs_main(_function_header.name.meth_name.name); for (int l = 0; l < lamdas.Count; l++) _block.defs.defs.Add(lambda((function_lambda_definition)lamdas[l])); ////////////////// int r = 0; while (r < let_funcs_funcs.Count && ((string)((ArrayList)let_funcs_funcs[r])[0]) != _function_header.name.meth_name.name) r++; if (r < let_funcs_funcs.Count) { if (_block.defs == null) _block.defs = new declarations(); for (int l = 0; l < ((ArrayList)((ArrayList)let_funcs_funcs[r])[1]).Count; l++) _block.defs.defs.Add(((ArrayList)((ArrayList)let_funcs_funcs[r])[1])[l] as procedure_definition); } let_funcs.Clear(); ////////////////// procedure_definition _procedure_definition = new procedure_definition(_function_header, null); rt = _function_header; if (_block != null) { rt = _block; if (_block is proc_block) _procedure_definition.proc_body = (proc_block)_block; } parsertools.create_source_context(_procedure_definition, _function_header, rt); funcs.Add(_procedure_definition); _functions.Add(_procedure_definition); } return funcs;} case (int)RuleConstants.RULE_VARIANTS : //<variants> ::= <variant> <empty> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIANTS2 : //<variants> ::= <variants> <variant> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIANT_TKIDENT: //<variant> ::= 'tkIdent' <params> <guard_body_list> <where_var> { ArrayList body_list = (ArrayList)LRParser.GetReductionSyntaxNode(2); for (int g_ind = 0; g_ind < body_list.Count; g_ind++) { ///////////////////////////////////body statement_list st = null; statement_list body_1 = (statement_list)((ArrayList)body_list[g_ind])[1]; if (LRParser.GetReductionSyntaxNode(3) != null) { ArrayList ar = (ArrayList)LRParser.GetReductionSyntaxNode(3); for (int ii = 0; ii < ar.Count; ii++) where_funcs.Add(ar[ii]); statement_list _statement_list = body_1; //////////////////////////////////////////////for guard formal_parameters _formal_parametres = null; ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = null; _procedure_definition.proc_body = null; _procedure_definition.parameters = null; _procedure_definition.lambda_name = "__lam_where__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, null, null, null, "lambda_where" + lambda_num); _procedure_definition.proc_body = _statement_list; procedure_definition pr = lambda(_procedure_definition); //_function_lambda_definitions.Add(_procedure_definition);//////////////// ((block)pr.proc_body).defs = new declarations(); int start = 0; int k = where_funcs.Count - 1; while (k > 0 && ((procedure_definition)where_funcs[k]).proc_header.name.meth_name.name.Contains("__lambda__")) k--; int kk = 0; while (k > 0 && kk < ar.Count - 1 && !((procedure_definition)where_funcs[k]).proc_header.name.meth_name.name.Contains("__lambda__")) { k--; kk++; } start = k; int i = start; int n = where_funcs.Count; if (start >= 0) while (i < n) { ((block)pr.proc_body).defs.defs.Add((procedure_definition)where_funcs[start]); where_funcs.RemoveAt(start); i++; } /////////////////////////////////lambda if (lambda_stack.Count > 0 && ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count == 0) lambda_stack.RemoveAt(lambda_stack.Count - 1); if (lambda_stack.Count > 0) { if (((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count > 0) { if (((block)pr.proc_body).defs == null) ((block)pr.proc_body).defs = new declarations(); for (int ii = 0; ii < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; ii++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)((ArrayList)lambda_stack[lambda_stack.Count - 1])[ii]); for (int ii = 0; ii < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; ii++) _function_lambda_definitions.RemoveAt(_function_lambda_definitions.Count - 1); } //lambda_stack.RemoveAt(lambda_stack.Count - 1); } ////////////////////////////////// where_funcs.Add(pr); //if (let_flag.Count > 0) //let_func_last.Add(pr); expression_list el = new expression_list(); //where_fact_params.Clear(); op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), new ident(_procedure_definition.lambda_name), Operators.Assignment); statement_list _statement_list1 = new statement_list(); _statement_list1.subnodes.Add(_assign); st = _statement_list1; } else { //////////////////////////////////////////////for guard st = body_1; } ///////////////////////////////////\body ////////////////////////////////////////////////////for let & where let_where_funcs.Clear(); while (let_where_funcs_main.Count > 1) let_where_funcs_main.RemoveAt(let_where_funcs_main.Count - 1); list_params1.Clear(); let_flag.Clear(); int iiii = 0; while (iiii < func_name.Count && ((ident)func_name[iiii]).name != ((ident)LRParser.GetReductionSyntaxNode(0)).name) iiii++; if (iiii == func_name.Count && let_funcs_funcs.Count == 0 || (let_funcs_funcs.Count > 0 && ((string)((ArrayList)let_funcs_funcs[let_funcs_funcs.Count - 1])[0]) != ((ident)LRParser.GetReductionSyntaxNode(0)).name)) { ArrayList ar = new ArrayList(); ar.Add(((ident)LRParser.GetReductionSyntaxNode(0)).name); if (where_funcs.Count > 0) { for (int i = 0; i < let_funcs.Count; i++) ((block)((procedure_definition)where_funcs[0]).proc_body).defs.defs.Add((procedure_definition)let_funcs[i]); ar.Add(where_funcs.Clone()); } else ar.Add(let_funcs.Clone()); let_funcs_funcs.Add(ar); let_funcs.Clear(); where_funcs.Clear(); let_func_last.Clear(); } else { int r = 0; while (r < let_funcs_funcs.Count && ((string)((ArrayList)let_funcs_funcs[r])[0]) != ((ident)LRParser.GetReductionSyntaxNode(0)).name) r++; if (r < let_funcs_funcs.Count) { if (where_funcs.Count > 0) { for (int i = 0; i < let_funcs.Count; i++) ((block)((procedure_definition)where_funcs[0]).proc_body).defs.defs.Add((procedure_definition)let_funcs[i]); for (int i = 0; i < where_funcs.Count; i++) ((ArrayList)((ArrayList)let_funcs_funcs[r])[1]).Add(where_funcs[i]); } else for (int i = 0; i < let_funcs.Count; i++) ((ArrayList)((ArrayList)let_funcs_funcs[r])[1]).Add(let_funcs[i]); let_funcs.Clear(); where_funcs.Clear(); let_func_last.Clear(); } } if (iiii == func_name.Count) { ///////////////////////////////////////////////////// ArrayList ar_lambda = new ArrayList(); ar_lambda.Add(((ident)LRParser.GetReductionSyntaxNode(0)).name); ar_lambda.Add(_function_lambda_definitions.Clone()); _function_lambda_definitions_main.Add(ar_lambda.Clone()); _function_lambda_definitions.Clear(); ///////////////////////////////////////////////////// } else { ////////////////////////////////// ArrayList ar_lambda = (ArrayList)_function_lambda_definitions.Clone(); for (int i = 0; i < ar_lambda.Count; i++) ((ArrayList)((ArrayList)_function_lambda_definitions_main[_function_lambda_definitions_main.Count - 1])[1]).Add(ar_lambda[i]); _function_lambda_definitions.Clear(); ////////////////////////////////// } //////////////////////////////////////////////////// if (st/* LRParser.GetReductionSyntaxNode(2)*/ != null) { int i = 0; while (i < func_name.Count && ((ident)func_name[i]).name != ((ident)LRParser.GetReductionSyntaxNode(0)).name) i++; if (i == func_name.Count) { func_name.Add((ident)LRParser.GetReductionSyntaxNode(0)); list_return_funcs_main.Add(list_return_funcs.Clone()); list_return_funcs.Clear(); if (list_method_calls_main.Count > 0) for (int iii = 0; iii < ((ArrayList)list_method_calls_main[list_method_calls_main.Count - 1]).Count; iii++) if (list_method_calls.Count > 0) list_method_calls.RemoveAt(0); list_method_calls_main.Add(list_method_calls.Clone()); if (param_value_list.Count != 0) { param_value_list_main.Add(param_value_list.Clone()); body_variant_list_main.Add(body_variant_list.Clone()); guard_list_main.Add(guard_list.Clone()); list_params_main.Add(list_params.Clone()); } param_value_list.Clear(); body_variant_list.Clear(); guard_list.Clear(); list_params.Clear(); param_value_list.Add(LRParser.GetReductionSyntaxNode(1)); ////////////////Dobavlyaem formalnye parametry //statement_list st = (statement_list)LRParser.GetReductionSyntaxNode(4); if (st.subnodes[0] is assign) { if (((assign)st.subnodes[0]).from is function_lambda_call) { function_lambda_call flc = (function_lambda_call)(((assign)st.subnodes[0]).from); function_lambda_definition fld = ((function_lambda_call)(((assign)st.subnodes[0]).from)).f_lambda_def; for (int ind = flc.parameters.expressions.Count; ind < fld.parameters.expressions.Count; ind++) { if (param_value_list.Count == 0) param_value_list.Add(new expression_list()); if (param_value_list[param_value_list.Count - 1] == null) param_value_list[param_value_list.Count - 1] = new expression_list(); ((expression_list)param_value_list[param_value_list.Count - 1]).expressions.Add(fld.parameters.expressions[ind]); } } if (((assign)st.subnodes[0]).from is method_call) { method_call mc = (method_call)(((assign)st.subnodes[0]).from); int jjj = 0; int ind_null = -1; while (jjj < mc.parameters.expressions.Count) if (mc.parameters.expressions[jjj] is new_expr && ((new_expr)mc.parameters.expressions[jjj]).params_list.expressions[0] is string_const && ((string_const)((new_expr)mc.parameters.expressions[jjj]).params_list.expressions[0]).Value == "$null") { ind_null = jjj; jjj = mc.parameters.expressions.Count; } else jjj++; if (ind_null >= 0) for (int ind = ind_null; ind < mc.parameters.expressions.Count; ind++) { //int j = 0; //while () if (param_value_list.Count == 0) param_value_list.Add(new expression_list()); if (param_value_list[param_value_list.Count - 1] == null) param_value_list[param_value_list.Count - 1] = new expression_list(); ((expression_list)param_value_list[param_value_list.Count - 1]).expressions.Add(new ident("$param" + ind)); ((method_call)(((assign)st.subnodes[0]).from)).parameters.expressions.Insert(ind, new ident("$param" + ind)); ((method_call)(((assign)st.subnodes[0]).from)).parameters.expressions.RemoveAt(ind + 1); } } } //////////////// body_variant_list.Add(st); //guard_list.Add(LRParser.GetReductionSyntaxNode(2)); guard_list.Add(((ArrayList)body_list[g_ind])[0]); if (list_params_temp.Count != 0) { list_params.Add(list_params_temp.Clone()); list_params_temp.Clear(); } } else { ArrayList ar = (ArrayList)list_method_calls.Clone(); for (int iii = 0; iii < list_method_calls.Count; iii++) ((ArrayList)list_method_calls_main[list_method_calls_main.Count - 1]).Add(ar[iii]); param_value_list.Add(LRParser.GetReductionSyntaxNode(1)); ////////////////Dobavlyaem formalnye parametry //statement_list st = (statement_list)LRParser.GetReductionSyntaxNode(4); if (st.subnodes[0] is assign) { if (((assign)st.subnodes[0]).from is function_lambda_call) { function_lambda_call flc = (function_lambda_call)(((assign)st.subnodes[0]).from); function_lambda_definition fld = ((function_lambda_call)(((assign)st.subnodes[0]).from)).f_lambda_def; for (int ind = flc.parameters.expressions.Count; ind < fld.parameters.expressions.Count; ind++) { if (param_value_list.Count == 0) param_value_list.Add(new expression_list()); if (param_value_list[param_value_list.Count - 1] == null) param_value_list[param_value_list.Count - 1] = new expression_list(); ((expression_list)param_value_list[param_value_list.Count - 1]).expressions.Add(fld.parameters.expressions[ind]); } } if (((assign)st.subnodes[0]).from is method_call) { method_call mc = (method_call)(((assign)st.subnodes[0]).from); int jjj = 0; int ind_null = -1; while (jjj < mc.parameters.expressions.Count) if (mc.parameters.expressions[jjj] is new_expr && ((new_expr)mc.parameters.expressions[jjj]).params_list.expressions[0] is string_const && ((string_const)((new_expr)mc.parameters.expressions[jjj]).params_list.expressions[0]).Value == "$null") { ind_null = jjj; jjj = mc.parameters.expressions.Count; } else jjj++; if (ind_null >= 0) for (int ind = ind_null; ind < mc.parameters.expressions.Count; ind++) { if (param_value_list.Count == 0) param_value_list.Add(new expression_list()); if (param_value_list[param_value_list.Count - 1] == null) param_value_list[param_value_list.Count - 1] = new expression_list(); ((expression_list)param_value_list[param_value_list.Count - 1]).expressions.Add(new ident("$param" + ind)); ((method_call)(((assign)st.subnodes[0]).from)).parameters.expressions.Insert(ind, new ident("$param" + ind)); ((method_call)(((assign)st.subnodes[0]).from)).parameters.expressions.RemoveAt(ind + 1); } } } //////////////// body_variant_list.Add(st); //guard_list.Add(LRParser.GetReductionSyntaxNode(2)); guard_list.Add(((ArrayList)body_list[g_ind])[0]); if (list_params_temp.Count != 0) { list_params.Add(list_params_temp.Clone()); list_params_temp.Clear(); } } } else { int i = 0; while (i < func_name.Count && ((ident)func_name[i]).name != ((ident)LRParser.GetReductionSyntaxNode(0)).name) i++; if (i == func_name.Count) { func_name.Add((ident)LRParser.GetReductionSyntaxNode(0)); } } list_params1.Clear(); //int kk = last_list_method_calls.Count; //kk = last_function_lambda_definitions.Count; for (int i = 0; i < last_function_lambda_definitions.Count; i++) { for (int j = 0; j < ((function_lambda_definition)last_function_lambda_definitions[i]).formal_parameters.params_list.Count; j++) { string name_param = ((function_lambda_definition)last_function_lambda_definitions[i]).formal_parameters.params_list[j].idents.idents[0].name; int k = 0; while (k < last_list_method_calls.Count && ((ident)((method_call)last_list_method_calls[k]).dereferencing_value).name != name_param) k++; if (k < last_list_method_calls.Count) { function_lambda_definition fld = find_func_lambda_after(((function_lambda_definition)last_function_lambda_definitions[i]).lambda_name); fld.formal_parameters.params_list[j].vars_type = func_type(((method_call)last_list_method_calls[k]).parameters.expressions.Count); } } } last_list_method_calls.Clear(); last_function_lambda_definitions.Clear(); } return null; } case (int)RuleConstants.RULE_VARIANT_TKQUOTE_TKIDENT_TKQUOTE: //<variant> ::= <list_param1> 'tkQuote' 'tkIdent' 'tkQuote' <list_param1> <guard_body_list> <where_var> { ArrayList body_list = (ArrayList)LRParser.GetReductionSyntaxNode(5); for (int g_ind = 0; g_ind < body_list.Count; g_ind++) { ///////////////////////////////////body statement_list st = null; statement_list body_1 = (statement_list)((ArrayList)body_list[g_ind])[1]; if (LRParser.GetReductionSyntaxNode(6) != null) { ArrayList ar = (ArrayList)LRParser.GetReductionSyntaxNode(6); for (int ii = 0; ii < ar.Count; ii++) where_funcs.Add(ar[ii]); statement_list _statement_list = body_1; //////////////////////////////////////////////for guard formal_parameters _formal_parametres = null; ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = null; _procedure_definition.proc_body = null; _procedure_definition.parameters = null; _procedure_definition.lambda_name = "__lam_where__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, null, null, null, "lambda_where" + lambda_num); _procedure_definition.proc_body = _statement_list; procedure_definition pr = lambda(_procedure_definition); //_function_lambda_definitions.Add(_procedure_definition);//////////////// ((block)pr.proc_body).defs = new declarations(); int start = 0; int k = where_funcs.Count - 1; while (k > 0 && ((procedure_definition)where_funcs[k]).proc_header.name.meth_name.name.Contains("__lambda__")) k--; int kk = 0; while (k > 0 && kk < ar.Count - 1 && !((procedure_definition)where_funcs[k]).proc_header.name.meth_name.name.Contains("__lambda__")) { k--; kk++; } start = k; int i = start; int n = where_funcs.Count; if (start >= 0) while (i < n) { ((block)pr.proc_body).defs.defs.Add((procedure_definition)where_funcs[start]); where_funcs.RemoveAt(start); i++; } /////////////////////////////////lambda if (lambda_stack.Count > 0 && ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count == 0) lambda_stack.RemoveAt(lambda_stack.Count - 1); if (lambda_stack.Count > 0) { if (((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count > 0) { if (((block)pr.proc_body).defs == null) ((block)pr.proc_body).defs = new declarations(); for (int ii = 0; ii < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; ii++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)((ArrayList)lambda_stack[lambda_stack.Count - 1])[ii]); for (int ii = 0; ii < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; ii++) _function_lambda_definitions.RemoveAt(_function_lambda_definitions.Count - 1); } //lambda_stack.RemoveAt(lambda_stack.Count - 1); } ////////////////////////////////// where_funcs.Add(pr); //if (let_flag.Count > 0) //let_func_last.Add(pr); expression_list el = new expression_list(); //where_fact_params.Clear(); op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), new ident(_procedure_definition.lambda_name), Operators.Assignment); statement_list _statement_list1 = new statement_list(); _statement_list1.subnodes.Add(_assign); st = _statement_list1; } else { //////////////////////////////////////////////for guard st = body_1; } ///////////////////////////////////\body ident _ident = (ident)LRParser.GetReductionSyntaxNode(2); expression_list _ex_l1 = (expression_list)LRParser.GetReductionSyntaxNode(0); expression_list _ex_l2 = (expression_list)LRParser.GetReductionSyntaxNode(4); for (int i = 0; i < _ex_l2.expressions.Count; i++) _ex_l1.expressions.Add(_ex_l2.expressions[i]); ////////////////////////////////////////////////////for let & where let_where_funcs.Clear(); while (let_where_funcs_main.Count > 1) let_where_funcs_main.RemoveAt(let_where_funcs_main.Count - 1); list_params1.Clear(); let_flag.Clear(); int iiii = 0; while (iiii < func_name.Count && ((ident)func_name[iiii]).name != _ident.name) iiii++; if (iiii == func_name.Count && let_funcs_funcs.Count == 0 || (let_funcs_funcs.Count > 0 && ((string)((ArrayList)let_funcs_funcs[let_funcs_funcs.Count - 1])[0]) != _ident.name)) { ArrayList ar = new ArrayList(); ar.Add(_ident.name); if (where_funcs.Count > 0) { for (int i = 0; i < let_funcs.Count; i++) ((block)((procedure_definition)where_funcs[0]).proc_body).defs.defs.Add((procedure_definition)let_funcs[i]); ar.Add(where_funcs.Clone()); } else ar.Add(let_funcs.Clone()); let_funcs_funcs.Add(ar); let_funcs.Clear(); where_funcs.Clear(); let_func_last.Clear(); } else { int r = 0; while (r < let_funcs_funcs.Count && ((string)((ArrayList)let_funcs_funcs[r])[0]) != _ident.name) r++; if (r < let_funcs_funcs.Count) { if (where_funcs.Count > 0) { for (int i = 0; i < let_funcs.Count; i++) ((block)((procedure_definition)where_funcs[0]).proc_body).defs.defs.Add((procedure_definition)let_funcs[i]); for (int i = 0; i < where_funcs.Count; i++) ((ArrayList)((ArrayList)let_funcs_funcs[r])[1]).Add(where_funcs[i]); } else for (int i = 0; i < let_funcs.Count; i++) ((ArrayList)((ArrayList)let_funcs_funcs[r])[1]).Add(let_funcs[i]); let_funcs.Clear(); where_funcs.Clear(); let_func_last.Clear(); } } if (iiii == func_name.Count) { ///////////////////////////////////////////////////// ArrayList ar_lambda = new ArrayList(); ar_lambda.Add(_ident.name); ar_lambda.Add(_function_lambda_definitions.Clone()); _function_lambda_definitions_main.Add(ar_lambda.Clone()); _function_lambda_definitions.Clear(); ///////////////////////////////////////////////////// } else { ////////////////////////////////// ArrayList ar_lambda = (ArrayList)_function_lambda_definitions.Clone(); for (int i = 0; i < ar_lambda.Count; i++) ((ArrayList)((ArrayList)_function_lambda_definitions_main[_function_lambda_definitions_main.Count - 1])[1]).Add(ar_lambda[i]); _function_lambda_definitions.Clear(); ////////////////////////////////// } //////////////////////////////////////////////////// if (st/*LRParser.GetReductionSyntaxNode(7)*/ != null) { int i = 0; while (i < func_name.Count && ((ident)func_name[i]).name != _ident.name) i++; if (i == func_name.Count) { func_name.Add(_ident); list_return_funcs_main.Add(list_return_funcs.Clone()); list_return_funcs.Clear(); if (list_method_calls_main.Count > 0) for (int iii = 0; iii < ((ArrayList)list_method_calls_main[list_method_calls_main.Count - 1]).Count; iii++) if (list_method_calls.Count > 0) list_method_calls.RemoveAt(0); list_method_calls_main.Add(list_method_calls.Clone()); if (param_value_list.Count != 0) { param_value_list_main.Add(param_value_list.Clone()); body_variant_list_main.Add(body_variant_list.Clone()); guard_list_main.Add(guard_list.Clone()); list_params_main.Add(list_params.Clone()); } param_value_list.Clear(); body_variant_list.Clear(); guard_list.Clear(); list_params.Clear(); param_value_list.Add(_ex_l1); ////////////////Dobavlyaem formalnye parametry //statement_list st = (statement_list)LRParser.GetReductionSyntaxNode(7); if (st.subnodes[0] is assign) { if (((assign)st.subnodes[0]).from is function_lambda_call) { function_lambda_call flc = (function_lambda_call)(((assign)st.subnodes[0]).from); function_lambda_definition fld = ((function_lambda_call)(((assign)st.subnodes[0]).from)).f_lambda_def; for (int ind = flc.parameters.expressions.Count; ind < fld.parameters.expressions.Count; ind++) { if (param_value_list.Count == 0) param_value_list.Add(new expression_list()); if (param_value_list[param_value_list.Count - 1] == null) param_value_list[param_value_list.Count - 1] = new expression_list(); ((expression_list)param_value_list[param_value_list.Count - 1]).expressions.Add(fld.parameters.expressions[ind]); } } if (((assign)st.subnodes[0]).from is method_call) { method_call mc = (method_call)(((assign)st.subnodes[0]).from); int jjj = 0; int ind_null = -1; while (jjj < mc.parameters.expressions.Count) if (mc.parameters.expressions[jjj] is new_expr && ((new_expr)mc.parameters.expressions[jjj]).params_list.expressions[0] is string_const && ((string_const)((new_expr)mc.parameters.expressions[jjj]).params_list.expressions[0]).Value == "$null") { ind_null = jjj; jjj = mc.parameters.expressions.Count; } else jjj++; if (ind_null >= 0) for (int ind = ind_null; ind < mc.parameters.expressions.Count; ind++) { //int j = 0; //while () if (param_value_list.Count == 0) param_value_list.Add(new expression_list()); if (param_value_list[param_value_list.Count - 1] == null) param_value_list[param_value_list.Count - 1] = new expression_list(); ((expression_list)param_value_list[param_value_list.Count - 1]).expressions.Add(new ident("$param" + ind)); ((method_call)(((assign)st.subnodes[0]).from)).parameters.expressions.Insert(ind, new ident("$param" + ind)); ((method_call)(((assign)st.subnodes[0]).from)).parameters.expressions.RemoveAt(ind + 1); } } } //////////////// body_variant_list.Add(st); //guard_list.Add(LRParser.GetReductionSyntaxNode(5)); guard_list.Add(((ArrayList)body_list[g_ind])[0]); if (list_params_temp.Count != 0) { list_params.Add(list_params_temp.Clone()); list_params_temp.Clear(); } } else { ArrayList ar = (ArrayList)list_method_calls.Clone(); for (int iii = 0; iii < list_method_calls.Count; iii++) ((ArrayList)list_method_calls_main[list_method_calls_main.Count - 1]).Add(ar[iii]); param_value_list.Add(_ex_l1); ////////////////Dobavlyaem formalnye parametry //statement_list st = (statement_list)LRParser.GetReductionSyntaxNode(7); if (st.subnodes[0] is assign) { if (((assign)st.subnodes[0]).from is function_lambda_call) { function_lambda_call flc = (function_lambda_call)(((assign)st.subnodes[0]).from); function_lambda_definition fld = ((function_lambda_call)(((assign)st.subnodes[0]).from)).f_lambda_def; for (int ind = flc.parameters.expressions.Count; ind < fld.parameters.expressions.Count; ind++) { if (param_value_list.Count == 0) param_value_list.Add(new expression_list()); if (param_value_list[param_value_list.Count - 1] == null) param_value_list[param_value_list.Count - 1] = new expression_list(); ((expression_list)param_value_list[param_value_list.Count - 1]).expressions.Add(fld.parameters.expressions[ind]); } } if (((assign)st.subnodes[0]).from is method_call) { method_call mc = (method_call)(((assign)st.subnodes[0]).from); int jjj = 0; int ind_null = -1; while (jjj < mc.parameters.expressions.Count) if (mc.parameters.expressions[jjj] is new_expr && ((new_expr)mc.parameters.expressions[jjj]).params_list.expressions[0] is string_const && ((string_const)((new_expr)mc.parameters.expressions[jjj]).params_list.expressions[0]).Value == "$null") { ind_null = jjj; jjj = mc.parameters.expressions.Count; } else jjj++; if (ind_null >= 0) for (int ind = ind_null; ind < mc.parameters.expressions.Count; ind++) { if (param_value_list.Count == 0) param_value_list.Add(new expression_list()); if (param_value_list[param_value_list.Count - 1] == null) param_value_list[param_value_list.Count - 1] = new expression_list(); ((expression_list)param_value_list[param_value_list.Count - 1]).expressions.Add(new ident("$param" + ind)); ((method_call)(((assign)st.subnodes[0]).from)).parameters.expressions.Insert(ind, new ident("$param" + ind)); ((method_call)(((assign)st.subnodes[0]).from)).parameters.expressions.RemoveAt(ind + 1); } } } //////////////// body_variant_list.Add(st); //guard_list.Add(LRParser.GetReductionSyntaxNode(5)); guard_list.Add(((ArrayList)body_list[g_ind])[0]); if (list_params_temp.Count != 0) { list_params.Add(list_params_temp.Clone()); list_params_temp.Clear(); } } } else { int i = 0; while (i < func_name.Count && ((ident)func_name[i]).name != _ident.name) i++; if (i == func_name.Count) { func_name.Add(_ident); } } list_params1.Clear(); //int kk = last_list_method_calls.Count; //kk = last_function_lambda_definitions.Count; for (int i = 0; i < last_function_lambda_definitions.Count; i++) { for (int j = 0; j < ((function_lambda_definition)last_function_lambda_definitions[i]).formal_parameters.params_list.Count; j++) { string name_param = ((function_lambda_definition)last_function_lambda_definitions[i]).formal_parameters.params_list[j].idents.idents[0].name; int k = 0; while (k < last_list_method_calls.Count && ((ident)((method_call)last_list_method_calls[k]).dereferencing_value).name != name_param) k++; if (k < last_list_method_calls.Count) { function_lambda_definition fld = find_func_lambda_after(((function_lambda_definition)last_function_lambda_definitions[i]).lambda_name); fld.formal_parameters.params_list[j].vars_type = func_type(((method_call)last_list_method_calls[k]).parameters.expressions.Count); } } } last_list_method_calls.Clear(); last_function_lambda_definitions.Clear(); } return null; } case (int)RuleConstants.RULE_LIST_PARAM1: //<list_param1> ::= <list_param> <empty> { bool b = false; if (list_param.Count == 1) { list_params_temp.Add(new ArrayList()); let_where_list_params.Add(new ArrayList());// if (list_param[0] is new_expr && ((string_const)((new_expr)list_param[0]).params_list.expressions[1]).Value == "empty") b = true; list_param.Clear(); } else { list_params_temp.Add(list_param.Clone()); let_where_list_params.Add(list_param.Clone());// } expression_list _expression_list = new expression_list(); if (list_param.Count == 0) { if (b) { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); el.expressions.Add(new int32_const(0)); literal lt; string text = "empty_list"; lt = new string_const(text); el.expressions.Add(lt as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); _expression_list.expressions.Add(newexpr); } else { _expression_list.source_context = ((expression)LRParser.GetReductionSyntaxNode(0)).source_context; _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); } } else { ident id = new ident(); for (int i = 0; i < list_param.Count; i++) { if (list_param[i] is ident) id.name += ((ident)list_param[i]).name; else { errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, "идентификатор")); return null; } } _expression_list.source_context = ((expression)id).source_context; _expression_list.expressions.Add((expression)id); list_param.Clear(); } list_params1.Clear(); for (int i = 0; i < _expression_list.expressions.Count; i++) list_params1.Add(_expression_list.expressions[i]); last_list_method_calls_lambda.Clear(); return _expression_list; } case (int)RuleConstants.RULE_BODY_WHERE: //<body_where> ::= <body_func> <where_var> { //guard_list.Add(LRParser.GetReductionSyntaxNode(0)); if (LRParser.GetReductionSyntaxNode(1) != null) { ArrayList ar = (ArrayList)LRParser.GetReductionSyntaxNode(1); for (int ii = 0; ii < ar.Count; ii++) where_funcs.Add(ar[ii]); statement_list _statement_list = (statement_list)LRParser.GetReductionSyntaxNode(0); //////////////////////////////////////////////for guard formal_parameters _formal_parametres = null; ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = null; _procedure_definition.proc_body = null; _procedure_definition.parameters = null; _procedure_definition.lambda_name = "__lam_where__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, null, null, null, "lambda_where" + lambda_num); _procedure_definition.proc_body = _statement_list; procedure_definition pr = lambda(_procedure_definition); //_function_lambda_definitions.Add(_procedure_definition);//////////////// ((block)pr.proc_body).defs = new declarations(); int start = 0; int k = where_funcs.Count - 1; while (k > 0 && ((procedure_definition)where_funcs[k]).proc_header.name.meth_name.name.Contains("__lambda__")) k--; int kk = 0; while (k > 0 && kk < ar.Count - 1 && !((procedure_definition)where_funcs[k]).proc_header.name.meth_name.name.Contains("__lambda__")) { k--; kk++; } start = k; int i = start; int n = where_funcs.Count; if (start >= 0) while (i < n) { ((block)pr.proc_body).defs.defs.Add((procedure_definition)where_funcs[start]); where_funcs.RemoveAt(start); i++; } /////////////////////////////////lambda if (lambda_stack.Count > 0 && ((ArrayList)lambda_stack[lambda_stack.Count-1]).Count==0) lambda_stack.RemoveAt(lambda_stack.Count - 1); if (lambda_stack.Count > 0) { if (((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count > 0) { if (((block)pr.proc_body).defs == null) ((block)pr.proc_body).defs = new declarations(); for (int ii = 0; ii < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; ii++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)((ArrayList)lambda_stack[lambda_stack.Count - 1])[ii]); for (int ii = 0; ii < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; ii++) _function_lambda_definitions.RemoveAt(_function_lambda_definitions.Count - 1); } //lambda_stack.RemoveAt(lambda_stack.Count - 1); } ////////////////////////////////// where_funcs.Add(pr); //if (let_flag.Count > 0) //let_func_last.Add(pr); expression_list el = new expression_list(); //where_fact_params.Clear(); op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), new ident(_procedure_definition.lambda_name), Operators.Assignment); statement_list _statement_list1 = new statement_list(); _statement_list1.subnodes.Add(_assign); return _statement_list1; } else { //////////////////////////////////////////////for guard statement_list _statement_list = (statement_list)LRParser.GetReductionSyntaxNode(0); return _statement_list; } } case (int)RuleConstants.RULE_WHERE_VAR : //<where_var> ::= //NONTERMINAL:<where_var> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_WHERE_VAR_TKWHERE: //<where_var> ::= 'tkWhere' <inits> { token_where_count--; //let_where_funcs_main.RemoveAt(let_where_funcs_main.Count-1); let_where_funcs.Clear(); return LRParser.GetReductionSyntaxNode(1); } case (int)RuleConstants.RULE_INITS: //<inits> ::= <init> <empty> { ArrayList ar = new ArrayList(); ar.Add(LRParser.GetReductionSyntaxNode(0)); return ar; } case (int)RuleConstants.RULE_INITS_TKSEMICOLON: //<inits> ::= <inits> 'tkSemiColon' <init> { ArrayList ar = (ArrayList)LRParser.GetReductionSyntaxNode(0); ar.Add(LRParser.GetReductionSyntaxNode(2)); return ar; } case (int)RuleConstants.RULE_INIT_TKIDENT: //<init> ::= 'tkIdent' <params_where> <guard_body_list> <where_var> { expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(1); /*statement_list _statement_list = (statement_list)LRParser.GetReductionSyntaxNode(4);*/ statement_list _statement_list = new statement_list(); ArrayList ar_main = (ArrayList)LRParser.GetReductionSyntaxNode(2); ////////////////////////////for list statement_list stmt_l = new statement_list(); int start = let_where_list_params.Count; if (_expression_list !=null) start = let_where_list_params.Count - _expression_list.expressions.Count; int i_ex = 0; for (int ll = start; ll < let_where_list_params.Count; ll++) { for (int l = 0; l < ((ArrayList)let_where_list_params[ll]).Count; l++) { ident_list il1 = new ident_list(); il1.idents.Add(new ident(((ident)((ArrayList)let_where_list_params[ll])[l]).name)); named_type_reference _n_t_r = new named_type_reference(); ident it = new ident("datatype"); _n_t_r.names.Add(it); var_def_statement _var_def_statement = new var_def_statement(il1, (type_definition)_n_t_r, null, definition_attribute.None, false); var_statement _var_statement = new var_statement(_var_def_statement); stmt_l.subnodes.Add(_var_statement); } if (((ArrayList)let_where_list_params[ll]).Count > 0) { op_type_node _op_type_node = new op_type_node(Operators.Assignment); dot_node _dot_node = new dot_node(null, (addressed_value)(new ident("head"))); ident id = _expression_list.expressions[i_ex] as ident; /*for (int i1 = 0; i1 < ((ArrayList)let_where_list_params[ll]).Count; i1++) id.name += ((ident)((ArrayList)let_where_list_params[ll])[i1]).name;*/ if (id.name != null) { _dot_node.left = (addressed_value)(id); object o = null; method_call _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node; assign _assign1 = new assign(((ident)((ArrayList)let_where_list_params[ll])[((ArrayList)let_where_list_params[ll]).Count - 1]) as addressed_value, _method_call as expression, _op_type_node.type); stmt_l.subnodes.Add(_assign1); /// for (int i1 = ((ArrayList)let_where_list_params[ll]).Count - 2; i1 > 0; i1--) { _dot_node = new dot_node((addressed_value)id, (addressed_value)(new ident("tail"))); for (int j1 = 0; j1 < ((ArrayList)let_where_list_params[ll]).Count - 2 - i1; j1++) { _dot_node = new dot_node(_dot_node, (addressed_value)(new ident("tail"))); } _dot_node = new dot_node(_dot_node, (addressed_value)(new ident("head"))); _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node; _assign1 = new assign(((ident)((ArrayList)let_where_list_params[ll])[i1]) as addressed_value, _method_call as expression, _op_type_node.type); stmt_l.subnodes.Add(_assign1); } _dot_node = new dot_node((addressed_value)id, (addressed_value)(new ident("tail"))); for (int j1 = 0; j1 < ((ArrayList)let_where_list_params[ll]).Count - 2; j1++) { _dot_node = new dot_node(_dot_node, (addressed_value)(new ident("tail"))); } _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node; _assign1 = new assign(((ident)((ArrayList)let_where_list_params[ll])[0]) as addressed_value, _method_call as expression, _op_type_node.type); stmt_l.subnodes.Add(_assign1); } } i_ex++; } for (int ll = 0; ll < let_where_list_params.Count - start; ll++) list_params_temp.RemoveAt(list_params_temp.Count - 1); for (int i = stmt_l.subnodes.Count - 1; i >= 0; i--) _statement_list.subnodes.Insert(0, stmt_l.subnodes[i]); if (_expression_list != null) for (int i = 0; i < _expression_list.expressions.Count; i++) let_where_list_params.RemoveAt(let_where_list_params.Count - 1); //////////////////////////// formal_parameters _formal_parametres = null; ident_list i_l = new ident_list(); if (_expression_list != null) { for (int i = 0; i < _expression_list.expressions.Count; i++) i_l.idents.Add((ident)_expression_list.expressions[i]); ///////////////////////////// _formal_parametres = new formal_parameters(); for (int i = 0; i < i_l.idents.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_expression_list.expressions[i]; _ident_list.idents.Add(id); string name_param = id.name; typed_parameters _typed_parametres = null; int k = 0; while (k < last_list_method_calls_lambda.Count && ((ident)((method_call)last_list_method_calls_lambda[k]).dereferencing_value).name != name_param) k++; if (k < last_list_method_calls_lambda.Count) _typed_parametres = new typed_parameters(_ident_list, func_type(((method_call)last_list_method_calls_lambda[k]).parameters.expressions.Count), parametr_kind.none, null); else { named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); } _formal_parametres.params_list.Add(_typed_parametres); } } ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = i_l; _procedure_definition.proc_body = null; _procedure_definition.parameters = _expression_list; _procedure_definition.lambda_name = ((ident)LRParser.GetReductionSyntaxNode(0)).name; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, i_l, null, _expression_list, ((ident)LRParser.GetReductionSyntaxNode(0)).name); object rt = _expression_list; ////////////////////////////////////////for guard for (int i = 0; i < ar_main.Count; i++) if (((ArrayList)ar_main[i])[0] != null) { if_node _if_node = new if_node(); _if_node.condition = _ob((expression)((ArrayList)ar_main[i])[0]); _if_node.then_body = new statement_list(); _if_node.then_body = (statement)((ArrayList)ar_main[i])[1]; procedure_call _exit = new procedure_call(new ident("exit") as addressed_value); ((statement_list)_if_node.then_body).subnodes.Add(_exit); _statement_list.subnodes.Add(_if_node); } else { _statement_list.subnodes.Add((statement)((ArrayList)ar_main[i])[1]); procedure_call _exit = new procedure_call(new ident("exit") as addressed_value); _statement_list.subnodes.Add(_exit); } ////////////////////////////////////////// _procedure_definition.proc_body = _statement_list; parsertools.create_source_context(_procedure_definition, _expression_list, rt); procedure_definition pr = lambda(_procedure_definition); /////////////////////////// /////////////////////////// if (LRParser.GetReductionSyntaxNode(3) != null) { if (((block)pr.proc_body).defs == null) ((block)pr.proc_body).defs = new declarations(); for (int i = 0; i < ((ArrayList)LRParser.GetReductionSyntaxNode(3)).Count; i++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)((ArrayList)LRParser.GetReductionSyntaxNode(3))[i]); } if (let_where_funcs.Count > 0) { if (((block)pr.proc_body).defs == null) ((block)pr.proc_body).defs = new declarations(); for (int i = 0; i < let_where_funcs.Count; i++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)let_where_funcs[i]); if (let_where_funcs_main.Count+1 > token_where_count) { if (((block)pr.proc_body).defs == null) ((block)pr.proc_body).defs = new declarations(); for (int i = 0; i < last_where_funcs.Count; i++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)last_where_funcs[i]); for (int i = 0; i < last_where_funcs.Count; i++) if (let_funcs.Count > 0) let_funcs.RemoveAt(let_funcs.Count - 1); last_where_funcs.Clear(); } let_where_funcs.Clear(); let_func_last.Clear(); let_flag.Clear(); } else if (let_where_funcs_main.Count > 2 && let_where_funcs_main.Count>token_where_count) { ArrayList ar = new ArrayList(); ar = (let_where_funcs_main[let_where_funcs_main.Count - 1] as ArrayList).Clone() as ArrayList; if (((block)pr.proc_body).defs == null) ((block)pr.proc_body).defs = new declarations(); for (int i = 0; i < ar.Count; i++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)ar[i]); let_where_funcs.Clear(); let_func_last.Clear(); let_flag.Clear(); let_where_funcs_main.RemoveAt(let_where_funcs_main.Count-1); for (int i = 0; i < ar.Count; i++) if (let_funcs.Count > 0) let_funcs.RemoveAt(let_funcs.Count - 1); } ///////////////////////////lambda if (lambda_stack.Count > 0) { if (((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count > 0) { if (((block)pr.proc_body).defs == null) ((block)pr.proc_body).defs = new declarations(); for (int i = 0; i < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; i++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)((ArrayList)lambda_stack[lambda_stack.Count - 1])[i]); for (int ii = 0; ii < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; ii++) _function_lambda_definitions.RemoveAt(_function_lambda_definitions.Count - 1); } int number = ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; for (int i = 0; i < number;i++ ) lambda_stack.RemoveAt(lambda_stack.Count - 1); } /////////////////////////// return pr; } case (int)RuleConstants.RULE_PARAMS_WHERE : //<params_where> ::= //NONTERMINAL:<params_where> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_PARAMS_WHERE2 : //<params_where> ::= <param> <empty> { bool b = false; if (list_param.Count == 1) { list_params_temp.Add(new ArrayList()); let_where_list_params.Add(new ArrayList());// if (list_param[0] is new_expr && ((string_const)((new_expr)list_param[0]).params_list.expressions[1]).Value == "empty") b = true; list_param.Clear(); } else { list_params_temp.Add(list_param.Clone()); let_where_list_params.Add(list_param.Clone());// } expression_list _expression_list = new expression_list(); if (list_param.Count == 0) { if (b) { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); el.expressions.Add(new int32_const(0)); literal lt; string text = "empty_list"; lt = new string_const(text); el.expressions.Add(lt as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); _expression_list.expressions.Add(newexpr); } else { _expression_list.source_context = ((expression)LRParser.GetReductionSyntaxNode(0)).source_context; _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); } } else { ident id = new ident(); for (int i = 0; i < list_param.Count; i++) { if (list_param[i] is ident) id.name += ((ident)list_param[i]).name; else { errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, "идентификатор")); return null; } } _expression_list.source_context = ((expression)id).source_context; _expression_list.expressions.Add((expression)id); list_param.Clear(); } list_params1.Clear(); for (int i = 0; i < _expression_list.expressions.Count; i++) list_params1.Add(_expression_list.expressions[i]); last_list_method_calls_lambda.Clear(); return _expression_list; } case (int)RuleConstants.RULE_PARAMS_WHERE3 : //<params_where> ::= <params_where> <param> { bool b = false; if (list_param.Count == 1) { list_params_temp.Add(new ArrayList()); let_where_list_params.Add(new ArrayList());// if (list_param[0] is new_expr && ((string_const)((new_expr)list_param[0]).params_list.expressions[1]).Value == "empty") b = true; list_param.Clear(); } else { list_params_temp.Add(list_param.Clone()); let_where_list_params.Add(list_param.Clone()); } expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(0); if (list_param.Count == 0) { if (!b) { _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(1) as expression); } else { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); el.expressions.Add(new int32_const(0)); literal lt; string text = "empty_list"; lt = new string_const(text); el.expressions.Add(lt as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); _expression_list.expressions.Add(newexpr); } } else { ident id = new ident(); for (int i = 0; i < list_param.Count; i++) { if (list_param[i] is ident) id.name += ((ident)list_param[i]).name; else { errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, "идентификатор")); return null; } } _expression_list.expressions.Add((expression)id); list_param.Clear(); } list_params1.Clear(); for (int i = 0; i < _expression_list.expressions.Count; i++) list_params1.Add(_expression_list.expressions[i]); last_list_method_calls_lambda.Clear(); return _expression_list; } case (int)RuleConstants.RULE_PARAMS : //<params> ::= //NONTERMINAL:<params> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_PARAMS2 : //<params> ::= <param> <empty> { //let_flag.Add(1); bool b = false; if (list_param.Count == 1) { list_params_temp.Add(new ArrayList()); let_where_list_params.Add(new ArrayList());// if (list_param[0] is new_expr && ((string_const)((new_expr)list_param[0]).params_list.expressions[1]).Value == "empty") b = true; list_param.Clear(); } else { list_params_temp.Add(list_param.Clone()); let_where_list_params.Add(list_param.Clone());// } expression_list _expression_list = new expression_list(); if (list_param.Count == 0) { if (b) { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); el.expressions.Add(new int32_const(0)); literal lt; string text = "empty_list"; lt = new string_const(text); el.expressions.Add(lt as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); _expression_list.expressions.Add(newexpr); } else { _expression_list.source_context = ((expression)LRParser.GetReductionSyntaxNode(0)).source_context; _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); } } else { ident id = new ident(); for (int i = 0; i < list_param.Count; i++) { if (list_param[i] is ident) id.name += ((ident)list_param[i]).name; else { errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, "идентификатор")); return null; } } _expression_list.source_context = ((expression)id).source_context; _expression_list.expressions.Add((expression)id); list_param.Clear(); } list_params1.Clear(); for (int i = 0; i < _expression_list.expressions.Count; i++) list_params1.Add(_expression_list.expressions[i]); last_list_method_calls_lambda.Clear(); return _expression_list; } case (int)RuleConstants.RULE_PARAMS3 : //<params> ::= <params> <param> { bool b = false; if (list_param.Count == 1) { list_params_temp.Add(new ArrayList()); let_where_list_params.Add(new ArrayList());// if (list_param[0] is new_expr && ((string_const)((new_expr)list_param[0]).params_list.expressions[1]).Value == "empty") b = true; list_param.Clear(); } else { list_params_temp.Add(list_param.Clone()); let_where_list_params.Add(list_param.Clone());// } expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(0); if (list_param.Count == 0) { if (!b) { _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(1) as expression); } else { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); el.expressions.Add(new int32_const(0)); literal lt; string text = "empty_list"; lt = new string_const(text); el.expressions.Add(lt as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); _expression_list.expressions.Add(newexpr); } } else { ident id = new ident(); for (int i = 0; i < list_param.Count; i++) { if (list_param[i] is ident) id.name += ((ident)list_param[i]).name; else { errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, "идентификатор")); return null; } } _expression_list.expressions.Add((expression)id); list_param.Clear(); } list_params1.Clear(); for (int i = 0; i < _expression_list.expressions.Count; i++) list_params1.Add(_expression_list.expressions[i]); last_list_method_calls_lambda.Clear(); return _expression_list; } case (int)RuleConstants.RULE_PARAM : //<param> ::= <list_param> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIST_PARAM_TKIDENT: //<list_param> ::= 'tkIdent' <empty> { list_param.Add(LRParser.GetReductionSyntaxNode(0)); return LRParser.GetReductionSyntaxNode(0); } case (int)RuleConstants.RULE_LIST_PARAM : //<list_param> ::= <simple_type_expr> <empty> { list_param.Add(LRParser.GetReductionSyntaxNode(0)); return LRParser.GetReductionSyntaxNode(0); } case (int)RuleConstants.RULE_LIST_PARAM_TKSQUAREOPEN_TKSQUARECLOSE: //<list_param> ::= 'tkSquareOpen' 'tkSquareClose' { ArrayList list_elements = new ArrayList();//(ArrayList)LRParser.GetReductionSyntaxNode(1); //////////////////////////////////////////////////////////proverka na type if (list_elements != null) { ArrayList types = new ArrayList(); for (int i = 0; i < list_elements.Count; i++) { string tp = ""; if (list_elements[i] is new_expr) { tp = ((string_const)((new_expr)list_elements[i]).params_list.expressions[1]).Value; if (!types.Contains(tp)) types.Add(tp); } } if ((types.Count == 2 && !(types.Contains("integer") && types.Contains("real"))) || types.Count > 2) { //errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, "одинаковый тип элементов списка")); errors.Add(new PascalABCCompiler.Errors.Error("элементы списка имеют разный тип")); return null; } } ////////////////////////////////////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype_list"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); if (list_elements == null) list_elements = new ArrayList(); int32_const n = new int32_const(list_elements.Count); el.expressions.Add(n); if (list_elements.Count > 0) { el.expressions.Add(new string_const("list")); } else el.expressions.Add(new string_const("empty")); for (int i = 0; i < list_elements.Count; i++) el.expressions.Add(list_elements[i] as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference1)); list_param.Add(newexpr); return newexpr; } case (int)RuleConstants.RULE_LIST_PARAM_TKBOTTOMMINUS: //<list_param> ::= 'tkBottomMinus' { ident _ident = new ident("$$$" + bottom_num); list_param.Add(_ident); bottom_num++; return _ident; } case (int)RuleConstants.RULE_LIST_PARAM_TKIDENT_TKCOLON: //<list_param> ::= 'tkIdent' 'tkColon' <list_param> { list_param.Add(LRParser.GetReductionSyntaxNode(0)); return LRParser.GetReductionSyntaxNode(0); } case (int)RuleConstants.RULE_LIST_PARAM_TKBOTTOMMINUS_TKCOLON: //<list_param> ::= 'tkBottomMinus' 'tkColon' <list_param> { ident _ident = new ident("$$$" + bottom_num); list_param.Add(_ident); bottom_num++; return _ident; } case (int)RuleConstants.RULE_LIST_PARAM_TKROUNDOPEN_TKROUNDCLOSE: //<list_param> ::= 'tkRoundOpen' <list_param> 'tkRoundClose' { return LRParser.GetReductionSyntaxNode(1); } case (int)RuleConstants.RULE_GUARD : //<guard> ::= //NONTERMINAL:<guard> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_GUARD_TKSPLIT : //<guard> ::= 'tkSplit' <expr> return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_GUARD_TKSPLIT_TKOTHERWISE: //<guard> ::= 'tkSplit' 'tkOtherwise' { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.names.Add(idtype1); ///// expression_list el = new expression_list(); el.expressions.Add(new ident("true") as expression); literal lt; string text = "boolean"; lt = new string_const(text); el.expressions.Add(lt as expression); ///// named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference1)); return newexpr; } case (int)RuleConstants.RULE_MAIN_FUNC_TKMAINIDENT1_TKASSIGN : //<main_func> ::= 'tkMainIdent1' 'tkAssign' <body_func> { block _block=new block(null, null); statement_list sl=null; if (LRParser.GetReductionSyntaxNode(2) is statement_list) { sl = LRParser.GetReductionSyntaxNode(2) as statement_list; /////////////////////// ident_list il = new ident_list(); il.idents.Add(new ident("result")); named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); var_def_statement _var_def_statement = new var_def_statement(il, (type_definition)_named_type_reference1, null, definition_attribute.None, false); parsertools.create_source_context(_var_def_statement, il, _named_type_reference1); var_statement _var_statement = new var_statement(_var_def_statement); parsertools.create_source_context(_var_statement, null, _var_def_statement); sl.subnodes.Insert(0,_var_statement); ///////////////////////// } else { sl = new statement_list(); /////////////////////// ident_list il = new ident_list(); il.idents.Add(new ident("result")); named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); var_def_statement _var_def_statement = new var_def_statement(il, (type_definition)_named_type_reference1, null, definition_attribute.None, false); parsertools.create_source_context(_var_def_statement, il, _named_type_reference1); var_statement _var_statement = new var_statement(_var_def_statement); parsertools.create_source_context(_var_statement, null, _var_def_statement); sl.subnodes.Add(_var_statement); ///////////////////////// sl.subnodes.Add(LRParser.GetReductionSyntaxNode(2) as statement); if (!(LRParser.GetReductionSyntaxNode(2) is empty_statement)) parsertools.assign_source_context(sl, LRParser.GetReductionSyntaxNode(2)); } _block.program_code=sl; return _block; } case (int)RuleConstants.RULE_BODY_FUNC : //<body_func> ::= <stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_STMTS : //<stmts> ::= <stmt> <empty> <empty> { statement_list _statement_list=new statement_list(); _statement_list.subnodes.Add((statement)LRParser.GetReductionSyntaxNode(0)); parsertools.assign_source_context(_statement_list,LRParser.GetReductionSyntaxNode(0)); return _statement_list; } case (int)RuleConstants.RULE_STMTS_TKSEMICOLON : //<stmts> ::= <stmts> 'tkSemiColon' <stmt> { statement_list _statement_list; _statement_list=(statement_list)LRParser.GetReductionSyntaxNode(0); _statement_list.subnodes.Add((statement)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_statement_list,_statement_list,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1))); return _statement_list; } case (int)RuleConstants.RULE_STMTS1: //<stmts1> ::= <stmt> <empty> <empty> { statement_list _statement_list = new statement_list(); _statement_list.subnodes.Add((statement)LRParser.GetReductionSyntaxNode(0)); parsertools.assign_source_context(_statement_list, LRParser.GetReductionSyntaxNode(0)); return _statement_list; } case (int)RuleConstants.RULE_STMTS12: //<stmts1> ::= <stmts1> <stmt> { statement_list _statement_list; _statement_list = (statement_list)LRParser.GetReductionSyntaxNode(0); _statement_list.subnodes.Add((statement)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_statement_list, _statement_list, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(1))); return _statement_list; } case (int)RuleConstants.RULE_EXPR_TKEQUAL : //<expr> ::= <expr> 'tkEqual' <add_expr> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPR_TKNOTEQUAL: //<expr> ::= <expr> 'tkNotEqual' <add_expr> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPR_TKMORE : //<expr> ::= <expr> 'tkMore' <add_expr> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPR_TKLESS : //<expr> ::= <expr> 'tkLess' <add_expr> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPR_TKMOREEQ : //<expr> ::= <expr> 'tkMoreEq' <add_expr> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPR_TKLESSEQ : //<expr> ::= <expr> 'tkLessEq' <add_expr> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPR : //<expr> ::= <add_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIST_TKSQUAREOPEN_TKSQUARECLOSE : //<list> ::= 'tkSquareOpen' <list_elements> 'tkSquareClose' { ArrayList list_elements = (ArrayList)LRParser.GetReductionSyntaxNode(1); //////////////////////////////////////////////////////////proverka na type if (list_elements != null) { ArrayList types = new ArrayList(); for (int i = 0; i < list_elements.Count; i++) { string tp = ""; if (list_elements[i] is new_expr) { tp = ((string_const)((new_expr)list_elements[i]).params_list.expressions[1]).Value; if (!types.Contains(tp)) types.Add(tp); } } if ((types.Count == 2 && !(types.Contains("integer") && types.Contains("real"))) || types.Count > 2) { //errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, "одинаковый тип элементов списка")); errors.Add(new PascalABCCompiler.Errors.Error("элементы списка имеют разный тип")); return null; } } ////////////////////////////////////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype_list"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); if (list_elements == null) list_elements = new ArrayList(); int32_const n = new int32_const(list_elements.Count); el.expressions.Add(n); if (list_elements.Count > 0) { el.expressions.Add(new string_const("list")); } else el.expressions.Add(new string_const("empty")); for (int i = 0; i < list_elements.Count;i++ ) el.expressions.Add(list_elements[i] as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference1)); return newexpr; } case (int)RuleConstants.RULE_LIST_TKSQUAREOPEN_TKDOT_TKDOT_TKSQUARECLOSE : //<list> ::= 'tkSquareOpen' <list_elements> 'tkDot' 'tkDot' <simple_expr> 'tkSquareClose' {ArrayList list_elements = (ArrayList)LRParser.GetReductionSyntaxNode(1); //////////////////////////////////////////////////////////proverka na type ArrayList types = new ArrayList(); for (int i = 0; i < list_elements.Count; i++) { if (list_elements[i] is new_expr) { string tp = ((string_const)((new_expr)list_elements[i]).params_list.expressions[1]).Value; if (!types.Contains(tp)) types.Add(tp); } } if (LRParser.GetReductionSyntaxNode(4) is new_expr) { new_expr ex_last = (new_expr)LRParser.GetReductionSyntaxNode(4); string tp_last = ((string_const)ex_last.params_list.expressions[1]).Value; if (!types.Contains(tp_last)) types.Add(tp_last); } if ((types.Count == 2 && !(types.Contains("integer") && types.Contains("real"))) || types.Count > 2) { //errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, "одинаковый тип элементов списка")); errors.Add(new PascalABCCompiler.Errors.Error("элементы списка имеют разный тип")); return null; } if (list_elements.Count > 2) { errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, ".")); return null; } ////////////////////////////////////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype_list"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); el.expressions.Add(list_elements[0] as expression); if (list_elements.Count>1) el.expressions.Add(list_elements[1] as expression); el.expressions.Add(LRParser.GetReductionSyntaxNode(4) as expression); el.expressions.Add(new string_const("list")); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference1)); return newexpr; } case (int)RuleConstants.RULE_LIST_TKSQUAREOPEN_TKDOT_TKDOT_TKSQUARECLOSE2 : //<list> ::= 'tkSquareOpen' <list_elements> 'tkDot' 'tkDot' 'tkSquareClose' {ArrayList list_elements = (ArrayList)LRParser.GetReductionSyntaxNode(1); //////////////////////////////////////////////////////////proverka na type ArrayList types = new ArrayList(); for (int i = 0; i < list_elements.Count; i++) { if (list_elements[i] is new_expr) { string tp = ((string_const)((new_expr)list_elements[i]).params_list.expressions[1]).Value; if (!types.Contains(tp)) types.Add(tp); } } if (types.Count == 2 && !(types.Contains("integer") && types.Contains("real"))) { //errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, "одинаковый тип элементов списка")); errors.Add(new PascalABCCompiler.Errors.Error("элементы списка имеют разный тип")); return null; } if (list_elements.Count > 2) { errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, ".")); return null; } ////////////////////////////////////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype_list"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); el.expressions.Add(list_elements[0] as expression); el.expressions.Add(list_elements[1] as expression); named_type_reference _named_type_reference11 = new named_type_reference(); ident idtype11 = new ident("datatype"); _named_type_reference11.names.Add(idtype11); expression_list ell = new expression_list(); new_expr ee = list_elements[0] as new_expr; ell.expressions.Add(ee.params_list.expressions[0]); literal lt; string text = "nil"; lt = new string_const(text); ell.expressions.Add(lt as expression); named_type_reference ntrr = _named_type_reference11; new_expr newexprr = new new_expr(ntrr, ell, false, null); el.expressions.Add(newexprr); el.expressions.Add(new string_const("list")); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference1)); return newexpr;} case (int)RuleConstants.RULE_LIST: //<list> ::= <list_constructor> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIST_TKCOLON : //<list> ::= <simple_expr> 'tkColon' <empty> <simple_expr> {expression_list el = new expression_list(); el.expressions.Add(LRParser.GetReductionSyntaxNode(3) as expression); dot_node _dot_node = new dot_node(null, new ident("colon")); _dot_node.left = (addressed_value)LRParser.GetReductionSyntaxNode(0); method_call _method_call = new method_call(el); _method_call.dereferencing_value = (addressed_value)_dot_node; return _method_call;} case (int)RuleConstants.RULE_LIST_CONSTRUCTOR_TKSQUAREOPEN_TKSPLIT_TKSQUARECLOSE: //<list_constructor> ::= 'tkSquareOpen' <simple_expr> 'tkSplit' <generators> <conditions_comma> 'tkSquareClose' { ArrayList generators=(ArrayList)LRParser.GetReductionSyntaxNode(3); ArrayList conditions = (ArrayList)LRParser.GetReductionSyntaxNode(4); ////////////////////////////////////////////////////////////////////////// statement_list body = new statement_list(); rec_num = 0; for (int i = 0; i < generators.Count; i++) { ident id = null; if (((ArrayList)generators[i])[0] is new_expr) { constructor_rec_var(body, ((ArrayList)generators[i])[0] as new_expr); } else { id = (ident)((ArrayList)generators[i])[0]; ident_list _ident_list1 = new ident_list(); _ident_list1.idents.Add(id); string name_param2 = id.name; typed_parameters _typed_parametres2 = null; named_type_reference _named_type_reference3 = new named_type_reference(); ident idtype3 = new ident("datatype"); _named_type_reference3.names.Add(idtype3); var_def_statement _var_def_statement2 = new var_def_statement(_ident_list1, (type_definition)_named_type_reference3, null, definition_attribute.None, false); var_statement _var_statement2 = new var_statement(_var_def_statement2); body.subnodes.Add(_var_statement2); } } ///////////////////////////////////////////////////////////////////////result named_type_reference _named_type_reference2 = new named_type_reference(); ident idtype2 = new ident("datatype_list"); _named_type_reference2.names.Add(idtype2); expression_list el2 = new expression_list(); int32_const n = new int32_const(0); el2.expressions.Add(n); el2.expressions.Add(new string_const("list")); named_type_reference ntr = _named_type_reference2; new_expr newexpr = new new_expr(ntr, el2, false, null); assign _result = new assign(); _result.operator_type = Operators.Assignment; _result.to = new ident("result"); _result.from = newexpr; body.subnodes.Add(_result); //////////////////////////////////////////////////////////////////////if if_node _if_node = new if_node(); if (conditions != null) { expression b_e = (expression)conditions[conditions.Count - 1]; for (int i = conditions.Count - 2; i >= 0; i--) { bin_expr b_e1 = new bin_expr(); b_e1.operation_type = Operators.LogicalAND; b_e1.left = (expression)conditions[i]; b_e1.right = b_e; b_e = b_e1; } _if_node.condition = _ob(b_e); } //////////////////////////////////////////////////////////////////////assign statement_list stmt_list=new statement_list(); rec_num = 0; for (int i = 0; i < generators.Count; i++) { if (((ArrayList)generators[i])[0] is new_expr) { constructor_rec_ass(stmt_list, ((ArrayList)generators[i])[0] as new_expr, _index((expression)((ArrayList)generators[i])[1], new ident("$i" + i))); } else { assign _assign = new assign(); _assign.operator_type = Operators.Assignment; _assign.to = (ident)((ArrayList)generators[i])[0]; _assign.from = _index((expression)((ArrayList)generators[i])[1], new ident("$i" + i)); stmt_list.subnodes.Add(_assign); } } if (conditions != null) { _if_node.then_body = _add(new ident("result"), (expression)LRParser.GetReductionSyntaxNode(1)); stmt_list.subnodes.Add(_if_node); } else stmt_list.subnodes.Add(_add(new ident("result"), (expression)LRParser.GetReductionSyntaxNode(1))); //////////////////////////////////////////////////////////////////////for statement _for_stmt = stmt_list; for (int i = generators.Count - 1; i >= 0; i--) { for_node _for_node = new for_node(); _for_node.cycle_type = for_cycle_type.to; _for_node.loop_variable = new ident("$i"+i); named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("integer"); _named_type_reference.names.Add(idtype); _for_node.type_name = (type_definition)_named_type_reference; _for_node.initial_value = new int32_const(0); _for_node.finish_value = _count((expression)((ArrayList)generators[i])[1]); _for_node.increment_value = new int32_const(1); _for_node.statements = _for_stmt; _for_stmt = _for_node; } body.subnodes.Add(_for_stmt); ///////////////////////////////////////////////////////////////////////////////////////////////////////lambda formal_parameters _formal_parametres = null; ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = null; _procedure_definition.proc_body = null; _procedure_definition.parameters = null; _procedure_definition.lambda_name = "__lambda__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, null, null, null, "lambda" + lambda_num); _procedure_definition.proc_body = body; procedure_definition pr = lambda(_procedure_definition); //_function_lambda_definitions.Add(_procedure_definition);//////////////// let_funcs.Add(pr); let_where_funcs.Add(pr); if (let_flag.Count > 0) let_func_last.Add(pr); expression_list el = new expression_list(); let_fact_params.Clear(); return new ident(_procedure_definition.lambda_name); } case (int)RuleConstants.RULE_GENERATORS: //<generators> ::= <generator> <empty> { ArrayList ar = new ArrayList(); ar.Add(LRParser.GetReductionSyntaxNode(0)); return ar; } case (int)RuleConstants.RULE_GENERATORS_TKCOMMA: //<generators> ::= <generators> 'tkComma' <generator> { ArrayList ar = (ArrayList)LRParser.GetReductionSyntaxNode(0); ar.Add(LRParser.GetReductionSyntaxNode(2)); return ar; } case (int)RuleConstants.RULE_GENERATOR_TKARROWGEN: //<generator> ::= <simple_expr> 'tkArrowGen' <simple_expr> { ArrayList ar = new ArrayList(); ar.Add(LRParser.GetReductionSyntaxNode(0)); ar.Add(LRParser.GetReductionSyntaxNode(2)); return ar; } case (int)RuleConstants.RULE_CONDITIONS_COMMA: //<conditions_comma> ::= <empty> { return null; } case (int)RuleConstants.RULE_CONDITIONS_COMMA_TKCOMMA: //<conditions_comma> ::= 'tkComma' <conditions> { return LRParser.GetReductionSyntaxNode(1); } case (int)RuleConstants.RULE_CONDITIONS: //<conditions> ::= <condition> <empty> { ArrayList ar = new ArrayList(); ar.Add(LRParser.GetReductionSyntaxNode(0)); return ar; } case (int)RuleConstants.RULE_CONDITIONS_TKCOMMA: //<conditions> ::= <conditions> 'tkComma' <condition> { ArrayList ar = (ArrayList)LRParser.GetReductionSyntaxNode(0); ar.Add(LRParser.GetReductionSyntaxNode(2)); return ar; } case (int)RuleConstants.RULE_CONDITION: //<condition> ::= <expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CORTEG_TKROUNDOPEN_TKCOMMA_TKROUNDCLOSE: //<corteg> ::= 'tkRoundOpen' <simple_expr> 'tkComma' <list_elements> 'tkRoundClose' { //new_expr first_el = (new_expr)LRParser.GetReductionSyntaxNode(1); ArrayList list_elements = (ArrayList)LRParser.GetReductionSyntaxNode(3); list_elements.Insert(0, LRParser.GetReductionSyntaxNode(1)); named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype_list"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); if (list_elements == null) list_elements = new ArrayList(); int32_const n = new int32_const(list_elements.Count); el.expressions.Add(n); if (list_elements.Count > 0) { el.expressions.Add(new string_const("corteg")); } else el.expressions.Add(new string_const("empty")); for (int i = 0; i < list_elements.Count; i++) el.expressions.Add(list_elements[i] as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference1)); return newexpr; } case (int)RuleConstants.RULE_LIST_ELEMENTS : //<list_elements> ::= <empty> return null; case (int)RuleConstants.RULE_LIST_ELEMENTS2 : //<list_elements> ::= <simple_expr> <empty> { ArrayList list_elements = new ArrayList(); list_elements.Add(LRParser.GetReductionSyntaxNode(0)); return list_elements; } case (int)RuleConstants.RULE_LIST_ELEMENTS_TKCOMMA : //<list_elements> ::= <list_elements> 'tkComma' <simple_expr> { ((ArrayList)LRParser.GetReductionSyntaxNode(0)).Add(LRParser.GetReductionSyntaxNode(2)); return LRParser.GetReductionSyntaxNode(0); } case (int)RuleConstants.RULE_ADD_EXPR_TKAND : //<add_expr> ::= <add_expr> 'tkAnd' <mult_expr> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_ADD_EXPR : //<add_expr> ::= <add_expr> <addop> <mult_expr> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_ADD_EXPR2 : //<add_expr> ::= <mult_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULT_EXPR_TKOR : //<mult_expr> ::= <mult_expr> 'tkOr' <negate_expr> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_MULT_EXPR : //<mult_expr> ::= <mult_expr> <multop> <negate_expr> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_MULT_EXPR2 : //<mult_expr> ::= <negate_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NEGATE_EXPR_TKMINUS : //<negate_expr> ::= 'tkMinus' <simple_expr> { un_expr _un_expr=new un_expr(LRParser.GetReductionSyntaxNode(1) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(0)).type); parsertools.create_source_context(_un_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _un_expr; } case (int)RuleConstants.RULE_NEGATE_EXPR_TKNOT : //<negate_expr> ::= 'tkNot' <simple_expr> { un_expr _un_expr=new un_expr(LRParser.GetReductionSyntaxNode(1) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(0)).type); parsertools.create_source_context(_un_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _un_expr; } case (int)RuleConstants.RULE_NEGATE_EXPR : //<negate_expr> ::= <simple_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_EXPR: //<simple_expr> ::= <simple_type_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_TYPE_EXPR_TKINT: //<simple_type_expr> ::= 'tkInt' { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///// expression_list el = new expression_list(); el.expressions.Add(LRParser.GetReductionSyntaxNode(0) as expression); literal lt; string text = "integer"; lt = new string_const(text); el.expressions.Add(lt as expression); ///// named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false,null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference1)); return newexpr; } case (int)RuleConstants.RULE_SIMPLE_TYPE_EXPR_TKDOUBLE: //<simple_type_expr> ::= 'tkDouble' { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///// expression_list el = new expression_list(); el.expressions.Add(LRParser.GetReductionSyntaxNode(0) as expression); literal lt; string text = "real"; lt = new string_const(text); el.expressions.Add(lt as expression); ///// named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false,null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference1)); return newexpr; } case (int)RuleConstants.RULE_SIMPLE_TYPE_EXPR_TKBOOL: //<simple_type_expr> ::= 'tkBool' { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///// expression_list el = new expression_list(); el.expressions.Add(LRParser.GetReductionSyntaxNode(0) as expression); literal lt; string text = "boolean"; lt = new string_const(text); el.expressions.Add(lt as expression); ///// named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false,null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference1)); return newexpr; } case (int)RuleConstants.RULE_SIMPLE_TYPE_EXPR_TKCHAR: //<simple_type_expr> ::= 'tkChar' { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///// expression_list el = new expression_list(); el.expressions.Add(LRParser.GetReductionSyntaxNode(0) as expression); literal lt; string text = "char"; lt = new string_const(text); el.expressions.Add(lt as expression); ///// named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false,null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference1)); return newexpr; } case (int)RuleConstants.RULE_SIMPLE_TYPE_EXPR_TKSTRING: //<simple_type_expr> ::= 'tkString' { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///// expression_list el = new expression_list(); el.expressions.Add(LRParser.GetReductionSyntaxNode(0) as expression); literal lt; string text = "string"; lt = new string_const(text); el.expressions.Add(lt as expression); ///// named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false,null); parsertools.create_source_context(newexpr, new ident("new"), parsertools.sc_not_null(el, _named_type_reference1)); return newexpr; } case (int)RuleConstants.RULE_SIMPLE_EXPR_TKROUNDOPEN_TKROUNDCLOSE : //<simple_expr> ::= 'tkRoundOpen' <expr> 'tkRoundClose' return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_SIMPLE_EXPR2: //<simple_expr> ::= <infix_expr> <empty> { if (LRParser.GetReductionSyntaxNode(0) is ArrayList) { ////////////////////////////////////////////////////////ident_params ArrayList arr = (ArrayList)LRParser.GetReductionSyntaxNode(0); ident _ident = (ident)arr[0]; expression_list el = new expression_list(); for (int ii = 1; ii < arr.Count; ii++) el.expressions.Add((expression)arr[ii]); //////////////////////////////////////////////////////// //expression_list el = LRParser.GetReductionSyntaxNode(2) as expression_list; ////////////////////////////for curring int n = el.expressions.Count; int fld_params_count = find_count_params(_ident.name); //////////////////////////// if (fld_params_count - n > 0) { expression_list _expression_list = el; expression_list _params = new expression_list(); expression_list _params_el = new expression_list(); for (int i = 0; i < list_params1.Count; i++) if (list_params1[i] is ident) { _params.expressions.Add(new ident(((ident)list_params1[i]).name)); _params_el.expressions.Add(new ident(((ident)list_params1[i]).name)); } for (int i = 1; i <= fld_params_count - n; i++) _expression_list.expressions.Add(new ident("$$" + i)); for (int i = 1; i <= fld_params_count - n; i++) { _params.expressions.Add(new ident("$$" + i)); _params_el.expressions.Add(new ident("$$" + i)); } method_call _method_call = new method_call(_expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_ident; op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), _method_call as expression, _op_type_node.type); statement_list _statement_list = new statement_list(); _statement_list.subnodes.Add(_assign); //////////////////////////// ident_list i_l = new ident_list(); for (int i = 1; i <= fld_params_count - n; i++) i_l.idents.Add(new ident("$$" + i)); ///////////////////////////// formal_parameters _formal_parametres = new formal_parameters(); for (int i = 0; i < _params.expressions.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_params.expressions[i]; _ident_list.idents.Add(id); named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); _formal_parametres.params_list.Add(_typed_parametres); } ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = i_l; _procedure_definition.proc_body = null; _procedure_definition.parameters = _params_el; _procedure_definition.lambda_name = "__lambda__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, i_l, null, _params_el, "lambda" + lambda_num); object rt = _expression_list; _procedure_definition.proc_body = _statement_list; _function_lambda_definitions_after.Add(_procedure_definition); _function_lambda_definitions_after.Add(_ident.name);//////////////// last_function_lambda_definitions.Add(_procedure_definition); return new ident(_procedure_definition.lambda_name); } else { method_call _method_call = new method_call(el); if (_method_call is dereference) { ((dereference)_method_call).dereferencing_value = (addressed_value)_ident; parsertools.create_source_context(_method_call, _ident, _method_call); } list_method_calls.Add(_method_call); last_list_method_calls.Add(_method_call); last_list_method_calls_lambda.Add(_method_call); return _method_call; } } else return LRParser.GetReductionSyntaxNode(0); } case (int)RuleConstants.RULE_SIMPLE_EXPR3 : //<simple_expr> ::= <variable> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_EXPR_TKLET_TKIN : //<simple_expr> ::= 'tkLet' <def_vars> 'tkIn' <body_func> {////////////////////////// expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(1); statement_list _statement_list = (statement_list)LRParser.GetReductionSyntaxNode(3); ////////////////////////// formal_parameters _formal_parametres = null; ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = null; _procedure_definition.proc_body = null; _procedure_definition.parameters = _expression_list; _procedure_definition.lambda_name = "__lambda__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, null, null, _expression_list, "lambda" + lambda_num); object rt = _expression_list; _procedure_definition.proc_body = _statement_list; parsertools.create_source_context(_procedure_definition, _expression_list, rt); procedure_definition pr = lambda(_procedure_definition); //_function_lambda_definitions.Add(_procedure_definition);//////////////// ((block)pr.proc_body).defs = new declarations(); int start=0; int k = let_funcs.Count-1; while (k>0 && ((procedure_definition)let_funcs[k]).proc_header.name.meth_name.name.Contains("__lambda__")) k--; int kk = 0; while (k > 0 && kk < _expression_list.expressions.Count-1 && !((procedure_definition)let_funcs[k]).proc_header.name.meth_name.name.Contains("__lambda__")) { k--; kk++; } start = k; int i = start; int n = let_funcs.Count; while (i < n) { if (let_where_funcs.Count > 0) if (start - (let_funcs.Count - let_where_funcs.Count) >= 0) let_where_funcs.RemoveAt(start - (let_funcs.Count - let_where_funcs.Count)); else let_where_funcs.RemoveAt(let_where_funcs.Count - 1); ((block)pr.proc_body).defs.defs.Add((procedure_definition)let_funcs[start]); let_funcs.RemoveAt(start); i++; } ///////////////////////////lambda if (((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count > 0) { if (((block)pr.proc_body).defs==null) ((block)pr.proc_body).defs = new declarations(); for (int ii = 0; ii < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; ii++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)((ArrayList)lambda_stack[lambda_stack.Count - 1])[ii]); for (int ii = 0; ii < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; ii++) _function_lambda_definitions.RemoveAt(_function_lambda_definitions.Count-1); } lambda_stack.RemoveAt(lambda_stack.Count - 1); //lambda_stack.RemoveAt(lambda_stack.Count - 1); /*if (((block)pr.proc_body).defs == null) ((block)pr.proc_body).defs = new declarations(); for (int ii = 0; ii < _function_lambda_definitions.Count; ii++) ((block)pr.proc_body).defs.defs.Add(lambda((function_lambda_definition)_function_lambda_definitions[ii])); _function_lambda_definitions.Clear();*/ /////////////////////////// let_funcs.Add(pr); let_where_funcs.Add(pr); if (let_flag.Count>0) let_func_last.Add(pr); expression_list el = new expression_list(); let_fact_params.Clear(); ///////////////////// if (let_stack.Count > 0) ((ArrayList)let_stack[let_stack.Count - 1]).Add(pr); /*else { let_funcs.Add(pr); let_where_funcs.Add(pr); }*/ ///////////////////// return new ident(_procedure_definition.lambda_name); } case (int)RuleConstants.RULE_SIMPLE_EXPR4 : //<simple_expr> ::= <list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_EXPR5: //<simple_expr> ::= <corteg> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_EXPR6 : //<simple_expr> ::= <lambda_func> <empty> return LRParser.GetReductionSyntaxNode(0); //case (int)RuleConstants.RULE_SIMPLE_EXPR_TKROUNDOPEN_TKROUNDCLOSE_TKROUNDOPEN_TKROUNDCLOSE : //<simple_expr> ::= 'tkRoundOpen' <lambda_func> 'tkRoundClose' 'tkRoundOpen' <params_value> 'tkRoundClose' case (int)RuleConstants.RULE_SIMPLE_EXPR_TKROUNDOPEN_TKROUNDOPEN_TKROUNDCLOSE_TKROUNDCLOSE: //<simple_expr> ::= 'tkRoundOpen' 'tkRoundOpen' <lambda_func> 'tkRoundClose' <params_value> 'tkRoundClose' { function_lambda_definition fld = find_func_lambda_name(((ident)LRParser.GetReductionSyntaxNode(2)).name); //function_lambda_definition fld = find_lambda_funcs(((ident)LRParser.GetReductionSyntaxNode(1)).name); //lambda_funcs.RemoveAt(lambda_funcs.Count-1); expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(4); function_lambda_definition _lambda_definition = fld; function_lambda_call _lambda_call = new function_lambda_call(_lambda_definition, _expression_list); return _lambda_call; } /*case (int)RuleConstants.RULE_SIMPLE_EXPR_TKROUNDOPEN_TKROUNDCLOSE2 : //<simple_expr> ::= <simple_expr> 'tkRoundOpen' <params_value> 'tkRoundClose' { if (LRParser.GetReductionSyntaxNode(0) is function_lambda_call) { expression_list _expression_list = new expression_list(); expression_list el_new = (expression_list)LRParser.GetReductionSyntaxNode(2); function_lambda_call _lambda_definition_call = (function_lambda_call)LRParser.GetReductionSyntaxNode(0); function_lambda_definition fld = _lambda_definition_call.f_lambda_def; for (int i = 0; i < _lambda_definition_call.parameters.expressions.Count; i++) _expression_list.expressions.Add(_lambda_definition_call.parameters.expressions[i]); for (int i = 0; i < el_new.expressions.Count; i++) _expression_list.expressions.Add(el_new.expressions[i]); function_lambda_call _lambda_call = new function_lambda_call(fld, _expression_list); return _lambda_call; } else return null;}*/ case (int)RuleConstants.RULE_VARIABLE_EXPR : //<variable_expr> ::= <simple_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_DEF_VARS : //<def_vars> ::= <def_var> <empty> { expression_list el=new expression_list(); el.expressions.Add(LRParser.GetReductionSyntaxNode(0) as expression); return el; } case (int)RuleConstants.RULE_DEF_VARS_TKSEMICOLON : //<def_vars> ::= <def_vars> 'tkSemiColon' <def_var> { expression_list el=(expression_list)LRParser.GetReductionSyntaxNode(0); el.expressions.Add(LRParser.GetReductionSyntaxNode(2) as expression); return el; } case (int)RuleConstants.RULE_DEF_VAR_TKIDENT: //<def_var> ::= 'tkIdent' <params> <guard_body_list> <where_var> { expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(1); /*statement_list _statement_list = (statement_list)LRParser.GetReductionSyntaxNode(4);*/ statement_list _statement_list = new statement_list(); ArrayList ar_main = (ArrayList)LRParser.GetReductionSyntaxNode(2); ////////////////////////////for list statement_list stmt_l = new statement_list(); int start = let_where_list_params.Count; if (_expression_list != null) start = let_where_list_params.Count - _expression_list.expressions.Count; int i_ex = 0; for (int ll = start; ll < let_where_list_params.Count; ll++) { for (int l = 0; l < ((ArrayList)let_where_list_params[ll]).Count; l++) { ident_list il1 = new ident_list(); il1.idents.Add(new ident(((ident)((ArrayList)let_where_list_params[ll])[l]).name)); named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.names.Add(idtype1); var_def_statement _var_def_statement = new var_def_statement(il1, (type_definition)_named_type_reference1, null, definition_attribute.None, false); var_statement _var_statement = new var_statement(_var_def_statement); stmt_l.subnodes.Add(_var_statement); } if (((ArrayList)let_where_list_params[ll]).Count > 0) { op_type_node _op_type_node = new op_type_node(Operators.Assignment); dot_node _dot_node = new dot_node(null, (addressed_value)(new ident("head"))); ident id = _expression_list.expressions[i_ex] as ident; /*for (int i1 = 0; i1 < ((ArrayList)let_where_list_params[ll]).Count; i1++) id.name += ((ident)((ArrayList)let_where_list_params[ll])[i1]).name;*/ if (id.name != null) { _dot_node.left = (addressed_value)(id); object o = null; method_call _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node; assign _assign1 = new assign(((ident)((ArrayList)let_where_list_params[ll])[((ArrayList)let_where_list_params[ll]).Count - 1]) as addressed_value, _method_call as expression, _op_type_node.type); stmt_l.subnodes.Add(_assign1); /// for (int i1 = ((ArrayList)let_where_list_params[ll]).Count - 2; i1 > 0; i1--) { _dot_node = new dot_node((addressed_value)id, (addressed_value)(new ident("tail"))); for (int j1 = 0; j1 < ((ArrayList)let_where_list_params[ll]).Count - 2 - i1; j1++) { _dot_node = new dot_node(_dot_node, (addressed_value)(new ident("tail"))); } _dot_node = new dot_node(_dot_node, (addressed_value)(new ident("head"))); _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node; _assign1 = new assign(((ident)((ArrayList)let_where_list_params[ll])[i1]) as addressed_value, _method_call as expression, _op_type_node.type); stmt_l.subnodes.Add(_assign1); } _dot_node = new dot_node((addressed_value)id, (addressed_value)(new ident("tail"))); for (int j1 = 0; j1 < ((ArrayList)let_where_list_params[ll]).Count - 2; j1++) { _dot_node = new dot_node(_dot_node, (addressed_value)(new ident("tail"))); } _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node; _assign1 = new assign(((ident)((ArrayList)let_where_list_params[ll])[0]) as addressed_value, _method_call as expression, _op_type_node.type); stmt_l.subnodes.Add(_assign1); } } i_ex++; } for (int ll = 0; ll < let_where_list_params.Count - start; ll++) list_params_temp.RemoveAt(list_params_temp.Count - 1); for (int i = stmt_l.subnodes.Count - 1; i >= 0; i--) _statement_list.subnodes.Insert(0, stmt_l.subnodes[i]); if (_expression_list != null) for (int i = 0; i < _expression_list.expressions.Count; i++) let_where_list_params.RemoveAt(let_where_list_params.Count - 1); //////////////////////////// formal_parameters _formal_parametres = null; ident_list i_l = new ident_list(); if (_expression_list != null) { for (int i = 0; i < _expression_list.expressions.Count; i++) i_l.idents.Add((ident)_expression_list.expressions[i]); ///////////////////////////// _formal_parametres = new formal_parameters(); for (int i = 0; i < i_l.idents.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_expression_list.expressions[i]; _ident_list.idents.Add(id); string name_param = id.name; typed_parameters _typed_parametres = null; int k = 0; while (k < last_list_method_calls_lambda.Count && ((ident)((method_call)last_list_method_calls_lambda[k]).dereferencing_value).name != name_param) k++; if (k < last_list_method_calls_lambda.Count) _typed_parametres = new typed_parameters(_ident_list, func_type(((method_call)last_list_method_calls_lambda[k]).parameters.expressions.Count), parametr_kind.none, null); else { named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); } _formal_parametres.params_list.Add(_typed_parametres); } } ////////////////////////// named_type_reference _n_t_r = new named_type_reference(); ident it = new ident("datatype"); _n_t_r.names.Add(it); ///////////////////////////// //lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_n_t_r; _procedure_definition.ident_list = i_l; _procedure_definition.proc_body = null; _procedure_definition.parameters = _expression_list; _procedure_definition.lambda_name = ((ident)LRParser.GetReductionSyntaxNode(0)).name; //new function_lambda_definition(_formal_parametres, (type_definition)_n_t_r, i_l, null, _expression_list, ((ident)LRParser.GetReductionSyntaxNode(0)).name); object rt = _expression_list; ////////////////////////////////////////////////for guard for (int i = 0; i < ar_main.Count;i++ ) if (((ArrayList)ar_main[i])[0] != null) { if_node _if_node = new if_node(); _if_node.condition = _ob((expression)((ArrayList)ar_main[i])[0]); _if_node.then_body = new statement_list(); _if_node.then_body = (statement)((ArrayList)ar_main[i])[1]; procedure_call _exit = new procedure_call(new ident("exit") as addressed_value); ((statement_list)_if_node.then_body).subnodes.Add(_exit); _statement_list.subnodes.Add(_if_node); } else { _statement_list.subnodes.Add((statement)((ArrayList)ar_main[i])[1]); procedure_call _exit = new procedure_call(new ident("exit") as addressed_value); _statement_list.subnodes.Add(_exit); } //////////////////////////////////////////////// _procedure_definition.proc_body = _statement_list; parsertools.create_source_context(_procedure_definition, _expression_list, rt); procedure_definition pr = lambda(_procedure_definition); /////////////////////////// /*if (let_func_last.Count > 0) { ((block)pr.proc_body).defs = new declarations(); for (int i = 0; i < let_func_last.Count; i++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)let_func_last[i]); for (int i = 0; i < let_func_last.Count; i++) if (let_where_funcs.Count > 0) let_where_funcs.RemoveAt(let_where_funcs.Count - 1); for (int i = 0; i < let_func_last.Count; i++) let_funcs.RemoveAt(let_funcs.Count - 1); let_func_last.Clear(); let_flag.RemoveAt(let_flag.Count - 1); } else if ((let_flag.Count > 0 && _expression_list != null) || let_funcs.Count == 0) let_flag.Clear();*/ if (((ArrayList)let_stack[let_stack.Count - 1]).Count > 0) { ((block)pr.proc_body).defs = new declarations(); for (int i = 0; i < ((ArrayList)let_stack[let_stack.Count - 1]).Count; i++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)((ArrayList)let_stack[let_stack.Count - 1])[i]); for (int i = 0; i < ((ArrayList)let_stack[let_stack.Count - 1]).Count; i++) if (let_where_funcs.Count > 0) let_where_funcs.RemoveAt(let_where_funcs.Count - 1); for (int i = 0; i < ((ArrayList)let_stack[let_stack.Count - 1]).Count; i++) if (let_funcs.Count > 0) let_funcs.RemoveAt(let_funcs.Count - 1); let_func_last.Clear(); if (let_flag.Count>0) let_flag.RemoveAt(let_flag.Count - 1); } let_stack.RemoveAt(let_stack.Count - 1); /////////////////////////////////////////////////////////////////// if (LRParser.GetReductionSyntaxNode(3) != null) { if (((block)pr.proc_body).defs == null) ((block)pr.proc_body).defs = new declarations(); for (int j = 0; j < ((ArrayList)LRParser.GetReductionSyntaxNode(3)).Count; j++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)((ArrayList)LRParser.GetReductionSyntaxNode(3))[j]); ArrayList ar = ((ArrayList)let_where_funcs_main[let_where_funcs_main.Count - 1]).Clone() as ArrayList; for (int j = 0; j < ar.Count; j++) last_where_funcs.Add(ar[j]); let_where_funcs_main.RemoveAt(let_where_funcs_main.Count - 1); } ///////////////////////////lambda if (((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count > 0) { if (((block)pr.proc_body).defs == null) ((block)pr.proc_body).defs = new declarations(); for (int i = 0; i < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; i++) ((block)pr.proc_body).defs.defs.Add((procedure_definition)((ArrayList)lambda_stack[lambda_stack.Count - 1])[i]); for (int ii = 0; ii < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; ii++) _function_lambda_definitions.RemoveAt(_function_lambda_definitions.Count - 1); } lambda_stack.RemoveAt(lambda_stack.Count - 1); /////////////////////////// let_funcs.Add(pr); let_where_funcs.Add(pr); //let_funcs1.Add(_procedure_definition); //_function_lambda_definitions.Add(_procedure_definition);//////////////// let_fact_params.Add(_procedure_definition.lambda_name); return new ident(((ident)LRParser.GetReductionSyntaxNode(0)).name); } case (int)RuleConstants.RULE_GUARD_BODY_LIST: //<guard_body_list> ::= <guard_body> <empty> { ArrayList ar = (ArrayList)LRParser.GetReductionSyntaxNode(0); ArrayList ar_main = new ArrayList(); ar_main.Add(ar); return ar_main; } case (int)RuleConstants.RULE_GUARD_BODY_LIST2: //<guard_body_list> ::= <guard_body_list> <guard_body> { ArrayList ar_main = (ArrayList)LRParser.GetReductionSyntaxNode(0); ar_main.Add(LRParser.GetReductionSyntaxNode(1)); return ar_main; } case (int)RuleConstants.RULE_GUARD_BODY_TKASSIGN: //<guard_body> ::= <guard> 'tkAssign' <body_func> { ArrayList ar = new ArrayList(); ar.Add(LRParser.GetReductionSyntaxNode(0)); ar.Add(LRParser.GetReductionSyntaxNode(2)); return ar; } case (int)RuleConstants.RULE_VARIABLE_TKIDENT: //<variable> ::= 'tkIdent' { if (token_where==1) token_where = 2; if (((ident)LRParser.GetReductionSyntaxNode(0)).name=="pi") { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.names.Add(idtype1); expression_list ell = new expression_list(); ell.expressions.Add(LRParser.GetReductionSyntaxNode(0) as expression); ell.expressions.Add(new string_const("real") as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, ell, false, null); return newexpr; } else return LRParser.GetReductionSyntaxNode(0); } case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKIDENT_TKROUNDCLOSE: //<variable> ::= 'tkRoundOpen' 'tkIdent' <params_value> 'tkRoundClose' { expression_list el = LRParser.GetReductionSyntaxNode(2) as expression_list; ////////////////////////////for curring int n = el.expressions.Count; int fld_params_count = find_count_params(((ident)LRParser.GetReductionSyntaxNode(1)).name); //////////////////////////// if (fld_params_count - n > 0) { expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(2); expression_list _params = new expression_list(); expression_list _params_el = new expression_list(); for (int i = 0; i < list_params1.Count; i++) if (list_params1[i] is ident) { _params.expressions.Add(new ident(((ident)list_params1[i]).name)); _params_el.expressions.Add(new ident(((ident)list_params1[i]).name)); } for (int i = 1; i <= fld_params_count - n; i++) _expression_list.expressions.Add(new ident("$$" + i)); for (int i = 1; i <= fld_params_count - n; i++) { _params.expressions.Add(new ident("$$" + i)); _params_el.expressions.Add(new ident("$$" + i)); } method_call _method_call = new method_call(_expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(1); op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), _method_call as expression, _op_type_node.type); statement_list _statement_list = new statement_list(); _statement_list.subnodes.Add(_assign); //////////////////////////// ident_list i_l = new ident_list(); for (int i = 1; i <= fld_params_count - n; i++) i_l.idents.Add(new ident("$$" + i)); ///////////////////////////// formal_parameters _formal_parametres = new formal_parameters(); for (int i = 0; i < _params.expressions.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_params.expressions[i]; _ident_list.idents.Add(id); named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); _formal_parametres.params_list.Add(_typed_parametres); } ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = i_l; _procedure_definition.proc_body = null; _procedure_definition.parameters = _params_el; _procedure_definition.lambda_name = "__lambda__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, i_l, null, _params_el, "lambda" + lambda_num); object rt = _expression_list; _procedure_definition.proc_body = _statement_list; _function_lambda_definitions_after.Add(_procedure_definition); _function_lambda_definitions_after.Add(((ident)LRParser.GetReductionSyntaxNode(1)).name);//////////////// last_function_lambda_definitions.Add(_procedure_definition); return new ident(_procedure_definition.lambda_name); } else { method_call _method_call = null; string name = ((ident)LRParser.GetReductionSyntaxNode(1)).name; if (name == "cos" || name == "sin" || name == "tan") { bin_expr b_e = new bin_expr(); b_e.operation_type = Operators.Plus; b_e.left = el.expressions[0]; named_type_reference _named_type_reference2 = new named_type_reference(); ident idtype2 = new ident("datatype"); _named_type_reference2.names.Add(idtype2); expression_list ell2 = new expression_list(); ell2.expressions.Add(new double_const(0.0)); ell2.expressions.Add(new string_const("real") as expression); named_type_reference ntr2 = _named_type_reference2; b_e.right = new new_expr(ntr2, ell2, false, null); ////////////////////////////////// dot_node d_n = new dot_node(); d_n.left = (addressed_value)b_e; d_n.right = new ident("ob"); expression_list el1 = new expression_list(); el1.expressions.Add(d_n); method_call m_c = new method_call(el1); m_c.dereferencing_value = new ident("real"); /////////////////////////////////// expression_list el2 = new expression_list(); el2.expressions.Add(m_c); _method_call = new method_call(el2); _method_call.dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(1); named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.names.Add(idtype1); expression_list ell = new expression_list(); ell.expressions.Add(_method_call as expression); ell.expressions.Add(new string_const("real") as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, ell, false, null); return newexpr; } else { _method_call = new method_call(el); if (_method_call is dereference) { ((dereference)_method_call).dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(1); parsertools.create_source_context(_method_call, LRParser.GetReductionSyntaxNode(1), _method_call); } list_method_calls.Add(_method_call); last_list_method_calls.Add(_method_call); last_list_method_calls_lambda.Add(_method_call); return _method_call; } } } //case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKROUNDCLOSE_TKROUNDOPEN_TKROUNDCLOSE: //<variable> ::= 'tkRoundOpen' <variable> 'tkRoundClose' 'tkRoundOpen' <params_value> 'tkRoundClose' case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKROUNDCLOSE: //<variable> ::= 'tkRoundOpen' <variable> <params_value> 'tkRoundClose' { if (LRParser.GetReductionSyntaxNode(1) is ident) { expression_list el = LRParser.GetReductionSyntaxNode(2) as expression_list; int n = el.expressions.Count; int fld_params_count = find_count_params_lambda(((ident)LRParser.GetReductionSyntaxNode(1)).name); if (_function_lambda_definitions_after.Count > 0) { function_lambda_definition fld = (function_lambda_definition)_function_lambda_definitions_after[_function_lambda_definitions_after.Count - 2]; for (int i = 0; i < fld.formal_parameters.params_list.Count; i++) if (!fld.formal_parameters.params_list[i].idents.idents[0].name.Contains("$")) n++; } //////////////////////////// if (fld_params_count - n > 0) { expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(2); expression_list _params = new expression_list(); expression_list _params_el = new expression_list(); for (int i = 0; i < list_params1.Count; i++) if (list_params1[i] is ident) { _params.expressions.Add(new ident(((ident)list_params1[i]).name)); _params_el.expressions.Add(new ident(((ident)list_params1[i]).name)); } for (int i = 1; i <= fld_params_count - n; i++) _expression_list.expressions.Add(new ident("$$" + i)); for (int i = 1; i <= fld_params_count - n; i++) { _params.expressions.Add(new ident("$$" + i)); _params_el.expressions.Add(new ident("$$" + i)); } method_call _method_call = new method_call(_expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(1); op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), _method_call as expression, _op_type_node.type); statement_list _statement_list = new statement_list(); _statement_list.subnodes.Add(_assign); //////////////////////////// ident_list i_l = new ident_list(); for (int i = 1; i <= fld_params_count - n; i++) i_l.idents.Add(new ident("$$" + i)); ///////////////////////////// formal_parameters _formal_parametres = new formal_parameters(); for (int i = 0; i < _params.expressions.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_params.expressions[i]; _ident_list.idents.Add(id); named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); _formal_parametres.params_list.Add(_typed_parametres); } ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = i_l; _procedure_definition.proc_body = null; _procedure_definition.parameters = _params_el; _procedure_definition.lambda_name = "__lambda__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, i_l, null, _params_el, "lambda" + lambda_num); object rt = _expression_list; _procedure_definition.proc_body = _statement_list; _function_lambda_definitions_after.Add(_procedure_definition); _function_lambda_definitions_after.Add(((ident)LRParser.GetReductionSyntaxNode(1)).name);//////////////// last_function_lambda_definitions.Add(_procedure_definition); return new ident(_procedure_definition.lambda_name); } else { for (int i = list_params1.Count - 1; i >= 0; i--) if (list_params1[i] is ident) { el.expressions.Insert(0, (new ident(((ident)list_params1[i]).name))); } method_call _method_call = new method_call(el); if (_method_call is dereference) { ((dereference)_method_call).dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(1); } list_method_calls.Add(_method_call); last_list_method_calls.Add(_method_call); last_list_method_calls_lambda.Add(_method_call); return _method_call; } } else { if (LRParser.GetReductionSyntaxNode(1) is method_call) { method_call mc = LRParser.GetReductionSyntaxNode(1) as method_call; expression_list el = LRParser.GetReductionSyntaxNode(2) as expression_list; expression_list _expression_list = new expression_list(); for (int i = 0; i < mc.parameters.expressions.Count; i++) _expression_list.expressions.Add(mc.parameters.expressions[i]); for (int i = 0; i < el.expressions.Count; i++) _expression_list.expressions.Add(el.expressions[i]); method_call _method_call = new method_call(_expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)(new ident(((ident)mc.dereferencing_value).name)); list_method_calls.RemoveAt(list_method_calls.Count - 1); list_method_calls.Add(_method_call); last_list_method_calls.Add(_method_call); last_list_method_calls_lambda.RemoveAt(last_list_method_calls_lambda.Count - 1); last_list_method_calls_lambda.Add(_method_call); return _method_call; } else return null; } } case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE: //<variable> ::= 'tkRoundtkOpen' 'tkQuote' 'tkIdent' 'tkQuote' <params_value> 'tkRoundClose' { expression_list el = LRParser.GetReductionSyntaxNode(4) as expression_list; ////////////////////////////for curring int n = el.expressions.Count; int fld_params_count = find_count_params(((ident)LRParser.GetReductionSyntaxNode(2)).name); //////////////////////////// if (fld_params_count - n > 0) { expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(4); expression_list _params = new expression_list(); expression_list _params_el = new expression_list(); for (int i = 0; i < list_params1.Count; i++) if (list_params1[i] is ident) { _params.expressions.Add(new ident(((ident)list_params1[i]).name)); _params_el.expressions.Add(new ident(((ident)list_params1[i]).name)); } for (int i = 1; i <= fld_params_count - n; i++) _expression_list.expressions.Insert(0,new ident("$$" + i)); for (int i = 1; i <= fld_params_count - n; i++) { _params.expressions.Add(new ident("$$" + i)); _params_el.expressions.Add(new ident("$$" + i)); } method_call _method_call = new method_call(_expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(2); op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), _method_call as expression, _op_type_node.type); statement_list _statement_list = new statement_list(); _statement_list.subnodes.Add(_assign); //////////////////////////// ident_list i_l = new ident_list(); for (int i = 1; i <= fld_params_count - n; i++) i_l.idents.Add(new ident("$$" + i)); ///////////////////////////// formal_parameters _formal_parametres = new formal_parameters(); for (int i = 0; i < _params.expressions.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_params.expressions[i]; _ident_list.idents.Add(id); named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); _formal_parametres.params_list.Add(_typed_parametres); } ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = i_l; _procedure_definition.proc_body = null; _procedure_definition.parameters = _params_el; _procedure_definition.lambda_name = "__lambda__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, i_l, null, _params_el, "lambda" + lambda_num); object rt = _expression_list; _procedure_definition.proc_body = _statement_list; _function_lambda_definitions_after.Add(_procedure_definition); _function_lambda_definitions_after.Add(((ident)LRParser.GetReductionSyntaxNode(2)).name);//////////////// last_function_lambda_definitions.Add(_procedure_definition); return new ident(_procedure_definition.lambda_name); } else { method_call _method_call = null; string name = ((ident)LRParser.GetReductionSyntaxNode(2)).name; _method_call = new method_call(el); if (_method_call is dereference) { ((dereference)_method_call).dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(2); parsertools.create_source_context(_method_call, LRParser.GetReductionSyntaxNode(2), _method_call); } list_method_calls.Add(_method_call); last_list_method_calls.Add(_method_call); last_list_method_calls_lambda.Add(_method_call); return _method_call; } } //case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE_TKROUNDOPEN_TKROUNDCLOSE: //<variable> ::= 'tkRoundOpen' 'tkQuote' 'tkIdent' 'tkQuote' <params_value> 'tkRoundClose' 'tkRoundOpen' <params_value> 'tkRoundClose' /*case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE2: //<variable> ::= 'tkRoundOpen' 'tkQuote' 'tkIdent' 'tkQuote' <params_value> 'tkRoundClose' <params_value> { ////////////////////////////////////////////////////////ident_params ident _ident = (ident)LRParser.GetReductionSyntaxNode(2); expression_list el = new expression_list(); el.expressions.Add(((expression_list)LRParser.GetReductionSyntaxNode(6)).expressions[0]); el.expressions.Add(((expression_list)LRParser.GetReductionSyntaxNode(4)).expressions[0]); //////////////////////////////////////////////////////// //expression_list el = LRParser.GetReductionSyntaxNode(2) as expression_list; ////////////////////////////for curring int n = el.expressions.Count; int fld_params_count = find_count_params(_ident.name); //////////////////////////// if (fld_params_count - n > 0) { expression_list _expression_list = el; expression_list _params = new expression_list(); expression_list _params_el = new expression_list(); for (int i = 0; i < list_params1.Count; i++) if (list_params1[i] is ident) { _params.expressions.Add(new ident(((ident)list_params1[i]).name)); _params_el.expressions.Add(new ident(((ident)list_params1[i]).name)); } for (int i = 1; i <= fld_params_count - n; i++) _expression_list.expressions.Add(new ident("$$" + i)); for (int i = 1; i <= fld_params_count - n; i++) { _params.expressions.Add(new ident("$$" + i)); _params_el.expressions.Add(new ident("$$" + i)); } method_call _method_call = new method_call(_expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_ident; op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), _method_call as expression, _op_type_node.type); statement_list _statement_list = new statement_list(); _statement_list.subnodes.Add(_assign); //////////////////////////// ident_list i_l = new ident_list(); for (int i = 1; i <= fld_params_count - n; i++) i_l.idents.Add(new ident("$$" + i)); ///////////////////////////// formal_parameters _formal_parametres = new formal_parameters(); for (int i = 0; i < _params.expressions.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_params.expressions[i]; _ident_list.idents.Add(id); named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); _formal_parametres.params_list.Add(_typed_parametres); } ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = i_l; _procedure_definition.proc_body = null; _procedure_definition.parameters = _params_el; _procedure_definition.lambda_name = "__lambda__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, i_l, null, _params_el, "lambda" + lambda_num); object rt = _expression_list; _procedure_definition.proc_body = _statement_list; _function_lambda_definitions_after.Add(_procedure_definition); _function_lambda_definitions_after.Add(_ident.name);//////////////// last_function_lambda_definitions.Add(_procedure_definition); return new ident(_procedure_definition.lambda_name); } else { method_call _method_call = new method_call(el); if (_method_call is dereference) { ((dereference)_method_call).dereferencing_value = (addressed_value)_ident; parsertools.create_source_context(_method_call, _ident, _method_call); } list_method_calls.Add(_method_call); last_list_method_calls.Add(_method_call); last_list_method_calls_lambda.Add(_method_call); return _method_call; } }*/ /*case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE: //<variable> ::= 'tkRoundOpen' <params_value> 'tkQuote' 'tkIdent' 'tkQuote' 'tkRoundClose' { expression_list el = LRParser.GetReductionSyntaxNode(1) as expression_list; ////////////////////////////for curring int n = el.expressions.Count; int fld_params_count = find_count_params(((ident)LRParser.GetReductionSyntaxNode(3)).name); //////////////////////////// if (fld_params_count - n > 0) { expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(1); expression_list _params = new expression_list(); expression_list _params_el = new expression_list(); for (int i = 0; i < list_params1.Count; i++) if (list_params1[i] is ident) { _params.expressions.Add(new ident(((ident)list_params1[i]).name)); _params_el.expressions.Add(new ident(((ident)list_params1[i]).name)); } for (int i = 1; i <= fld_params_count - n; i++) _expression_list.expressions.Add(new ident("$$" + i)); for (int i = 1; i <= fld_params_count - n; i++) { _params.expressions.Add(new ident("$$" + i)); _params_el.expressions.Add(new ident("$$" + i)); } method_call _method_call = new method_call(_expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(3); op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), _method_call as expression, _op_type_node.type); statement_list _statement_list = new statement_list(); _statement_list.subnodes.Add(_assign); //////////////////////////// ident_list i_l = new ident_list(); for (int i = 1; i <= fld_params_count - n; i++) i_l.idents.Add(new ident("$$" + i)); ///////////////////////////// formal_parameters _formal_parametres = new formal_parameters(); for (int i = 0; i < _params.expressions.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_params.expressions[i]; _ident_list.idents.Add(id); named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); _formal_parametres.params_list.Add(_typed_parametres); } ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, i_l, null, _params_el, "lambda" + lambda_num); object rt = _expression_list; _procedure_definition.proc_body = _statement_list; _function_lambda_definitions_after.Add(_procedure_definition); _function_lambda_definitions_after.Add(((ident)LRParser.GetReductionSyntaxNode(3)).name);//////////////// last_function_lambda_definitions.Add(_procedure_definition); return new ident(_procedure_definition.lambda_name); } else { method_call _method_call = null; string name = ((ident)LRParser.GetReductionSyntaxNode(3)).name; _method_call = new method_call(el); if (_method_call is dereference) { ((dereference)_method_call).dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(3); parsertools.create_source_context(_method_call, LRParser.GetReductionSyntaxNode(3), _method_call); } list_method_calls.Add(_method_call); last_list_method_calls.Add(_method_call); last_list_method_calls_lambda.Add(_method_call); return _method_call; } } case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE_TKROUNDOPEN_TKROUNDCLOSE: //<variable> ::= 'tkRoundOpen' <params_value> 'tkQuote' 'tkIdent' 'tkQuote' 'tkRoundClose' 'tkRoundOpen' <params_value> 'tkRoundClose' { ////////////////////////////////////////////////////////ident_params ident _ident = (ident)LRParser.GetReductionSyntaxNode(3); expression_list el = new expression_list(); el.expressions.Add(((expression_list)LRParser.GetReductionSyntaxNode(1)).expressions[0]); el.expressions.Add(((expression_list)LRParser.GetReductionSyntaxNode(7)).expressions[0]); //////////////////////////////////////////////////////// //expression_list el = LRParser.GetReductionSyntaxNode(2) as expression_list; ////////////////////////////for curring int n = el.expressions.Count; int fld_params_count = find_count_params(_ident.name); //////////////////////////// if (fld_params_count - n > 0) { expression_list _expression_list = el; expression_list _params = new expression_list(); expression_list _params_el = new expression_list(); for (int i = 0; i < list_params1.Count; i++) if (list_params1[i] is ident) { _params.expressions.Add(new ident(((ident)list_params1[i]).name)); _params_el.expressions.Add(new ident(((ident)list_params1[i]).name)); } for (int i = 1; i <= fld_params_count - n; i++) _expression_list.expressions.Add(new ident("$$" + i)); for (int i = 1; i <= fld_params_count - n; i++) { _params.expressions.Add(new ident("$$" + i)); _params_el.expressions.Add(new ident("$$" + i)); } method_call _method_call = new method_call(_expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_ident; op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), _method_call as expression, _op_type_node.type); statement_list _statement_list = new statement_list(); _statement_list.subnodes.Add(_assign); //////////////////////////// ident_list i_l = new ident_list(); for (int i = 1; i <= fld_params_count - n; i++) i_l.idents.Add(new ident("$$" + i)); ///////////////////////////// formal_parameters _formal_parametres = new formal_parameters(); for (int i = 0; i < _params.expressions.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_params.expressions[i]; _ident_list.idents.Add(id); named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); _formal_parametres.params_list.Add(_typed_parametres); } ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, i_l, null, _params_el, "lambda" + lambda_num); object rt = _expression_list; _procedure_definition.proc_body = _statement_list; _function_lambda_definitions_after.Add(_procedure_definition); _function_lambda_definitions_after.Add(_ident.name);//////////////// last_function_lambda_definitions.Add(_procedure_definition); return new ident(_procedure_definition.lambda_name); } else { method_call _method_call = new method_call(el); if (_method_call is dereference) { ((dereference)_method_call).dereferencing_value = (addressed_value)_ident; parsertools.create_source_context(_method_call, _ident, _method_call); } list_method_calls.Add(_method_call); last_list_method_calls.Add(_method_call); last_list_method_calls_lambda.Add(_method_call); return _method_call; } }*/ /*case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE: //<variable> ::= 'tkRoundOpen' <params_value> 'tkQuote' 'tkIdent' 'tkQuote' <params_value> 'tkRoundClose' return null; case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE_TKROUNDOPEN_TKROUNDCLOSE: //<variable> ::= 'tkRoundOpen' <params_value> 'tkQuote' 'tkIdent' 'tkQuote' <params_value> 'tkRoundClose' 'tkRoundOpen' <params_value> 'tkRoundClose' return null;*/ case (int)RuleConstants.RULE_INFIX_EXPR_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE: //<infix_expr> ::= 'tkRoundOpen' <simple_expr> 'tkQuote' 'tkIdent' 'tkQuote' <simple_expr> 'tkRoundClose' { ArrayList ar = new ArrayList(); ar.Add(LRParser.GetReductionSyntaxNode(3)); ar.Add(LRParser.GetReductionSyntaxNode(1)); ar.Add(LRParser.GetReductionSyntaxNode(5)); return ar; } case (int)RuleConstants.RULE_INFIX_EXPR_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE2: //<infix_expr> ::= 'tkRoundOpen' <simple_expr> 'tkQuote' 'tkIdent' 'tkQuote' 'tkRoundClose' { expression_list el = new expression_list(); el.expressions.Add((expression)LRParser.GetReductionSyntaxNode(1)); ////////////////////////////for curring int n = el.expressions.Count; int fld_params_count = find_count_params(((ident)LRParser.GetReductionSyntaxNode(3)).name); //////////////////////////// if (fld_params_count - n > 0) { expression_list _expression_list = new expression_list(); _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(1)); expression_list _params = new expression_list(); expression_list _params_el = new expression_list(); for (int i = 0; i < list_params1.Count; i++) if (list_params1[i] is ident) { _params.expressions.Add(new ident(((ident)list_params1[i]).name)); _params_el.expressions.Add(new ident(((ident)list_params1[i]).name)); } for (int i = 1; i <= fld_params_count - n; i++) _expression_list.expressions.Add(new ident("$$" + i)); for (int i = 1; i <= fld_params_count - n; i++) { _params.expressions.Add(new ident("$$" + i)); _params_el.expressions.Add(new ident("$$" + i)); } method_call _method_call = new method_call(_expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(3); op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), _method_call as expression, _op_type_node.type); statement_list _statement_list = new statement_list(); _statement_list.subnodes.Add(_assign); //////////////////////////// ident_list i_l = new ident_list(); for (int i = 1; i <= fld_params_count - n; i++) i_l.idents.Add(new ident("$$" + i)); ///////////////////////////// formal_parameters _formal_parametres = new formal_parameters(); for (int i = 0; i < _params.expressions.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_params.expressions[i]; _ident_list.idents.Add(id); named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); _formal_parametres.params_list.Add(_typed_parametres); } ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = i_l; _procedure_definition.proc_body = null; _procedure_definition.parameters = _params_el; _procedure_definition.lambda_name = "__lambda__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, i_l, null, _params_el, "lambda" + lambda_num); object rt = _expression_list; _procedure_definition.proc_body = _statement_list; _function_lambda_definitions_after.Add(_procedure_definition); _function_lambda_definitions_after.Add(((ident)LRParser.GetReductionSyntaxNode(3)).name);//////////////// last_function_lambda_definitions.Add(_procedure_definition); return new ident(_procedure_definition.lambda_name); } else { method_call _method_call = null; string name = ((ident)LRParser.GetReductionSyntaxNode(3)).name; _method_call = new method_call(el); if (_method_call is dereference) { ((dereference)_method_call).dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(3); parsertools.create_source_context(_method_call, LRParser.GetReductionSyntaxNode(3), _method_call); } list_method_calls.Add(_method_call); last_list_method_calls.Add(_method_call); last_list_method_calls_lambda.Add(_method_call); return _method_call; } } //case (int)RuleConstants.RULE_INFIX_EXPR_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE_TKROUNDOPEN_TKROUNDCLOSE: //<infix_expr> ::= 'tkRoundOpen' <simple_expr> 'tkQuote' 'tkIdent' 'tkQuote' 'tkRoundClose' 'tkRoundOpen' <params_value> 'tkRoundClose' //case (int)RuleConstants.RULE_INFIX_EXPR_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE3: //<infix_expr> ::= 'tkRoundOpen' <simple_expr> 'tkQuote' 'tkIdent' 'tkQuote' 'tkRoundClose' <params_value> case (int)RuleConstants.RULE_INFIX_EXPR_TKROUNDOPEN_TKROUNDOPEN_TKQUOTE_TKIDENT_TKQUOTE_TKROUNDCLOSE_TKROUNDCLOSE: //<infix_expr> ::= 'tkRoundOpen' 'tkRoundOpen' <simple_expr> 'tkQuote' 'tkIdent' 'tkQuote' 'tkRoundClose' <params_value> 'tkRoundClose' { ////////////////////////////////////////////////////////ident_params ident _ident = (ident)LRParser.GetReductionSyntaxNode(4); expression_list el = new expression_list(); el.expressions.Add((expression)LRParser.GetReductionSyntaxNode(2)); el.expressions.Add(((expression_list)LRParser.GetReductionSyntaxNode(7)).expressions[0]); //////////////////////////////////////////////////////// //expression_list el = LRParser.GetReductionSyntaxNode(2) as expression_list; ////////////////////////////for curring int n = el.expressions.Count; int fld_params_count = find_count_params(_ident.name); //////////////////////////// if (fld_params_count - n > 0) { expression_list _expression_list = el; expression_list _params = new expression_list(); expression_list _params_el = new expression_list(); for (int i = 0; i < list_params1.Count; i++) if (list_params1[i] is ident) { _params.expressions.Add(new ident(((ident)list_params1[i]).name)); _params_el.expressions.Add(new ident(((ident)list_params1[i]).name)); } for (int i = 1; i <= fld_params_count - n; i++) _expression_list.expressions.Add(new ident("$$" + i)); for (int i = 1; i <= fld_params_count - n; i++) { _params.expressions.Add(new ident("$$" + i)); _params_el.expressions.Add(new ident("$$" + i)); } method_call _method_call = new method_call(_expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_ident; op_type_node _op_type_node = new op_type_node(Operators.Assignment); assign _assign = new assign((addressed_value)new ident("result"), _method_call as expression, _op_type_node.type); statement_list _statement_list = new statement_list(); _statement_list.subnodes.Add(_assign); //////////////////////////// ident_list i_l = new ident_list(); for (int i = 1; i <= fld_params_count - n; i++) i_l.idents.Add(new ident("$$" + i)); ///////////////////////////// formal_parameters _formal_parametres = new formal_parameters(); for (int i = 0; i < _params.expressions.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_params.expressions[i]; _ident_list.idents.Add(id); named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); typed_parameters _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); _formal_parametres.params_list.Add(_typed_parametres); } ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = i_l; _procedure_definition.proc_body = null; _procedure_definition.parameters = _params_el; _procedure_definition.lambda_name = "__lambda__" + lambda_num; //new function_lambda_definition(_formal_parametres, (type_definition)_named_type_reference1, i_l, null, _params_el, "lambda" + lambda_num); object rt = _expression_list; _procedure_definition.proc_body = _statement_list; _function_lambda_definitions_after.Add(_procedure_definition); _function_lambda_definitions_after.Add(_ident.name);//////////////// last_function_lambda_definitions.Add(_procedure_definition); return new ident(_procedure_definition.lambda_name); } else { method_call _method_call = new method_call(el); if (_method_call is dereference) { ((dereference)_method_call).dereferencing_value = (addressed_value)_ident; parsertools.create_source_context(_method_call, _ident, _method_call); } list_method_calls.Add(_method_call); last_list_method_calls.Add(_method_call); last_list_method_calls_lambda.Add(_method_call); return _method_call; } } case (int)RuleConstants.RULE_MULTOP_TKSTAR: //<multop> ::= 'tkStar' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULTOP_TKSLASH : //<multop> ::= 'tkSlash' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ADDOP_TKPLUS : //<addop> ::= 'tkPlus' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ADDOP_TKMINUS : //<addop> ::= 'tkMinus' return LRParser.GetReductionSyntaxNode(0); /*case (int)RuleConstants.RULE_STMT_TKPRINT : //<stmt> ::= 'tkPrint' <expr> { if (!(LRParser.GetReductionSyntaxNode(1) is function_lambda_call)) { dot_node _dot_node = new dot_node(null, (addressed_value)(new ident("print"))); _dot_node.left = (addressed_value)LRParser.GetReductionSyntaxNode(1); object o = null; method_call _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node; procedure_call _procedure_call = new procedure_call(_method_call as addressed_value); return _procedure_call; } else { function_lambda_call flc = LRParser.GetReductionSyntaxNode(1) as function_lambda_call; method_call _method_call1 = new SyntaxTree.method_call(flc.parameters); ((dereference)_method_call1).dereferencing_value = (addressed_value)(new ident(flc.f_lambda_def.lambda_name)); dot_node _dot_node = new dot_node(null, (addressed_value)(new ident("print"))); _dot_node.left = (addressed_value)_method_call1; object o = null; method_call _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node; procedure_call _procedure_call = new procedure_call(_method_call as addressed_value); return _procedure_call; } }*/ case (int)RuleConstants.RULE_STMT_TKIDENT_TKARROWGEN_TKIDENT: //<stmt> ::= 'tkIdent' 'tkArrowGen' 'tkIdent' { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ident_list il = new ident_list(); il.idents.Add((ident)LRParser.GetReductionSyntaxNode(0)); //////////////////////////////////////// named_type_reference _named_type_reference2 = new named_type_reference(); _named_type_reference2.names.Add(new SyntaxTree.ident("datatype")); expression_list ell = new expression_list(); //////////////////////////////////////// dot_node _dot_node = new dot_node(null, (addressed_value)LRParser.GetReductionSyntaxNode(2)/*(new ident("getChar"))*/); /////***************** named_type_reference _named_type_reference3 = new named_type_reference(); _named_type_reference3.names.Add(new SyntaxTree.ident("datatype")); expression_list ell3 = new expression_list(); ell3.expressions.Add(new string_const("$null")); ell3.expressions.Add(new string_const("string") as expression); named_type_reference ntr3 = _named_type_reference2; new_expr ne3= new new_expr(ntr3, ell3, false, null); /////***************** _dot_node.left = (addressed_value)ne3; object o = null; method_call _method_call = new method_call(o as expression_list); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)_dot_node;//LRParser.GetReductionSyntaxNode(2); ///////////////////////////////// /*ell.expressions.Add(_method_call); ell.expressions.Add(new string_const("string") as expression); named_type_reference ntr = _named_type_reference2; new_expr ne = new new_expr(ntr, ell, false, null);*/ //////////////////////////////////////// var_def_statement _var_def_statement = new var_def_statement(il, (type_definition)_named_type_reference1, _method_call, definition_attribute.None, false); var_statement _var_statement = new var_statement(_var_def_statement); return _var_statement; } case (int)RuleConstants.RULE_STMT_TKIF_TKTHEN_TKELSE: //<stmt> ::= 'tkIf' <expr> 'tkThen' <body_func> 'tkElse' <body_func> { if_node _if_node = new if_node(null, (statement)LRParser.GetReductionSyntaxNode(3), (statement)LRParser.GetReductionSyntaxNode(5)); parsertools.create_source_context(_if_node, LRParser.GetReductionSyntaxNode(4), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(5), LRParser.GetReductionSyntaxNode(4))); _if_node.condition = _ob((expression)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_if_node, LRParser.GetReductionSyntaxNode(0), _if_node); statement_list sl = new statement_list(); sl.subnodes.Add(_if_node); return sl; } case (int)RuleConstants.RULE_STMT_TKCASE_TKROUNDOPEN_TKROUNDCLOSE_TKOF : //<stmt> ::= 'tkCase' 'tkRoundOpen' <params1> 'tkRoundClose' 'tkOf' <case_variants> return null; case (int)RuleConstants.RULE_STMT_TKDO_TKFIGUREOPEN_TKSEMICOLON_TKFIGURECLOSE : //<stmt> ::= 'tkDo' 'tkFigureOpen' <stmts> 'tkSemiColon' 'tkFigureClose' return LRParser.GetReductionSyntaxNode(2); case (int)RuleConstants.RULE_STMT_TKDO: //<stmt> ::= 'tkDo' <stmts1> { return LRParser.GetReductionSyntaxNode(1); } case (int)RuleConstants.RULE_STMT_TKRETURN : //<stmt> ::= 'tkReturn' <expr> { statement_list _statement_list = new statement_list(); ident id = new ident("result"); op_type_node _op_type_node = new op_type_node(Operators.Assignment); _op_type_node.source_context = parsertools.GetTokenSourceContext(); assign _assign = new assign((addressed_value)id, LRParser.GetReductionSyntaxNode(1) as expression, _op_type_node.type); parsertools.create_source_context(_assign, id, LRParser.GetReductionSyntaxNode(1)); _statement_list.subnodes.Add((statement)_assign); parsertools.assign_source_context(_statement_list, _assign); return _statement_list; } case (int)RuleConstants.RULE_STMT : //<stmt> ::= <func_call> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CASE_VARIANTS : //<case_variants> ::= <case_variant> <empty> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CASE_VARIANTS_TKSPLIT: //<case_variants> ::= <case_variants> tkSplit <case_variant> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CASE_VARIANT_TKROUNDOPEN_TKROUNDCLOSE_TKARROW : //<case_variant> ::= 'tkRoundOpen' <params1> 'tkRoundClose' 'tkArrow' <body_func> { param_value_list.Add(LRParser.GetReductionSyntaxNode(1)); body_variant_list.Add(LRParser.GetReductionSyntaxNode(4)); return null; } case (int)RuleConstants.RULE_PARAMS1: //<params1> ::= <param> <empty> { //let_flag.Add(1); bool b = false; if (list_param.Count == 1) { list_params_temp.Add(new ArrayList()); let_where_list_params.Add(new ArrayList());// if (list_param[0] is new_expr && ((string_const)((new_expr)list_param[0]).params_list.expressions[1]).Value == "empty") b = true; list_param.Clear(); } else { list_params_temp.Add(list_param.Clone()); let_where_list_params.Add(list_param.Clone());// } expression_list _expression_list = new expression_list(); if (list_param.Count == 0) { if (b) { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); el.expressions.Add(new int32_const(0)); literal lt; string text = "empty_list"; lt = new string_const(text); el.expressions.Add(lt as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); _expression_list.expressions.Add(newexpr); } else { _expression_list.source_context = ((expression)LRParser.GetReductionSyntaxNode(0)).source_context; _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); } } else { ident id = new ident(); for (int i = 0; i < list_param.Count; i++) { if (list_param[i] is ident) id.name += ((ident)list_param[i]).name; else { errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, "идентификатор")); return null; } } _expression_list.source_context = ((expression)id).source_context; _expression_list.expressions.Add((expression)id); list_param.Clear(); } list_params1.Clear(); for (int i = 0; i < _expression_list.expressions.Count; i++) list_params1.Add(_expression_list.expressions[i]); last_list_method_calls_lambda.Clear(); return _expression_list; } case (int)RuleConstants.RULE_PARAMS1_TKCOMMA: //<params1> ::= <params1> 'tkComma' <param> { bool b = false; if (list_param.Count == 1) { list_params_temp.Add(new ArrayList()); let_where_list_params.Add(new ArrayList());// if (list_param[0] is new_expr && ((string_const)((new_expr)list_param[0]).params_list.expressions[1]).Value == "empty") b = true; list_param.Clear(); } else { list_params_temp.Add(list_param.Clone()); let_where_list_params.Add(list_param.Clone());// } expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(0); if (list_param.Count == 0) { if (!b) { _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(2) as expression); } else { named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); expression_list el = new expression_list(); el.expressions.Add(new int32_const(0)); literal lt; string text = "empty_list"; lt = new string_const(text); el.expressions.Add(lt as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, el, false, null); _expression_list.expressions.Add(newexpr); } } else { ident id = new ident(); for (int i = 0; i < list_param.Count; i++) { if (list_param[i] is ident) id.name += ((ident)list_param[i]).name; else { errors.Add(new PascalABCCompiler.Errors.UnexpectedToken(this, "идентификатор")); return null; } } _expression_list.expressions.Add((expression)id); list_param.Clear(); } list_params1.Clear(); for (int i = 0; i < _expression_list.expressions.Count; i++) list_params1.Add(_expression_list.expressions[i]); last_list_method_calls_lambda.Clear(); return _expression_list; } case (int)RuleConstants.RULE_FUNC_CALL : //<func_call> ::= <expr> <empty> { statement_list _statement_list = new statement_list(); ident id = new ident("result"); op_type_node _op_type_node = new op_type_node(Operators.Assignment); _op_type_node.source_context = parsertools.GetTokenSourceContext(); expression from = (expression)LRParser.GetReductionSyntaxNode(0); if (LRParser.GetReductionSyntaxNode(0) is ident && (find_func_name(((ident)LRParser.GetReductionSyntaxNode(0)).name) || find_count_params_lambda(((ident)LRParser.GetReductionSyntaxNode(0)).name) >= 0)) { //expression_list el = LRParser.GetReductionSyntaxNode(2) as expression_list; //int n = el.expressions.Count; expression_list el = new expression_list(); int fld_params_count = 0; if (find_func_name(((ident)LRParser.GetReductionSyntaxNode(0)).name)) fld_params_count = find_count_params(((ident)LRParser.GetReductionSyntaxNode(0)).name); else fld_params_count = find_count_params_lambda(((ident)LRParser.GetReductionSyntaxNode(0)).name); if (fld_params_count != 0) for (int i = 0; i < fld_params_count; i++) { string param_name = find_name_params_lambda(((ident)LRParser.GetReductionSyntaxNode(0)).name, i); if (param_name.Contains("$")) { named_type_reference _named_type_reference1 = new named_type_reference(); _named_type_reference1.names.Add(new SyntaxTree.ident("datatype")); expression_list ell = new expression_list(); ell.expressions.Add(new string_const("$null") as expression); ell.expressions.Add(new string_const("string") as expression); named_type_reference ntr = _named_type_reference1; new_expr newexpr = new new_expr(ntr, ell, false, null); el.expressions.Add(newexpr); } else { el.expressions.Add(new ident(param_name)); } } method_call _method_call = new method_call(el); if (_method_call is dereference) ((dereference)_method_call).dereferencing_value = (addressed_value)LRParser.GetReductionSyntaxNode(0); from = _method_call; } if (LRParser.GetReductionSyntaxNode(0) is ident) { function_lambda_definition fld = find_func_lambda_name(((ident)LRParser.GetReductionSyntaxNode(0)).name); if (fld != null) { expression_list _expression_list1 = new expression_list(); function_lambda_call _lambda_call = new function_lambda_call(fld, _expression_list1); from = _lambda_call; } } assign _assign = new assign((addressed_value)id, from, _op_type_node.type); parsertools.create_source_context(_assign, id, LRParser.GetReductionSyntaxNode(0)); _statement_list.subnodes.Add((statement)_assign); parsertools.assign_source_context(_statement_list, _assign); //////////////////////////// if (LRParser.GetReductionSyntaxNode(0) is ident) { list_return_funcs.Add(find_count_params(((ident)LRParser.GetReductionSyntaxNode(0)).name)); } //////////////////////////// return _statement_list; } case (int)RuleConstants.RULE_PARAMS_VALUE : //<params_value> ::= <param_value> <empty> { expression_list _expression_list = new expression_list(); if (LRParser.GetReductionSyntaxNode(0) != null) _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); else _expression_list.expressions.Add(null); return _expression_list; } case (int)RuleConstants.RULE_PARAMS_VALUE2 : //<params_value> ::= <params_value> <param_value> { expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_expression_list, _expression_list, LRParser.GetReductionSyntaxNode(1)); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(1) as expression); return _expression_list; } case (int)RuleConstants.RULE_PARAM_VALUE: //<param_value> ::= <expr> <empty> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LAMBDA_FUNC_TKLEFTSLASH_TKARROW : //<lambda_func> ::= 'tkLeftSlash' <params> 'tkArrow' <body_func> { expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(1); statement_list _statement_list = (statement_list)LRParser.GetReductionSyntaxNode(3); //////////////////////////// ident_list i_l = new ident_list(); for (int i = 0; i < _expression_list.expressions.Count; i++) i_l.idents.Add((ident)_expression_list.expressions[i]); ///////////////////////////// formal_parameters _formal_parametres = new formal_parameters(); for (int i = 0; i < _expression_list.expressions.Count; i++) { ident_list _ident_list = new ident_list(); ident id = (ident)_expression_list.expressions[i]; _ident_list.idents.Add(id); string name_param = id.name; typed_parameters _typed_parametres = null; int k = 0; while (k < last_list_method_calls_lambda.Count && ((ident)((method_call)last_list_method_calls_lambda[k]).dereferencing_value).name != name_param) k++; if (k < last_list_method_calls_lambda.Count) _typed_parametres = new typed_parameters(_ident_list, func_type(((method_call)last_list_method_calls_lambda[k]).parameters.expressions.Count), parametr_kind.none, null); else { named_type_reference _named_type_reference = new named_type_reference(); ident idtype = new ident("datatype"); _named_type_reference.names.Add(idtype); _typed_parametres = new typed_parameters(_ident_list, (type_definition)_named_type_reference, parametr_kind.none, null); parsertools.create_source_context(_typed_parametres, _ident_list, _named_type_reference); } _formal_parametres.params_list.Add(_typed_parametres); } ////////////////////////// named_type_reference _named_type_reference1 = new named_type_reference(); ident idtype1 = new ident("datatype"); _named_type_reference1.source_context = idtype1.source_context; _named_type_reference1.names.Add(idtype1); ///////////////////////////// lambda_num++; function_lambda_definition _procedure_definition = new function_lambda_definition(); _procedure_definition.formal_parameters = _formal_parametres; _procedure_definition.return_type = (type_definition)_named_type_reference1; _procedure_definition.ident_list = i_l; _procedure_definition.proc_body = null; _procedure_definition.parameters = _expression_list; _procedure_definition.lambda_name = "__lambda__" + lambda_num; //new function_lambda_definition(_formal_parametres,(type_definition)_named_type_reference1,i_l, null,_expression_list, "lambda"+lambda_num); object rt = _expression_list; _procedure_definition.proc_body = _statement_list; //////////////////////let & where if (let_stack.Count>0 && ((ArrayList)let_stack[let_stack.Count - 1]).Count > 0) { _procedure_definition.defs = new List<object>(); for (int i = 0; i < ((ArrayList)let_stack[let_stack.Count - 1]).Count; i++) _procedure_definition.defs.Add((procedure_definition)((ArrayList)let_stack[let_stack.Count - 1])[i]); if (let_where_funcs_main.Count + 1 > token_where_count) { for (int i = 0; i < last_where_funcs.Count; i++) //if (((procedure_definition)last_where_funcs[i]).proc_header.name.meth_name.name.Contains("lambda")) _procedure_definition.defs.Add((procedure_definition)last_where_funcs[i]); for (int i = 0; i < last_where_funcs.Count; i++) if (let_funcs.Count > 0) let_funcs.RemoveAt(let_funcs.Count - 1); last_where_funcs.Clear(); } for (int i = 0; i < ((ArrayList)let_stack[let_stack.Count - 1]).Count; i++) if (let_where_funcs.Count > 0) let_where_funcs.RemoveAt(let_where_funcs.Count - 1); for (int i = 0; i < ((ArrayList)let_stack[let_stack.Count - 1]).Count; i++) if (let_funcs.Count > 0) let_funcs.RemoveAt(let_funcs.Count - 1); let_func_last.Clear(); if (let_flag.Count > 0) let_flag.RemoveAt(let_flag.Count - 1); } if (let_stack.Count>0) let_stack.RemoveAt(let_stack.Count - 1); /*if (let_where_funcs.Count > 0) { _procedure_definition.defs = new ArrayList(); for (int i = 0; i < let_where_funcs.Count; i++) if (((procedure_definition)let_where_funcs[i]).proc_header.name.meth_name.name.Contains("lambda")) _procedure_definition.defs.Add(let_where_funcs[i]); if (let_where_funcs_main.Count + 1 > token_where_count) { for (int i = 0; i < last_where_funcs.Count; i++) //if (((procedure_definition)last_where_funcs[i]).proc_header.name.meth_name.name.Contains("lambda")) _procedure_definition.defs.Add((procedure_definition)last_where_funcs[i]); for (int i = 0; i < last_where_funcs.Count; i++) if (let_funcs.Count > 0) let_funcs.RemoveAt(let_funcs.Count - 1); last_where_funcs.Clear(); } int j=0; while (j < let_where_funcs.Count) if (((procedure_definition)let_where_funcs[j]).proc_header.name.meth_name.name.Contains("lambda")) let_where_funcs.RemoveAt(j); else j++; //let_where_funcs.Clear(); let_func_last.Clear(); let_flag.Clear(); }*/ ////////////////////// parsertools.create_source_context(_procedure_definition, _expression_list, rt); _function_lambda_definitions.Add(_procedure_definition);//////////////// if (lambda_stack.Count > 0) { if (((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count > 0) { if (_procedure_definition.defs == null) _procedure_definition.defs = new List<object>(); for (int i = 0; i < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; i++) { _procedure_definition.defs.Add((procedure_definition)((ArrayList)lambda_stack[lambda_stack.Count - 1])[i]); int j = 0; while (j < _function_lambda_definitions.Count && ((function_lambda_definition)_function_lambda_definitions[j]).lambda_name != ((procedure_definition)((ArrayList)lambda_stack[lambda_stack.Count - 1])[i]).proc_header.name.meth_name.name) j++; if (j < _function_lambda_definitions.Count) _function_lambda_definitions.RemoveAt(j); } //for (int i = 0; i < ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Count; i++) //_function_lambda_definitions.RemoveAt(_function_lambda_definitions.Count-1); lambda_stack.RemoveAt(lambda_stack.Count - 1); } if (lambda_stack.Count > 1 && ((ArrayList)lambda_stack[lambda_stack.Count - 2]).Count > 0) { ((ArrayList)lambda_stack[lambda_stack.Count - 2]).Add(lambda(_procedure_definition)); lambda_stack.RemoveAt(lambda_stack.Count - 1); } else ((ArrayList)lambda_stack[lambda_stack.Count - 1]).Add(lambda(_procedure_definition)); } //lambda_funcs.Add(_procedure_definition); //let_funcs.Add(lambda(_procedure_definition)); //let_where_funcs.Add(lambda(_procedure_definition)); return new ident(_procedure_definition.lambda_name); } case (int)RuleConstants.RULE_EMPTY : //<empty> ::= //NONTERMINAL:<empty> ::= return null; //ENDNONTERMINAL } throw new RuleException("Unknown rule"); }
public void CompareInternal(procedure_call left, procedure_call right) { if (left == null && right != null || left != null && right == null) throw_not_equal(left, right); if (left != null && right != null) { CompareInternal(left.func_name, right.func_name); } }
public override void visit(for_node fn) { var b = HasStatementVisitor<yield_node>.Has(fn); if (!b) return; var gotoContinue = goto_statement.New; var gotoBreak = goto_statement.New; var gotoStart = goto_statement.New; ReplaceBreakContinueWithGotoLabelVisitor replaceBreakContinueVis = new ReplaceBreakContinueWithGotoLabelVisitor(gotoContinue, gotoBreak); fn.statements.visit(replaceBreakContinueVis); ProcessNode(fn.statements); var newNames = this.NewVarNames(fn.loop_variable); var newLoopVar = fn.create_loop_variable ? new ident(newNames.VarName) : fn.loop_variable; // Нужно заменить fn.loop_variable -> newLoopVar в теле цикла var replacerVis = new ReplaceVariableNameVisitor(fn.loop_variable, newLoopVar); fn.visit(replacerVis); fn.loop_variable = newLoopVar; var endtemp = new ident(newNames.VarEndName); //new ident(newVarName()); //var ass1 = new var_statement(fn.loop_variable, fn.type_name, fn.initial_value); //var ass1 = new var_statement(fn.loop_variable, fn.type_name, fn.initial_value); //var ass2 = new var_statement(endtemp, fn.type_name, fn.finish_value); // frninja 05/06/16 - фиксим для !fn.create_variable var ass1 = fn.create_loop_variable ? new var_statement(fn.loop_variable, fn.type_name, fn.initial_value) as statement : new assign(fn.loop_variable, fn.initial_value) as statement; var if0 = new if_node((fn.cycle_type == for_cycle_type.to) ? bin_expr.Greater(fn.loop_variable, fn.finish_value) : bin_expr.Less(fn.loop_variable, fn.finish_value), gotoBreak); var lb2 = new labeled_statement(gotoStart.label, if0); var lb1 = new labeled_statement(gotoBreak.label); var Inc = new procedure_call(new method_call((fn.cycle_type == for_cycle_type.to) ? new ident("Inc") : new ident("Dec"), new expression_list(fn.loop_variable))); var lbInc = new labeled_statement(gotoContinue.label, Inc); ReplaceStatement(fn, SeqStatements(ass1, lb2, fn.statements, lbInc, gotoStart, lb1)); // в declarations ближайшего блока добавить описание labels block bl = listNodes.FindLast(x => x is block) as block; bl.defs.Add(new label_definitions(gotoContinue.label, gotoBreak.label, gotoStart.label)); }
/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //CreateNonTerminalObject /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// public Object CreateNonTerminalObject(int ReductionRuleIndex) { switch (ReductionRuleIndex) { case (int)RuleConstants.RULE_PARSE_GOAL : //<parse_goal> ::= <program_file> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PARSE_GOAL2 : //<parse_goal> ::= <unit_file> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PARSE_GOAL3 : //<parse_goal> ::= <parts> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PARTS_TKPARSEMODEEXPRESSION : //<parts> ::= tkParseModeExpression <expr> return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_PARTS_TKPARSEMODESTATEMENT : //<parts> ::= tkParseModeStatement <stmt_or_expression> return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_STMT_OR_EXPRESSION : //<stmt_or_expression> ::= <expr> <empty> { expression_as_statement _expression_as_statement=new expression_as_statement((expression)LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_expression_as_statement,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _expression_as_statement; } case (int)RuleConstants.RULE_STMT_OR_EXPRESSION2 : //<stmt_or_expression> ::= <assignment> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_STMT_OR_EXPRESSION3 : //<stmt_or_expression> ::= <var_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_HEAD_COMPILER_DIRECTIVES : //<opt_head_compiler_directives> ::= //NONTERMINAL:<opt_head_compiler_directives> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OPT_HEAD_COMPILER_DIRECTIVES2 : //<opt_head_compiler_directives> ::= <head_compiler_directives> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_HEAD_COMPILER_DIRECTIVES : //<head_compiler_directives> ::= <one_compiler_directive> return null; case (int)RuleConstants.RULE_HEAD_COMPILER_DIRECTIVES2 : //<head_compiler_directives> ::= <head_compiler_directives> <one_compiler_directive> return null; case (int)RuleConstants.RULE_ONE_COMPILER_DIRECTIVE_TKDIRECTIVENAME_TKIDENTIFIER : //<one_compiler_directive> ::= tkDirectiveName tkIdentifier { token_info t1 = new token_info(); t1.text=((ident)LRParser.GetReductionSyntaxNode(0)).name; t1.source_context = ((ident)LRParser.GetReductionSyntaxNode(0)).source_context; token_info t2 = new token_info(); t2.text=((ident)LRParser.GetReductionSyntaxNode(1)).name; t2.source_context = ((ident)LRParser.GetReductionSyntaxNode(1)).source_context; compiler_directive cd=new compiler_directive(t1,t2); parsertools.create_source_context(cd,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); CompilerDirectives.Add(cd); return null; } case (int)RuleConstants.RULE_ONE_COMPILER_DIRECTIVE_TKDIRECTIVENAME_TKSTRINGLITERAL : //<one_compiler_directive> ::= tkDirectiveName tkStringLiteral { token_info t1 = new token_info(); t1.text=((ident)LRParser.GetReductionSyntaxNode(0)).name; t1.source_context = ((ident)LRParser.GetReductionSyntaxNode(0)).source_context; token_info t2 = new token_info(); t2.text=((string_const)LRParser.GetReductionSyntaxNode(1)).Value; t2.source_context = ((string_const)LRParser.GetReductionSyntaxNode(1)).source_context; compiler_directive cd=new compiler_directive(t1,t2); parsertools.create_source_context(cd,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); CompilerDirectives.Add(cd); return null; } case (int)RuleConstants.RULE_PROGRAM_FILE : //<program_file> ::= <program_heading> <opt_head_compiler_directives> <main_uses_clause> <using_clause> <program_block> <opt_tk_point> { program_module _program_module=new program_module(LRParser.GetReductionSyntaxNode(0) as program_name,(uses_list)LRParser.GetReductionSyntaxNode(2),(block)LRParser.GetReductionSyntaxNode(4),LRParser.GetReductionSyntaxNode(3) as using_list); _program_module.Language = LanguageId.PascalABCNET; parsertools.create_source_context(_program_module,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(4)),LRParser.GetReductionSyntaxNode(4)); if (LRParser.GetReductionSyntaxNode(5) == null && LRParser.GetReductionSyntaxNode(4) != null) { file_position fp = (LRParser.GetReductionSyntaxNode(4) as syntax_tree_node).source_context.end_position; syntax_tree_node err_stn = (syntax_tree_node)LRParser.GetReductionSyntaxNode(4); if ((LRParser.GetReductionSyntaxNode(4) is block) && (LRParser.GetReductionSyntaxNode(4) as block).program_code != null && (LRParser.GetReductionSyntaxNode(4) as block).program_code.subnodes != null && (LRParser.GetReductionSyntaxNode(4) as block).program_code.subnodes.Count > 0) err_stn = (LRParser.GetReductionSyntaxNode(4) as block).program_code.subnodes[(LRParser.GetReductionSyntaxNode(4) as block).program_code.subnodes.Count-1]; errors.Add(new Errors.PABCNETUnexpectedToken(current_file_name, StringResources.Get("TKPOINT"),new SourceContext(fp.line_num, fp.column_num+1, fp.line_num, fp.column_num+1, 0, 0),err_stn)); } return _program_module; } case (int)RuleConstants.RULE_OPT_TK_POINT_TKPOINT : //<opt_tk_point> ::= tkPoint return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_TK_POINT_TKSEMICOLON : //<opt_tk_point> ::= tkSemiColon return null; case (int)RuleConstants.RULE_OPT_TK_POINT_TKCOLON : //<opt_tk_point> ::= tkColon return null; case (int)RuleConstants.RULE_OPT_TK_POINT_ZKCOMMA : //<opt_tk_point> ::= zkComma return null; case (int)RuleConstants.RULE_OPT_TK_POINT_TKDOTDOT : //<opt_tk_point> ::= tkDotDot return null; case (int)RuleConstants.RULE_OPT_TK_POINT : //<opt_tk_point> ::= //NONTERMINAL:<opt_tk_point> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_PROGRAM_HEADING : //<program_heading> ::= //NONTERMINAL:<program_heading> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_PROGRAM_HEADING_TKPROGRAM : //<program_heading> ::= tkProgram <program_name> <program_heading_2> { program_name _program_name=new program_name((ident)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_program_name,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _program_name; } case (int)RuleConstants.RULE_PROGRAM_HEADING_2_TKSEMICOLON : //<program_heading_2> ::= tkSemiColon return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROGRAM_HEADING_2_TKROUNDOPEN_TKROUNDCLOSE_TKSEMICOLON : //<program_heading_2> ::= tkRoundOpen <program_param_list> tkRoundClose tkSemiColon return null; case (int)RuleConstants.RULE_PROGRAM_NAME : //<program_name> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROGRAM_PARAM_LIST : //<program_param_list> ::= <program_param> <empty> return null; case (int)RuleConstants.RULE_PROGRAM_PARAM_LIST_TKCOMMA : //<program_param_list> ::= <program_param_list> tkComma <program_param> return null; case (int)RuleConstants.RULE_PROGRAM_PARAM : //<program_param> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROGRAM_BLOCK : //<program_block> ::= <program_decl_sect_list> <compound_stmt> { block _block=new block(null,LRParser.GetReductionSyntaxNode(1) as statement_list); if (LRParser.GetReductionSyntaxNode(0)!=null) { _block.defs=LRParser.GetReductionSyntaxNode(0) as declarations; parsertools.create_source_context(_block,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); }else parsertools.create_source_context(_block,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(1)); //tasha 16.04.2010 add_lambda_to_program_block(_block); return _block; } case (int)RuleConstants.RULE_PROGRAM_DECL_SECT_LIST : //<program_decl_sect_list> ::= <impl_decl_sect_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_USES_CLAUSE : //<uses_clause> ::= <main_uses_clause> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_USING_CLAUSE : //<using_clause> ::= //NONTERMINAL:<using_clause> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_USING_CLAUSE2 : //<using_clause> ::= <using_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_USING_LIST : //<using_list> ::= <using_one> <empty> { using_list _using_list=new using_list(); parsertools.create_source_context(_using_list,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); _using_list.namespaces.Add((unit_or_namespace)LRParser.GetReductionSyntaxNode(0)); return _using_list; } case (int)RuleConstants.RULE_USING_LIST2 : //<using_list> ::= <using_list> <using_one> { using_list _using_list=(using_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_using_list,_using_list,LRParser.GetReductionSyntaxNode(1)); _using_list.namespaces.Add((unit_or_namespace)LRParser.GetReductionSyntaxNode(1)); return _using_list; } case (int)RuleConstants.RULE_USING_ONE_TKUSING_TKSEMICOLON : //<using_one> ::= tkUsing <ident_or_keyword_pointseparator_list> tkSemiColon { unit_or_namespace _unit_or_namespace=new unit_or_namespace((ident_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_unit_or_namespace,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _unit_or_namespace; } case (int)RuleConstants.RULE_IDENT_OR_KEYWORD_POINTSEPARATOR_LIST : //<ident_or_keyword_pointseparator_list> ::= <identifier_or_keyword> <empty> //TemplateList for ident_list (create) { ident_list _ident_list=new ident_list(); _ident_list.source_context=((ident)LRParser.GetReductionSyntaxNode(0)).source_context; _ident_list.idents.Add((ident)LRParser.GetReductionSyntaxNode(0)); return _ident_list; } case (int)RuleConstants.RULE_IDENT_OR_KEYWORD_POINTSEPARATOR_LIST_TKPOINT : //<ident_or_keyword_pointseparator_list> ::= <ident_or_keyword_pointseparator_list> tkPoint <identifier_or_keyword> //TemplateList for ident_list (add) { ident_list _ident_list=(ident_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_ident_list,_ident_list,LRParser.GetReductionSyntaxNode(2)); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(2) as ident); return _ident_list; } case (int)RuleConstants.RULE_MAIN_USES_CLAUSE : //<main_uses_clause> ::= //NONTERMINAL:<main_uses_clause> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_MAIN_USES_CLAUSE_TKUSES_TKSEMICOLON : //<main_uses_clause> ::= tkUses <main_used_units_list> tkSemiColon parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2));return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_MAIN_USED_UNITS_LIST_TKCOMMA : //<main_used_units_list> ::= <main_used_units_list> tkComma <main_used_unit_name> { uses_list _uses_list=(uses_list)LRParser.GetReductionSyntaxNode(0); _uses_list.units.Add((unit_or_namespace)LRParser.GetReductionSyntaxNode(2)); return _uses_list; } case (int)RuleConstants.RULE_MAIN_USED_UNITS_LIST : //<main_used_units_list> ::= <main_used_unit_name> <empty> { uses_list _uses_list=new uses_list(); _uses_list.units.Add((unit_or_namespace)LRParser.GetReductionSyntaxNode(0)); return _uses_list; } case (int)RuleConstants.RULE_MAIN_USED_UNIT_NAME : //<main_used_unit_name> ::= <ident_or_keyword_pointseparator_list> <empty> { unit_or_namespace _unit_or_namespace=new unit_or_namespace((ident_list)LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_unit_or_namespace,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _unit_or_namespace; } case (int)RuleConstants.RULE_MAIN_USED_UNIT_NAME_TKIN_TKSTRINGLITERAL : //<main_used_unit_name> ::= <ident_or_keyword_pointseparator_list> tkIn tkStringLiteral { uses_unit_in _uses_unit_in=new uses_unit_in(); parsertools.create_source_context(_uses_unit_in,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); _uses_unit_in.name=(ident_list)LRParser.GetReductionSyntaxNode(0); _uses_unit_in.in_file=(string_const)LRParser.GetReductionSyntaxNode(2); return _uses_unit_in; } case (int)RuleConstants.RULE_LIBRARY_FILE_TKPOINT : //<library_file> ::= <library_heading> <main_uses_clause> <library_block> tkPoint {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<library_file> ::= <library_heading> <main_uses_clause> <library_block> tkPoint"));}return null; case (int)RuleConstants.RULE_LIBRARY_HEADING_TKLIBRARY_TKSEMICOLON : //<library_heading> ::= tkLibrary <identifier> tkSemiColon {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<library_heading> ::= tkLibrary <identifier> tkSemiColon"));}return null; case (int)RuleConstants.RULE_LIBRARY_BLOCK : //<library_block> ::= <library_impl_decl_sect_list> <compound_stmt> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<library_block> ::= <library_impl_decl_sect_list> <compound_stmt>"));}return null; case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT_LIST : //<library_impl_decl_sect_list> ::= //NONTERMINAL:<library_impl_decl_sect_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT_LIST2 : //<library_impl_decl_sect_list> ::= <library_impl_decl_sect_list> <library_impl_decl_sect> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<library_impl_decl_sect_list> ::= <library_impl_decl_sect_list> <library_impl_decl_sect>"));}return null; case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT : //<library_impl_decl_sect> ::= <label_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT2 : //<library_impl_decl_sect> ::= <const_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT3 : //<library_impl_decl_sect> ::= <res_str_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT4 : //<library_impl_decl_sect> ::= <type_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT5 : //<library_impl_decl_sect> ::= <var_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT6 : //<library_impl_decl_sect> ::= <proc_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT7 : //<library_impl_decl_sect> ::= <func_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT8 : //<library_impl_decl_sect> ::= <constructor_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT9 : //<library_impl_decl_sect> ::= <destructor_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LIBRARY_IMPL_DECL_SECT10 : //<library_impl_decl_sect> ::= <export_clause> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXPORT_CLAUSE_TKEXPORTS_TKSEMICOLON : //<export_clause> ::= tkExports <exports_list> tkSemiColon {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<export_clause> ::= tkExports <exports_list> tkSemiColon"));}return null; case (int)RuleConstants.RULE_EXPORTS_LIST : //<exports_list> ::= <exports_entry> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXPORTS_LIST_TKCOMMA : //<exports_list> ::= <exports_list> tkComma <exports_entry> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<exports_list> ::= <exports_list> tkComma <exports_entry>"));}return null; case (int)RuleConstants.RULE_EXPORTS_ENTRY : //<exports_entry> ::= <identifier> <exports_index> <exports_name> <exports_resident> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<exports_entry> ::= <identifier> <exports_index> <exports_name> <exports_resident>"));}return null; case (int)RuleConstants.RULE_EXPORTS_INDEX : //<exports_index> ::= //NONTERMINAL:<exports_index> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_EXPORTS_INDEX_TKINDEX : //<exports_index> ::= tkIndex <integer_const> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<exports_index> ::= tkIndex <integer_const>"));}return null; case (int)RuleConstants.RULE_EXPORTS_NAME : //<exports_name> ::= //NONTERMINAL:<exports_name> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_EXPORTS_NAME_TKNAME : //<exports_name> ::= tkName <identifier> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<exports_name> ::= tkName <identifier>"));}return null; case (int)RuleConstants.RULE_EXPORTS_NAME_TKNAME2 : //<exports_name> ::= tkName <literal> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<exports_name> ::= tkName <literal>"));}return null; case (int)RuleConstants.RULE_EXPORTS_RESIDENT : //<exports_resident> ::= //NONTERMINAL:<exports_resident> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_EXPORTS_RESIDENT_TKRESIDENT : //<exports_resident> ::= tkResident return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNIT_FILE_TKPOINT : //<unit_file> ::= <unit_heading> <interface_part> <implementation_part> <initialization_part> tkPoint { unit_module _unit_module=new unit_module((unit_name)LRParser.GetReductionSyntaxNode(0),(interface_node)LRParser.GetReductionSyntaxNode(1),(implementation_node)LRParser.GetReductionSyntaxNode(2),((initfinal_part)LRParser.GetReductionSyntaxNode(3)).initialization_sect,((initfinal_part)LRParser.GetReductionSyntaxNode(3)).finalization_sect); _unit_module.Language = LanguageId.PascalABCNET; parsertools.create_source_context(_unit_module,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return _unit_module; } case (int)RuleConstants.RULE_UNIT_FILE_TKPOINT2 : //<unit_file> ::= <unit_heading> <abc_interface_part> <initialization_part> tkPoint { unit_module _unit_module=new unit_module((unit_name)LRParser.GetReductionSyntaxNode(0),(interface_node)LRParser.GetReductionSyntaxNode(1),null,((initfinal_part)LRParser.GetReductionSyntaxNode(2)).initialization_sect,((initfinal_part)LRParser.GetReductionSyntaxNode(2)).finalization_sect); _unit_module.Language = LanguageId.PascalABCNET; parsertools.create_source_context(_unit_module,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _unit_module; } case (int)RuleConstants.RULE_UNIT_HEADING_TKSEMICOLON : //<unit_heading> ::= <unit_key_word> <unit_name> tkSemiColon <opt_head_compiler_directives> { unit_name _unit_name=new unit_name((ident)LRParser.GetReductionSyntaxNode(1),UnitHeaderKeyword.Unit); if(((ident)LRParser.GetReductionSyntaxNode(0)).name.ToLower()=="library") _unit_name.HeaderKeyword=UnitHeaderKeyword.Library; parsertools.create_source_context(_unit_name,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _unit_name; } case (int)RuleConstants.RULE_UNIT_KEY_WORD_TKUNIT : //<unit_key_word> ::= tkUnit return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNIT_KEY_WORD_TKLIBRARY : //<unit_key_word> ::= tkLibrary return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNIT_NAME : //<unit_name> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_INTERFACE_PART_TKINTERFACE : //<interface_part> ::= tkInterface <uses_clause> <using_clause> <int_decl_sect_list> { interface_node _interface_node=new interface_node(); _interface_node.uses_modules=LRParser.GetReductionSyntaxNode(1) as uses_list; _interface_node.using_namespaces=LRParser.GetReductionSyntaxNode(2) as using_list; _interface_node.interface_definitions=LRParser.GetReductionSyntaxNode(3) as declarations; parsertools.create_source_context(_interface_node,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); return _interface_node; } case (int)RuleConstants.RULE_IMPLEMENTATION_PART_TKIMPLEMENTATION : //<implementation_part> ::= tkImplementation <uses_clause> <using_clause> <impl_decl_sect_list> { implementation_node _implementation_node=new implementation_node(); _implementation_node.uses_modules=LRParser.GetReductionSyntaxNode(1) as uses_list; _implementation_node.using_namespaces=LRParser.GetReductionSyntaxNode(2) as using_list; _implementation_node.implementation_definitions=LRParser.GetReductionSyntaxNode(3) as declarations; parsertools.create_source_context(_implementation_node,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); return _implementation_node; } case (int)RuleConstants.RULE_ABC_INTERFACE_PART : //<abc_interface_part> ::= <uses_clause> <using_clause> <impl_decl_sect_list> { interface_node _interface_node=new interface_node(); _interface_node.uses_modules=LRParser.GetReductionSyntaxNode(0) as uses_list; _interface_node.using_namespaces=LRParser.GetReductionSyntaxNode(1) as using_list; _interface_node.interface_definitions=LRParser.GetReductionSyntaxNode(2) as declarations; object lt=parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(2)); object rt=parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0)); if (lt!=null)parsertools.create_source_context(_interface_node,lt,rt); return _interface_node; } case (int)RuleConstants.RULE_INITIALIZATION_PART_TKEND : //<initialization_part> ::= tkEnd { initfinal_part _initfinal_part=new initfinal_part(); return _initfinal_part; } case (int)RuleConstants.RULE_INITIALIZATION_PART_TKINITIALIZATION_TKEND : //<initialization_part> ::= tkInitialization <stmt_list> tkEnd { initfinal_part _initfinal_part=new initfinal_part((statement_list)LRParser.GetReductionSyntaxNode(1),null); ((statement_list)LRParser.GetReductionSyntaxNode(1)).left_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(0); ((statement_list)LRParser.GetReductionSyntaxNode(1)).right_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(2); return _initfinal_part; } case (int)RuleConstants.RULE_INITIALIZATION_PART_TKINITIALIZATION_TKFINALIZATION_TKEND : //<initialization_part> ::= tkInitialization <stmt_list> tkFinalization <stmt_list> tkEnd { initfinal_part _initfinal_part=new initfinal_part((statement_list)LRParser.GetReductionSyntaxNode(1),(statement_list)LRParser.GetReductionSyntaxNode(3)); ((statement_list)LRParser.GetReductionSyntaxNode(1)).left_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(0); ((statement_list)LRParser.GetReductionSyntaxNode(3)).left_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(2); ((statement_list)LRParser.GetReductionSyntaxNode(3)).right_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(4); return _initfinal_part; } case (int)RuleConstants.RULE_INITIALIZATION_PART_TKBEGIN_TKEND : //<initialization_part> ::= tkBegin <stmt_list> tkEnd { initfinal_part _initfinal_part=new initfinal_part((statement_list)LRParser.GetReductionSyntaxNode(1),null); ((statement_list)LRParser.GetReductionSyntaxNode(1)).left_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(0); ((statement_list)LRParser.GetReductionSyntaxNode(1)).right_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(2); return _initfinal_part; } case (int)RuleConstants.RULE_PACKAGE_FILE_TKPACKAGE_TKSEMICOLON_TKEND_TKPOINT : //<package_file> ::= tkPackage <package_name> tkSemiColon <requires_clause> <contains_clause> tkEnd tkPoint {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<package_file> ::= tkPackage <package_name> tkSemiColon <requires_clause> <contains_clause> tkEnd tkPoint"));}return null; case (int)RuleConstants.RULE_PACKAGE_NAME : //<package_name> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_REQUIRES_CLAUSE : //<requires_clause> ::= //NONTERMINAL:<requires_clause> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_REQUIRES_CLAUSE_TKREQUIRES : //<requires_clause> ::= tkRequires return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_REQUIRES_CLAUSE_TKREQUIRES_TKSEMICOLON : //<requires_clause> ::= tkRequires <main_used_units_list> tkSemiColon {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<requires_clause> ::= tkRequires <main_used_units_list> tkSemiColon"));}return null; case (int)RuleConstants.RULE_CONTAINS_CLAUSE : //<contains_clause> ::= //NONTERMINAL:<contains_clause> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_CONTAINS_CLAUSE_TKCONTAINS : //<contains_clause> ::= tkContains return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONTAINS_CLAUSE_TKCONTAINS_TKSEMICOLON : //<contains_clause> ::= tkContains <main_used_units_list> tkSemiColon {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<contains_clause> ::= tkContains <main_used_units_list> tkSemiColon"));}return null; case (int)RuleConstants.RULE_INT_DECL_SECT_LIST : //<int_decl_sect_list> ::= <int_decl_sect_list1> <empty> if (((declarations)LRParser.GetReductionSyntaxNode(0)).defs.Count>0) return LRParser.GetReductionSyntaxNode(0); return null; case (int)RuleConstants.RULE_INT_DECL_SECT_LIST1 : //<int_decl_sect_list1> ::= <empty> <empty> { declarations _declarations=new declarations(); return _declarations; } case (int)RuleConstants.RULE_INT_DECL_SECT_LIST12 : //<int_decl_sect_list1> ::= <int_decl_sect_list1> <int_decl_sect> { declarations _declarations=(declarations)LRParser.GetReductionSyntaxNode(0); _declarations.defs.Add((declaration)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_declarations,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)),LRParser.GetReductionSyntaxNode(1)); return _declarations; } case (int)RuleConstants.RULE_IMPL_DECL_SECT_LIST : //<impl_decl_sect_list> ::= <impl_decl_sect_list1> <empty> if (((declarations)LRParser.GetReductionSyntaxNode(0)).defs.Count>0) return LRParser.GetReductionSyntaxNode(0); return null; case (int)RuleConstants.RULE_IMPL_DECL_SECT_LIST1 : //<impl_decl_sect_list1> ::= <empty> <empty> { declarations _declarations=new declarations(); return _declarations; } case (int)RuleConstants.RULE_IMPL_DECL_SECT_LIST12 : //<impl_decl_sect_list1> ::= <impl_decl_sect_list1> <impl_decl_sect> { declarations _declarations=(declarations)LRParser.GetReductionSyntaxNode(0); _declarations.defs.Add((declaration)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_declarations,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)),LRParser.GetReductionSyntaxNode(1)); return _declarations; } case (int)RuleConstants.RULE_ABC_DECL_SECT_LIST : //<abc_decl_sect_list> ::= <abc_decl_sect_list1> <empty> if (((declarations)LRParser.GetReductionSyntaxNode(0)).defs.Count>0) return LRParser.GetReductionSyntaxNode(0); return null; case (int)RuleConstants.RULE_ABC_DECL_SECT_LIST1 : //<abc_decl_sect_list1> ::= <empty> <empty> { declarations _declarations=new declarations(); return _declarations; } case (int)RuleConstants.RULE_ABC_DECL_SECT_LIST12 : //<abc_decl_sect_list1> ::= <abc_decl_sect_list1> <abc_decl_sect> { declarations _declarations=(declarations)LRParser.GetReductionSyntaxNode(0); _declarations.defs.Add((declaration)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_declarations,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)),LRParser.GetReductionSyntaxNode(1)); return _declarations; } case (int)RuleConstants.RULE_INT_DECL_SECT : //<int_decl_sect> ::= <const_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_INT_DECL_SECT2 : //<int_decl_sect> ::= <res_str_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_INT_DECL_SECT3 : //<int_decl_sect> ::= <type_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_INT_DECL_SECT4 : //<int_decl_sect> ::= <var_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_INT_DECL_SECT5 : //<int_decl_sect> ::= <int_proc_heading> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_INT_DECL_SECT6 : //<int_decl_sect> ::= <int_func_heading> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IMPL_DECL_SECT : //<impl_decl_sect> ::= <label_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IMPL_DECL_SECT2 : //<impl_decl_sect> ::= <const_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IMPL_DECL_SECT3 : //<impl_decl_sect> ::= <res_str_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IMPL_DECL_SECT4 : //<impl_decl_sect> ::= <type_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IMPL_DECL_SECT5 : //<impl_decl_sect> ::= <var_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IMPL_DECL_SECT6 : //<impl_decl_sect> ::= <proc_decl_with_attr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IMPL_DECL_SECT7 : //<impl_decl_sect> ::= <func_decl_with_attr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IMPL_DECL_SECT8 : //<impl_decl_sect> ::= <constructor_decl_with_attr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IMPL_DECL_SECT9 : //<impl_decl_sect> ::= <destructor_decl_with_attr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROC_DECL_WITH_ATTR : //<proc_decl_with_attr> ::= <opt_attribute_declarations> <proc_decl> { procedure_definition _procedure_definition; _procedure_definition=(LRParser.GetReductionSyntaxNode(1) as procedure_definition); if (_procedure_definition.proc_header != null) _procedure_definition.proc_header.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _procedure_definition; } case (int)RuleConstants.RULE_FUNC_DECL_WITH_ATTR : //<func_decl_with_attr> ::= <opt_attribute_declarations> <func_decl> { procedure_definition _procedure_definition; _procedure_definition=(LRParser.GetReductionSyntaxNode(1) as procedure_definition); if (_procedure_definition.proc_header != null) _procedure_definition.proc_header.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _procedure_definition; } case (int)RuleConstants.RULE_CONSTRUCTOR_DECL_WITH_ATTR : //<constructor_decl_with_attr> ::= <opt_attribute_declarations> <constructor_decl> { procedure_definition _procedure_definition; _procedure_definition=(LRParser.GetReductionSyntaxNode(1) as procedure_definition); if (_procedure_definition.proc_header != null) _procedure_definition.proc_header.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _procedure_definition; } case (int)RuleConstants.RULE_DESTRUCTOR_DECL_WITH_ATTR : //<destructor_decl_with_attr> ::= <opt_attribute_declarations> <destructor_decl> { procedure_definition _procedure_definition; _procedure_definition=(LRParser.GetReductionSyntaxNode(1) as procedure_definition); if (_procedure_definition.proc_header != null) _procedure_definition.proc_header.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _procedure_definition; } case (int)RuleConstants.RULE_ABC_DECL_SECT : //<abc_decl_sect> ::= <label_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_DECL_SECT2 : //<abc_decl_sect> ::= <const_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_DECL_SECT3 : //<abc_decl_sect> ::= <res_str_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_DECL_SECT4 : //<abc_decl_sect> ::= <type_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_DECL_SECT5 : //<abc_decl_sect> ::= <var_decl_sect> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_INT_PROC_HEADING : //<int_proc_heading> ::= <opt_attribute_declarations> <proc_heading> { declaration _declaration; _declaration=(LRParser.GetReductionSyntaxNode(1) as declaration); _declaration.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _declaration; } case (int)RuleConstants.RULE_INT_PROC_HEADING_TKFORWARD_TKSEMICOLON : //<int_proc_heading> ::= <opt_attribute_declarations> <proc_heading> tkForward tkSemiColon { procedure_header _procedure_header; _procedure_header=(LRParser.GetReductionSyntaxNode(1) as procedure_header); if (_procedure_header.proc_attributes==null) _procedure_header.proc_attributes=new procedure_attributes_list(); _procedure_header.proc_attributes.proc_attributes.Add((procedure_attribute)LRParser.GetReductionSyntaxNode(2)); _procedure_header.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; parsertools.create_source_context(_procedure_header.proc_attributes,parsertools.sc_not_null(_procedure_header.proc_attributes,LRParser.GetReductionSyntaxNode(2)),LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_procedure_header,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(2)); return _procedure_header; } case (int)RuleConstants.RULE_INT_FUNC_HEADING : //<int_func_heading> ::= <opt_attribute_declarations> <func_heading> { declaration _declaration; _declaration=(LRParser.GetReductionSyntaxNode(1) as declaration); _declaration.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _declaration; } case (int)RuleConstants.RULE_INT_FUNC_HEADING_TKFORWARD_TKSEMICOLON : //<int_func_heading> ::= <opt_attribute_declarations> <func_heading> tkForward tkSemiColon { procedure_header _procedure_header; _procedure_header=(LRParser.GetReductionSyntaxNode(1) as procedure_header); if (_procedure_header.proc_attributes==null) _procedure_header.proc_attributes=new procedure_attributes_list(); _procedure_header.proc_attributes.proc_attributes.Add((procedure_attribute)LRParser.GetReductionSyntaxNode(2)); _procedure_header.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; parsertools.create_source_context(_procedure_header.proc_attributes,parsertools.sc_not_null(_procedure_header.proc_attributes,LRParser.GetReductionSyntaxNode(2)),LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_procedure_header,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(2)); return _procedure_header; } case (int)RuleConstants.RULE_LABEL_DECL_SECT_TKLABEL_TKSEMICOLON : //<label_decl_sect> ::= tkLabel <label_list> tkSemiColon { label_definitions _label_definitions=new label_definitions((ident_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_label_definitions,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _label_definitions; } case (int)RuleConstants.RULE_LABEL_LIST : //<label_list> ::= <label_name> <empty> //TemplateList for ident_list (create) { ident_list _ident_list=new ident_list(); _ident_list.source_context=((ident)LRParser.GetReductionSyntaxNode(0)).source_context; _ident_list.idents.Add((ident)LRParser.GetReductionSyntaxNode(0)); return _ident_list; } case (int)RuleConstants.RULE_LABEL_LIST_TKCOMMA : //<label_list> ::= <label_list> tkComma <label_name> //TemplateList for ident_list (add) { ident_list _ident_list=(ident_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_ident_list,_ident_list,LRParser.GetReductionSyntaxNode(2)); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(2) as ident); return _ident_list; } case (int)RuleConstants.RULE_LABEL_NAME_TKINTEGER : //<label_name> ::= tkInteger <empty> { ident _ident=new ident(); if(LRParser.GetReductionSyntaxNode(0) is int32_const) _ident.name = ((int32_const)LRParser.GetReductionSyntaxNode(0)).val.ToString(); else if(LRParser.GetReductionSyntaxNode(0) is int64_const) _ident.name = ((int64_const)LRParser.GetReductionSyntaxNode(0)).val.ToString(); else _ident.name = ((uint64_const)LRParser.GetReductionSyntaxNode(0)).val.ToString(); parsertools.assign_source_context(_ident,LRParser.GetReductionSyntaxNode(0)); return _ident; } case (int)RuleConstants.RULE_LABEL_NAME_TKFLOAT : //<label_name> ::= tkFloat <empty> { ident _ident=new ident(((double_const)LRParser.GetReductionSyntaxNode(0)).val.ToString()); parsertools.assign_source_context(_ident,LRParser.GetReductionSyntaxNode(0)); return _ident; } case (int)RuleConstants.RULE_LABEL_NAME : //<label_name> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_DECL_SECT_TKCONST : //<const_decl_sect> ::= tkConst <const_decl> { consts_definitions_list _consts_definitions_list=new consts_definitions_list(); _consts_definitions_list.const_defs.Add((const_definition)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_consts_definitions_list,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _consts_definitions_list; } case (int)RuleConstants.RULE_CONST_DECL_SECT : //<const_decl_sect> ::= <const_decl_sect> <const_decl> { consts_definitions_list _consts_definitions_list=(consts_definitions_list)LRParser.GetReductionSyntaxNode(0); _consts_definitions_list.const_defs.Add((const_definition)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_consts_definitions_list,_consts_definitions_list,LRParser.GetReductionSyntaxNode(1)); return _consts_definitions_list; } case (int)RuleConstants.RULE_RES_STR_DECL_SECT_TKRESOURCESTRING : //<res_str_decl_sect> ::= tkResourceString <const_decl> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<res_str_decl_sect> ::= tkResourceString <const_decl>"));}return null; case (int)RuleConstants.RULE_RES_STR_DECL_SECT : //<res_str_decl_sect> ::= <res_str_decl_sect> <const_decl> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<res_str_decl_sect> ::= <res_str_decl_sect> <const_decl>"));}return null; case (int)RuleConstants.RULE_TYPE_DECL_SECT_TKTYPE : //<type_decl_sect> ::= tkType <type_decl> { type_declarations _type_declarations=new type_declarations(); ///////////////tasha 28.04.2010 pascalABC_type_declarations.Add((type_declaration)LRParser.GetReductionSyntaxNode(1)); /////////////////////////////// _type_declarations.types_decl.Add((type_declaration)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_type_declarations,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _type_declarations; } case (int)RuleConstants.RULE_TYPE_DECL_SECT : //<type_decl_sect> ::= <type_decl_sect> <type_decl> { type_declarations _type_declarations=(type_declarations)LRParser.GetReductionSyntaxNode(0); _type_declarations.types_decl.Add((type_declaration)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_type_declarations,_type_declarations,LRParser.GetReductionSyntaxNode(1)); return _type_declarations; } case (int)RuleConstants.RULE_VAR_DECL_SECT_TKVAR : //<var_decl_sect> ::= tkVar <var_decl> { variable_definitions _variable_definitions=new variable_definitions(); ///////////////tasha 28.04.2010 pascalABC_var_statements.Add((var_def_statement)LRParser.GetReductionSyntaxNode(1)); /////////////////////////////// _variable_definitions.var_definitions.Add((var_def_statement)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_variable_definitions,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _variable_definitions; } case (int)RuleConstants.RULE_VAR_DECL_SECT_TKEVENT : //<var_decl_sect> ::= tkEvent <var_decl> { variable_definitions _variable_definitions=new variable_definitions(); _variable_definitions.var_definitions.Add((var_def_statement)LRParser.GetReductionSyntaxNode(1)); (LRParser.GetReductionSyntaxNode(1) as var_def_statement).is_event = true; parsertools.create_source_context(_variable_definitions,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _variable_definitions; } case (int)RuleConstants.RULE_VAR_DECL_SECT : //<var_decl_sect> ::= <var_decl_sect> <var_decl> { variable_definitions _variable_definitions=(variable_definitions)LRParser.GetReductionSyntaxNode(0); _variable_definitions.var_definitions.Add((var_def_statement)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_variable_definitions,_variable_definitions,LRParser.GetReductionSyntaxNode(1)); return _variable_definitions; } case (int)RuleConstants.RULE_CONST_DECL_TKSEMICOLON : //<const_decl> ::= <only_const_decl> tkSemiColon return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ONLY_CONST_DECL_TKEQUAL : //<only_const_decl> ::= <const_name> tkEqual <init_const_expr> { simple_const_definition _simple_const_definition=new simple_const_definition(); _simple_const_definition.const_name=(ident)LRParser.GetReductionSyntaxNode(0); _simple_const_definition.const_value=(expression)LRParser.GetReductionSyntaxNode(2); parsertools.create_source_context(_simple_const_definition,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _simple_const_definition; } case (int)RuleConstants.RULE_ONLY_CONST_DECL_TKCOLON_TKEQUAL : //<only_const_decl> ::= <const_name> tkColon <type_ref> tkEqual <typed_const> { typed_const_definition _typed_const_definition=new typed_const_definition(); _typed_const_definition.const_name=(ident)LRParser.GetReductionSyntaxNode(0); _typed_const_definition.const_type=(type_definition)LRParser.GetReductionSyntaxNode(2); _typed_const_definition.const_value=(expression)LRParser.GetReductionSyntaxNode(4); parsertools.create_source_context(_typed_const_definition,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return _typed_const_definition; } case (int)RuleConstants.RULE_INIT_CONST_EXPR : //<init_const_expr> ::= <const_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_INIT_CONST_EXPR2 : //<init_const_expr> ::= <array_const> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_NAME : //<const_name> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_EXPR : //<const_expr> ::= <const_simple_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_EXPR2 : //<const_expr> ::= <const_simple_expr> <const_relop> <const_simple_expr> { bin_expr _bin_expr=new bin_expr((expression)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2),((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_CONST_EXPR3 : //<const_expr> ::= <question_constexpr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_QUESTION_CONSTEXPR_TKQUESTION_TKCOLON : //<question_constexpr> ::= <const_expr> tkQuestion <const_expr> tkColon <const_expr> { question_colon_expression _question_colon_expression=new question_colon_expression((expression)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2),(expression)LRParser.GetReductionSyntaxNode(4)); parsertools.create_source_context(_question_colon_expression,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return _question_colon_expression; } case (int)RuleConstants.RULE_CONST_RELOP_TKEQUAL : //<const_relop> ::= tkEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_RELOP_TKNOTEQUAL : //<const_relop> ::= tkNotEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_RELOP_TKLOWER : //<const_relop> ::= tkLower return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_RELOP_TKGREATER : //<const_relop> ::= tkGreater return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_RELOP_TKLOWEREQUAL : //<const_relop> ::= tkLowerEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_RELOP_TKGREATEREQUAL : //<const_relop> ::= tkGreaterEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_RELOP_TKIN : //<const_relop> ::= tkIn return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_SIMPLE_EXPR : //<const_simple_expr> ::= <const_term> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_SIMPLE_EXPR2 : //<const_simple_expr> ::= <const_simple_expr> <const_addop> <const_term> { bin_expr _bin_expr=new bin_expr((expression)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2),((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_CONST_ADDOP_TKPLUS : //<const_addop> ::= tkPlus return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_ADDOP_TKMINUS : //<const_addop> ::= tkMinus return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_ADDOP_TKOR : //<const_addop> ::= tkOr return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_ADDOP_TKXOR : //<const_addop> ::= tkXor return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_AS_IS_CONSTEXPR : //<as_is_constexpr> ::= <const_term> <typecast_op> <simple_or_template_type_reference> { typecast_node _typecast_node=new typecast_node((addressed_value)LRParser.GetReductionSyntaxNode(0),(type_definition)LRParser.GetReductionSyntaxNode(2),(op_typecast)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_typecast_node,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); if (!(LRParser.GetReductionSyntaxNode(0) is addressed_value)) errors.Add(new Errors.bad_operand_type(current_file_name,((syntax_tree_node)LRParser.GetReductionSyntaxNode(0)).source_context,_typecast_node)); return _typecast_node; } case (int)RuleConstants.RULE_CONST_TERM : //<const_term> ::= <const_factor> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_TERM2 : //<const_term> ::= <as_is_constexpr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_TERM3 : //<const_term> ::= <const_term> <const_mulop> <const_factor> { bin_expr _bin_expr=new bin_expr((expression)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2),((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_CONST_MULOP_TKSTAR : //<const_mulop> ::= tkStar return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_MULOP_TKSLASH : //<const_mulop> ::= tkSlash return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_MULOP_TKDIV : //<const_mulop> ::= tkDiv return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_MULOP_TKMOD : //<const_mulop> ::= tkMod return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_MULOP_TKSHL : //<const_mulop> ::= tkShl return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_MULOP_TKSHR : //<const_mulop> ::= tkShr return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_MULOP_TKAND : //<const_mulop> ::= tkAnd return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_FACTOR : //<const_factor> ::= <const_variable> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_FACTOR2 : //<const_factor> ::= <const_set> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_FACTOR3 : //<const_factor> ::= <unsigned_number> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_FACTOR4 : //<const_factor> ::= <literal> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_FACTOR_TKNIL : //<const_factor> ::= tkNil <empty> { nil_const _nil_const=new nil_const(); parsertools.create_source_context(_nil_const,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _nil_const; } case (int)RuleConstants.RULE_CONST_FACTOR_TKADDRESSOF : //<const_factor> ::= tkAddressOf <const_factor> { get_address _get_address=new get_address((addressed_value)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_get_address,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _get_address; } case (int)RuleConstants.RULE_CONST_FACTOR_TKROUNDOPEN_TKROUNDCLOSE : //<const_factor> ::= tkRoundOpen <const_expr> tkRoundClose bracket_expr _expr = new bracket_expr((expression)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _expr; case (int)RuleConstants.RULE_CONST_FACTOR_TKNOT : //<const_factor> ::= tkNot <const_factor> { un_expr _un_expr=new un_expr((expression)LRParser.GetReductionSyntaxNode(1),((op_type_node)LRParser.GetReductionSyntaxNode(0)).type); parsertools.create_source_context(_un_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _un_expr; } case (int)RuleConstants.RULE_CONST_FACTOR5 : //<const_factor> ::= <sign> <const_factor> { un_expr _un_expr=new un_expr((expression)LRParser.GetReductionSyntaxNode(1),((op_type_node)LRParser.GetReductionSyntaxNode(0)).type); parsertools.create_source_context(_un_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _un_expr; } case (int)RuleConstants.RULE_CONST_FACTOR_TKDEREF : //<const_factor> ::= tkDeref <const_factor> { roof_dereference _roof_dereference=new roof_dereference(); _roof_dereference.dereferencing_value=(addressed_value)LRParser.GetReductionSyntaxNode(1); parsertools.create_source_context(_roof_dereference,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _roof_dereference; } case (int)RuleConstants.RULE_CONST_SET_TKSQUAREOPEN_TKSQUARECLOSE : //<const_set> ::= tkSquareOpen <const_elem_list> tkSquareClose { pascal_set_constant _pascal_set_constant=new pascal_set_constant(LRParser.GetReductionSyntaxNode(1) as expression_list); parsertools.create_source_context(_pascal_set_constant,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _pascal_set_constant; } case (int)RuleConstants.RULE_SIGN_TKPLUS : //<sign> ::= tkPlus return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIGN_TKMINUS : //<sign> ::= tkMinus return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_VARIABLE : //<const_variable> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_VARIABLE2 : //<const_variable> ::= <sizeof_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_VARIABLE3 : //<const_variable> ::= <typeof_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_VARIABLE4 : //<const_variable> ::= <const_variable> <const_variable_2> if (LRParser.GetReductionSyntaxNode(1) is dereference) { ((dereference)LRParser.GetReductionSyntaxNode(1)).dereferencing_value=(addressed_value)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); } if (LRParser.GetReductionSyntaxNode(1) is dot_node) { ((dot_node)LRParser.GetReductionSyntaxNode(1)).left=(addressed_value)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),((dot_node)LRParser.GetReductionSyntaxNode(1)).right); } return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_CONST_VARIABLE_2_TKPOINT : //<const_variable_2> ::= tkPoint <identifier_or_keyword> { dot_node _dot_node=new dot_node(null,(addressed_value)LRParser.GetReductionSyntaxNode(1)); return _dot_node; } case (int)RuleConstants.RULE_CONST_VARIABLE_2_TKDEREF : //<const_variable_2> ::= tkDeref <empty> { roof_dereference _roof_dereference=new roof_dereference(); parsertools.assign_source_context(_roof_dereference,LRParser.GetReductionSyntaxNode(0)); return _roof_dereference; } case (int)RuleConstants.RULE_CONST_VARIABLE_2_TKROUNDOPEN_TKROUNDCLOSE : //<const_variable_2> ::= tkRoundOpen <opt_const_func_expr_list> tkRoundClose { method_call _method_call=new method_call((expression_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_method_call,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _method_call; } case (int)RuleConstants.RULE_CONST_VARIABLE_2_TKSQUAREOPEN_TKSQUARECLOSE : //<const_variable_2> ::= tkSquareOpen <const_elem_list> tkSquareClose { indexer _indexer=new indexer((expression_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_indexer,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _indexer; } case (int)RuleConstants.RULE_OPT_CONST_FUNC_EXPR_LIST : //<opt_const_func_expr_list> ::= <const_func_expr_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_CONST_FUNC_EXPR_LIST2 : //<opt_const_func_expr_list> ::= //NONTERMINAL:<opt_const_func_expr_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_CONST_FUNC_EXPR_LIST : //<const_func_expr_list> ::= <const_expr> <empty> //TemplateList for expression_list (create) { expression_list _expression_list=new expression_list(); _expression_list.source_context=((expression)LRParser.GetReductionSyntaxNode(0)).source_context; _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); return _expression_list; } case (int)RuleConstants.RULE_CONST_FUNC_EXPR_LIST_TKCOMMA : //<const_func_expr_list> ::= <const_func_expr_list> tkComma <const_expr> //TemplateList for expression_list (add) { expression_list _expression_list=(expression_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_expression_list,_expression_list,LRParser.GetReductionSyntaxNode(2)); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(2) as expression); return _expression_list; } case (int)RuleConstants.RULE_CONST_ELEM_LIST : //<const_elem_list> ::= <const_elem_list1> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_ELEM_LIST2 : //<const_elem_list> ::= //NONTERMINAL:<const_elem_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_CONST_ELEM_LIST1 : //<const_elem_list1> ::= <const_elem> <empty> //TemplateList for expression_list (create) { expression_list _expression_list=new expression_list(); _expression_list.source_context=((expression)LRParser.GetReductionSyntaxNode(0)).source_context; _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); return _expression_list; } case (int)RuleConstants.RULE_CONST_ELEM_LIST1_TKCOMMA : //<const_elem_list1> ::= <const_elem_list1> tkComma <const_elem> //TemplateList for expression_list (add) { expression_list _expression_list=(expression_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_expression_list,_expression_list,LRParser.GetReductionSyntaxNode(2)); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(2) as expression); return _expression_list; } case (int)RuleConstants.RULE_CONST_ELEM : //<const_elem> ::= <const_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_ELEM_TKDOTDOT : //<const_elem> ::= <const_expr> tkDotDot <const_expr> { diapason_expr _diapason_expr=new diapason_expr((expression)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_diapason_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _diapason_expr; } case (int)RuleConstants.RULE_UNSIGNED_NUMBER_TKINTEGER : //<unsigned_number> ::= tkInteger return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNSIGNED_NUMBER_TKHEX : //<unsigned_number> ::= tkHex return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNSIGNED_NUMBER_TKFLOAT : //<unsigned_number> ::= tkFloat return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPED_CONST : //<typed_const> ::= <const_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPED_CONST2 : //<typed_const> ::= <array_const> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPED_CONST3 : //<typed_const> ::= <record_const> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ARRAY_CONST_TKROUNDOPEN_TKROUNDCLOSE : //<array_const> ::= tkRoundOpen <typed_const_list> tkRoundClose { array_const _array_const=new array_const((expression_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_array_const,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _array_const; } case (int)RuleConstants.RULE_ARRAY_CONST_TKROUNDOPEN_TKROUNDCLOSE2 : //<array_const> ::= tkRoundOpen <record_const> tkRoundClose return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_ARRAY_CONST_TKROUNDOPEN_TKROUNDCLOSE3 : //<array_const> ::= tkRoundOpen <array_const> tkRoundClose return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_TYPED_CONST_LIST : //<typed_const_list> ::= //NONTERMINAL:<typed_const_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_TYPED_CONST_LIST2 : //<typed_const_list> ::= <typed_const_or_new> <empty> { expression_list _expression_list=new expression_list(); _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); //_expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(2)); //parsertools.create_source_context(_expression_list,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _expression_list; } case (int)RuleConstants.RULE_TYPED_CONST_LIST_TKCOMMA : //<typed_const_list> ::= <typed_const_list> tkComma <typed_const_or_new> { expression_list _expression_list=(expression_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_expression_list,_expression_list,LRParser.GetReductionSyntaxNode(2)); if (_expression_list == null) { _expression_list = new expression_list(); errors.Add(new Errors.PABCNETUnexpectedToken(current_file_name, StringResources.Get("TKIDENTIFIER"),((syntax_tree_node)LRParser.GetReductionSyntaxNode(1)).source_context,_expression_list)); } _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(2)); return _expression_list; } case (int)RuleConstants.RULE_RECORD_CONST_TKROUNDOPEN_TKROUNDCLOSE : //<record_const> ::= tkRoundOpen <const_field_list> tkRoundClose parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2));return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_CONST_FIELD_LIST : //<const_field_list> ::= <const_field_list_1> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_FIELD_LIST_TKSEMICOLON : //<const_field_list> ::= <const_field_list_1> tkSemiColon return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_FIELD_LIST_1 : //<const_field_list_1> ::= <const_field> <empty> //TemplateList for record_const (create) { record_const _record_const=new record_const(); _record_const.source_context=((record_const_definition)LRParser.GetReductionSyntaxNode(0)).source_context; _record_const.rec_consts.Add((record_const_definition)LRParser.GetReductionSyntaxNode(0)); return _record_const; } case (int)RuleConstants.RULE_CONST_FIELD_LIST_1_TKSEMICOLON : //<const_field_list_1> ::= <const_field_list_1> tkSemiColon <const_field> //TemplateList for record_const (add) { record_const _record_const=(record_const)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_record_const,_record_const,LRParser.GetReductionSyntaxNode(2)); _record_const.rec_consts.Add(LRParser.GetReductionSyntaxNode(2) as record_const_definition); return _record_const; } case (int)RuleConstants.RULE_CONST_FIELD_TKCOLON : //<const_field> ::= <const_field_name> tkColon <typed_const> { record_const_definition _record_const_definition=new record_const_definition((ident)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_record_const_definition,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _record_const_definition; } case (int)RuleConstants.RULE_CONST_FIELD_NAME : //<const_field_name> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_DECL : //<type_decl> ::= <opt_attribute_declarations> <simple_type_decl> { declaration _declaration; _declaration=(LRParser.GetReductionSyntaxNode(1) as declaration); _declaration.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _declaration; } case (int)RuleConstants.RULE_OPT_ATTRIBUTE_DECLARATIONS : //<opt_attribute_declarations> ::= <attribute_declarations> <empty> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_ATTRIBUTE_DECLARATIONS2 : //<opt_attribute_declarations> ::= <empty> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ATTRIBUTE_DECLARATIONS : //<attribute_declarations> ::= <attribute_declaration> <empty> { attribute_list _attribute_list=new attribute_list(); _attribute_list.attributes.Add((simple_attribute_list)LRParser.GetReductionSyntaxNode(0)); return _attribute_list; } case (int)RuleConstants.RULE_ATTRIBUTE_DECLARATIONS2 : //<attribute_declarations> ::= <attribute_declarations> <attribute_declaration> { attribute_list _attribute_list=(attribute_list)LRParser.GetReductionSyntaxNode(0); _attribute_list.attributes.Add((simple_attribute_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_attribute_list,_attribute_list,LRParser.GetReductionSyntaxNode(1)); return _attribute_list; } case (int)RuleConstants.RULE_ATTRIBUTE_DECLARATION_TKSQUAREOPEN_TKSQUARECLOSE : //<attribute_declaration> ::= tkSquareOpen <one_or_some_attribute> tkSquareClose return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_ONE_OR_SOME_ATTRIBUTE : //<one_or_some_attribute> ::= <one_attribute> <empty> //TemplateList for simple_attribute_list (create) { simple_attribute_list _simple_attribute_list=new simple_attribute_list(); _simple_attribute_list.source_context=((attribute)LRParser.GetReductionSyntaxNode(0)).source_context; _simple_attribute_list.attributes.Add((attribute)LRParser.GetReductionSyntaxNode(0)); return _simple_attribute_list; } case (int)RuleConstants.RULE_ONE_OR_SOME_ATTRIBUTE_TKCOMMA : //<one_or_some_attribute> ::= <one_or_some_attribute> tkComma <one_attribute> //TemplateList for simple_attribute_list (add) { simple_attribute_list _simple_attribute_list=(simple_attribute_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_simple_attribute_list,_simple_attribute_list,LRParser.GetReductionSyntaxNode(2)); _simple_attribute_list.attributes.Add(LRParser.GetReductionSyntaxNode(2) as attribute); return _simple_attribute_list; } case (int)RuleConstants.RULE_ONE_ATTRIBUTE : //<one_attribute> ::= <attribute_variable> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ONE_ATTRIBUTE_TKCOLON : //<one_attribute> ::= <identifier> tkColon <attribute_variable> { attribute _attribute; _attribute=LRParser.GetReductionSyntaxNode(2) as attribute; _attribute.qualifier = LRParser.GetReductionSyntaxNode(0) as ident; return _attribute; } case (int)RuleConstants.RULE_SIMPLE_TYPE_DECL_TKEQUAL_TKSEMICOLON : //<simple_type_decl> ::= <type_decl_identifier> tkEqual <type_decl_type> tkSemiColon { type_declaration _type_declaration=new type_declaration((ident)LRParser.GetReductionSyntaxNode(0),(type_definition)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_type_declaration,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _type_declaration; } case (int)RuleConstants.RULE_SIMPLE_TYPE_DECL_TKSEMICOLON : //<simple_type_decl> ::= <template_identifier_with_equal> <type_decl_type> tkSemiColon { type_declaration _type_declaration=new type_declaration((ident)LRParser.GetReductionSyntaxNode(0),(type_definition)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_type_declaration,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _type_declaration; } case (int)RuleConstants.RULE_TYPE_DECL_IDENTIFIER : //<type_decl_identifier> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_DECL_IDENTIFIER2 : //<type_decl_identifier> ::= <identifier> <template_arguments> { template_type_name _template_type_name=new template_type_name((ident_list)LRParser.GetReductionSyntaxNode(1)); _template_type_name.name=((ident)LRParser.GetReductionSyntaxNode(0)).name; parsertools.create_source_context(_template_type_name,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _template_type_name; } case (int)RuleConstants.RULE_TEMPLATE_IDENTIFIER_WITH_EQUAL_TKLOWER_TKGREATEREQUAL : //<template_identifier_with_equal> ::= <identifier> tkLower <ident_list> tkGreaterEqual { template_type_name _template_type_name=new template_type_name((ident_list)LRParser.GetReductionSyntaxNode(2)); _template_type_name.name=((ident)LRParser.GetReductionSyntaxNode(0)).name; parsertools.create_source_context(_template_type_name,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _template_type_name; } case (int)RuleConstants.RULE_TYPE_DECL_TYPE : //<type_decl_type> ::= <type_ref> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_DECL_TYPE_TKTYPE : //<type_decl_type> ::= tkType <type_ref> parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1));return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_TYPE_DECL_TYPE2 : //<type_decl_type> ::= <object_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_REF : //<type_ref> ::= <simple_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_REF2 : //<type_ref> ::= <string_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_REF3 : //<type_ref> ::= <pointer_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_REF4 : //<type_ref> ::= <structured_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_REF5 : //<type_ref> ::= <procedural_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_REF6 : //<type_ref> ::= <template_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TEMPLATE_TYPE : //<template_type> ::= <simple_type_identifier> <template_type_params> { template_type_reference _template_type_reference=new template_type_reference((named_type_reference)LRParser.GetReductionSyntaxNode(0),(template_param_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_template_type_reference,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _template_type_reference; } case (int)RuleConstants.RULE_TEMPLATE_TYPE_PARAMS_TKLOWER_TKGREATER : //<template_type_params> ::= tkLower <template_param_list> tkGreater parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2));return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_TEMPLATE_PARAM_LIST : //<template_param_list> ::= <template_param> <empty> //TemplateList for template_param_list (create) { template_param_list _template_param_list=new template_param_list(); _template_param_list.source_context=((type_definition)LRParser.GetReductionSyntaxNode(0)).source_context; _template_param_list.params_list.Add((type_definition)LRParser.GetReductionSyntaxNode(0)); return _template_param_list; } case (int)RuleConstants.RULE_TEMPLATE_PARAM_LIST_TKCOMMA : //<template_param_list> ::= <template_param_list> tkComma <template_param> //TemplateList for template_param_list (add) { template_param_list _template_param_list=(template_param_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_template_param_list,_template_param_list,LRParser.GetReductionSyntaxNode(2)); _template_param_list.params_list.Add(LRParser.GetReductionSyntaxNode(2) as type_definition); return _template_param_list; } case (int)RuleConstants.RULE_TEMPLATE_PARAM : //<template_param> ::= <simple_type_identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TEMPLATE_PARAM2 : //<template_param> ::= <template_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_TYPE : //<simple_type> ::= <simple_type_identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_TYPE_TKDOTDOT : //<simple_type> ::= <range_expr> tkDotDot <range_expr> { diapason _diapason=new diapason((expression)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_diapason,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _diapason; } case (int)RuleConstants.RULE_SIMPLE_TYPE_TKROUNDOPEN_TKROUNDCLOSE : //<simple_type> ::= tkRoundOpen <enumeration_id_list> tkRoundClose { enum_type_definition _enum_type_definition=new enum_type_definition((enumerator_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_enum_type_definition,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _enum_type_definition; } case (int)RuleConstants.RULE_RANGE_EXPR : //<range_expr> ::= <range_term> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RANGE_EXPR2 : //<range_expr> ::= <range_expr> <const_addop> <range_term> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_RANGE_TERM : //<range_term> ::= <range_factor> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RANGE_TERM2 : //<range_term> ::= <range_term> <const_mulop> <range_factor> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_RANGE_FACTOR : //<range_factor> ::= <simple_type_identifier> <empty> if(((named_type_reference)LRParser.GetReductionSyntaxNode(0)).names.Count>0) return ((named_type_reference)LRParser.GetReductionSyntaxNode(0)).names[0]; else return null; case (int)RuleConstants.RULE_RANGE_FACTOR2 : //<range_factor> ::= <unsigned_number> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RANGE_FACTOR3 : //<range_factor> ::= <sign> <range_factor> { un_expr _un_expr=new un_expr((expression)LRParser.GetReductionSyntaxNode(1),((op_type_node)LRParser.GetReductionSyntaxNode(0)).type); parsertools.create_source_context(_un_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _un_expr; } case (int)RuleConstants.RULE_RANGE_FACTOR4 : //<range_factor> ::= <literal> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RANGE_FACTOR_TKROUNDOPEN_TKROUNDCLOSE : //<range_factor> ::= <range_factor> tkRoundOpen <const_elem_list> tkRoundClose { method_call _method_call=new method_call((expression_list)LRParser.GetReductionSyntaxNode(2)); _method_call.dereferencing_value=(addressed_value)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_method_call,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _method_call; } case (int)RuleConstants.RULE_RANGE_FACTOR_TKROUNDOPEN_TKROUNDCLOSE2 : //<range_factor> ::= tkRoundOpen <const_expr> tkRoundClose return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_RANGE_METHODNAME : //<range_methodname> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RANGE_METHODNAME_TKPOINT : //<range_methodname> ::= <identifier> tkPoint <identifier_or_keyword> { dot_node _dot_node=new dot_node((ident)LRParser.GetReductionSyntaxNode(0),(ident)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_dot_node,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _dot_node; } case (int)RuleConstants.RULE_SIMPLE_TYPE_IDENTIFIER : //<simple_type_identifier> ::= <identifier> <empty> //TemplateList for named_type_reference (create) { named_type_reference _named_type_reference=new named_type_reference(); _named_type_reference.source_context=((ident)LRParser.GetReductionSyntaxNode(0)).source_context; _named_type_reference.names.Add((ident)LRParser.GetReductionSyntaxNode(0)); return _named_type_reference; } case (int)RuleConstants.RULE_SIMPLE_TYPE_IDENTIFIER_TKPOINT : //<simple_type_identifier> ::= <simple_type_identifier> tkPoint <identifier_or_keyword> //TemplateList for named_type_reference (add) { named_type_reference _named_type_reference=(named_type_reference)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_named_type_reference,_named_type_reference,LRParser.GetReductionSyntaxNode(2)); _named_type_reference.names.Add(LRParser.GetReductionSyntaxNode(2) as ident); return _named_type_reference; } case (int)RuleConstants.RULE_ENUMERATION_ID_LIST_TKCOMMA : //<enumeration_id_list> ::= <enumeration_id> tkComma <enumeration_id> { enumerator_list _enumerator_list=new enumerator_list(); _enumerator_list.enumerators.Add((enumerator)LRParser.GetReductionSyntaxNode(0)); _enumerator_list.enumerators.Add((enumerator)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_enumerator_list,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _enumerator_list; } case (int)RuleConstants.RULE_ENUMERATION_ID_LIST_TKCOMMA2 : //<enumeration_id_list> ::= <enumeration_id_list> tkComma <enumeration_id> { enumerator_list _enumerator_list=(enumerator_list)LRParser.GetReductionSyntaxNode(0); _enumerator_list.enumerators.Add((enumerator)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_enumerator_list,_enumerator_list,LRParser.GetReductionSyntaxNode(2)); return _enumerator_list; } case (int)RuleConstants.RULE_ENUMERATION_ID : //<enumeration_id> ::= <identifier> <empty> { enumerator _enumerator=new enumerator(LRParser.GetReductionSyntaxNode(0) as ident,null); parsertools.create_source_context(_enumerator,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _enumerator; } case (int)RuleConstants.RULE_ENUMERATION_ID_TKEQUAL : //<enumeration_id> ::= <identifier> tkEqual <expr> { enumerator _enumerator=new enumerator(LRParser.GetReductionSyntaxNode(0) as ident,LRParser.GetReductionSyntaxNode(2) as expression); parsertools.create_source_context(_enumerator,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _enumerator; } case (int)RuleConstants.RULE_POINTER_TYPE_TKDEREF : //<pointer_type> ::= tkDeref <fptype> { ref_type _ref_type=new ref_type((type_definition)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_ref_type,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _ref_type; } case (int)RuleConstants.RULE_STRUCTURED_TYPE : //<structured_type> ::= <unpacked_structured_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_STRUCTURED_TYPE_TKPACKED : //<structured_type> ::= tkPacked <unpacked_structured_type> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<structured_type> ::= tkPacked <unpacked_structured_type>"));}return null; case (int)RuleConstants.RULE_UNPACKED_STRUCTURED_TYPE : //<unpacked_structured_type> ::= <array_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNPACKED_STRUCTURED_TYPE2 : //<unpacked_structured_type> ::= <new_record_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNPACKED_STRUCTURED_TYPE3 : //<unpacked_structured_type> ::= <set_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNPACKED_STRUCTURED_TYPE4 : //<unpacked_structured_type> ::= <file_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ARRAY_TYPE_TKARRAY_TKSQUAREOPEN_TKSQUARECLOSE_TKOF : //<array_type> ::= tkArray tkSquareOpen <simple_type_list> tkSquareClose tkOf <type_ref> { array_type _array_type=new array_type((indexers_types)LRParser.GetReductionSyntaxNode(2),(type_definition)LRParser.GetReductionSyntaxNode(5)); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_array_type,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(5)); return _array_type; } case (int)RuleConstants.RULE_ARRAY_TYPE : //<array_type> ::= <unsized_array_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNSIZED_ARRAY_TYPE_TKARRAY_TKOF : //<unsized_array_type> ::= tkArray tkOf <type_ref> { array_type _array_type=new array_type(null,(type_definition)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_array_type,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _array_type; } case (int)RuleConstants.RULE_SIMPLE_TYPE_LIST : //<simple_type_list> ::= <simple_type_or_empty> <empty> { indexers_types _indexers_types=new indexers_types(); _indexers_types.indexers.Add((type_definition)LRParser.GetReductionSyntaxNode(0)); return _indexers_types; } case (int)RuleConstants.RULE_SIMPLE_TYPE_LIST_TKCOMMA : //<simple_type_list> ::= <simple_type_list> tkComma <simple_type_or_empty> { indexers_types _indexers_types=(indexers_types)LRParser.GetReductionSyntaxNode(0); _indexers_types.indexers.Add((type_definition)LRParser.GetReductionSyntaxNode(2)); return _indexers_types; } case (int)RuleConstants.RULE_SIMPLE_TYPE_OR_EMPTY : //<simple_type_or_empty> ::= <simple_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_TYPE_OR_EMPTY2 : //<simple_type_or_empty> ::= //NONTERMINAL:<simple_type_or_empty> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_RECORD_TYPE_TKRECORD_TKEND : //<record_type> ::= tkRecord <field_list> tkEnd { record_type _record_type=new record_type((record_type_parts)LRParser.GetReductionSyntaxNode(1),null); parsertools.create_source_context(_record_type,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _record_type; } case (int)RuleConstants.RULE_RECORD_TYPE_TKRECORD_TKEND2 : //<record_type> ::= tkRecord tkEnd { record_type _record_type=new record_type(null,null); parsertools.create_source_context(_record_type,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _record_type; } case (int)RuleConstants.RULE_FIELD_LIST : //<field_list> ::= <fixed_part> <empty> { record_type_parts _record_type_parts=new record_type_parts((var_def_list)LRParser.GetReductionSyntaxNode(0),null); parsertools.create_source_context(_record_type_parts,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _record_type_parts; } case (int)RuleConstants.RULE_FIELD_LIST2 : //<field_list> ::= <variant_part> <empty> { record_type_parts _record_type_parts=new record_type_parts(null,(variant_record_type)LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_record_type_parts,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _record_type_parts; } case (int)RuleConstants.RULE_FIELD_LIST_TKSEMICOLON : //<field_list> ::= <fixed_part_2> tkSemiColon <variant_part> { record_type_parts _record_type_parts=new record_type_parts((var_def_list)LRParser.GetReductionSyntaxNode(0),(variant_record_type)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_record_type_parts,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _record_type_parts; } case (int)RuleConstants.RULE_FIXED_PART : //<fixed_part> ::= <fixed_part_2> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FIXED_PART_TKSEMICOLON : //<fixed_part> ::= <fixed_part_2> tkSemiColon return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FIXED_PART_2 : //<fixed_part_2> ::= <record_section> <empty> //TemplateList for var_def_list (create) { var_def_list _var_def_list=new var_def_list(); _var_def_list.source_context=((var_def_statement)LRParser.GetReductionSyntaxNode(0)).source_context; _var_def_list.vars.Add((var_def_statement)LRParser.GetReductionSyntaxNode(0)); return _var_def_list; } case (int)RuleConstants.RULE_FIXED_PART_2_TKSEMICOLON : //<fixed_part_2> ::= <fixed_part_2> tkSemiColon <record_section> //TemplateList for var_def_list (add) { var_def_list _var_def_list=(var_def_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_var_def_list,_var_def_list,LRParser.GetReductionSyntaxNode(2)); _var_def_list.vars.Add(LRParser.GetReductionSyntaxNode(2) as var_def_statement); return _var_def_list; } case (int)RuleConstants.RULE_RECORD_SECTION_TKCOLON : //<record_section> ::= <record_section_id_list> tkColon <type_ref> { var_def_statement _var_def_statement=new var_def_statement((ident_list)LRParser.GetReductionSyntaxNode(0),(type_definition)LRParser.GetReductionSyntaxNode(2),null,definition_attribute.None,false); parsertools.create_source_context(_var_def_statement,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _var_def_statement; } case (int)RuleConstants.RULE_RECORD_SECTION_ID_LIST : //<record_section_id_list> ::= <record_section_id> <empty> //TemplateList for ident_list (create) { ident_list _ident_list=new ident_list(); _ident_list.source_context=((ident)LRParser.GetReductionSyntaxNode(0)).source_context; _ident_list.idents.Add((ident)LRParser.GetReductionSyntaxNode(0)); return _ident_list; } case (int)RuleConstants.RULE_RECORD_SECTION_ID_LIST_TKCOMMA : //<record_section_id_list> ::= <record_section_id_list> tkComma <record_section_id> //TemplateList for ident_list (add) { ident_list _ident_list=(ident_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_ident_list,_ident_list,LRParser.GetReductionSyntaxNode(2)); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(2) as ident); return _ident_list; } case (int)RuleConstants.RULE_RECORD_SECTION_ID : //<record_section_id> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIANT_PART_TKCASE_TKOF : //<variant_part> ::= tkCase <tag_field> tkOf <variant_list> { variant_record_type _variant_record_type; _variant_record_type=(variant_record_type)LRParser.GetReductionSyntaxNode(1); _variant_record_type.vars=LRParser.GetReductionSyntaxNode(3) as variant_types; parsertools.create_source_context(_variant_record_type,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2))); return _variant_record_type; } case (int)RuleConstants.RULE_TAG_FIELD : //<tag_field> ::= <tag_field_name> <empty> { variant_record_type _variant_record_type=new variant_record_type((ident)LRParser.GetReductionSyntaxNode(0),null,null); return _variant_record_type; } case (int)RuleConstants.RULE_TAG_FIELD_TKCOLON : //<tag_field> ::= <tag_field_name> tkColon <tag_field_typename> { variant_record_type _variant_record_type=new variant_record_type((ident)LRParser.GetReductionSyntaxNode(0),(type_definition)LRParser.GetReductionSyntaxNode(2),null); return _variant_record_type; } case (int)RuleConstants.RULE_TAG_FIELD_NAME : //<tag_field_name> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TAG_FIELD_TYPENAME : //<tag_field_typename> ::= <fptype> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIANT_LIST : //<variant_list> ::= <variant_list_2> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIANT_LIST_TKSEMICOLON : //<variant_list> ::= <variant_list_2> tkSemiColon return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIANT_LIST_2 : //<variant_list_2> ::= <variant> <empty> //TemplateList for variant_types (create) { variant_types _variant_types=new variant_types(); _variant_types.source_context=((variant_type)LRParser.GetReductionSyntaxNode(0)).source_context; _variant_types.vars.Add((variant_type)LRParser.GetReductionSyntaxNode(0)); return _variant_types; } case (int)RuleConstants.RULE_VARIANT_LIST_2_TKSEMICOLON : //<variant_list_2> ::= <variant_list_2> tkSemiColon <variant> //TemplateList for variant_types (add) { variant_types _variant_types=(variant_types)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_variant_types,_variant_types,LRParser.GetReductionSyntaxNode(2)); _variant_types.vars.Add(LRParser.GetReductionSyntaxNode(2) as variant_type); return _variant_types; } case (int)RuleConstants.RULE_VARIANT_TKCOLON_TKROUNDOPEN_TKROUNDCLOSE : //<variant> ::= <case_tag_list> tkColon tkRoundOpen <variant_field_list> tkRoundClose { variant_type _variant_type=new variant_type((expression_list)LRParser.GetReductionSyntaxNode(0),(record_type_parts)LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_variant_type,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return _variant_type; } case (int)RuleConstants.RULE_VARIANT_FIELD_LIST : //<variant_field_list> ::= //NONTERMINAL:<variant_field_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_VARIANT_FIELD_LIST2 : //<variant_field_list> ::= <field_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CASE_TAG_LIST : //<case_tag_list> ::= <const_expr_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONST_EXPR_LIST : //<const_expr_list> ::= <const_expr> <empty> //TemplateList for expression_list (create) { expression_list _expression_list=new expression_list(); _expression_list.source_context=((expression)LRParser.GetReductionSyntaxNode(0)).source_context; _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); return _expression_list; } case (int)RuleConstants.RULE_CONST_EXPR_LIST_TKCOMMA : //<const_expr_list> ::= <const_expr_list> tkComma <const_expr> //TemplateList for expression_list (add) { expression_list _expression_list=(expression_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_expression_list,_expression_list,LRParser.GetReductionSyntaxNode(2)); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(2) as expression); return _expression_list; } case (int)RuleConstants.RULE_SET_TYPE_TKSET_TKOF : //<set_type> ::= tkSet tkOf <simple_type> { set_type_definition _set_type_definition=new set_type_definition((type_definition)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_set_type_definition,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _set_type_definition; } case (int)RuleConstants.RULE_FILE_TYPE_TKFILE_TKOF : //<file_type> ::= tkFile tkOf <type_ref> { file_type _file_type=new file_type((type_definition)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_file_type,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _file_type; } case (int)RuleConstants.RULE_FILE_TYPE_TKFILE : //<file_type> ::= tkFile <empty> { file_type _file_type=new file_type(); parsertools.assign_source_context(_file_type,LRParser.GetReductionSyntaxNode(0)); return _file_type; } case (int)RuleConstants.RULE_STRING_TYPE_TKIDENTIFIER_TKSQUAREOPEN_TKSQUARECLOSE : //<string_type> ::= tkIdentifier tkSquareOpen <const_expr> tkSquareClose { string_num_definition _string_num_definition=new string_num_definition((expression)LRParser.GetReductionSyntaxNode(2),(ident)LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_string_num_definition,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _string_num_definition; } case (int)RuleConstants.RULE_PROCEDURAL_TYPE : //<procedural_type> ::= <procedural_type_kind> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROCEDURAL_TYPE_KIND : //<procedural_type_kind> ::= <procedural_type_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROCEDURAL_TYPE_DECL_TKPROCEDURE : //<procedural_type_decl> ::= tkProcedure <fp_list> <maybe_error> { procedure_header _procedure_header=new procedure_header((formal_parameters)LRParser.GetReductionSyntaxNode(1),null,null,false,false,null,null); object rt=LRParser.GetReductionSyntaxNode(0); if (LRParser.GetReductionSyntaxNode(1)!=null) rt=LRParser.GetReductionSyntaxNode(1); parsertools.create_source_context(_procedure_header,LRParser.GetReductionSyntaxNode(0),rt); if(LRParser.GetReductionSyntaxNode(2)!=null) (LRParser.GetReductionSyntaxNode(2) as SyntaxError).bad_node=_procedure_header; return _procedure_header; } case (int)RuleConstants.RULE_PROCEDURAL_TYPE_DECL_TKFUNCTION_TKCOLON : //<procedural_type_decl> ::= tkFunction <fp_list> tkColon <fptype> { function_header _function_header=new function_header(); if (LRParser.GetReductionSyntaxNode(1)!=null) _function_header.parameters=(formal_parameters)LRParser.GetReductionSyntaxNode(1); if (LRParser.GetReductionSyntaxNode(3)!=null) _function_header.return_type=(type_definition)LRParser.GetReductionSyntaxNode(3); _function_header.of_object=false; _function_header.class_keyword=false; parsertools.create_source_context(_function_header,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _function_header; } case (int)RuleConstants.RULE_MAYBE_ERROR_TKCOLON : //<maybe_error> ::= tkColon <fptype> Errors.unexpected_return_value er=new Errors.unexpected_return_value(current_file_name,((syntax_tree_node)LRParser.GetReductionSyntaxNode(1)).source_context,null); errors.Add(er);return er; case (int)RuleConstants.RULE_MAYBE_ERROR : //<maybe_error> ::= //NONTERMINAL:<maybe_error> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OBJECT_TYPE : //<object_type> ::= <new_object_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_PRIVAT_LIST : //<oot_privat_list> ::= //NONTERMINAL:<oot_privat_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OOT_PRIVAT_LIST_TKPRIVATE : //<oot_privat_list> ::= tkPrivate <oot_component_list> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<oot_privat_list> ::= tkPrivate <oot_component_list>"));}return null; case (int)RuleConstants.RULE_OOT_COMPONENT_LIST : //<oot_component_list> ::= //NONTERMINAL:<oot_component_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OOT_COMPONENT_LIST2 : //<oot_component_list> ::= <oot_field_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_COMPONENT_LIST3 : //<oot_component_list> ::= <oot_field_list> <oot_method_list> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<oot_component_list> ::= <oot_field_list> <oot_method_list>"));}return null; case (int)RuleConstants.RULE_OOT_COMPONENT_LIST4 : //<oot_component_list> ::= <oot_method_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_SUCCESSOR_TKROUNDOPEN_TKROUNDCLOSE : //<oot_successor> ::= tkRoundOpen <oot_typeidentifier> tkRoundClose {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<oot_successor> ::= tkRoundOpen <oot_typeidentifier> tkRoundClose"));}return null; case (int)RuleConstants.RULE_OOT_TYPEIDENTIFIER : //<oot_typeidentifier> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_FIELD_LIST : //<oot_field_list> ::= <oot_field> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_FIELD_LIST2 : //<oot_field_list> ::= <oot_field_list> <oot_field> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<oot_field_list> ::= <oot_field_list> <oot_field>"));}return null; case (int)RuleConstants.RULE_OOT_FIELD_TKCOLON_TKSEMICOLON : //<oot_field> ::= <oot_id_list> tkColon <type_ref> tkSemiColon {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<oot_field> ::= <oot_id_list> tkColon <type_ref> tkSemiColon"));}return null; case (int)RuleConstants.RULE_OOT_ID_LIST : //<oot_id_list> ::= <oot_field_identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_ID_LIST_TKCOMMA : //<oot_id_list> ::= <oot_id_list> tkComma <oot_field_identifier> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<oot_id_list> ::= <oot_id_list> tkComma <oot_field_identifier>"));}return null; case (int)RuleConstants.RULE_OOT_FIELD_IDENTIFIER : //<oot_field_identifier> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_METHOD_LIST : //<oot_method_list> ::= <oot_method> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_METHOD_LIST2 : //<oot_method_list> ::= <oot_method_list> <oot_method> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<oot_method_list> ::= <oot_method_list> <oot_method>"));}return null; case (int)RuleConstants.RULE_OOT_METHOD : //<oot_method> ::= <oot_method_head> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_METHOD_HEAD : //<oot_method_head> ::= <proc_heading> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_METHOD_HEAD2 : //<oot_method_head> ::= <func_heading> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_METHOD_HEAD3 : //<oot_method_head> ::= <oot_constructor_head> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_METHOD_HEAD4 : //<oot_method_head> ::= <oot_destructor_head> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OOT_CONSTRUCTOR_HEAD_TKCONSTRUCTOR : //<oot_constructor_head> ::= tkConstructor <proc_name> <fp_list> <opt_meth_modificators> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<oot_constructor_head> ::= tkConstructor <proc_name> <fp_list> <opt_meth_modificators>"));}return null; case (int)RuleConstants.RULE_OOT_DESTRUCTOR_HEAD_TKDESTRUCTOR : //<oot_destructor_head> ::= tkDestructor <proc_name> <fp_list> <opt_meth_modificators> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<oot_destructor_head> ::= tkDestructor <proc_name> <fp_list> <opt_meth_modificators>"));}return null; case (int)RuleConstants.RULE_NEW_OBJECT_TYPE : //<new_object_type> ::= <not_object_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_OBJECT_TYPE : //<not_object_type> ::= <class_attributes> <class_or_interface_keyword> <opt_base_classes> <opt_where_section> <opt_not_component_list_seq_end> { class_definition _class_definition=new class_definition(LRParser.GetReductionSyntaxNode(2) as named_type_reference_list,LRParser.GetReductionSyntaxNode(4) as class_body,class_keyword.Class,null,LRParser.GetReductionSyntaxNode(3) as where_definition_list, class_attribute.None,false); string kw=(LRParser.GetReductionSyntaxNode(1) as token_info).text.ToLower(); if(LRParser.GetReductionSyntaxNode(0)!=null) _class_definition.attribute=(class_attribute)((LRParser.GetReductionSyntaxNode(0) as token_taginfo).tag); if (kw=="record") _class_definition.keyword=class_keyword.Record; else if (kw=="interface") _class_definition.keyword=class_keyword.Interface; else if (kw=="i<>") _class_definition.keyword=class_keyword.TemplateInterface; else if (kw=="r<>") _class_definition.keyword=class_keyword.TemplateRecord; else if (kw=="c<>") _class_definition.keyword=class_keyword.TemplateClass; if (_class_definition.body!=null && _class_definition.body.class_def_blocks!=null && _class_definition.body.class_def_blocks.Count>0 && _class_definition.body.class_def_blocks[0].access_mod==null) { if(_class_definition.keyword==class_keyword.Class) _class_definition.body.class_def_blocks[0].access_mod = new access_modifer_node(access_modifer.internal_modifer); else _class_definition.body.class_def_blocks[0].access_mod = new access_modifer_node(access_modifer.none); } parsertools.create_source_context(_class_definition,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(4),LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); return _class_definition; } case (int)RuleConstants.RULE_NEW_RECORD_TYPE_TKEND : //<new_record_type> ::= <record_keyword> <opt_base_classes> <opt_where_section> <not_component_list_seq> tkEnd { class_definition _class_definition=new class_definition(LRParser.GetReductionSyntaxNode(1) as named_type_reference_list,LRParser.GetReductionSyntaxNode(3) as class_body,class_keyword.Record,null,LRParser.GetReductionSyntaxNode(2) as where_definition_list, class_attribute.None,false); if (_class_definition.body!=null && _class_definition.body.class_def_blocks!=null && _class_definition.body.class_def_blocks.Count>0 && _class_definition.body.class_def_blocks[0].access_mod==null) { _class_definition.body.class_def_blocks[0].access_mod = new access_modifer_node(access_modifer.public_modifer); } parsertools.create_source_context(_class_definition,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return _class_definition; } case (int)RuleConstants.RULE_CLASS_ATTRIBUTES_TKFINAL : //<class_attributes> ::= tkFinal return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CLASS_ATTRIBUTES : //<class_attributes> ::= //NONTERMINAL:<class_attributes> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_CLASS_OR_INTERFACE_KEYWORD_TKCLASS : //<class_or_interface_keyword> ::= tkClass return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CLASS_OR_INTERFACE_KEYWORD_TKINTERFACE : //<class_or_interface_keyword> ::= tkInterface return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CLASS_OR_INTERFACE_KEYWORD_TKTEMPLATE : //<class_or_interface_keyword> ::= tkTemplate { token_info _token_info=(token_info)LRParser.GetReductionSyntaxNode(0);_token_info.text="c<>"; return _token_info; } case (int)RuleConstants.RULE_CLASS_OR_INTERFACE_KEYWORD_TKTEMPLATE_TKCLASS : //<class_or_interface_keyword> ::= tkTemplate tkClass { token_info _token_info=(token_info)LRParser.GetReductionSyntaxNode(0);_token_info.text="c<>";parsertools.create_source_context(_token_info,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _token_info; } case (int)RuleConstants.RULE_CLASS_OR_INTERFACE_KEYWORD_TKTEMPLATE_TKRECORD : //<class_or_interface_keyword> ::= tkTemplate tkRecord { token_info _token_info=(token_info)LRParser.GetReductionSyntaxNode(0);_token_info.text="r<>";parsertools.create_source_context(_token_info,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _token_info; } case (int)RuleConstants.RULE_CLASS_OR_INTERFACE_KEYWORD_TKTEMPLATE_TKINTERFACE : //<class_or_interface_keyword> ::= tkTemplate tkInterface { token_info _token_info=(token_info)LRParser.GetReductionSyntaxNode(0);_token_info.text="i<>";parsertools.create_source_context(_token_info,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _token_info; } case (int)RuleConstants.RULE_RECORD_KEYWORD_TKRECORD : //<record_keyword> ::= tkRecord return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_NOT_COMPONENT_LIST_SEQ_END : //<opt_not_component_list_seq_end> ::= //NONTERMINAL:<opt_not_component_list_seq_end> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OPT_NOT_COMPONENT_LIST_SEQ_END_TKEND : //<opt_not_component_list_seq_end> ::= <not_component_list_seq> tkEnd parsertools.create_source_context(LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)),LRParser.GetReductionSyntaxNode(1));return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_BASE_CLASSES : //<opt_base_classes> ::= //NONTERMINAL:<opt_base_classes> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OPT_BASE_CLASSES_TKROUNDOPEN_TKROUNDCLOSE : //<opt_base_classes> ::= tkRoundOpen <base_classes_names_list> tkRoundClose return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_BASE_CLASSES_NAMES_LIST : //<base_classes_names_list> ::= <base_class_name> <empty> //TemplateList for named_type_reference_list (create) { named_type_reference_list _named_type_reference_list=new named_type_reference_list(); _named_type_reference_list.source_context=((named_type_reference)LRParser.GetReductionSyntaxNode(0)).source_context; _named_type_reference_list.types.Add((named_type_reference)LRParser.GetReductionSyntaxNode(0)); return _named_type_reference_list; } case (int)RuleConstants.RULE_BASE_CLASSES_NAMES_LIST_TKCOMMA : //<base_classes_names_list> ::= <base_classes_names_list> tkComma <base_class_name> //TemplateList for named_type_reference_list (add) { named_type_reference_list _named_type_reference_list=(named_type_reference_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_named_type_reference_list,_named_type_reference_list,LRParser.GetReductionSyntaxNode(2)); _named_type_reference_list.types.Add(LRParser.GetReductionSyntaxNode(2) as named_type_reference); return _named_type_reference_list; } case (int)RuleConstants.RULE_BASE_CLASS_NAME : //<base_class_name> ::= <simple_type_identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_BASE_CLASS_NAME2 : //<base_class_name> ::= <template_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_TEMPLATE_ARGUMENTS : //<opt_template_arguments> ::= //NONTERMINAL:<opt_template_arguments> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OPT_TEMPLATE_ARGUMENTS2 : //<opt_template_arguments> ::= <template_arguments> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TEMPLATE_ARGUMENTS_TKLOWER_TKGREATER : //<template_arguments> ::= tkLower <ident_list> tkGreater parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2));return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_OPT_WHERE_SECTION : //<opt_where_section> ::= //NONTERMINAL:<opt_where_section> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OPT_WHERE_SECTION2 : //<opt_where_section> ::= <where_part_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_WHERE_PART_LIST : //<where_part_list> ::= <where_part> <empty> { where_definition_list _where_definition_list=new where_definition_list(); parsertools.create_source_context(_where_definition_list,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); _where_definition_list.defs.Add((where_definition)LRParser.GetReductionSyntaxNode(0)); return _where_definition_list; } case (int)RuleConstants.RULE_WHERE_PART_LIST2 : //<where_part_list> ::= <where_part_list> <where_part> { where_definition_list _where_definition_list=(where_definition_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_where_definition_list,_where_definition_list,LRParser.GetReductionSyntaxNode(1)); _where_definition_list.defs.Add((where_definition)LRParser.GetReductionSyntaxNode(1)); return _where_definition_list; } case (int)RuleConstants.RULE_WHERE_PART_TKWHERE_TKCOLON_TKSEMICOLON : //<where_part> ::= tkWhere <ident_list> tkColon <type_ref_and_secific_list> tkSemiColon { where_definition _where_definition=new where_definition((ident_list)LRParser.GetReductionSyntaxNode(1),(type_definition_list)LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_where_definition,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return _where_definition; } case (int)RuleConstants.RULE_TYPE_REF_AND_SECIFIC_LIST : //<type_ref_and_secific_list> ::= <type_ref_or_secific> <empty> //TemplateList for type_definition_list (create) { type_definition_list _type_definition_list=new type_definition_list(); _type_definition_list.source_context=((type_definition)LRParser.GetReductionSyntaxNode(0)).source_context; _type_definition_list.defs.Add((type_definition)LRParser.GetReductionSyntaxNode(0)); return _type_definition_list; } case (int)RuleConstants.RULE_TYPE_REF_AND_SECIFIC_LIST_TKCOMMA : //<type_ref_and_secific_list> ::= <type_ref_and_secific_list> tkComma <type_ref_or_secific> //TemplateList for type_definition_list (add) { type_definition_list _type_definition_list=(type_definition_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_type_definition_list,_type_definition_list,LRParser.GetReductionSyntaxNode(2)); _type_definition_list.defs.Add(LRParser.GetReductionSyntaxNode(2) as type_definition); return _type_definition_list; } case (int)RuleConstants.RULE_TYPE_REF_OR_SECIFIC : //<type_ref_or_secific> ::= <type_ref> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_REF_OR_SECIFIC_TKCLASS : //<type_ref_or_secific> ::= tkClass { declaration_specificator _declaration_specificator=new declaration_specificator(DeclarationSpecificator.WhereDefClass, (LRParser.GetReductionSyntaxNode(0) as token_info).text); parsertools.assign_source_context(_declaration_specificator,LRParser.GetReductionSyntaxNode(0)); return _declaration_specificator; } case (int)RuleConstants.RULE_TYPE_REF_OR_SECIFIC_TKRECORD : //<type_ref_or_secific> ::= tkRecord { declaration_specificator _declaration_specificator=new declaration_specificator(DeclarationSpecificator.WhereDefValueType, (LRParser.GetReductionSyntaxNode(0) as token_info).text); parsertools.assign_source_context(_declaration_specificator,LRParser.GetReductionSyntaxNode(0)); return _declaration_specificator; } case (int)RuleConstants.RULE_TYPE_REF_OR_SECIFIC_TKCONSTRUCTOR : //<type_ref_or_secific> ::= tkConstructor { declaration_specificator _declaration_specificator=new declaration_specificator(DeclarationSpecificator.WhereDefConstructor, (LRParser.GetReductionSyntaxNode(0) as token_info).text); parsertools.assign_source_context(_declaration_specificator,LRParser.GetReductionSyntaxNode(0)); return _declaration_specificator; } case (int)RuleConstants.RULE_RECORD_COMPONENT_LIST : //<record_component_list> ::= <not_component_list> <empty> { class_body _class_body=new class_body(); if (LRParser.GetReductionSyntaxNode(0)!=null) { access_modifer_node acn=new access_modifer_node(access_modifer.public_modifer); ((class_members)LRParser.GetReductionSyntaxNode(0)).access_mod = acn; _class_body.class_def_blocks.Add((class_members)LRParser.GetReductionSyntaxNode(0)); parsertools.assign_source_context(_class_body,LRParser.GetReductionSyntaxNode(0)); } return _class_body; } case (int)RuleConstants.RULE_NOT_COMPONENT_LIST_SEQ : //<not_component_list_seq> ::= <not_component_list> <empty> { class_body _class_body=new class_body(); if (LRParser.GetReductionSyntaxNode(0)!=null) { _class_body.class_def_blocks.Add((class_members)LRParser.GetReductionSyntaxNode(0)); parsertools.assign_source_context(_class_body,LRParser.GetReductionSyntaxNode(0)); } return _class_body; } case (int)RuleConstants.RULE_NOT_COMPONENT_LIST_SEQ2 : //<not_component_list_seq> ::= <not_component_list_seq> <ot_visibility_specifier> <not_component_list> { class_body _class_body=(class_body)LRParser.GetReductionSyntaxNode(0); class_members cl=(class_members)LRParser.GetReductionSyntaxNode(2); if (cl==null) { cl=new class_members(); parsertools.create_source_context(cl,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(1)); } cl.access_mod=(access_modifer_node)LRParser.GetReductionSyntaxNode(1); _class_body.class_def_blocks.Add(cl); parsertools.create_source_context(_class_body,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)),parsertools.sc_not_null(cl,LRParser.GetReductionSyntaxNode(1))); return _class_body; } case (int)RuleConstants.RULE_OT_VISIBILITY_SPECIFIER_TKINTERNAL : //<ot_visibility_specifier> ::= tkInternal { access_modifer_node _access_modifer_node=new access_modifer_node(access_modifer.internal_modifer); parsertools.assign_source_context(_access_modifer_node,LRParser.GetReductionSyntaxNode(0)); return _access_modifer_node; } case (int)RuleConstants.RULE_OT_VISIBILITY_SPECIFIER_TKPUBLIC : //<ot_visibility_specifier> ::= tkPublic { access_modifer_node _access_modifer_node=new access_modifer_node(access_modifer.public_modifer); parsertools.assign_source_context(_access_modifer_node,LRParser.GetReductionSyntaxNode(0)); return _access_modifer_node; } case (int)RuleConstants.RULE_OT_VISIBILITY_SPECIFIER_TKPROTECTED : //<ot_visibility_specifier> ::= tkProtected { access_modifer_node _access_modifer_node=new access_modifer_node(access_modifer.protected_modifer); parsertools.assign_source_context(_access_modifer_node,LRParser.GetReductionSyntaxNode(0)); return _access_modifer_node; } case (int)RuleConstants.RULE_OT_VISIBILITY_SPECIFIER_TKPRIVATE : //<ot_visibility_specifier> ::= tkPrivate { access_modifer_node _access_modifer_node=new access_modifer_node(access_modifer.private_modifer); parsertools.assign_source_context(_access_modifer_node,LRParser.GetReductionSyntaxNode(0)); return _access_modifer_node; } case (int)RuleConstants.RULE_NOT_OBJECT_TYPE_IDENTIFIER_LIST : //<not_object_type_identifier_list> ::= <simple_type_identifier> <empty> //TemplateList for named_type_reference_list (create) { named_type_reference_list _named_type_reference_list=new named_type_reference_list(); _named_type_reference_list.source_context=((named_type_reference)LRParser.GetReductionSyntaxNode(0)).source_context; _named_type_reference_list.types.Add((named_type_reference)LRParser.GetReductionSyntaxNode(0)); return _named_type_reference_list; } case (int)RuleConstants.RULE_NOT_OBJECT_TYPE_IDENTIFIER_LIST_TKCOMMA : //<not_object_type_identifier_list> ::= <not_object_type_identifier_list> tkComma <simple_type_identifier> //TemplateList for named_type_reference_list (add) { named_type_reference_list _named_type_reference_list=(named_type_reference_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_named_type_reference_list,_named_type_reference_list,LRParser.GetReductionSyntaxNode(2)); _named_type_reference_list.types.Add(LRParser.GetReductionSyntaxNode(2) as named_type_reference); return _named_type_reference_list; } case (int)RuleConstants.RULE_IDENT_LIST : //<ident_list> ::= <identifier> <empty> //TemplateList for ident_list (create) { ident_list _ident_list=new ident_list(); _ident_list.source_context=((ident)LRParser.GetReductionSyntaxNode(0)).source_context; _ident_list.idents.Add((ident)LRParser.GetReductionSyntaxNode(0)); return _ident_list; } case (int)RuleConstants.RULE_IDENT_LIST_TKCOMMA : //<ident_list> ::= <ident_list> tkComma <identifier> //TemplateList for ident_list (add) { ident_list _ident_list=(ident_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_ident_list,_ident_list,LRParser.GetReductionSyntaxNode(2)); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(2) as ident); return _ident_list; } case (int)RuleConstants.RULE_NOT_COMPONENT_LIST : //<not_component_list> ::= <not_guid> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_COMPONENT_LIST2 : //<not_component_list> ::= <not_guid> <not_component_list_1> <opt_semicolon> return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_NOT_COMPONENT_LIST3 : //<not_component_list> ::= <not_guid> <not_component_list_2> return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_NOT_COMPONENT_LIST_TKSEMICOLON : //<not_component_list> ::= <not_guid> <not_component_list_1> tkSemiColon <not_component_list_2> { class_members _class_members; _class_members=(class_members)LRParser.GetReductionSyntaxNode(1); for (int i=0;i<((class_members)LRParser.GetReductionSyntaxNode(3)).members.Count;i++) _class_members.members.Add(((class_members)LRParser.GetReductionSyntaxNode(3)).members[i]); parsertools.create_source_context(_class_members,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(3)); return _class_members; } case (int)RuleConstants.RULE_OPT_SEMICOLON : //<opt_semicolon> ::= //NONTERMINAL:<opt_semicolon> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OPT_SEMICOLON_TKSEMICOLON : //<opt_semicolon> ::= tkSemiColon return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_GUID : //<not_guid> ::= //NONTERMINAL:<not_guid> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_NOT_COMPONENT_LIST_1 : //<not_component_list_1> ::= <filed_or_const_definition> <empty> { class_members _class_members=new class_members(); _class_members.members.Add((declaration)LRParser.GetReductionSyntaxNode(0)); parsertools.assign_source_context(_class_members,LRParser.GetReductionSyntaxNode(0)); return _class_members; } case (int)RuleConstants.RULE_NOT_COMPONENT_LIST_1_TKSEMICOLON : //<not_component_list_1> ::= <not_component_list_1> tkSemiColon <filed_or_const_definition_or_am> { class_members _class_members=(class_members)LRParser.GetReductionSyntaxNode(0); if(LRParser.GetReductionSyntaxNode(2) is declaration) _class_members.members.Add((declaration)LRParser.GetReductionSyntaxNode(2)); else (_class_members.members[_class_members.members.Count-1] as var_def_statement).var_attr=definition_attribute.Static; parsertools.create_source_context(_class_members,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _class_members; } case (int)RuleConstants.RULE_NOT_COMPONENT_LIST_2 : //<not_component_list_2> ::= <not_method_definition> <empty> { class_members _class_members=new class_members(); _class_members.members.Add((declaration)LRParser.GetReductionSyntaxNode(0)); parsertools.assign_source_context(_class_members,LRParser.GetReductionSyntaxNode(0)); return _class_members; } case (int)RuleConstants.RULE_NOT_COMPONENT_LIST_22 : //<not_component_list_2> ::= <not_property_definition> <empty> { class_members _class_members=new class_members(); _class_members.members.Add((declaration)LRParser.GetReductionSyntaxNode(0)); parsertools.assign_source_context(_class_members,LRParser.GetReductionSyntaxNode(0)); return _class_members; } case (int)RuleConstants.RULE_NOT_COMPONENT_LIST_23 : //<not_component_list_2> ::= <not_component_list_2> <not_method_definition> { class_members _class_members=(class_members)LRParser.GetReductionSyntaxNode(0); _class_members.members.Add((declaration)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_class_members,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _class_members; } case (int)RuleConstants.RULE_NOT_COMPONENT_LIST_24 : //<not_component_list_2> ::= <not_component_list_2> <not_property_definition> { class_members _class_members=(class_members)LRParser.GetReductionSyntaxNode(0); _class_members.members.Add((declaration)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_class_members,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _class_members; } case (int)RuleConstants.RULE_FILED_OR_CONST_DEFINITION : //<filed_or_const_definition> ::= <opt_attribute_declarations> <simple_filed_or_const_definition> { declaration _declaration; _declaration=LRParser.GetReductionSyntaxNode(1) as declaration; _declaration.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _declaration; } case (int)RuleConstants.RULE_SIMPLE_FILED_OR_CONST_DEFINITION_TKCONST : //<simple_filed_or_const_definition> ::= tkConst <only_const_decl> parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_SIMPLE_FILED_OR_CONST_DEFINITION : //<simple_filed_or_const_definition> ::= <not_field_definition> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_FILED_OR_CONST_DEFINITION_TKCLASS : //<simple_filed_or_const_definition> ::= tkClass <not_field_definition> { var_def_statement _var_def_statement=(var_def_statement)LRParser.GetReductionSyntaxNode(1); _var_def_statement.var_attr = definition_attribute.Static; parsertools.create_source_context(_var_def_statement,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _var_def_statement; } case (int)RuleConstants.RULE_FILED_OR_CONST_DEFINITION_OR_AM : //<filed_or_const_definition_or_am> ::= <filed_or_const_definition> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FILED_OR_CONST_DEFINITION_OR_AM2 : //<filed_or_const_definition_or_am> ::= <field_access_modifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_FIELD_DEFINITION : //<not_field_definition> ::= <var_decl_part> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_FIELD_DEFINITION_TKEVENT_TKCOLON : //<not_field_definition> ::= tkEvent <var_name_list> tkColon <type_ref> { var_def_statement _var_def_statement=new var_def_statement((ident_list)LRParser.GetReductionSyntaxNode(1),(type_definition)LRParser.GetReductionSyntaxNode(3),null,definition_attribute.None,true); parsertools.create_source_context(_var_def_statement,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _var_def_statement; } case (int)RuleConstants.RULE_FIELD_ACCESS_MODIFIER_TKSTATIC : //<field_access_modifier> ::= tkStatic return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_METHOD_DEFINITION : //<not_method_definition> ::= <opt_attribute_declarations> <not_method_heading> { declaration _declaration; _declaration=(LRParser.GetReductionSyntaxNode(1) as declaration); if (_declaration != null) _declaration.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _declaration; } case (int)RuleConstants.RULE_NOT_METHOD_DEFINITION2 : //<not_method_definition> ::= <opt_attribute_declarations> <abc_method_decl> { procedure_definition _procedure_definition; _procedure_definition=(LRParser.GetReductionSyntaxNode(1) as procedure_definition); if (_procedure_definition != null && _procedure_definition.proc_header != null) _procedure_definition.proc_header.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _procedure_definition; } case (int)RuleConstants.RULE_ABC_METHOD_DECL : //<abc_method_decl> ::= <abc_proc_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_METHOD_DECL2 : //<abc_method_decl> ::= <abc_func_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_METHOD_DECL3 : //<abc_method_decl> ::= <abc_constructor_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_METHOD_DECL4 : //<abc_method_decl> ::= <abc_destructor_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_METHOD_HEADING_TKCLASS : //<not_method_heading> ::= tkClass <not_procfunc_heading> ((procedure_header)LRParser.GetReductionSyntaxNode(1)).class_keyword=true;return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_NOT_METHOD_HEADING : //<not_method_heading> ::= <not_procfunc_heading> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_METHOD_HEADING2 : //<not_method_heading> ::= <not_constructor_heading> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_METHOD_HEADING3 : //<not_method_heading> ::= <not_destructor_heading> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_PROCFUNC_HEADING : //<not_procfunc_heading> ::= <not_procfunc_heading_variants> <empty> ((procedure_header)LRParser.GetReductionSyntaxNode(0)).name.explicit_interface_name=((procedure_header)LRParser.GetReductionSyntaxNode(0)).name.class_name; ((procedure_header)LRParser.GetReductionSyntaxNode(0)).name.class_name=null; return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_PROCFUNC_HEADING_VARIANTS : //<not_procfunc_heading_variants> ::= <proc_heading> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_PROCFUNC_HEADING_VARIANTS2 : //<not_procfunc_heading_variants> ::= <func_heading> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPTIONAL_QUALIFIED_IDENTIFIER : //<optional_qualified_identifier> ::= <qualified_identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPTIONAL_QUALIFIED_IDENTIFIER2 : //<optional_qualified_identifier> ::= //NONTERMINAL:<optional_qualified_identifier> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_NOT_CONSTRUCTOR_HEADING : //<not_constructor_heading> ::= <not_constructor_heading_object> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_CONSTRUCTOR_HEADING_TKCLASS : //<not_constructor_heading> ::= tkClass <not_constructor_heading_object> ((procedure_header)LRParser.GetReductionSyntaxNode(1)).class_keyword=true;return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_OPT_PROC_NAME : //<opt_proc_name> ::= <proc_name> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_PROC_NAME2 : //<opt_proc_name> ::= //NONTERMINAL:<opt_proc_name> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_NOT_CONSTRUCTOR_HEADING_OBJECT_TKCONSTRUCTOR : //<not_constructor_heading_object> ::= tkConstructor <opt_proc_name> <fp_list> <opt_meth_modificators> { constructor _constructor=new constructor(); object rt=LRParser.GetReductionSyntaxNode(1); _constructor.name=LRParser.GetReductionSyntaxNode(1) as method_name; if (LRParser.GetReductionSyntaxNode(2)!=null) { rt=LRParser.GetReductionSyntaxNode(2); _constructor.parameters=(formal_parameters)LRParser.GetReductionSyntaxNode(2); } if (LRParser.GetReductionSyntaxNode(3)!=null) { rt=LRParser.GetReductionSyntaxNode(3); if (((procedure_attributes_list)LRParser.GetReductionSyntaxNode(3)).proc_attributes.Count>0) _constructor.proc_attributes=(procedure_attributes_list)LRParser.GetReductionSyntaxNode(3); } parsertools.create_source_context(_constructor,LRParser.GetReductionSyntaxNode(0),rt); return _constructor; } case (int)RuleConstants.RULE_NOT_DESTRUCTOR_HEADING_TKDESTRUCTOR : //<not_destructor_heading> ::= tkDestructor <opt_proc_name> <fp_list> <opt_meth_modificators> { destructor _destructor=new destructor(); object rt=LRParser.GetReductionSyntaxNode(1); _destructor.name=LRParser.GetReductionSyntaxNode(1) as method_name; if (LRParser.GetReductionSyntaxNode(2)!=null) { rt=LRParser.GetReductionSyntaxNode(2); _destructor.parameters=(formal_parameters)LRParser.GetReductionSyntaxNode(2); } if (LRParser.GetReductionSyntaxNode(3)!=null) { rt=LRParser.GetReductionSyntaxNode(3); if (((procedure_attributes_list)LRParser.GetReductionSyntaxNode(3)).proc_attributes.Count>0) _destructor.proc_attributes=(procedure_attributes_list)LRParser.GetReductionSyntaxNode(3); } parsertools.create_source_context(_destructor,LRParser.GetReductionSyntaxNode(0),rt); return _destructor; } case (int)RuleConstants.RULE_QUALIFIED_IDENTIFIER : //<qualified_identifier> ::= <identifier> <empty> { method_name _method_name=new method_name(null,null,(ident)LRParser.GetReductionSyntaxNode(0),null); parsertools.create_source_context(_method_name,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _method_name; } case (int)RuleConstants.RULE_QUALIFIED_IDENTIFIER2 : //<qualified_identifier> ::= <visibility_specifier> <empty> { method_name _method_name=new method_name(null,null,(ident)LRParser.GetReductionSyntaxNode(0),null); parsertools.create_source_context(_method_name,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _method_name; } case (int)RuleConstants.RULE_QUALIFIED_IDENTIFIER_TKPOINT : //<qualified_identifier> ::= <qualified_identifier> tkPoint <identifier> { method_name mn=(method_name)LRParser.GetReductionSyntaxNode(0); mn.class_name=mn.meth_name; mn.meth_name=(ident)LRParser.GetReductionSyntaxNode(2); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return LRParser.GetReductionSyntaxNode(0); } case (int)RuleConstants.RULE_QUALIFIED_IDENTIFIER_TKPOINT2 : //<qualified_identifier> ::= <qualified_identifier> tkPoint <visibility_specifier> { method_name mn=(method_name)LRParser.GetReductionSyntaxNode(0); mn.class_name=mn.meth_name; mn.meth_name=(ident)LRParser.GetReductionSyntaxNode(2); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return LRParser.GetReductionSyntaxNode(0); } case (int)RuleConstants.RULE_NOT_PROPERTY_DEFINITION : //<not_property_definition> ::= <opt_attribute_declarations> <simple_not_property_definition> { declaration _declaration; _declaration=LRParser.GetReductionSyntaxNode(1) as declaration; _declaration.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _declaration; } case (int)RuleConstants.RULE_SIMPLE_NOT_PROPERTY_DEFINITION : //<simple_not_property_definition> ::= <not_simple_property_definition> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_NOT_PROPERTY_DEFINITION_TKCLASS : //<simple_not_property_definition> ::= tkClass <not_simple_property_definition> { simple_property _simple_property=(simple_property)LRParser.GetReductionSyntaxNode(1); _simple_property.attr=definition_attribute.Static; parsertools.create_source_context(_simple_property,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _simple_property; } case (int)RuleConstants.RULE_NOT_SIMPLE_PROPERTY_DEFINITION_TKPROPERTY_TKSEMICOLON : //<not_simple_property_definition> ::= tkProperty <qualified_identifier> <not_property_interface> <not_property_specifiers> tkSemiColon <not_array_defaultproperty> { simple_property _simple_property=new simple_property(); _simple_property.property_name=((method_name)LRParser.GetReductionSyntaxNode(1)).meth_name; if (LRParser.GetReductionSyntaxNode(2)!=null){ _simple_property.parameter_list=((property_interface)LRParser.GetReductionSyntaxNode(2)).parameter_list; _simple_property.property_type=((property_interface)LRParser.GetReductionSyntaxNode(2)).property_type; _simple_property.index_expression=((property_interface)LRParser.GetReductionSyntaxNode(2)).index_expression; } if (LRParser.GetReductionSyntaxNode(3)!=null) _simple_property.accessors=(property_accessors)LRParser.GetReductionSyntaxNode(3); if (LRParser.GetReductionSyntaxNode(5)!=null) _simple_property.array_default=(property_array_default)LRParser.GetReductionSyntaxNode(5); parsertools.create_source_context(_simple_property,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(5),LRParser.GetReductionSyntaxNode(4),LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); return _simple_property; } case (int)RuleConstants.RULE_NOT_ARRAY_DEFAULTPROPERTY : //<not_array_defaultproperty> ::= //NONTERMINAL:<not_array_defaultproperty> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_NOT_ARRAY_DEFAULTPROPERTY_TKDEFAULT_TKSEMICOLON : //<not_array_defaultproperty> ::= tkDefault tkSemiColon { property_array_default _property_array_default=new property_array_default(); parsertools.create_source_context(_property_array_default,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _property_array_default; } case (int)RuleConstants.RULE_NOT_PROPERTY_INTERFACE : //<not_property_interface> ::= //NONTERMINAL:<not_property_interface> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_NOT_PROPERTY_INTERFACE_TKCOLON : //<not_property_interface> ::= <not_property_parameter_list> tkColon <fptype> <not_property_interface_index> { property_interface _property_interface=new property_interface(); _property_interface.parameter_list=(property_parameter_list)LRParser.GetReductionSyntaxNode(0); _property_interface.property_type=(type_definition)LRParser.GetReductionSyntaxNode(2); _property_interface.index_expression=(expression)LRParser.GetReductionSyntaxNode(3); parsertools.create_source_context(_property_interface,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(3)),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); return _property_interface; } case (int)RuleConstants.RULE_NOT_PROPERTY_INTERFACE_INDEX : //<not_property_interface_index> ::= //NONTERMINAL:<not_property_interface_index> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_NOT_PROPERTY_INTERFACE_INDEX_TKINDEX : //<not_property_interface_index> ::= tkIndex <expr> return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_NOT_PROPERTY_PARAMETER_LIST : //<not_property_parameter_list> ::= //NONTERMINAL:<not_property_parameter_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_NOT_PROPERTY_PARAMETER_LIST_TKSQUAREOPEN_TKSQUARECLOSE : //<not_property_parameter_list> ::= tkSquareOpen <not_parameter_decl_list> tkSquareClose return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_NOT_PARAMETER_DECL_LIST : //<not_parameter_decl_list> ::= <not_parameter_decl> <empty> //TemplateList for property_parameter_list (create) { property_parameter_list _property_parameter_list=new property_parameter_list(); _property_parameter_list.source_context=((property_parameter)LRParser.GetReductionSyntaxNode(0)).source_context; _property_parameter_list.parameters.Add((property_parameter)LRParser.GetReductionSyntaxNode(0)); return _property_parameter_list; } case (int)RuleConstants.RULE_NOT_PARAMETER_DECL_LIST_TKSEMICOLON : //<not_parameter_decl_list> ::= <not_parameter_decl_list> tkSemiColon <not_parameter_decl> //TemplateList for property_parameter_list (add) { property_parameter_list _property_parameter_list=(property_parameter_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_property_parameter_list,_property_parameter_list,LRParser.GetReductionSyntaxNode(2)); _property_parameter_list.parameters.Add(LRParser.GetReductionSyntaxNode(2) as property_parameter); return _property_parameter_list; } case (int)RuleConstants.RULE_NOT_PARAMETER_DECL_TKCOLON : //<not_parameter_decl> ::= <not_parameter_name_list> tkColon <fptype> { property_parameter _property_parameter=new property_parameter((ident_list)LRParser.GetReductionSyntaxNode(0),(type_definition)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_property_parameter,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _property_parameter; } case (int)RuleConstants.RULE_NOT_PARAMETER_DECL_TKCONST_TKCOLON : //<not_parameter_decl> ::= tkConst <not_parameter_name_list> tkColon <fptype> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<not_parameter_decl> ::= tkConst <not_parameter_name_list> tkColon <fptype>"));}return null; case (int)RuleConstants.RULE_NOT_PARAMETER_DECL_TKVAR_TKCOLON : //<not_parameter_decl> ::= tkVar <not_parameter_name_list> tkColon <fptype> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<not_parameter_decl> ::= tkVar <not_parameter_name_list> tkColon <fptype>"));}return null; case (int)RuleConstants.RULE_NOT_PARAMETER_DECL_TKOUT_TKCOLON : //<not_parameter_decl> ::= tkOut <not_parameter_name_list> tkColon <fptype> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<not_parameter_decl> ::= tkOut <not_parameter_name_list> tkColon <fptype>"));}return null; case (int)RuleConstants.RULE_NOT_PARAMETER_NAME_LIST : //<not_parameter_name_list> ::= <ident_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_IDENTIFIER : //<opt_identifier> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_IDENTIFIER2 : //<opt_identifier> ::= //NONTERMINAL:<opt_identifier> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_NOT_PROPERTY_SPECIFIERS : //<not_property_specifiers> ::= //NONTERMINAL:<not_property_specifiers> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_NOT_PROPERTY_SPECIFIERS_TKREADONLY : //<not_property_specifiers> ::= tkReadOnly <not_property_specifiers> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<not_property_specifiers> ::= tkReadOnly <not_property_specifiers>"));}return null; case (int)RuleConstants.RULE_NOT_PROPERTY_SPECIFIERS_TKWRITEONLY : //<not_property_specifiers> ::= tkWriteOnly <not_property_specifiers> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<not_property_specifiers> ::= tkWriteOnly <not_property_specifiers>"));}return null; case (int)RuleConstants.RULE_NOT_PROPERTY_SPECIFIERS_TKDEFAULT : //<not_property_specifiers> ::= tkDefault <const_expr> <not_property_specifiers> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<not_property_specifiers> ::= tkDefault <const_expr> <not_property_specifiers>"));}return null; case (int)RuleConstants.RULE_NOT_PROPERTY_SPECIFIERS_TKREAD : //<not_property_specifiers> ::= tkRead <opt_identifier> <not_property_specifiers> { property_accessors _property_accessors; property_accessors _pa=LRParser.GetReductionSyntaxNode(2) as property_accessors; if (_pa==null) { _pa=new property_accessors();parsertools.create_source_context(_pa,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); } _property_accessors=_pa; if(LRParser.GetReductionSyntaxNode(1)!=null && ((ident)LRParser.GetReductionSyntaxNode(1)).name.ToLower()=="write") { _property_accessors.read_accessor=new read_accessor_name(null); _property_accessors.write_accessor=new write_accessor_name(null); parsertools.create_source_context(_property_accessors.read_accessor,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_property_accessors.write_accessor,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_property_accessors,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); } else { _property_accessors.read_accessor=new read_accessor_name((ident)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_property_accessors.read_accessor,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); parsertools.create_source_context(_property_accessors,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); } return _property_accessors; } case (int)RuleConstants.RULE_NOT_PROPERTY_SPECIFIERS_TKWRITE : //<not_property_specifiers> ::= tkWrite <opt_identifier> <not_property_specifiers> { property_accessors _property_accessors; property_accessors _pa=LRParser.GetReductionSyntaxNode(2) as property_accessors; if (_pa==null) { _pa=new property_accessors();parsertools.create_source_context(_pa,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); } _property_accessors=_pa; _property_accessors.write_accessor=new write_accessor_name((ident)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_property_accessors.write_accessor,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); parsertools.create_source_context(_property_accessors,LRParser.GetReductionSyntaxNode(0),_pa); return _property_accessors; } case (int)RuleConstants.RULE_VAR_DECL_TKSEMICOLON : //<var_decl> ::= <var_decl_part> tkSemiColon return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VAR_DECL_PART : //<var_decl_part> ::= <var_decl_part_normal> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VAR_DECL_PART2 : //<var_decl_part> ::= <var_decl_part_assign> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VAR_DECL_PART_TKCOLON_TKASSIGN : //<var_decl_part> ::= <var_name_list> tkColon <type_ref> tkAssign <var_init_value_typed> { var_def_statement _var_def_statement=new var_def_statement((ident_list)LRParser.GetReductionSyntaxNode(0),(type_definition)LRParser.GetReductionSyntaxNode(2),(expression)LRParser.GetReductionSyntaxNode(4),definition_attribute.None,false); parsertools.create_source_context(_var_def_statement,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return _var_def_statement; } case (int)RuleConstants.RULE_VAR_DECL_PART_IN_STMT : //<var_decl_part_in_stmt> ::= <var_decl_part> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VAR_DECL_PART_ASSIGN_TKASSIGN : //<var_decl_part_assign> ::= <var_name_list> tkAssign <var_init_value> { var_def_statement _var_def_statement=new var_def_statement((ident_list)LRParser.GetReductionSyntaxNode(0),null,(expression)LRParser.GetReductionSyntaxNode(2),definition_attribute.None,false); parsertools.create_source_context(_var_def_statement,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _var_def_statement; } case (int)RuleConstants.RULE_VAR_DECL_PART_NORMAL_TKCOLON : //<var_decl_part_normal> ::= <var_name_list> tkColon <type_ref> { var_def_statement _var_def_statement=new var_def_statement((ident_list)LRParser.GetReductionSyntaxNode(0),(type_definition)LRParser.GetReductionSyntaxNode(2),null,definition_attribute.None,false); parsertools.create_source_context(_var_def_statement,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _var_def_statement; } case (int)RuleConstants.RULE_VAR_INIT_VALUE : //<var_init_value> ::= <expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VAR_INIT_VALUE_TYPED : //<var_init_value_typed> ::= <typed_const_or_new> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPED_CONST_OR_NEW : //<typed_const_or_new> ::= <typed_const> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPED_CONST_OR_NEW2 : //<typed_const_or_new> ::= <new_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPED_CONST_OR_NEW3 : //<typed_const_or_new> ::= <default_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VAR_NAME_LIST : //<var_name_list> ::= <var_name> <empty> { ident_list _ident_list=new ident_list(); parsertools.create_source_context(_ident_list,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); _ident_list.idents.Add((ident)LRParser.GetReductionSyntaxNode(0)); return _ident_list; } case (int)RuleConstants.RULE_VAR_NAME_LIST_TKCOMMA : //<var_name_list> ::= <var_name_list> tkComma <var_name> { ident_list _ident_list=(ident_list)LRParser.GetReductionSyntaxNode(0); _ident_list.idents.Add((ident)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_ident_list,_ident_list,LRParser.GetReductionSyntaxNode(2)); return _ident_list; } case (int)RuleConstants.RULE_VAR_NAME : //<var_name> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_DECLARED_VAR_NAME : //<declared_var_name> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CONSTRUCTOR_DECL : //<constructor_decl> ::= <not_constructor_heading> <not_constructor_block_decl> //procedure_definition create { procedure_definition _procedure_definition=new procedure_definition((procedure_header)LRParser.GetReductionSyntaxNode(0),null); object rt=LRParser.GetReductionSyntaxNode(0); if(LRParser.GetReductionSyntaxNode(1)!=null) { rt=LRParser.GetReductionSyntaxNode(1); if(LRParser.GetReductionSyntaxNode(1) is proc_block) _procedure_definition.proc_body=(proc_block)LRParser.GetReductionSyntaxNode(1); if(LRParser.GetReductionSyntaxNode(1) is procedure_attribute) { procedure_header ph=_procedure_definition.proc_header; if(ph.proc_attributes==null) { ph.proc_attributes=new procedure_attributes_list(); parsertools.assign_source_context(ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } ph.proc_attributes.proc_attributes.Add((procedure_attribute)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(ph.proc_attributes,ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } } parsertools.create_source_context(_procedure_definition,LRParser.GetReductionSyntaxNode(0),rt); return _procedure_definition; } case (int)RuleConstants.RULE_ABC_CONSTRUCTOR_DECL : //<abc_constructor_decl> ::= <not_constructor_heading> <abc_block> //procedure_definition create { procedure_definition _procedure_definition=new procedure_definition((procedure_header)LRParser.GetReductionSyntaxNode(0),null); object rt=LRParser.GetReductionSyntaxNode(0); if(LRParser.GetReductionSyntaxNode(1)!=null) { rt=LRParser.GetReductionSyntaxNode(1); if(LRParser.GetReductionSyntaxNode(1) is proc_block) _procedure_definition.proc_body=(proc_block)LRParser.GetReductionSyntaxNode(1); if(LRParser.GetReductionSyntaxNode(1) is procedure_attribute) { procedure_header ph=_procedure_definition.proc_header; if(ph.proc_attributes==null) { ph.proc_attributes=new procedure_attributes_list(); parsertools.assign_source_context(ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } ph.proc_attributes.proc_attributes.Add((procedure_attribute)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(ph.proc_attributes,ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } } parsertools.create_source_context(_procedure_definition,LRParser.GetReductionSyntaxNode(0),rt); return _procedure_definition; } case (int)RuleConstants.RULE_DESTRUCTOR_DECL : //<destructor_decl> ::= <not_destructor_heading> <not_constructor_block_decl> //procedure_definition create { procedure_definition _procedure_definition=new procedure_definition((procedure_header)LRParser.GetReductionSyntaxNode(0),null); object rt=LRParser.GetReductionSyntaxNode(0); if(LRParser.GetReductionSyntaxNode(1)!=null) { rt=LRParser.GetReductionSyntaxNode(1); if(LRParser.GetReductionSyntaxNode(1) is proc_block) _procedure_definition.proc_body=(proc_block)LRParser.GetReductionSyntaxNode(1); if(LRParser.GetReductionSyntaxNode(1) is procedure_attribute) { procedure_header ph=_procedure_definition.proc_header; if(ph.proc_attributes==null) { ph.proc_attributes=new procedure_attributes_list(); parsertools.assign_source_context(ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } ph.proc_attributes.proc_attributes.Add((procedure_attribute)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(ph.proc_attributes,ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } } parsertools.create_source_context(_procedure_definition,LRParser.GetReductionSyntaxNode(0),rt); return _procedure_definition; } case (int)RuleConstants.RULE_ABC_DESTRUCTOR_DECL : //<abc_destructor_decl> ::= <not_destructor_heading> <abc_block> //procedure_definition create { procedure_definition _procedure_definition=new procedure_definition((procedure_header)LRParser.GetReductionSyntaxNode(0),null); object rt=LRParser.GetReductionSyntaxNode(0); if(LRParser.GetReductionSyntaxNode(1)!=null) { rt=LRParser.GetReductionSyntaxNode(1); if(LRParser.GetReductionSyntaxNode(1) is proc_block) _procedure_definition.proc_body=(proc_block)LRParser.GetReductionSyntaxNode(1); if(LRParser.GetReductionSyntaxNode(1) is procedure_attribute) { procedure_header ph=_procedure_definition.proc_header; if(ph.proc_attributes==null) { ph.proc_attributes=new procedure_attributes_list(); parsertools.assign_source_context(ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } ph.proc_attributes.proc_attributes.Add((procedure_attribute)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(ph.proc_attributes,ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } } parsertools.create_source_context(_procedure_definition,LRParser.GetReductionSyntaxNode(0),rt); return _procedure_definition; } case (int)RuleConstants.RULE_NOT_CONSTRUCTOR_BLOCK_DECL : //<not_constructor_block_decl> ::= <block> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_CONSTRUCTOR_BLOCK_DECL2 : //<not_constructor_block_decl> ::= <external_directr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NOT_CONSTRUCTOR_BLOCK_DECL3 : //<not_constructor_block_decl> ::= <asm_block> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROC_DECL : //<proc_decl> ::= <proc_decl_noclass> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROC_DECL_TKCLASS : //<proc_decl> ::= tkClass <proc_decl_noclass> ((LRParser.GetReductionSyntaxNode(1) as procedure_definition).proc_header as procedure_header).class_keyword=true;return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_PROC_DECL_NOCLASS : //<proc_decl_noclass> ::= <proc_heading> <proc_block> { procedure_definition _procedure_definition=new procedure_definition((procedure_header)LRParser.GetReductionSyntaxNode(0),null); object rt=LRParser.GetReductionSyntaxNode(0); if(LRParser.GetReductionSyntaxNode(1)!=null) { rt=LRParser.GetReductionSyntaxNode(1); if (LRParser.GetReductionSyntaxNode(1) is proc_block) { add_lambda(LRParser.GetReductionSyntaxNode(1), _procedure_definition);//tasha 16.04.2010 } if(LRParser.GetReductionSyntaxNode(1) is procedure_attribute) { procedure_header ph=_procedure_definition.proc_header; if(ph.proc_attributes==null) { ph.proc_attributes=new procedure_attributes_list(); parsertools.assign_source_context(ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } ph.proc_attributes.proc_attributes.Add((procedure_attribute)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(ph.proc_attributes,ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } } parsertools.create_source_context(_procedure_definition,LRParser.GetReductionSyntaxNode(0),rt); return _procedure_definition; } case (int)RuleConstants.RULE_ABC_PROC_DECL : //<abc_proc_decl> ::= <abc_proc_decl_noclass> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_PROC_DECL_TKCLASS : //<abc_proc_decl> ::= tkClass <abc_proc_decl_noclass> ((LRParser.GetReductionSyntaxNode(1) as procedure_definition).proc_header as procedure_header).class_keyword=true;return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_ABC_PROC_DECL_NOCLASS : //<abc_proc_decl_noclass> ::= <proc_heading> <abc_proc_block> {procedure_definition _procedure_definition=new procedure_definition((procedure_header)LRParser.GetReductionSyntaxNode(0),null); object rt=LRParser.GetReductionSyntaxNode(0); if(LRParser.GetReductionSyntaxNode(1)!=null) { rt=LRParser.GetReductionSyntaxNode(1); if (LRParser.GetReductionSyntaxNode(1) is proc_block) { add_lambda(LRParser.GetReductionSyntaxNode(1), _procedure_definition);//tasha 16.04.2010 } if(LRParser.GetReductionSyntaxNode(1) is procedure_attribute) { procedure_header ph=_procedure_definition.proc_header; if(ph.proc_attributes==null) { ph.proc_attributes=new procedure_attributes_list(); parsertools.assign_source_context(ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } ph.proc_attributes.proc_attributes.Add((procedure_attribute)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(ph.proc_attributes,ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } } parsertools.create_source_context(_procedure_definition,LRParser.GetReductionSyntaxNode(0),rt); return _procedure_definition;} case (int)RuleConstants.RULE_FUNC_DECL : //<func_decl> ::= <func_decl_noclass> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FUNC_DECL_TKCLASS : //<func_decl> ::= tkClass <func_decl_noclass> ((LRParser.GetReductionSyntaxNode(1) as procedure_definition).proc_header as procedure_header).class_keyword=true;return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_FUNC_DECL_NOCLASS : //<func_decl_noclass> ::= <func_heading> <func_block> { procedure_definition _procedure_definition=new procedure_definition((function_header)LRParser.GetReductionSyntaxNode(0),null); object rt=LRParser.GetReductionSyntaxNode(0); if(LRParser.GetReductionSyntaxNode(1)!=null) { rt=LRParser.GetReductionSyntaxNode(1); if (LRParser.GetReductionSyntaxNode(1) is proc_block) { add_lambda(LRParser.GetReductionSyntaxNode(1), _procedure_definition);//tasha 16.04.2010 } if(LRParser.GetReductionSyntaxNode(1) is procedure_attribute) { procedure_header ph=_procedure_definition.proc_header; if(ph.proc_attributes==null) { ph.proc_attributes=new procedure_attributes_list(); parsertools.assign_source_context(ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } ph.proc_attributes.proc_attributes.Add((procedure_attribute)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(ph.proc_attributes,ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } } parsertools.create_source_context(_procedure_definition,LRParser.GetReductionSyntaxNode(0),rt); return _procedure_definition;} case (int)RuleConstants.RULE_ABC_FUNC_DECL : //<abc_func_decl> ::= <abc_func_decl_noclass> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_FUNC_DECL_TKCLASS : //<abc_func_decl> ::= tkClass <abc_func_decl_noclass> ((LRParser.GetReductionSyntaxNode(1) as procedure_definition).proc_header as procedure_header).class_keyword=true;return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_ABC_FUNC_DECL_NOCLASS : //<abc_func_decl_noclass> ::= <func_heading> <abc_proc_block> { procedure_definition _procedure_definition=new procedure_definition((function_header)LRParser.GetReductionSyntaxNode(0),null); object rt=LRParser.GetReductionSyntaxNode(0); if(LRParser.GetReductionSyntaxNode(1)!=null) { rt=LRParser.GetReductionSyntaxNode(1); if (LRParser.GetReductionSyntaxNode(1) is proc_block) { add_lambda(LRParser.GetReductionSyntaxNode(1), _procedure_definition);//tasha 16.04.2010 } if(LRParser.GetReductionSyntaxNode(1) is procedure_attribute) { procedure_header ph=_procedure_definition.proc_header; if(ph.proc_attributes==null) { ph.proc_attributes=new procedure_attributes_list(); parsertools.assign_source_context(ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } ph.proc_attributes.proc_attributes.Add((procedure_attribute)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(ph.proc_attributes,ph.proc_attributes,LRParser.GetReductionSyntaxNode(1)); } } parsertools.create_source_context(_procedure_definition,LRParser.GetReductionSyntaxNode(0),rt); return _procedure_definition; } case (int)RuleConstants.RULE_PROC_HEADING_TKPROCEDURE : //<proc_heading> ::= tkProcedure <proc_name> <fp_list> <maybe_error> <opt_meth_modificators> <opt_where_section> { procedure_header _procedure_header=new procedure_header(null,null,(method_name)LRParser.GetReductionSyntaxNode(1),false,false,null,null); object rt=LRParser.GetReductionSyntaxNode(1); if(_procedure_header.name.meth_name is template_type_name) { _procedure_header.template_args=(_procedure_header.name.meth_name as template_type_name).template_args; ident id = new ident(_procedure_header.name.meth_name.name); parsertools.create_source_context(id,_procedure_header.name.meth_name,_procedure_header.name.meth_name); _procedure_header.name.meth_name=id; } if (LRParser.GetReductionSyntaxNode(2)!=null) { rt=LRParser.GetReductionSyntaxNode(2); _procedure_header.parameters=(formal_parameters)LRParser.GetReductionSyntaxNode(2); } if(LRParser.GetReductionSyntaxNode(3)!=null) (LRParser.GetReductionSyntaxNode(3) as SyntaxError).bad_node=_procedure_header; if (LRParser.GetReductionSyntaxNode(4)!=null) { rt=LRParser.GetReductionSyntaxNode(4); if (((procedure_attributes_list)LRParser.GetReductionSyntaxNode(4)).proc_attributes.Count>0) _procedure_header.proc_attributes=(procedure_attributes_list)LRParser.GetReductionSyntaxNode(4); } if (LRParser.GetReductionSyntaxNode(5)!=null) { rt=LRParser.GetReductionSyntaxNode(5); _procedure_header.where_defs = (where_definition_list)LRParser.GetReductionSyntaxNode(5); } parsertools.create_source_context(_procedure_header,LRParser.GetReductionSyntaxNode(0),rt); return _procedure_header; } case (int)RuleConstants.RULE_PROC_NAME : //<proc_name> ::= <func_name> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FUNC_NAME : //<func_name> ::= <func_meth_name_ident> <empty> { method_name _method_name=new method_name(null,null,(ident)LRParser.GetReductionSyntaxNode(0),null); parsertools.create_source_context(_method_name,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _method_name; } case (int)RuleConstants.RULE_FUNC_NAME_TKPOINT : //<func_name> ::= <func_class_name_ident> tkPoint <func_meth_name_ident> { method_name _method_name=new method_name(null,(ident)LRParser.GetReductionSyntaxNode(0),(ident)LRParser.GetReductionSyntaxNode(2),null); parsertools.create_source_context(_method_name,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _method_name; } case (int)RuleConstants.RULE_FUNC_NAME_TKPOINT_TKPOINT : //<func_name> ::= <func_class_name_ident> tkPoint <func_class_name_ident> tkPoint <func_meth_name_ident> { method_name _method_name=new method_name(null,(ident)LRParser.GetReductionSyntaxNode(0),(ident)LRParser.GetReductionSyntaxNode(4),(ident)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_method_name,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return _method_name; } case (int)RuleConstants.RULE_FUNC_CLASS_NAME_IDENT : //<func_class_name_ident> ::= <func_name_with_template_args> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FUNC_METH_NAME_IDENT : //<func_meth_name_ident> ::= <func_name_with_template_args> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FUNC_METH_NAME_IDENT2 : //<func_meth_name_ident> ::= <operator_name_ident> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FUNC_NAME_WITH_TEMPLATE_ARGS : //<func_name_with_template_args> ::= <func_name_ident> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FUNC_NAME_WITH_TEMPLATE_ARGS2 : //<func_name_with_template_args> ::= <func_name_ident> <template_arguments> { template_type_name _template_type_name=new template_type_name((ident_list)LRParser.GetReductionSyntaxNode(1)); _template_type_name.name=((ident)LRParser.GetReductionSyntaxNode(0)).name; parsertools.create_source_context(_template_type_name,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _template_type_name; } case (int)RuleConstants.RULE_FUNC_NAME_IDENT : //<func_name_ident> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FUNC_NAME_IDENT2 : //<func_name_ident> ::= <visibility_specifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FUNC_HEADING_TKFUNCTION_TKCOLON : //<func_heading> ::= tkFunction <func_name> <fp_list> tkColon <fptype> <opt_meth_modificators> <opt_where_section> { function_header _function_header=new function_header(); object rt=LRParser.GetReductionSyntaxNode(1); _function_header.name=(method_name)LRParser.GetReductionSyntaxNode(1); if(_function_header.name.meth_name is template_type_name) { _function_header.template_args=(_function_header.name.meth_name as template_type_name).template_args; ident id = new ident(_function_header.name.meth_name.name); parsertools.create_source_context(id,_function_header.name.meth_name,_function_header.name.meth_name); _function_header.name.meth_name=id; } //_function_header.template_args=(ident_list)LRParser.GetReductionSyntaxNode(2); if (LRParser.GetReductionSyntaxNode(2)!=null) { rt=LRParser.GetReductionSyntaxNode(2); _function_header.parameters=(formal_parameters)LRParser.GetReductionSyntaxNode(2); } if (LRParser.GetReductionSyntaxNode(4)!=null) { rt=LRParser.GetReductionSyntaxNode(4); _function_header.return_type=(type_definition)LRParser.GetReductionSyntaxNode(4); } if (LRParser.GetReductionSyntaxNode(5)!=null) { rt=LRParser.GetReductionSyntaxNode(5); if (((procedure_attributes_list)LRParser.GetReductionSyntaxNode(5)).proc_attributes.Count>0) _function_header.proc_attributes=(procedure_attributes_list)LRParser.GetReductionSyntaxNode(5); } if (LRParser.GetReductionSyntaxNode(6)!=null) { rt=LRParser.GetReductionSyntaxNode(6); _function_header.where_defs = (where_definition_list)LRParser.GetReductionSyntaxNode(6); } _function_header.of_object=false; _function_header.class_keyword=false; parsertools.create_source_context(_function_header,LRParser.GetReductionSyntaxNode(0),rt); return _function_header; } case (int)RuleConstants.RULE_FUNC_HEADING_TKFUNCTION : //<func_heading> ::= tkFunction <func_name> <opt_meth_modificators> { function_header _function_header=new function_header(); object rt=LRParser.GetReductionSyntaxNode(1); _function_header.name=(method_name)LRParser.GetReductionSyntaxNode(1); if (LRParser.GetReductionSyntaxNode(2)!=null) { rt=LRParser.GetReductionSyntaxNode(2); if (((procedure_attributes_list)LRParser.GetReductionSyntaxNode(2)).proc_attributes.Count>0) _function_header.proc_attributes=(procedure_attributes_list)LRParser.GetReductionSyntaxNode(2); } _function_header.of_object=false; _function_header.class_keyword=false; parsertools.create_source_context(_function_header,LRParser.GetReductionSyntaxNode(0),rt); return _function_header; } case (int)RuleConstants.RULE_PROC_BLOCK : //<proc_block> ::= <proc_block_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FUNC_BLOCK : //<func_block> ::= <proc_block_decl> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROC_BLOCK_DECL : //<proc_block_decl> ::= <block> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROC_BLOCK_DECL2 : //<proc_block_decl> ::= <external_directr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROC_BLOCK_DECL3 : //<proc_block_decl> ::= <asm_block> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROC_BLOCK_DECL_TKFORWARD_TKSEMICOLON : //<proc_block_decl> ::= tkForward tkSemiColon return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_PROC_BLOCK : //<abc_proc_block> ::= <abc_block> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_PROC_BLOCK2 : //<abc_proc_block> ::= <external_directr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXTERNAL_DIRECTR : //<external_directr> ::= <abc_external_directr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXTERNAL_DIRECTR_TKSEMICOLON : //<external_directr> ::= <abc_external_directr> tkSemiColon return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXTERNAL_DIRECTR_TKEXTERNAL_TKSEMICOLON : //<external_directr> ::= tkExternal tkSemiColon { external_directive _external_directive=new external_directive(null,null); parsertools.create_source_context(_external_directive,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _external_directive; } case (int)RuleConstants.RULE_EXTERNAL_DIRECTR_IDENT : //<external_directr_ident> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXTERNAL_DIRECTR_IDENT2 : //<external_directr_ident> ::= <literal> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ABC_EXTERNAL_DIRECTR_TKEXTERNAL_TKNAME : //<abc_external_directr> ::= tkExternal <external_directr_ident> tkName <external_directr_ident> { external_directive _external_directive=new external_directive((expression)LRParser.GetReductionSyntaxNode(1),(expression)LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_external_directive,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _external_directive; } case (int)RuleConstants.RULE_ABC_EXTERNAL_DIRECTR_TKEXTERNAL : //<abc_external_directr> ::= tkExternal <external_directr_ident> { external_directive _external_directive=new external_directive((expression)LRParser.GetReductionSyntaxNode(1),null); parsertools.create_source_context(_external_directive,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _external_directive; } case (int)RuleConstants.RULE_ASM_BLOCK_TKASMBODY_TKSEMICOLON : //<asm_block> ::= <impl_decl_sect_list> tkAsmBody tkSemiColon {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<asm_block> ::= <impl_decl_sect_list> tkAsmBody tkSemiColon"));}return null; case (int)RuleConstants.RULE_BLOCK_TKSEMICOLON : //<block> ::= <impl_decl_sect_list> <compound_stmt> tkSemiColon { block _block=new block((declarations)LRParser.GetReductionSyntaxNode(0),(statement_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_block,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)),LRParser.GetReductionSyntaxNode(2)); return _block; } case (int)RuleConstants.RULE_ABC_BLOCK_TKSEMICOLON : //<abc_block> ::= <abc_decl_sect_list> <compound_stmt> tkSemiColon { block _block=new block((declarations)LRParser.GetReductionSyntaxNode(0),(statement_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_block,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)),LRParser.GetReductionSyntaxNode(2)); return _block; } case (int)RuleConstants.RULE_FP_LIST : //<fp_list> ::= //NONTERMINAL:<fp_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_FP_LIST_TKROUNDOPEN_TKROUNDCLOSE : //<fp_list> ::= tkRoundOpen <fp_sect_list> tkRoundClose if(LRParser.GetReductionSyntaxNode(1)!=null) parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_FP_SECT_LIST : //<fp_sect_list> ::= //NONTERMINAL:<fp_sect_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_FP_SECT_LIST2 : //<fp_sect_list> ::= <fp_sect> <empty> { formal_parameters _formal_parameters=new formal_parameters(); _formal_parameters.params_list.Add((typed_parameters)LRParser.GetReductionSyntaxNode(0)); return _formal_parameters; } case (int)RuleConstants.RULE_FP_SECT_LIST_TKSEMICOLON : //<fp_sect_list> ::= <fp_sect_list> tkSemiColon <fp_sect> { formal_parameters _formal_parameters=(formal_parameters)LRParser.GetReductionSyntaxNode(0); _formal_parameters.params_list.Add((typed_parameters)LRParser.GetReductionSyntaxNode(2)); return _formal_parameters; } case (int)RuleConstants.RULE_FP_SECT : //<fp_sect> ::= <opt_attribute_declarations> <simple_fp_sect> { declaration _declaration; _declaration=LRParser.GetReductionSyntaxNode(1) as declaration; _declaration.attributes = LRParser.GetReductionSyntaxNode(0) as attribute_list; return _declaration; } case (int)RuleConstants.RULE_SIMPLE_FP_SECT_TKCOLON : //<simple_fp_sect> ::= <param_name_list> tkColon <fptype_new> { typed_parameters _typed_parameters=new typed_parameters((ident_list)LRParser.GetReductionSyntaxNode(0),(type_definition)LRParser.GetReductionSyntaxNode(2),parametr_kind.none,null); parsertools.create_source_context(_typed_parameters,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _typed_parameters; } case (int)RuleConstants.RULE_SIMPLE_FP_SECT_TKVAR_TKCOLON : //<simple_fp_sect> ::= tkVar <param_name_list> tkColon <fptype_new> { typed_parameters _typed_parameters=new typed_parameters((ident_list)LRParser.GetReductionSyntaxNode(1),(type_definition)LRParser.GetReductionSyntaxNode(3),parametr_kind.var_parametr,null); parsertools.create_source_context(_typed_parameters,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _typed_parameters; } case (int)RuleConstants.RULE_SIMPLE_FP_SECT_TKOUT_TKCOLON : //<simple_fp_sect> ::= tkOut <param_name_list> tkColon <fptype_new> { typed_parameters _typed_parameters=new typed_parameters((ident_list)LRParser.GetReductionSyntaxNode(1),(type_definition)LRParser.GetReductionSyntaxNode(3),parametr_kind.out_parametr,null); parsertools.create_source_context(_typed_parameters,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _typed_parameters; } case (int)RuleConstants.RULE_SIMPLE_FP_SECT_TKCONST_TKCOLON : //<simple_fp_sect> ::= tkConst <param_name_list> tkColon <fptype_new> { typed_parameters _typed_parameters=new typed_parameters((ident_list)LRParser.GetReductionSyntaxNode(1),(type_definition)LRParser.GetReductionSyntaxNode(3),parametr_kind.const_parametr,null); parsertools.create_source_context(_typed_parameters,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _typed_parameters; } case (int)RuleConstants.RULE_SIMPLE_FP_SECT_TKPARAMS_TKCOLON : //<simple_fp_sect> ::= tkParams <param_name_list> tkColon <fptype_new> { typed_parameters _typed_parameters=new typed_parameters((ident_list)LRParser.GetReductionSyntaxNode(1),(type_definition)LRParser.GetReductionSyntaxNode(3),parametr_kind.params_parametr,null); parsertools.create_source_context(_typed_parameters,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _typed_parameters; } case (int)RuleConstants.RULE_SIMPLE_FP_SECT_TKCOLON_TKASSIGN : //<simple_fp_sect> ::= <param_name_list> tkColon <fptype> tkAssign <const_expr> { typed_parameters _typed_parameters=new typed_parameters((ident_list)LRParser.GetReductionSyntaxNode(0),(type_definition)LRParser.GetReductionSyntaxNode(2),parametr_kind.none,(expression)LRParser.GetReductionSyntaxNode(4)); parsertools.create_source_context(_typed_parameters,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return _typed_parameters; } case (int)RuleConstants.RULE_SIMPLE_FP_SECT_TKVAR_TKCOLON_TKASSIGN : //<simple_fp_sect> ::= tkVar <param_name_list> tkColon <fptype> tkAssign <const_expr> { typed_parameters _typed_parameters=new typed_parameters((ident_list)LRParser.GetReductionSyntaxNode(1),(type_definition)LRParser.GetReductionSyntaxNode(3),parametr_kind.var_parametr,(expression)LRParser.GetReductionSyntaxNode(5)); parsertools.create_source_context(_typed_parameters,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(5)); return _typed_parameters; } case (int)RuleConstants.RULE_SIMPLE_FP_SECT_TKOUT_TKCOLON_TKASSIGN : //<simple_fp_sect> ::= tkOut <param_name_list> tkColon <fptype> tkAssign <const_expr> { typed_parameters _typed_parameters=new typed_parameters((ident_list)LRParser.GetReductionSyntaxNode(1),(type_definition)LRParser.GetReductionSyntaxNode(3),parametr_kind.out_parametr,(expression)LRParser.GetReductionSyntaxNode(5)); parsertools.create_source_context(_typed_parameters,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(5)); return _typed_parameters; } case (int)RuleConstants.RULE_SIMPLE_FP_SECT_TKCONST_TKCOLON_TKASSIGN : //<simple_fp_sect> ::= tkConst <param_name_list> tkColon <fptype> tkAssign <const_expr> { typed_parameters _typed_parameters=new typed_parameters((ident_list)LRParser.GetReductionSyntaxNode(1),(type_definition)LRParser.GetReductionSyntaxNode(3),parametr_kind.const_parametr,(expression)LRParser.GetReductionSyntaxNode(5)); parsertools.create_source_context(_typed_parameters,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(5)); return _typed_parameters; } case (int)RuleConstants.RULE_PARAM_NAME_LIST : //<param_name_list> ::= <param_name> <empty> //TemplateList for ident_list (create) { ident_list _ident_list=new ident_list(); _ident_list.source_context=((ident)LRParser.GetReductionSyntaxNode(0)).source_context; _ident_list.idents.Add((ident)LRParser.GetReductionSyntaxNode(0)); return _ident_list; } case (int)RuleConstants.RULE_PARAM_NAME_LIST_TKCOMMA : //<param_name_list> ::= <param_name_list> tkComma <param_name> //TemplateList for ident_list (add) { ident_list _ident_list=(ident_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_ident_list,_ident_list,LRParser.GetReductionSyntaxNode(2)); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(2) as ident); return _ident_list; } case (int)RuleConstants.RULE_PARAM_NAME : //<param_name> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FPTYPE : //<fptype> ::= <type_ref> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FPTYPE_NEW : //<fptype_new> ::= <type_ref> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FPTYPE_NEW_TKARRAY_TKOF_TKCONST : //<fptype_new> ::= tkArray tkOf tkConst { array_of_const_type_definition _array_of_const_type_definition=new array_of_const_type_definition(); parsertools.create_source_context(_array_of_const_type_definition,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _array_of_const_type_definition; } case (int)RuleConstants.RULE_STMT : //<stmt> ::= <unlabelled_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_STMT_TKCOLON : //<stmt> ::= <label_name> tkColon <stmt> { labeled_statement _labeled_statement=new labeled_statement((ident)LRParser.GetReductionSyntaxNode(0),(statement)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_labeled_statement,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1))); return _labeled_statement; } case (int)RuleConstants.RULE_UNLABELLED_STMT : //<unlabelled_stmt> ::= <empty> <empty> { empty_statement _empty_statement=new empty_statement(); return _empty_statement; } case (int)RuleConstants.RULE_UNLABELLED_STMT2 : //<unlabelled_stmt> ::= <assignment> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT3 : //<unlabelled_stmt> ::= <proc_call> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT4 : //<unlabelled_stmt> ::= <goto_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT5 : //<unlabelled_stmt> ::= <compound_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT6 : //<unlabelled_stmt> ::= <if_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT7 : //<unlabelled_stmt> ::= <case_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT8 : //<unlabelled_stmt> ::= <repeat_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT9 : //<unlabelled_stmt> ::= <while_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT10 : //<unlabelled_stmt> ::= <for_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT11 : //<unlabelled_stmt> ::= <with_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT12 : //<unlabelled_stmt> ::= <asm_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT13 : //<unlabelled_stmt> ::= <inherited_message> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT14 : //<unlabelled_stmt> ::= <try_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT15 : //<unlabelled_stmt> ::= <raise_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT16 : //<unlabelled_stmt> ::= <foreach_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT17 : //<unlabelled_stmt> ::= <var_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT18 : //<unlabelled_stmt> ::= <expr_as_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_UNLABELLED_STMT19 : //<unlabelled_stmt> ::= <lock_stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VAR_STMT_TKVAR : //<var_stmt> ::= tkVar <var_decl_part_in_stmt> { var_statement _var_statement=new var_statement(LRParser.GetReductionSyntaxNode(1) as var_def_statement); ///////////////tasha 28.04.2010 pascalABC_var_statements.Add((var_def_statement)LRParser.GetReductionSyntaxNode(1)); /////////////////////////////// parsertools.create_source_context(_var_statement,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _var_statement; } case (int)RuleConstants.RULE_ASSIGNMENT : //<assignment> ::= <var_reference> <assign_operator> <expr> { ///////////////tasha 28.04.2010 for_assignment(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); /////////////////////////////// assign _assign=new assign(LRParser.GetReductionSyntaxNode(0) as addressed_value,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_assign,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _assign; } case (int)RuleConstants.RULE_PROC_CALL : //<proc_call> ::= <var_reference> <empty> { procedure_call _procedure_call=new procedure_call(LRParser.GetReductionSyntaxNode(0) as addressed_value); parsertools.create_source_context(_procedure_call,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _procedure_call; } case (int)RuleConstants.RULE_GOTO_STMT_TKGOTO : //<goto_stmt> ::= tkGoto <label_name> { goto_statement _goto_statement=new goto_statement((ident)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_goto_statement,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_goto_statement,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _goto_statement; } case (int)RuleConstants.RULE_COMPOUND_STMT_TKBEGIN_TKEND : //<compound_stmt> ::= tkBegin <stmt_list> tkEnd parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); ((statement_list)LRParser.GetReductionSyntaxNode(1)).left_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(0); ((statement_list)LRParser.GetReductionSyntaxNode(1)).right_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(2); return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_STMT_LIST : //<stmt_list> ::= <stmt> <empty> { statement_list _statement_list=new statement_list(); _statement_list.subnodes.Add((statement)LRParser.GetReductionSyntaxNode(0)); parsertools.assign_source_context(_statement_list,LRParser.GetReductionSyntaxNode(0)); return _statement_list; } case (int)RuleConstants.RULE_STMT_LIST_TKSEMICOLON : //<stmt_list> ::= <stmt_list> tkSemiColon <stmt> { statement_list _statement_list; _statement_list=(statement_list)LRParser.GetReductionSyntaxNode(0); if(_statement_list!=LRParser.GetReductionSyntaxNode(2)){ _statement_list.subnodes.Add((statement)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_statement_list,_statement_list,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1))); } return _statement_list; } case (int)RuleConstants.RULE_IF_STMT_TKIF : //<if_stmt> ::= tkIf <expr> <if_then_else_branch> ((if_node)LRParser.GetReductionSyntaxNode(2)).condition=(expression)LRParser.GetReductionSyntaxNode(1); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return LRParser.GetReductionSyntaxNode(2); case (int)RuleConstants.RULE_IF_THEN_ELSE_BRANCH_TKTHEN : //<if_then_else_branch> ::= tkThen <then_branch> { if_node _if_node=new if_node(null,(statement)LRParser.GetReductionSyntaxNode(1),null); parsertools.create_source_context(_if_node,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); return _if_node; } case (int)RuleConstants.RULE_IF_THEN_ELSE_BRANCH_TKTHEN_TKELSE : //<if_then_else_branch> ::= tkThen <then_branch> tkElse <else_branch> { if_node _if_node=new if_node(null,(statement)LRParser.GetReductionSyntaxNode(1),(statement)LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_if_node,LRParser.GetReductionSyntaxNode(2),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2))); return _if_node; } case (int)RuleConstants.RULE_THEN_BRANCH : //<then_branch> ::= <stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ELSE_BRANCH : //<else_branch> ::= <stmt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_CASE_STMT_TKCASE_TKOF_TKEND : //<case_stmt> ::= tkCase <expr> tkOf <case_list> <else_case> tkEnd { case_node _case_node=new case_node((expression)LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(3) as case_variants,LRParser.GetReductionSyntaxNode(4) as statement); parsertools.create_source_context(_case_node,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(5)); return _case_node; } case (int)RuleConstants.RULE_CASE_LIST : //<case_list> ::= <case_item> <empty> { case_variants _case_variants=new case_variants(); if (LRParser.GetReductionSyntaxNode(0) is case_variant) { _case_variants.variants.Add((case_variant)LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_case_variants,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); } return _case_variants; } case (int)RuleConstants.RULE_CASE_LIST_TKSEMICOLON : //<case_list> ::= <case_list> tkSemiColon <case_item> { case_variants _case_variants=(case_variants)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_case_variants,parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1))); if (LRParser.GetReductionSyntaxNode(2) is case_variant) _case_variants.variants.Add((case_variant)LRParser.GetReductionSyntaxNode(2)); return _case_variants; } case (int)RuleConstants.RULE_CASE_ITEM : //<case_item> ::= <empty> <empty> { empty_statement _empty_statement=new empty_statement(); return _empty_statement; } case (int)RuleConstants.RULE_CASE_ITEM_TKCOLON : //<case_item> ::= <case_label_list> tkColon <stmt> { case_variant _case_variant=new case_variant((expression_list)LRParser.GetReductionSyntaxNode(0),(statement)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_case_variant,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1))); return _case_variant; } case (int)RuleConstants.RULE_CASE_LABEL_LIST : //<case_label_list> ::= <case_label> <empty> //TemplateList for expression_list (create) { expression_list _expression_list=new expression_list(); _expression_list.source_context=((expression)LRParser.GetReductionSyntaxNode(0)).source_context; _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); return _expression_list; } case (int)RuleConstants.RULE_CASE_LABEL_LIST_TKCOMMA : //<case_label_list> ::= <case_label_list> tkComma <case_label> //TemplateList for expression_list (add) { expression_list _expression_list=(expression_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_expression_list,_expression_list,LRParser.GetReductionSyntaxNode(2)); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(2) as expression); return _expression_list; } case (int)RuleConstants.RULE_CASE_LABEL : //<case_label> ::= <const_elem> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ELSE_CASE : //<else_case> ::= //NONTERMINAL:<else_case> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_ELSE_CASE_TKELSE : //<else_case> ::= tkElse <stmt_list> return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_REPEAT_STMT_TKREPEAT_TKUNTIL : //<repeat_stmt> ::= tkRepeat <stmt_list> tkUntil <expr> { repeat_node _repeat_node=new repeat_node((statement)LRParser.GetReductionSyntaxNode(1),(expression)LRParser.GetReductionSyntaxNode(3)); ((statement_list)LRParser.GetReductionSyntaxNode(1)).left_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(0); ((statement_list)LRParser.GetReductionSyntaxNode(1)).right_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(2); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_repeat_node,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _repeat_node; } case (int)RuleConstants.RULE_WHILE_STMT_TKWHILE : //<while_stmt> ::= tkWhile <expr> <opt_tk_do> <stmt> { while_node _while_node=new while_node((expression)LRParser.GetReductionSyntaxNode(1),(statement)LRParser.GetReductionSyntaxNode(3),WhileCycleType.While); if (LRParser.GetReductionSyntaxNode(2) == null) { file_position fp = (LRParser.GetReductionSyntaxNode(1) as syntax_tree_node).source_context.end_position; syntax_tree_node err_stn = (syntax_tree_node)LRParser.GetReductionSyntaxNode(3); if (err_stn == null) err_stn = (syntax_tree_node)LRParser.GetReductionSyntaxNode(1); errors.Add(new Errors.PABCNETUnexpectedToken(current_file_name, StringResources.Get("TKDO"),new SourceContext(fp.line_num, fp.column_num+1, fp.line_num, fp.column_num+1, 0, 0),err_stn)); parsertools.create_source_context(_while_node,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(3))); } else parsertools.create_source_context(_while_node,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2))); return _while_node; } case (int)RuleConstants.RULE_OPT_TK_DO_TKDO : //<opt_tk_do> ::= tkDo return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_TK_DO : //<opt_tk_do> ::= //NONTERMINAL:<opt_tk_do> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_LOCK_STMT_TKLOCK_TKDO : //<lock_stmt> ::= tkLock <expr> tkDo <stmt> { lock_stmt _lock_stmt=new lock_stmt((expression)LRParser.GetReductionSyntaxNode(1),(statement)LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_lock_stmt,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2))); return _lock_stmt; } case (int)RuleConstants.RULE_FOREACH_STMT_TKFOREACH_TKIN_TKDO : //<foreach_stmt> ::= tkForeach <identifier> <foreach_stmt_ident_dype_opt> tkIn <expr> tkDo <stmt> { foreach_stmt _foreach_stmt=new foreach_stmt((ident)LRParser.GetReductionSyntaxNode(1),(type_definition)LRParser.GetReductionSyntaxNode(2),(expression)LRParser.GetReductionSyntaxNode(4),(statement)LRParser.GetReductionSyntaxNode(6)); parsertools.create_source_context(_foreach_stmt,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(6),LRParser.GetReductionSyntaxNode(5))); return _foreach_stmt; } case (int)RuleConstants.RULE_FOREACH_STMT_TKFOREACH_TKVAR_TKCOLON_TKIN_TKDO : //<foreach_stmt> ::= tkForeach tkVar <identifier> tkColon <type_ref> tkIn <expr> tkDo <stmt> { foreach_stmt _foreach_stmt=new foreach_stmt((ident)LRParser.GetReductionSyntaxNode(2),(type_definition)LRParser.GetReductionSyntaxNode(4),(expression)LRParser.GetReductionSyntaxNode(6),(statement)LRParser.GetReductionSyntaxNode(8)); parsertools.create_source_context(_foreach_stmt,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(8),LRParser.GetReductionSyntaxNode(7))); return _foreach_stmt; } case (int)RuleConstants.RULE_FOREACH_STMT_IDENT_DYPE_OPT_TKCOLON : //<foreach_stmt_ident_dype_opt> ::= tkColon <type_ref> return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_FOREACH_STMT_IDENT_DYPE_OPT : //<foreach_stmt_ident_dype_opt> ::= //NONTERMINAL:<foreach_stmt_ident_dype_opt> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_FOR_STMT_TKFOR : //<for_stmt> ::= tkFor <opt_var> <identifier> <for_stmt_decl_or_assign> <expr> <for_cycle_type> <expr> <opt_tk_do> <stmt> { for_node _for_node=new for_node((ident)LRParser.GetReductionSyntaxNode(2),(expression)LRParser.GetReductionSyntaxNode(4),(expression)LRParser.GetReductionSyntaxNode(6),(statement)LRParser.GetReductionSyntaxNode(8),(for_cycle_type)LRParser.GetReductionSyntaxNode(5),null,LRParser.GetReductionSyntaxNode(3) as type_definition, LRParser.GetReductionSyntaxNode(1)!=null); if (LRParser.GetReductionSyntaxNode(7) == null) { file_position fp = (LRParser.GetReductionSyntaxNode(6) as syntax_tree_node).source_context.end_position; syntax_tree_node err_stn = (syntax_tree_node)LRParser.GetReductionSyntaxNode(8); if (err_stn == null) err_stn = (syntax_tree_node)LRParser.GetReductionSyntaxNode(6); errors.Add(new Errors.PABCNETUnexpectedToken(current_file_name, StringResources.Get("TKDO"),new SourceContext(fp.line_num, fp.column_num+1, fp.line_num, fp.column_num+1, 0, 0),err_stn)); parsertools.create_source_context(_for_node,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(8),LRParser.GetReductionSyntaxNode(6))); } else parsertools.create_source_context(_for_node,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(8),LRParser.GetReductionSyntaxNode(7))); return _for_node; } case (int)RuleConstants.RULE_OPT_VAR_TKVAR : //<opt_var> ::= tkVar return true; case (int)RuleConstants.RULE_OPT_VAR : //<opt_var> ::= //NONTERMINAL:<opt_var> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_FOR_STMT_DECL_OR_ASSIGN_TKASSIGN : //<for_stmt_decl_or_assign> ::= tkAssign return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FOR_STMT_DECL_OR_ASSIGN_TKCOLON_TKASSIGN : //<for_stmt_decl_or_assign> ::= tkColon <simple_type_identifier> tkAssign return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_FOR_CYCLE_TYPE_TKTO : //<for_cycle_type> ::= tkTo return for_cycle_type.to; case (int)RuleConstants.RULE_FOR_CYCLE_TYPE_TKDOWNTO : //<for_cycle_type> ::= tkDownto return for_cycle_type.downto; case (int)RuleConstants.RULE_WITH_STMT_TKWITH_TKDO : //<with_stmt> ::= tkWith <expr_list> tkDo <stmt> { with_statement _with_statement=new with_statement((statement)LRParser.GetReductionSyntaxNode(3),(expression_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_with_statement,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2))); return _with_statement; } case (int)RuleConstants.RULE_INHERITED_MESSAGE_TKINHERITED : //<inherited_message> ::= tkInherited <empty> { inherited_message _inherited_message=new inherited_message(); parsertools.assign_source_context(_inherited_message,LRParser.GetReductionSyntaxNode(0)); return _inherited_message; } case (int)RuleConstants.RULE_TRY_STMT_TKTRY : //<try_stmt> ::= tkTry <stmt_list> <try_handler> { try_stmt _try_stmt=new try_stmt(((statement_list)LRParser.GetReductionSyntaxNode(1)),(try_handler)LRParser.GetReductionSyntaxNode(2)); ((statement_list)LRParser.GetReductionSyntaxNode(1)).left_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_try_stmt,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _try_stmt; } case (int)RuleConstants.RULE_TRY_HANDLER_TKFINALLY_TKEND : //<try_handler> ::= tkFinally <stmt_list> tkEnd { try_handler_finally _try_handler_finally=new try_handler_finally((statement_list)LRParser.GetReductionSyntaxNode(1)); ((statement_list)LRParser.GetReductionSyntaxNode(1)).left_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(0); ((statement_list)LRParser.GetReductionSyntaxNode(1)).right_logical_bracket=(syntax_tree_node)LRParser.GetReductionSyntaxNode(2); parsertools.create_source_context(_try_handler_finally,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _try_handler_finally; } case (int)RuleConstants.RULE_TRY_HANDLER_TKEXCEPT_TKEND : //<try_handler> ::= tkExcept <exception_block> tkEnd { try_handler_except _try_handler_except=new try_handler_except((exception_block)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_try_handler_except,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _try_handler_except; } case (int)RuleConstants.RULE_EXCEPTION_BLOCK : //<exception_block> ::= <exception_handler_list> <exception_block_else_branch> { exception_block _exception_block=new exception_block(null,(exception_handler_list)LRParser.GetReductionSyntaxNode(0),(statement_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_exception_block,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0))); return _exception_block; } case (int)RuleConstants.RULE_EXCEPTION_BLOCK_TKSEMICOLON : //<exception_block> ::= <exception_handler_list> tkSemiColon <exception_block_else_branch> { exception_block _exception_block=new exception_block(null,(exception_handler_list)LRParser.GetReductionSyntaxNode(0),(statement_list)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_exception_block,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1))); return _exception_block; } case (int)RuleConstants.RULE_EXCEPTION_BLOCK2 : //<exception_block> ::= <stmt_list> <empty> { exception_block _exception_block=new exception_block((statement_list)LRParser.GetReductionSyntaxNode(0),null,null); if (((syntax_tree_node)LRParser.GetReductionSyntaxNode(0)).source_context!=null) parsertools.assign_source_context(_exception_block,LRParser.GetReductionSyntaxNode(0)); return _exception_block; } case (int)RuleConstants.RULE_EXCEPTION_HANDLER_LIST : //<exception_handler_list> ::= <exception_handler> <empty> //TemplateList for exception_handler_list (create) { exception_handler_list _exception_handler_list=new exception_handler_list(); _exception_handler_list.source_context=((exception_handler)LRParser.GetReductionSyntaxNode(0)).source_context; _exception_handler_list.handlers.Add((exception_handler)LRParser.GetReductionSyntaxNode(0)); return _exception_handler_list; } case (int)RuleConstants.RULE_EXCEPTION_HANDLER_LIST_TKSEMICOLON : //<exception_handler_list> ::= <exception_handler_list> tkSemiColon <exception_handler> //TemplateList for exception_handler_list (add) { exception_handler_list _exception_handler_list=(exception_handler_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_exception_handler_list,_exception_handler_list,LRParser.GetReductionSyntaxNode(2)); _exception_handler_list.handlers.Add(LRParser.GetReductionSyntaxNode(2) as exception_handler); return _exception_handler_list; } case (int)RuleConstants.RULE_EXCEPTION_BLOCK_ELSE_BRANCH : //<exception_block_else_branch> ::= //NONTERMINAL:<exception_block_else_branch> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_EXCEPTION_BLOCK_ELSE_BRANCH_TKELSE : //<exception_block_else_branch> ::= tkElse <stmt_list> return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_EXCEPTION_HANDLER_TKON_TKDO : //<exception_handler> ::= tkOn <exception_identifier> tkDo <stmt> { exception_handler _exception_handler=new exception_handler(((exception_ident)LRParser.GetReductionSyntaxNode(1)).variable,((exception_ident)LRParser.GetReductionSyntaxNode(1)).type_name,(statement)LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_exception_handler,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3),LRParser.GetReductionSyntaxNode(2))); return _exception_handler; } case (int)RuleConstants.RULE_EXCEPTION_IDENTIFIER : //<exception_identifier> ::= <exception_class_type_identifier> <empty> { exception_ident _exception_ident=new exception_ident(null,(named_type_reference)LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_exception_ident,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _exception_ident; } case (int)RuleConstants.RULE_EXCEPTION_IDENTIFIER_TKCOLON : //<exception_identifier> ::= <exception_variable> tkColon <exception_class_type_identifier> { exception_ident _exception_ident=new exception_ident((ident)LRParser.GetReductionSyntaxNode(0),(named_type_reference)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_exception_ident,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _exception_ident; } case (int)RuleConstants.RULE_EXCEPTION_CLASS_TYPE_IDENTIFIER : //<exception_class_type_identifier> ::= <simple_type_identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXCEPTION_VARIABLE : //<exception_variable> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RAISE_STMT_TKRAISE : //<raise_stmt> ::= tkRaise <empty> { raise_stmt _raise_stmt=new raise_stmt(); parsertools.assign_source_context(_raise_stmt,LRParser.GetReductionSyntaxNode(0)); return _raise_stmt; } case (int)RuleConstants.RULE_RAISE_STMT_TKRAISE2 : //<raise_stmt> ::= tkRaise <expr> { raise_stmt _raise_stmt=new raise_stmt((expression)LRParser.GetReductionSyntaxNode(1),null); parsertools.create_source_context(_raise_stmt,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _raise_stmt; } case (int)RuleConstants.RULE_RAISE_STMT_TKRAISE_TKAT : //<raise_stmt> ::= tkRaise <expr> tkAt <expr> { raise_stmt _raise_stmt=new raise_stmt((expression)LRParser.GetReductionSyntaxNode(1),(expression)LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_raise_stmt,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _raise_stmt; } case (int)RuleConstants.RULE_ASM_STMT_TKASMBODY : //<asm_stmt> ::= tkAsmBody return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXPR_LIST : //<expr_list> ::= <expr> <empty> //TemplateList for expression_list (create) { expression_list _expression_list=new expression_list(); _expression_list.source_context=((expression)LRParser.GetReductionSyntaxNode(0)).source_context; _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); return _expression_list; } case (int)RuleConstants.RULE_EXPR_LIST_TKCOMMA : //<expr_list> ::= <expr_list> tkComma <expr> //TemplateList for expression_list (add) { expression_list _expression_list=(expression_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_expression_list,_expression_list,LRParser.GetReductionSyntaxNode(2)); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(2) as expression); return _expression_list; } case (int)RuleConstants.RULE_ATTR_EXPR_LIST : //<attr_expr_list> ::= <expr_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXPR_AS_STMT : //<expr_as_stmt> ::= <allowable_expr_as_stmt> <empty> { expression_as_statement _expression_as_statement=new expression_as_statement((expression)LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_expression_as_statement,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _expression_as_statement; } case (int)RuleConstants.RULE_ALLOWABLE_EXPR_AS_STMT : //<allowable_expr_as_stmt> ::= <new_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXPR : //<expr> ::= <expr_l1> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXPR2 : //<expr> ::= <format_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXPR3 : //<expr> ::= <func_decl_lambda> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXPR_L1 : //<expr_l1> ::= <relop_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EXPR_L12 : //<expr_l1> ::= <question_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIZEOF_EXPR_TKSIZEOF_TKROUNDOPEN_TKROUNDCLOSE : //<sizeof_expr> ::= tkSizeOf tkRoundOpen <simple_or_template_type_reference> tkRoundClose { sizeof_operator _sizeof_operator=new sizeof_operator((named_type_reference)LRParser.GetReductionSyntaxNode(2),null); parsertools.create_source_context(_sizeof_operator,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _sizeof_operator; } case (int)RuleConstants.RULE_TYPEOF_EXPR_TKTYPEOF_TKROUNDOPEN_TKROUNDCLOSE : //<typeof_expr> ::= tkTypeOf tkRoundOpen <simple_or_template_type_reference> tkRoundClose { typeof_operator _typeof_operator=new typeof_operator((named_type_reference)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_typeof_operator,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _typeof_operator; } case (int)RuleConstants.RULE_QUESTION_EXPR_TKQUESTION_TKCOLON : //<question_expr> ::= <expr_l1> tkQuestion <expr_l1> tkColon <expr_l1> { question_colon_expression _question_colon_expression=new question_colon_expression((expression)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2),(expression)LRParser.GetReductionSyntaxNode(4)); parsertools.create_source_context(_question_colon_expression,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return _question_colon_expression; } case (int)RuleConstants.RULE_OPT_AMPERSEND : //<opt_ampersend> ::= //NONTERMINAL:<opt_ampersend> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OPT_AMPERSEND_TKAMPERSEND : //<opt_ampersend> ::= tkAmpersend return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_OR_TEMPLATE_TYPE_REFERENCE : //<simple_or_template_type_reference> ::= <simple_type_identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_OR_TEMPLATE_TYPE_REFERENCE2 : //<simple_or_template_type_reference> ::= <simple_type_identifier> <template_type_params> { template_type_reference _template_type_reference=new template_type_reference((named_type_reference)LRParser.GetReductionSyntaxNode(0),(template_param_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_template_type_reference,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _template_type_reference; } case (int)RuleConstants.RULE_SIMPLE_OR_TEMPLATE_TYPE_REFERENCE_TKAMPERSEND : //<simple_or_template_type_reference> ::= <simple_type_identifier> tkAmpersend <template_type_params> { template_type_reference _template_type_reference=new template_type_reference((named_type_reference)LRParser.GetReductionSyntaxNode(0),(template_param_list)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_template_type_reference,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _template_type_reference; } case (int)RuleConstants.RULE_OPT_ARRAY_INITIALIZER_TKROUNDOPEN_TKROUNDCLOSE : //<opt_array_initializer> ::= tkRoundOpen <typed_const_list> tkRoundClose { array_const _array_const=new array_const((expression_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_array_const,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _array_const; } case (int)RuleConstants.RULE_OPT_ARRAY_INITIALIZER : //<opt_array_initializer> ::= //NONTERMINAL:<opt_array_initializer> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_NEW_EXPR : //<new_expr> ::= <identifier> <simple_or_template_type_reference> <opt_expr_list_with_bracket> { named_type_reference ntr=(named_type_reference)LRParser.GetReductionSyntaxNode(1); new_expr newexpr=new new_expr(ntr,LRParser.GetReductionSyntaxNode(2) as expression_list,false,null); parsertools.create_source_context(newexpr,LRParser.GetReductionSyntaxNode(0),parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2),LRParser.GetReductionSyntaxNode(1))); if ((LRParser.GetReductionSyntaxNode(0) as ident).name.ToLower()!="new") errors.Add(new Errors.PABCNETUnexpectedToken(current_file_name,";",((syntax_tree_node)LRParser.GetReductionSyntaxNode(0)).source_context,newexpr)); return newexpr; } case (int)RuleConstants.RULE_NEW_EXPR_TKSQUAREOPEN_TKSQUARECLOSE : //<new_expr> ::= <identifier> <array_name_for_new_expr> tkSquareOpen <expr_list> tkSquareClose <opt_array_initializer> { new_expr newexpr=new new_expr((type_definition)LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(3) as expression_list,true,LRParser.GetReductionSyntaxNode(5) as array_const); if (LRParser.GetReductionSyntaxNode(5) != null) parsertools.create_source_context(newexpr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(5)); else parsertools.create_source_context(newexpr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); if ((LRParser.GetReductionSyntaxNode(0) as ident).name.ToLower()!="new") errors.Add(new Errors.PABCNETUnexpectedToken(current_file_name,";",((syntax_tree_node)LRParser.GetReductionSyntaxNode(0)).source_context,newexpr)); return newexpr; } case (int)RuleConstants.RULE_ARRAY_NAME_FOR_NEW_EXPR : //<array_name_for_new_expr> ::= <simple_type_identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ARRAY_NAME_FOR_NEW_EXPR2 : //<array_name_for_new_expr> ::= <unsized_array_type> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_TEMPLATE_TYPE_PARAMS : //<opt_template_type_params> ::= //NONTERMINAL:<opt_template_type_params> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OPT_TEMPLATE_TYPE_PARAMS2 : //<opt_template_type_params> ::= <template_type_params> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_EXPR_LIST_WITH_BRACKET : //<opt_expr_list_with_bracket> ::= //NONTERMINAL:<opt_expr_list_with_bracket> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OPT_EXPR_LIST_WITH_BRACKET_TKROUNDOPEN_TKROUNDCLOSE : //<opt_expr_list_with_bracket> ::= tkRoundOpen <opt_expr_list> tkRoundClose return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_RELOP_EXPR : //<relop_expr> ::= <simple_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_EXPR2 : //<relop_expr> ::= <simple_expr> <relop> <relop_expr> { bin_expr _bin_expr=new bin_expr((expression)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2),((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_FORMAT_EXPR_TKCOLON : //<format_expr> ::= <simple_expr> tkColon <simple_expr> { format_expr _format_expr=new format_expr((expression)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2),null); parsertools.create_source_context(_format_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _format_expr; } case (int)RuleConstants.RULE_FORMAT_EXPR_TKCOLON_TKCOLON : //<format_expr> ::= <simple_expr> tkColon <simple_expr> tkColon <simple_expr> { format_expr _format_expr=new format_expr((expression)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2),(expression)LRParser.GetReductionSyntaxNode(4)); parsertools.create_source_context(_format_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(4)); return _format_expr; } case (int)RuleConstants.RULE_RELOP_TKEQUAL : //<relop> ::= tkEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_TKNOTEQUAL : //<relop> ::= tkNotEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_TKLOWER : //<relop> ::= tkLower return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_TKGREATER : //<relop> ::= tkGreater return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_TKLOWEREQUAL : //<relop> ::= tkLowerEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_TKGREATEREQUAL : //<relop> ::= tkGreaterEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RELOP_TKIN : //<relop> ::= tkIn return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_EXPR : //<simple_expr> ::= <term> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SIMPLE_EXPR2 : //<simple_expr> ::= <simple_expr> <addop> <term> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_ADDOP_TKPLUS : //<addop> ::= tkPlus return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ADDOP_TKMINUS : //<addop> ::= tkMinus return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ADDOP_TKOR : //<addop> ::= tkOr return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ADDOP_TKXOR : //<addop> ::= tkXor return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ADDOP_TKCSHARPSTYLEOR : //<addop> ::= tkCSharpStyleOr return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPECAST_OP_TKAS : //<typecast_op> ::= tkAs <empty> return op_typecast.as_op; case (int)RuleConstants.RULE_TYPECAST_OP_TKIS : //<typecast_op> ::= tkIs <empty> return op_typecast.is_op; case (int)RuleConstants.RULE_AS_IS_EXPR : //<as_is_expr> ::= <term> <typecast_op> <simple_or_template_type_reference> { typecast_node _typecast_node=new typecast_node((addressed_value)LRParser.GetReductionSyntaxNode(0),(type_definition)LRParser.GetReductionSyntaxNode(2),(op_typecast)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_typecast_node,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); if (!(LRParser.GetReductionSyntaxNode(0) is addressed_value)) errors.Add(new Errors.bad_operand_type(current_file_name,((syntax_tree_node)LRParser.GetReductionSyntaxNode(0)).source_context,_typecast_node)); return _typecast_node; } case (int)RuleConstants.RULE_TERM : //<term> ::= <factor> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TERM2 : //<term> ::= <new_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TERM3 : //<term> ::= <term> <mulop> <factor> { bin_expr _bin_expr=new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression,LRParser.GetReductionSyntaxNode(2) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_TERM4 : //<term> ::= <as_is_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULOP_TKSTAR : //<mulop> ::= tkStar return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULOP_TKSLASH : //<mulop> ::= tkSlash return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULOP_TKDIV : //<mulop> ::= tkDiv return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULOP_TKMOD : //<mulop> ::= tkMod return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULOP_TKSHL : //<mulop> ::= tkShl return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULOP_TKSHR : //<mulop> ::= tkShr return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULOP_TKAND : //<mulop> ::= tkAnd return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_DEFAULT_EXPR_TKDEFAULT_TKROUNDOPEN_TKROUNDCLOSE : //<default_expr> ::= tkDefault tkRoundOpen <simple_or_template_type_reference> tkRoundClose { default_operator _default_operator=new default_operator(LRParser.GetReductionSyntaxNode(2) as named_type_reference); parsertools.create_source_context(_default_operator,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(3)); return _default_operator; } case (int)RuleConstants.RULE_FACTOR_TKNIL : //<factor> ::= tkNil <empty> { nil_const _nil_const=new nil_const(); parsertools.create_source_context(_nil_const,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _nil_const; } case (int)RuleConstants.RULE_FACTOR : //<factor> ::= <literal_or_number> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FACTOR2 : //<factor> ::= <default_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FACTOR_TKSQUAREOPEN_TKSQUARECLOSE : //<factor> ::= tkSquareOpen <elem_list> tkSquareClose { pascal_set_constant _pascal_set_constant=new pascal_set_constant(LRParser.GetReductionSyntaxNode(1) as expression_list); parsertools.create_source_context(_pascal_set_constant,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _pascal_set_constant; } case (int)RuleConstants.RULE_FACTOR_TKNOT : //<factor> ::= tkNot <factor> { un_expr _un_expr=new un_expr(LRParser.GetReductionSyntaxNode(1) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(0)).type); parsertools.create_source_context(_un_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _un_expr; } case (int)RuleConstants.RULE_FACTOR3 : //<factor> ::= <sign> <factor> { un_expr _un_expr=new un_expr(LRParser.GetReductionSyntaxNode(1) as expression,((op_type_node)LRParser.GetReductionSyntaxNode(0)).type); parsertools.create_source_context(_un_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _un_expr; } case (int)RuleConstants.RULE_FACTOR_TKDEREF : //<factor> ::= tkDeref <factor> { roof_dereference _roof_dereference=new roof_dereference(); _roof_dereference.dereferencing_value=(addressed_value)LRParser.GetReductionSyntaxNode(1); parsertools.create_source_context(_roof_dereference,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _roof_dereference; } case (int)RuleConstants.RULE_FACTOR4 : //<factor> ::= <var_reference> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FACTOR_TKROUNDOPEN_TKROUNDCLOSE_TKROUNDOPEN_TKROUNDCLOSE : //<factor> ::= tkRoundOpen <func_decl_lambda> tkRoundClose tkRoundOpen <expr_list> tkRoundClose { function_lambda_definition fld = find_pascalABC_lambda_name(((ident)LRParser.GetReductionSyntaxNode(1)).name); expression_list _expression_list = (expression_list)LRParser.GetReductionSyntaxNode(4); function_lambda_definition _lambda_definition = fld; function_lambda_call _lambda_call = new function_lambda_call(_lambda_definition, _expression_list); _lambda_call.source_context = ((ident)LRParser.GetReductionSyntaxNode(1)).source_context; return _lambda_call;} case (int)RuleConstants.RULE_LITERAL_OR_NUMBER : //<literal_or_number> ::= <literal> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LITERAL_OR_NUMBER2 : //<literal_or_number> ::= <unsigned_number> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VAR_REFERENCE : //<var_reference> ::= <var_address> <variable> ((get_address)LRParser.GetReductionSyntaxNode(0)).address_of=(addressed_value)LRParser.GetReductionSyntaxNode(1);parsertools.create_source_context(NodesStack.Peek(),NodesStack.Peek(),LRParser.GetReductionSyntaxNode(1));return NodesStack.Pop(); case (int)RuleConstants.RULE_VAR_REFERENCE2 : //<var_reference> ::= <variable> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VAR_ADDRESS_TKADDRESSOF : //<var_address> ::= tkAddressOf <empty> { get_address _get_address=new get_address(); parsertools.assign_source_context(_get_address,LRParser.GetReductionSyntaxNode(0)); NodesStack.Push(_get_address); return _get_address; } case (int)RuleConstants.RULE_VAR_ADDRESS_TKADDRESSOF2 : //<var_address> ::= <var_address> tkAddressOf { get_address _get_address=new get_address(); ((get_address)LRParser.GetReductionSyntaxNode(0)).address_of=(addressed_value)_get_address;parsertools.create_source_context(_get_address,LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(1)); return _get_address; } case (int)RuleConstants.RULE_ATTRIBUTE_VARIABLE : //<attribute_variable> ::= <simple_type_identifier> <opt_expr_list_with_bracket> { attribute _attribute=new attribute(null,(named_type_reference)LRParser.GetReductionSyntaxNode(0),(expression_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_attribute,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); if (LRParser.GetReductionSyntaxNode(1) == null) parsertools.create_source_context(_attribute,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _attribute; } case (int)RuleConstants.RULE_VARIABLE : //<variable> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIABLE2 : //<variable> ::= <operator_name_ident> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIABLE_TKINHERITED : //<variable> ::= tkInherited <identifier> { inherited_ident _inherited_ident=new inherited_ident(); _inherited_ident.name=((ident)LRParser.GetReductionSyntaxNode(1)).name; parsertools.create_source_context(_inherited_ident,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _inherited_ident; } case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKROUNDCLOSE : //<variable> ::= tkRoundOpen <expr> tkRoundClose if (!build_tree_for_brackets) { parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2));return LRParser.GetReductionSyntaxNode(1);} else { expression br_exp = new bracket_expr(LRParser.GetReductionSyntaxNode(1) as expression); parsertools.create_source_context(br_exp,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return br_exp; } case (int)RuleConstants.RULE_VARIABLE3 : //<variable> ::= <sizeof_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIABLE4 : //<variable> ::= <typeof_expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIABLE_TKROUNDOPEN_TKROUNDCLOSE2 : //<variable> ::= tkRoundOpen tkRoundClose {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<variable> ::= tkRoundOpen tkRoundClose"));}return null; case (int)RuleConstants.RULE_VARIABLE_TKPOINT : //<variable> ::= <literal_or_number> tkPoint <identifier_or_keyword> { dot_node _dot_node=new dot_node((addressed_value)LRParser.GetReductionSyntaxNode(0),(addressed_value)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_dot_node,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _dot_node; } case (int)RuleConstants.RULE_VARIABLE5 : //<variable> ::= <variable> <var_specifiers> if (LRParser.GetReductionSyntaxNode(1) is dot_node) { ((dot_node)LRParser.GetReductionSyntaxNode(1)).left=(addressed_value)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),((dot_node)LRParser.GetReductionSyntaxNode(1)).right); } else if (LRParser.GetReductionSyntaxNode(1) is template_param_list) { ((dot_node)(((template_param_list)LRParser.GetReductionSyntaxNode(1)).dereferencing_value)).left=(addressed_value)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(((template_param_list)LRParser.GetReductionSyntaxNode(1)).dereferencing_value,LRParser.GetReductionSyntaxNode(0),((template_param_list)LRParser.GetReductionSyntaxNode(1)).dereferencing_value); } else if (LRParser.GetReductionSyntaxNode(1) is dereference) { ((dereference)LRParser.GetReductionSyntaxNode(1)).dereferencing_value=(addressed_value)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); } else if (LRParser.GetReductionSyntaxNode(1) is ident_with_templateparams) { ((ident_with_templateparams)LRParser.GetReductionSyntaxNode(1)).name=(addressed_value_funcname)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); } return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_OPT_EXPR_LIST : //<opt_expr_list> ::= <expr_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_EXPR_LIST2 : //<opt_expr_list> ::= //NONTERMINAL:<opt_expr_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_OPT_ATTR_EXPR_LIST : //<opt_attr_expr_list> ::= <attr_expr_list> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OPT_ATTR_EXPR_LIST2 : //<opt_attr_expr_list> ::= //NONTERMINAL:<opt_attr_expr_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_ATTRIBUTE_VAR_SPECIFIERS_TKROUNDOPEN_TKROUNDCLOSE : //<attribute_var_specifiers> ::= tkRoundOpen <opt_attr_expr_list> tkRoundClose { method_call _method_call=new method_call(LRParser.GetReductionSyntaxNode(1) as expression_list); parsertools.create_source_context(_method_call,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _method_call; } case (int)RuleConstants.RULE_ATTRIBUTE_VAR_SPECIFIERS_TKPOINT : //<attribute_var_specifiers> ::= tkPoint <identifier_keyword_operatorname> { dot_node _dot_node=new dot_node(null,(addressed_value)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_dot_node,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _dot_node; } case (int)RuleConstants.RULE_VAR_SPECIFIERS_TKSQUAREOPEN_TKSQUARECLOSE : //<var_specifiers> ::= tkSquareOpen <expr_list> tkSquareClose { indexer _indexer=new indexer((expression_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_indexer,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _indexer; } case (int)RuleConstants.RULE_VAR_SPECIFIERS_TKSQUAREOPEN_TKSQUARECLOSE2 : //<var_specifiers> ::= tkSquareOpen tkSquareClose {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<var_specifiers> ::= tkSquareOpen tkSquareClose"));}return null; case (int)RuleConstants.RULE_VAR_SPECIFIERS_TKROUNDOPEN_TKROUNDCLOSE : //<var_specifiers> ::= tkRoundOpen <opt_expr_list> tkRoundClose { method_call _method_call=new method_call(LRParser.GetReductionSyntaxNode(1) as expression_list); parsertools.create_source_context(_method_call,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _method_call; } case (int)RuleConstants.RULE_VAR_SPECIFIERS_TKPOINT : //<var_specifiers> ::= tkPoint <identifier_keyword_operatorname> { dot_node _dot_node=new dot_node(null,(addressed_value)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_dot_node,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _dot_node; } case (int)RuleConstants.RULE_VAR_SPECIFIERS_TKDEREF : //<var_specifiers> ::= tkDeref <empty> { roof_dereference _roof_dereference=new roof_dereference(); parsertools.assign_source_context(_roof_dereference,LRParser.GetReductionSyntaxNode(0)); return _roof_dereference; } case (int)RuleConstants.RULE_VAR_SPECIFIERS_TKAMPERSEND : //<var_specifiers> ::= tkAmpersend <template_type_params> { ident_with_templateparams _ident_with_templateparams=new ident_with_templateparams(null,(template_param_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_ident_with_templateparams,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _ident_with_templateparams; } case (int)RuleConstants.RULE_TEMPLATE_TYPE_BACK_VARSPECIFIERS_TKROUNDOPEN_TKROUNDCLOSE : //<template_type_back_varspecifiers> ::= tkRoundOpen <expr_list> tkRoundClose { method_call _method_call=new method_call((expression_list)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_method_call,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _method_call; } case (int)RuleConstants.RULE_TEMPLATE_TYPE_BACK_VARSPECIFIERS_TKROUNDOPEN_TKROUNDCLOSE2 : //<template_type_back_varspecifiers> ::= tkRoundOpen tkRoundClose { method_call _method_call=new method_call(); parsertools.create_source_context(_method_call,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _method_call; } case (int)RuleConstants.RULE_ELEM_LIST : //<elem_list> ::= <elem_list1> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ELEM_LIST2 : //<elem_list> ::= //NONTERMINAL:<elem_list> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_ELEM_LIST1 : //<elem_list1> ::= <elem> <empty> //TemplateList for expression_list (create) { expression_list _expression_list=new expression_list(); _expression_list.source_context=((expression)LRParser.GetReductionSyntaxNode(0)).source_context; _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(0)); return _expression_list; } case (int)RuleConstants.RULE_ELEM_LIST1_TKCOMMA : //<elem_list1> ::= <elem_list1> tkComma <elem> //TemplateList for expression_list (add) { expression_list _expression_list=(expression_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_expression_list,_expression_list,LRParser.GetReductionSyntaxNode(2)); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(2) as expression); return _expression_list; } case (int)RuleConstants.RULE_ELEM : //<elem> ::= <expr> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ELEM_TKDOTDOT : //<elem> ::= <expr> tkDotDot <expr> { diapason_expr _diapason_expr=new diapason_expr((expression)LRParser.GetReductionSyntaxNode(0),(expression)LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_diapason_expr,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); return _diapason_expr; } case (int)RuleConstants.RULE_ONE_LITERAL_TKSTRINGLITERAL : //<one_literal> ::= tkStringLiteral return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ONE_LITERAL_TKASCIICHAR : //<one_literal> ::= tkAsciiChar return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_LITERAL : //<literal> ::= <literal_list> <empty> literal_const_line lcl=(literal_const_line)LRParser.GetReductionSyntaxNode(0); if (lcl.literals.Count==1) return lcl.literals[0]; return lcl; case (int)RuleConstants.RULE_LITERAL_LIST : //<literal_list> ::= <one_literal> <empty> { literal_const_line _literal_const_line=new literal_const_line(); parsertools.create_source_context(_literal_const_line,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); _literal_const_line.literals.Add((literal)LRParser.GetReductionSyntaxNode(0)); return _literal_const_line; } case (int)RuleConstants.RULE_LITERAL_LIST2 : //<literal_list> ::= <literal_list> <one_literal> { literal_const_line _literal_const_line=(literal_const_line)LRParser.GetReductionSyntaxNode(0); _literal_const_line.literals.Add((literal)LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_literal_const_line,_literal_const_line,LRParser.GetReductionSyntaxNode(1)); return _literal_const_line; } case (int)RuleConstants.RULE_OPERATOR_NAME_IDENT_TKOPERATOR : //<operator_name_ident> ::= tkOperator <overload_operator> { operator_name_ident _operator_name_ident=new operator_name_ident(((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); _operator_name_ident.name=((op_type_node)LRParser.GetReductionSyntaxNode(1)).text; parsertools.create_source_context(_operator_name_ident,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(1)); return _operator_name_ident; } case (int)RuleConstants.RULE_OPT_METH_MODIFICATORS_TKSEMICOLON : //<opt_meth_modificators> ::= tkSemiColon { procedure_attributes_list _procedure_attributes_list=new procedure_attributes_list(); parsertools.AddModifier(_procedure_attributes_list,proc_attribute.attr_overload); parsertools.create_source_context(_procedure_attributes_list,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _procedure_attributes_list; } case (int)RuleConstants.RULE_OPT_METH_MODIFICATORS_TKSEMICOLON_TKSEMICOLON : //<opt_meth_modificators> ::= tkSemiColon <meth_modificators> tkSemiColon parsertools.AddModifier((procedure_attributes_list)LRParser.GetReductionSyntaxNode(1),proc_attribute.attr_overload); return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_METH_MODIFICATORS : //<meth_modificators> ::= <meth_modificator> <empty> //TemplateList for procedure_attributes_list (create) { procedure_attributes_list _procedure_attributes_list=new procedure_attributes_list(); _procedure_attributes_list.source_context=((procedure_attribute)LRParser.GetReductionSyntaxNode(0)).source_context; _procedure_attributes_list.proc_attributes.Add((procedure_attribute)LRParser.GetReductionSyntaxNode(0)); return _procedure_attributes_list; } case (int)RuleConstants.RULE_METH_MODIFICATORS_TKSEMICOLON : //<meth_modificators> ::= <meth_modificators> tkSemiColon <meth_modificator> //TemplateList for procedure_attributes_list (add) { procedure_attributes_list _procedure_attributes_list=(procedure_attributes_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_procedure_attributes_list,_procedure_attributes_list,LRParser.GetReductionSyntaxNode(2)); _procedure_attributes_list.proc_attributes.Add(LRParser.GetReductionSyntaxNode(2) as procedure_attribute); return _procedure_attributes_list; } case (int)RuleConstants.RULE_INTEGER_CONST_TKINTEGER : //<integer_const> ::= <sign> tkInteger {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<integer_const> ::= <sign> tkInteger"));}return null; case (int)RuleConstants.RULE_INTEGER_CONST_TKINTEGER2 : //<integer_const> ::= tkInteger return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_INTEGER_CONST_TKHEX : //<integer_const> ::= <sign> tkHex {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<integer_const> ::= <sign> tkHex"));}return null; case (int)RuleConstants.RULE_INTEGER_CONST_TKHEX2 : //<integer_const> ::= tkHex return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_INTEGER_CONST : //<integer_const> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_INTEGER_CONST2 : //<integer_const> ::= <sign> <identifier> {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<integer_const> ::= <sign> <identifier>"));}return null; case (int)RuleConstants.RULE_IDENTIFIER_TKIDENTIFIER : //<identifier> ::= tkIdentifier return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IDENTIFIER : //<identifier> ::= <real_type_name> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IDENTIFIER2 : //<identifier> ::= <ord_type_name> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IDENTIFIER3 : //<identifier> ::= <variant_type_name> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IDENTIFIER4 : //<identifier> ::= <meth_modificator> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IDENTIFIER5 : //<identifier> ::= <property_specifier_directives> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IDENTIFIER6 : //<identifier> ::= <non_reserved> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IDENTIFIER7 : //<identifier> ::= <other> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IDENTIFIER_OR_KEYWORD : //<identifier_or_keyword> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IDENTIFIER_OR_KEYWORD2 : //<identifier_or_keyword> ::= <keyword> <empty> { ident _ident=new ident((LRParser.GetReductionSyntaxNode(0) as token_info).text); parsertools.create_source_context(_ident,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _ident; } case (int)RuleConstants.RULE_IDENTIFIER_OR_KEYWORD3 : //<identifier_or_keyword> ::= <reserved_keyword> <empty> { ident _ident=new ident((LRParser.GetReductionSyntaxNode(0) as token_info).text); parsertools.create_source_context(_ident,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _ident; } case (int)RuleConstants.RULE_IDENTIFIER_KEYWORD_OPERATORNAME : //<identifier_keyword_operatorname> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_IDENTIFIER_KEYWORD_OPERATORNAME2 : //<identifier_keyword_operatorname> ::= <keyword> <empty> { ident _ident=new ident((LRParser.GetReductionSyntaxNode(0) as token_info).text); parsertools.create_source_context(_ident,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _ident; } case (int)RuleConstants.RULE_IDENTIFIER_KEYWORD_OPERATORNAME3 : //<identifier_keyword_operatorname> ::= <operator_name_ident> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_REAL_TYPE_NAME_TKREAL : //<real_type_name> ::= tkReal return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_REAL_TYPE_NAME_TKSINGLE : //<real_type_name> ::= tkSingle return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_REAL_TYPE_NAME_TKDOUBLE : //<real_type_name> ::= tkDouble return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_REAL_TYPE_NAME_TKEXTENDED : //<real_type_name> ::= tkExtended return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_REAL_TYPE_NAME_TKCOMP : //<real_type_name> ::= tkComp return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKSHORTINT : //<ord_type_name> ::= tkShortInt return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKSMALLINT : //<ord_type_name> ::= tkSmallInt return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKORDINTEGER : //<ord_type_name> ::= tkOrdInteger return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKBYTE : //<ord_type_name> ::= tkByte return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKLONGINT : //<ord_type_name> ::= tkLongInt return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKINT64 : //<ord_type_name> ::= tkInt64 return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKWORD : //<ord_type_name> ::= tkWord return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKBOOLEAN : //<ord_type_name> ::= tkBoolean return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKCHAR : //<ord_type_name> ::= tkChar return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKWIDECHAR : //<ord_type_name> ::= tkWideChar return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKLONGWORD : //<ord_type_name> ::= tkLongWord return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKPCHAR : //<ord_type_name> ::= tkPChar return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ORD_TYPE_NAME_TKCARDINAL : //<ord_type_name> ::= tkCardinal return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIANT_TYPE_NAME_TKVARIANT : //<variant_type_name> ::= tkVariant return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VARIANT_TYPE_NAME_TKOLEVARIANT : //<variant_type_name> ::= tkOleVariant return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_METH_MODIFICATOR_TKABSTRACT : //<meth_modificator> ::= tkAbstract return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_METH_MODIFICATOR_TKOVERLOAD : //<meth_modificator> ::= tkOverload return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_METH_MODIFICATOR_TKREINTRODUCE : //<meth_modificator> ::= tkReintroduce return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_METH_MODIFICATOR_TKOVERRIDE : //<meth_modificator> ::= tkOverride return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_METH_MODIFICATOR_TKVIRTUAL : //<meth_modificator> ::= tkVirtual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_METH_MODIFICATOR_TKSTATIC : //<meth_modificator> ::= tkStatic return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROPERTY_SPECIFIER_DIRECTIVES_TKREAD : //<property_specifier_directives> ::= tkRead return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROPERTY_SPECIFIER_DIRECTIVES_TKWRITE : //<property_specifier_directives> ::= tkWrite return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROPERTY_SPECIFIER_DIRECTIVES_TKSTORED : //<property_specifier_directives> ::= tkStored return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROPERTY_SPECIFIER_DIRECTIVES_TKNODEFAULT : //<property_specifier_directives> ::= tkNodefault return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROPERTY_SPECIFIER_DIRECTIVES_TKIMPLEMENTS : //<property_specifier_directives> ::= tkImplements return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROPERTY_SPECIFIER_DIRECTIVES_TKWRITEONLY : //<property_specifier_directives> ::= tkWriteOnly return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROPERTY_SPECIFIER_DIRECTIVES_TKREADONLY : //<property_specifier_directives> ::= tkReadOnly return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_PROPERTY_SPECIFIER_DIRECTIVES_TKDISPID : //<property_specifier_directives> ::= tkDispid return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NON_RESERVED_TKAT : //<non_reserved> ::= tkAt return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NON_RESERVED_TKABSOLUTE : //<non_reserved> ::= tkAbsolute return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NON_RESERVED_TKON : //<non_reserved> ::= tkOn return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NON_RESERVED_TKNAME : //<non_reserved> ::= tkName return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NON_RESERVED_TKINDEX : //<non_reserved> ::= tkIndex return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NON_RESERVED_TKMESSAGE : //<non_reserved> ::= tkMessage return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NON_RESERVED_TKCONTAINS : //<non_reserved> ::= tkContains return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NON_RESERVED_TKREQUIRES : //<non_reserved> ::= tkRequires return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NON_RESERVED_TKFORWARD : //<non_reserved> ::= tkForward return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_NON_RESERVED_TKOUT : //<non_reserved> ::= tkOut return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VISIBILITY_SPECIFIER_TKINTERNAL : //<visibility_specifier> ::= tkInternal return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VISIBILITY_SPECIFIER_TKPUBLIC : //<visibility_specifier> ::= tkPublic return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VISIBILITY_SPECIFIER_TKPROTECTED : //<visibility_specifier> ::= tkProtected return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VISIBILITY_SPECIFIER_TKPRIVATE : //<visibility_specifier> ::= tkPrivate return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OTHER_TKPACKAGE : //<other> ::= tkPackage return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OTHER_TKUNIT : //<other> ::= tkUnit return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OTHER_TKLIBRARY : //<other> ::= tkLibrary return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OTHER_TKEXTERNAL : //<other> ::= tkExternal return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OTHER_TKPARAMS : //<other> ::= tkParams return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD : //<keyword> ::= <visibility_specifier> <empty> { token_info _token_info=new token_info((LRParser.GetReductionSyntaxNode(0) as ident).name); parsertools.create_source_context(_token_info,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _token_info; } case (int)RuleConstants.RULE_KEYWORD_TKFINAL : //<keyword> ::= tkFinal return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKTEMPLATE : //<keyword> ::= tkTemplate return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKOR : //<keyword> ::= tkOr return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKTYPEOF : //<keyword> ::= tkTypeOf return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKSIZEOF : //<keyword> ::= tkSizeOf return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKDEFAULT : //<keyword> ::= tkDefault return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKWHERE : //<keyword> ::= tkWhere return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKXOR : //<keyword> ::= tkXor return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKAND : //<keyword> ::= tkAnd return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKDIV : //<keyword> ::= tkDiv return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKMOD : //<keyword> ::= tkMod return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKSHL : //<keyword> ::= tkShl return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKSHR : //<keyword> ::= tkShr return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKNOT : //<keyword> ::= tkNot return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKAS : //<keyword> ::= tkAs return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKIN : //<keyword> ::= tkIn return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKIS : //<keyword> ::= tkIs return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKARRAY : //<keyword> ::= tkArray return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKBEGIN : //<keyword> ::= tkBegin return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKCASE : //<keyword> ::= tkCase return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKCLASS : //<keyword> ::= tkClass return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKCONST : //<keyword> ::= tkConst return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKCONSTRUCTOR : //<keyword> ::= tkConstructor return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKDESTRUCTOR : //<keyword> ::= tkDestructor return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKDOWNTO : //<keyword> ::= tkDownto return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKDO : //<keyword> ::= tkDo return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKELSE : //<keyword> ::= tkElse return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKEXCEPT : //<keyword> ::= tkExcept return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKFILE : //<keyword> ::= tkFile return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKFINALIZATION : //<keyword> ::= tkFinalization return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKFINALLY : //<keyword> ::= tkFinally return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKFOR : //<keyword> ::= tkFor return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKFOREACH : //<keyword> ::= tkForeach return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKFUNCTION : //<keyword> ::= tkFunction return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKIF : //<keyword> ::= tkIf return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKIMPLEMENTATION : //<keyword> ::= tkImplementation return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKINHERITED : //<keyword> ::= tkInherited return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKINITIALIZATION : //<keyword> ::= tkInitialization return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKINTERFACE : //<keyword> ::= tkInterface return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKPROCEDURE : //<keyword> ::= tkProcedure return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKPROPERTY : //<keyword> ::= tkProperty return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKRAISE : //<keyword> ::= tkRaise return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKRECORD : //<keyword> ::= tkRecord return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKREPEAT : //<keyword> ::= tkRepeat return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKSET : //<keyword> ::= tkSet return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKTRY : //<keyword> ::= tkTry return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKTYPE : //<keyword> ::= tkType return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKTHEN : //<keyword> ::= tkThen return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKTO : //<keyword> ::= tkTo return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKUNTIL : //<keyword> ::= tkUntil return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKUSES : //<keyword> ::= tkUses return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKUSING : //<keyword> ::= tkUsing return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKVAR : //<keyword> ::= tkVar return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKWHILE : //<keyword> ::= tkWhile return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKWITH : //<keyword> ::= tkWith return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKNIL : //<keyword> ::= tkNil return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKGOTO : //<keyword> ::= tkGoto return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKOF : //<keyword> ::= tkOf return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKLABEL : //<keyword> ::= tkLabel return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_KEYWORD_TKPROGRAM : //<keyword> ::= tkProgram return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RESERVED_KEYWORD_TKOPERATOR : //<reserved_keyword> ::= tkOperator return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_RESERVED_KEYWORD_TKEND : //<reserved_keyword> ::= tkEnd return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKMINUS : //<overload_operator> ::= tkMinus return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKPLUS : //<overload_operator> ::= tkPlus return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKSQUAREOPEN_TKSQUARECLOSE : //<overload_operator> ::= tkSquareOpen tkSquareClose {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<overload_operator> ::= tkSquareOpen tkSquareClose"));}return null; case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKROUNDOPEN_TKROUNDCLOSE : //<overload_operator> ::= tkRoundOpen tkRoundClose {errors.Add(new nonterminal_token_return_null(current_file_name,parsertools.GetTokenSourceContext(),(syntax_tree_node)prev_node,"<overload_operator> ::= tkRoundOpen tkRoundClose"));}return null; case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKSLASH : //<overload_operator> ::= tkSlash return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKSTAR : //<overload_operator> ::= tkStar return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKEQUAL : //<overload_operator> ::= tkEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKGREATER : //<overload_operator> ::= tkGreater return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKGREATEREQUAL : //<overload_operator> ::= tkGreaterEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKLOWER : //<overload_operator> ::= tkLower return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKLOWEREQUAL : //<overload_operator> ::= tkLowerEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKNOTEQUAL : //<overload_operator> ::= tkNotEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKOR : //<overload_operator> ::= tkOr return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKXOR : //<overload_operator> ::= tkXor return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKAND : //<overload_operator> ::= tkAnd return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKDIV : //<overload_operator> ::= tkDiv return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKMOD : //<overload_operator> ::= tkMod return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKSHL : //<overload_operator> ::= tkShl return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKSHR : //<overload_operator> ::= tkShr return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKNOT : //<overload_operator> ::= tkNot return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKIN : //<overload_operator> ::= tkIn return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKADDRESSOF : //<overload_operator> ::= tkAddressOf return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKDEREF : //<overload_operator> ::= tkDeref return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKIMPLICIT : //<overload_operator> ::= tkImplicit return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR_TKEXPLICIT : //<overload_operator> ::= tkExplicit return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_OVERLOAD_OPERATOR : //<overload_operator> ::= <assign_operator> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ASSIGN_OPERATOR_TKASSIGN : //<assign_operator> ::= tkAssign return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ASSIGN_OPERATOR_TKPLUSEQUAL : //<assign_operator> ::= tkPlusEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ASSIGN_OPERATOR_TKMINUSEQUAL : //<assign_operator> ::= tkMinusEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ASSIGN_OPERATOR_TKMULTEQUAL : //<assign_operator> ::= tkMultEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ASSIGN_OPERATOR_TKDIVEQUAL : //<assign_operator> ::= tkDivEqual return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_EMPTY : //<empty> ::= //NONTERMINAL:<empty> ::= return null; //ENDNONTERMINAL case (int)RuleConstants.RULE_ERROR_TKERROR : //<error> ::= tkError return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FUNC_DECL_LAMBDA_TKARROW : //<func_decl_lambda> ::= <ident_list1> tkArrow <lambda_body> {return func_decl_lambda(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2));} case (int)RuleConstants.RULE_FUNC_DECL_LAMBDA_TKARROW2 : //<func_decl_lambda> ::= tkArrow <lambda_body> {return func_decl_lambda(null, LRParser.GetReductionSyntaxNode(1));} case (int)RuleConstants.RULE_FUNC_DECL_LAMBDA_TKROUNDOPEN_TKROUNDCLOSE_TKARROW : //<func_decl_lambda> ::= tkRoundOpen tkRoundClose tkArrow <lambda_body> {return func_decl_lambda(null, LRParser.GetReductionSyntaxNode(3));} case (int)RuleConstants.RULE_IDENT_LIST1_TKROUNDOPEN_TKCOMMA_TKROUNDCLOSE : //<ident_list1> ::= tkRoundOpen <identifier> tkComma <ident_list2> tkRoundClose {return ident_list11(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(3));} case (int)RuleConstants.RULE_IDENT_LIST1 : //<ident_list1> ::= <identifier> <empty> {return ident_list12(LRParser.GetReductionSyntaxNode(0));} case (int)RuleConstants.RULE_IDENT_LIST1_TKROUNDOPEN_TKCOLON_TKCOMMA_TKROUNDCLOSE : //<ident_list1> ::= tkRoundOpen <identifier> tkColon <fptype> tkComma <ident_list2> tkRoundClose {return ident_list13(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(3), LRParser.GetReductionSyntaxNode(5));} case (int)RuleConstants.RULE_IDENT_LIST1_TKROUNDOPEN_TKCOLON_TKROUNDCLOSE : //<ident_list1> ::= tkRoundOpen <identifier> tkColon <fptype> tkRoundClose {return ident_list14(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(3));} case (int)RuleConstants.RULE_IDENT_LIST2_TKCOMMA : //<ident_list2> ::= <ident_list2> tkComma <var_or_identifier> {return ident_list21(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2));} case (int)RuleConstants.RULE_IDENT_LIST2 : //<ident_list2> ::= <var_or_identifier> <empty> {return ident_list12(LRParser.GetReductionSyntaxNode(0));} case (int)RuleConstants.RULE_VAR_OR_IDENTIFIER : //<var_or_identifier> ::= <identifier> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VAR_OR_IDENTIFIER_TKCOLON : //<var_or_identifier> ::= <identifier> tkColon <fptype> { named_type_reference n_t_r = (named_type_reference)LRParser.GetReductionSyntaxNode(2); var_def_statement vds = new var_def_statement(); vds.vars = new ident_list(); vds.vars.idents.Add((ident)LRParser.GetReductionSyntaxNode(0)); vds.vars_type = n_t_r; return vds; } case (int)RuleConstants.RULE_LAMBDA_BODY : //<lambda_body> ::= <expr_l1> <empty> { statement_list _statement_list = new statement_list(); ident id = new ident("result"); op_type_node _op_type_node = new op_type_node(Operators.Assignment); _op_type_node.source_context = parsertools.GetTokenSourceContext(); assign _assign = new assign((addressed_value)id, LRParser.GetReductionSyntaxNode(0) as expression, _op_type_node.type); parsertools.create_source_context(_assign, id, LRParser.GetReductionSyntaxNode(0)); _statement_list.subnodes.Add((statement)_assign); parsertools.assign_source_context(_statement_list, _assign); parsertools.create_source_context(_statement_list, null, null); //block _block = new block(null, _statement_list); return _statement_list; } case (int)RuleConstants.RULE_LAMBDA_BODY2 : //<lambda_body> ::= <compound_stmt> <empty> return LRParser.GetReductionSyntaxNode(0); } throw new RuleException("Unknown rule"); }
public Object CreateNonTerminalObject() { switch ((RuleConstants) LRParser.ReductionRule.Index) { case RuleConstants.RULE_BF : //<BF> ::= <bf_instructions> { program_module _program_module=new program_module(); _program_module.Language = LanguageId.PascalABCNET; ident BFSystem=new ident("BFSystem"); unit_or_namespace unit=new unit_or_namespace(); unit.name = new ident_list(); unit.name.idents.Add(BFSystem); uses_list used_units=new uses_list(); used_units.units.Add(unit); block program_block=new block(null,(statement_list)LRParser.GetReductionSyntaxNode(0)); _program_module.used_units=used_units; _program_module.program_block=program_block; used_units.source_context=unit.source_context=BFSystem.source_context=new SourceContext(1,1,1,1,1,1); parsertools.create_source_context(program_block,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_program_module,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); operation_value=0; return _program_module; } case RuleConstants.RULE_BF_EMPTY_INSTRUCTION : //<bf_empty_instruction> ::= //NONTERMINAL:<bf_empty_instruction> ::= return null; //ENDNONTERMINAL case RuleConstants.RULE_BF_INSTRUCTIONS : //<bf_instructions> ::= <bf_instructions_list> return LRParser.GetReductionSyntaxNode(0); case RuleConstants.RULE_BF_INSTRUCTIONS2 : //<bf_instructions> ::= <bf_empty_instruction> { statement_list _statement_list=new statement_list(); _statement_list.subnodes.Add(new empty_statement()); return _statement_list; } case RuleConstants.RULE_BF_INSTRUCTIONS_LIST : //<bf_instructions_list> ::= <bf_instruction> //TemplateList for statement_list (create) { statement_list _statement_list=new statement_list(); _statement_list.source_context=((statement)LRParser.GetReductionSyntaxNode(0)).source_context; _statement_list.subnodes.Add((statement)LRParser.GetReductionSyntaxNode(0)); return _statement_list; } case RuleConstants.RULE_BF_INSTRUCTIONS_LIST2 : //<bf_instructions_list> ::= <bf_instructions_list> <bf_instruction> //TemplateList for statement_list (add) { statement_list _statement_list=(statement_list)LRParser.GetReductionSyntaxNode(0); parsertools.create_source_context(_statement_list,_statement_list,LRParser.GetReductionSyntaxNode(1)); _statement_list.subnodes.Add((statement)LRParser.GetReductionSyntaxNode(1)); return _statement_list; } case RuleConstants.RULE_CHANGE_POS_LIST : //<change_pos_list> ::= <change_pos> left_node=right_node=LRParser.GetReductionSyntaxNode(0); return null; case RuleConstants.RULE_CHANGE_POS_LIST2 : //<change_pos_list> ::= <change_pos_list> <change_pos> right_node=LRParser.GetReductionSyntaxNode(1); return null; case RuleConstants.RULE_CHANGE_VALUE_LIST : //<change_value_list> ::= <change_value> left_node=right_node=LRParser.GetReductionSyntaxNode(0); return null; case RuleConstants.RULE_CHANGE_VALUE_LIST2 : //<change_value_list> ::= <change_value_list> <change_value> right_node=LRParser.GetReductionSyntaxNode(1); return null; case RuleConstants.RULE_CHANGE_POS_TKINC : //<change_pos> ::= 'tkInc' operation_value++; return LRParser.GetReductionSyntaxNode(0); case RuleConstants.RULE_CHANGE_POS_TKDEC : //<change_pos> ::= 'tkDec' operation_value--; return LRParser.GetReductionSyntaxNode(0); case RuleConstants.RULE_CHANGE_VALUE_TKINCVALUE : //<change_value> ::= 'tkIncValue' operation_value++; return LRParser.GetReductionSyntaxNode(0); case RuleConstants.RULE_CHANGE_VALUE_TKDECVALUE : //<change_value> ::= 'tkDecValue' operation_value--; return LRParser.GetReductionSyntaxNode(0); case RuleConstants.RULE_BF_INSTRUCTION_TKJMPPAST_TKJMPRET : //<bf_instruction> ::= 'tkJMPPast' <bf_instructions> 'tkJMPRet' { indexer indx=new indexer(new expression_list()); indx.indexes.expressions.Add(new ident("BFCaretPos")); indx.dereferencing_value=new ident("BFField"); bin_expr be=new bin_expr(indx,new int32_const(0),Operators.NotEqual); while_node wn=new while_node(); wn.expr=be; wn.statements=(statement_list)LRParser.GetReductionSyntaxNode(1); parsertools.create_source_context(wn,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(2)); be.right.source_context=indx.dereferencing_value.source_context=indx.source_context=indx.indexes.expressions[0].source_context=be.source_context=wn.source_context; return wn; } case RuleConstants.RULE_BF_INSTRUCTION : //<bf_instruction> ::= <change_pos_list> { if (operation_value!=0) { ident caret=new ident("BFCaretPos"); int32_const caret_n=new int32_const(operation_value); operation_value=0; bin_expr expr=new bin_expr(caret,caret_n,Operators.Plus); assign _assign=new assign(caret,expr,Operators.Assignment); parsertools.create_source_context(caret,left_node,right_node); caret_n.source_context=expr.source_context=_assign.source_context=caret.source_context; return _assign; } syntax_tree_node tn=new empty_statement(); parsertools.create_source_context(tn,left_node,right_node); return tn; } case RuleConstants.RULE_BF_INSTRUCTION2 : //<bf_instruction> ::= <change_value_list> { if (operation_value!=0) { indexer indx=new indexer(new expression_list()); indx.indexes.expressions.Add(new ident("BFCaretPos")); indx.dereferencing_value=new ident("BFField"); bin_expr be=new bin_expr(indx,new int32_const(operation_value),Operators.Plus); assign assg=new assign(indx,be,Operators.Assignment); operation_value=0; parsertools.create_source_context(assg,left_node,right_node); indx.dereferencing_value.source_context=indx.source_context=indx.indexes.expressions[0].source_context=be.right.source_context=be.source_context=assg.source_context; return assg; } syntax_tree_node tn=new empty_statement(); parsertools.create_source_context(tn,left_node,right_node); return tn; } case RuleConstants.RULE_BF_INSTRUCTION_TKWRITE : //<bf_instruction> ::= 'tkWrite' { ident _ident=new ident("WriteCaretValue"); procedure_call _procedure_call=new procedure_call(_ident); parsertools.create_source_context(_ident,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_procedure_call,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _procedure_call; } case RuleConstants.RULE_BF_INSTRUCTION_TKREAD : //<bf_instruction> ::= 'tkRead' { ident _ident=new ident("ReadCaretValue"); procedure_call _procedure_call=new procedure_call(_ident); parsertools.create_source_context(_ident,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_procedure_call,LRParser.GetReductionSyntaxNode(0),LRParser.GetReductionSyntaxNode(0)); return _procedure_call; } } throw new RuleException("Unknown rule"); }
public override void visit(SyntaxTree.yield_node yn) { // надо что то сгенерировать, иначе выдается ложное предупреждение о недостижимом коде и проч. var ass = new assign("Result", new nil_const()); visit(ass); var pc = new procedure_call("exit"); visit(pc); }
/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //CreateNonTerminalObject /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// public Object CreateNonTerminalObject(int ReductionRuleIndex) { switch (ReductionRuleIndex) { case (int)RuleConstants.RULE_SEPARATOR_TK_SEMICOLON: //<Separator> ::= 'tk_SemiColon' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SEPARATOR_TK_NEWLINE: //<Separator> ::= 'tk_NewLine' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SEPARATORS: //<Separators> ::= <Separators> <Separator> return LRParser.GetReductionSyntaxNode(1); case (int)RuleConstants.RULE_SEPARATORS2: //<Separators> ::= <Separator> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SEPARATORSOPT: //<Separators Opt> ::= <Separator> <Separators Opt> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_SEPARATORSOPT2: //<Separators Opt> ::= return null; case (int)RuleConstants.RULE_PROGRAM_TK_ALG_TK_IDENTIFIER_TK_BEGIN_TK_END: //<Program> ::= <Separators Opt> <Global_part> 'tk_alg' 'tk_Identifier' <Separators> 'tk_begin' <Statements> 'tk_end' <Sub_declarations> { program_module _program_module; block _block; statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(6)); program_name _program_name = new program_name((ident)LRParser.GetReductionSyntaxNode(3)); if ((_units[this.unit_number - 1] as unit_data).initialization.subnodes.Count != 0) _statement_list.subnodes.InsertRange(0, (_units[this.unit_number - 1] as unit_data).initialization.subnodes); if ((_units[this.unit_number - 1] as unit_data).sub_progs.defs.Count != 0) _block = new block((_units[this.unit_number - 1] as unit_data).sub_progs, _statement_list); else _block = new block(null, _statement_list); (_units[this.unit_number - 1] as unit_data).used_units.idents.Add(new ident("MathForKumir")); if ((_units[this.unit_number - 1] as unit_data).used_units.idents.Count != 0) { unit_or_namespace _unit_or_namespace; uses_list _uses_list = new uses_list(); for (int i = 0; i < (_units[this.unit_number - 1] as unit_data).used_units.idents.Count; i++) { ident_list _ident_list = new ident_list(); _ident_list.idents.Add((_units[this.unit_number - 1] as unit_data).used_units.idents[i]); _unit_or_namespace = new unit_or_namespace(_ident_list); _uses_list.units.Add(_unit_or_namespace); } _program_module = new program_module(_program_name, _uses_list, _block, null); } else _program_module = new program_module(_program_name, null, _block, null); declarations _declarations = new declarations(); _program_module.Language = LanguageId.PascalABCNET; parsertools.create_source_context(_program_module, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(3)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(8), LRParser.GetReductionSyntaxNode(7), LRParser.GetReductionSyntaxNode(6))); parsertools.create_source_context(_block, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(2)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(8), LRParser.GetReductionSyntaxNode(7))); parsertools.create_source_context(_program_name, LRParser.GetReductionSyntaxNode(3), LRParser.GetReductionSyntaxNode(3)); return _program_module; } case (int)RuleConstants.RULE_PROGRAM_TK_ISP_TK_IDENTIFIER_TK_END: //<Program> ::= <Separators Opt> 'tk_isp' 'tk_Identifier' <Separators> <Global_part> <Sub_declarations> 'tk_end' { interface_node _interface_node; (_units[this.unit_number - 1] as unit_data).used_units.idents.Add(new ident("MathForKumir")); if ((_units[this.unit_number - 1] as unit_data).used_units.idents.Count > 0) { unit_or_namespace _unit_or_namespace; uses_list _uses_list = new uses_list(); for (int i = 0; i < (_units[this.unit_number - 1] as unit_data).used_units.idents.Count; i++) { ident_list _ident_list = new ident_list(); _ident_list.idents.Add((_units[this.unit_number - 1] as unit_data).used_units.idents[i]); _unit_or_namespace = new unit_or_namespace(_ident_list); _uses_list.units.Add(_unit_or_namespace); } _interface_node = new interface_node((_units[this.unit_number - 1] as unit_data).sub_progs, _uses_list, null); } else _interface_node = new interface_node((_units[this.unit_number - 1] as unit_data).sub_progs, null, null); unit_module _unit_module = new unit_module(new unit_name((ident)LRParser.GetReductionSyntaxNode(2), 0), _interface_node, null, (_units[this.unit_number - 1] as unit_data).initialization, null); _unit_module.Language = LanguageId.PascalABCNET; unit_name _unit_name = new unit_name((ident)LRParser.GetReductionSyntaxNode(2), 0); parsertools.create_source_context(_unit_module, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(3)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(6), LRParser.GetReductionSyntaxNode(5))); parsertools.create_source_context(_unit_name, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(2)); return _unit_module; } case (int)RuleConstants.RULE_PROCEDURE_TK_ALG_TK_IDENTIFIER_TK_ROUNDOPEN_TK_ROUNDCLOSE_TK_BEGIN_TK_END: //<Procedure> ::= 'tk_alg' 'tk_Identifier' 'tk_RoundOpen' <Formal_list> 'tk_RoundClose' <Separators> 'tk_begin' <Statements> 'tk_end' { method_name _method_name = new method_name(null, (ident)LRParser.GetReductionSyntaxNode(1), null); procedure_header _procedure_header = new procedure_header(GetFormals(LRParser.GetReductionSyntaxNode(3)), null, _method_name, false, false, null,null); statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(7)); block _block = new block(null, _statement_list); procedure_definition _procedure_definition = new procedure_definition(_procedure_header, _block); parsertools.create_source_context(_method_name, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_procedure_header, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(4)); parsertools.create_source_context(_procedure_definition, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(8)); parsertools.create_source_context(_block, LRParser.GetReductionSyntaxNode(6), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(8), LRParser.GetReductionSyntaxNode(7))); (_units[this.unit_number - 1] as unit_data).sub_progs.defs.Add(_procedure_definition); return _procedure_definition; } case (int)RuleConstants.RULE_PROCEDURE_TK_ALG_TK_IDENTIFIER_TK_BEGIN_TK_END: //<Procedure> ::= 'tk_alg' 'tk_Identifier' <Separators> 'tk_begin' <Statements> 'tk_end' { method_name _method_name = new method_name(null, (ident)LRParser.GetReductionSyntaxNode(1), null); procedure_header _procedure_header = new procedure_header(null, null, _method_name, false, false, null,null); statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(4)); block _block = new block(null, _statement_list); procedure_definition _procedure_definition = new procedure_definition(_procedure_header, _block); parsertools.create_source_context(_method_name, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_procedure_header, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_procedure_definition, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(5)); parsertools.create_source_context(_block, LRParser.GetReductionSyntaxNode(3), LRParser.GetReductionSyntaxNode(5)); (_units[this.unit_number - 1] as unit_data).sub_progs.defs.Add(_procedure_definition); declarations _declarations = new declarations(); _declarations.defs.Add(_procedure_definition); parsertools.create_source_context(_declarations, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(5), LRParser.GetReductionSyntaxNode(4))); return _procedure_definition; } case (int)RuleConstants.RULE_FUNCTION_TK_ALG_TK_IDENTIFIER_TK_ROUNDOPEN_TK_ROUNDCLOSE_TK_BEGIN_TK_END: //<Function> ::= 'tk_alg' <Type> 'tk_Identifier' 'tk_RoundOpen' <Formal_list> 'tk_RoundClose' <Separators> 'tk_begin' <Statements> 'tk_end' { method_name _method_name = new method_name(null, LRParser.GetReductionSyntaxNode(2) as ident, null); named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(1)).text.ToLower()); function_header _function_header = new function_header(_named_type_reference); _function_header.of_object = false; _function_header.name = _method_name; _function_header.parameters = GetFormals(LRParser.GetReductionSyntaxNode(4)); statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(8)); block _block = new block(null, _statement_list); procedure_definition _procedure_definition = new procedure_definition(_function_header, _block); parsertools.create_source_context(_method_name, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_function_header, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(5)); parsertools.create_source_context(_procedure_definition, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(9)); parsertools.create_source_context(_block, LRParser.GetReductionSyntaxNode(7), LRParser.GetReductionSyntaxNode(9)); (_units[this.unit_number - 1] as unit_data).sub_progs.defs.Add(_procedure_definition); declarations _declarations = new declarations(); _declarations.defs.Add(_procedure_definition); parsertools.create_source_context(_declarations, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(9)); return _procedure_definition; } case (int)RuleConstants.RULE_FUNCTION_TK_ALG_TK_IDENTIFIER_TK_BEGIN_TK_END: //<Function> ::= 'tk_alg' <Type> 'tk_Identifier' <Separators> 'tk_begin' <Statements> 'tk_end' { method_name _method_name = new method_name(null, LRParser.GetReductionSyntaxNode(2) as ident, null); named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(1)).text.ToLower()); function_header _function_header = new function_header(_named_type_reference); _function_header.of_object = false; _function_header.name = _method_name; statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(5)); block _block = new block(null, _statement_list); procedure_definition _procedure_definition = new procedure_definition(_function_header, _block); parsertools.create_source_context(_method_name, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_function_header, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_procedure_definition, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(6)); parsertools.create_source_context(_block, LRParser.GetReductionSyntaxNode(4), LRParser.GetReductionSyntaxNode(6)); (_units[this.unit_number - 1] as unit_data).sub_progs.defs.Add(_procedure_definition); return _procedure_definition; } case (int)RuleConstants.RULE_SUB_DECLARATIONS: //<Sub_declarations> ::= return null; case (int)RuleConstants.RULE_SUB_DECLARATIONS2: //<Sub_declarations> ::= <Sub_declarations> <Procedure> { declarations _declarations; if (LRParser.GetReductionSyntaxNode(0) != null) { _declarations = (declarations)LRParser.GetReductionSyntaxNode(0); _declarations.defs.Add((declaration)LRParser.GetReductionSyntaxNode(1)); } else { _declarations = new declarations(); _declarations.defs.Add((declaration)LRParser.GetReductionSyntaxNode(1)); } // parsertools.create_source_context(_declarations, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)), LRParser.GetReductionSyntaxNode(1)); return _declarations; } case (int)RuleConstants.RULE_SUB_DECLARATIONS3: //<Sub_declarations> ::= <Sub_declarations> <Function> { declarations _declarations; if (LRParser.GetReductionSyntaxNode(0) != null) { _declarations = (declarations)LRParser.GetReductionSyntaxNode(0); _declarations.defs.Add((declaration)LRParser.GetReductionSyntaxNode(1)); } else { _declarations = new declarations(); _declarations.defs.Add((declaration)LRParser.GetReductionSyntaxNode(1)); } parsertools.create_source_context(_declarations, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)), LRParser.GetReductionSyntaxNode(1)); return _declarations; } case (int)RuleConstants.RULE_SUB_DECLARATIONS4: //<Sub_declarations> ::= <Sub_declarations> <Separators> { declarations _declarations; if (LRParser.GetReductionSyntaxNode(0) != null) { _declarations = (declarations)LRParser.GetReductionSyntaxNode(0); } else { _declarations = new declarations(); } parsertools.create_source_context(_declarations, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(0))); return _declarations; } case (int)RuleConstants.RULE_TYPE_TK_INTEGER_TYPE: //<Type> ::= 'tk_integer_type' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_TK_REAL_TYPE: //<Type> ::= 'tk_real_type' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_TK_BOOLEAN_TYPE: //<Type> ::= 'tk_boolean_type' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_TK_CHAR_TYPE: //<Type> ::= 'tk_char_type' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_TYPE_TK_STRING_TYPE: //<Type> ::= 'tk_string_type' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_DIAP_TK_COLON: //<Diap> ::= <Expression> 'tk_Colon' <Expression> { diapason _diapason = new diapason(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression); parsertools.create_source_context(_diapason, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _diapason; } case (int)RuleConstants.RULE_DIAP_LIST_TK_COMMA: //<Diap_list> ::= <Diap_list> 'tk_Comma' <Diap> { indexers_types _indexers_types = GetIndexers(LRParser.GetReductionSyntaxNode(0)); _indexers_types.indexers.Add(LRParser.GetReductionSyntaxNode(2) as diapason); parsertools.create_source_context(_indexers_types, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _indexers_types; } case (int)RuleConstants.RULE_DIAP_LIST: //<Diap_list> ::= <Diap> { indexers_types _indexers_types = new indexers_types(); _indexers_types.indexers.Add(LRParser.GetReductionSyntaxNode(0) as diapason); parsertools.create_source_context(_indexers_types, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); return _indexers_types; } case (int)RuleConstants.RULE_LIST_OF_EXPRESSIONS_TK_COMMA: //<List_of_expressions> ::= <List_of_expressions> 'tk_Comma' <Expression> { expression_list _expression_list = GetExpressions(LRParser.GetReductionSyntaxNode(0)); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(2) as expression); parsertools.create_source_context(_expression_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _expression_list; } case (int)RuleConstants.RULE_LIST_OF_EXPRESSIONS: //<List_of_expressions> ::= <Expression> { expression_list _expression_list = new expression_list(); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(0) as expression); _expression_list.source_context = ((expression)LRParser.GetReductionSyntaxNode(0)).source_context; return _expression_list; } case (int)RuleConstants.RULE_ID_LIST1_TK_IDENTIFIER: //<Id_list1> ::= 'tk_Identifier' { ident_list _ident_list = new ident_list(); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(0) as ident); _ident_list.source_context = ((ident)LRParser.GetReductionSyntaxNode(0)).source_context; return _ident_list; } case (int)RuleConstants.RULE_ID_LIST1_TK_IDENTIFIER_TK_COMMA: //<Id_list1> ::= 'tk_Identifier' 'tk_Comma' <Id_list1> { ident_list _ident_list = GetIdents(LRParser.GetReductionSyntaxNode(2)); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(0) as ident); parsertools.create_source_context(_ident_list, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(0))); return _ident_list; } case (int)RuleConstants.RULE_ARRAY_LIST1_TK_IDENTIFIER_TK_SQUAREOPEN_TK_SQUARECLOSE: //<Array_list1> ::= 'tk_Identifier' 'tk_SquareOpen' <Diap_list> 'tk_SquareClose' { ident_list _ident_list = new ident_list(); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(0) as ident); indexers_types _indexers_types = GetIndexers(LRParser.GetReductionSyntaxNode(2)); array_type _array_type = new array_type(_indexers_types, null); var_def_statement _var_def_statement = new var_def_statement(_ident_list, _array_type, null, definition_attribute.None, false); variable_definitions _variable_definitions = new variable_definitions(); _variable_definitions.var_definitions.Add(_var_def_statement); //_ident_list.source_context = ((ident)LRParser.GetReductionSyntaxNode(0)).source_context; parsertools.create_source_context(_array_type, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(3)); //parsertools.create_source_context(LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_ident_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_indexers_types, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_variable_definitions, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_var_def_statement, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); return _variable_definitions; } case (int)RuleConstants.RULE_ARRAY_LIST1_TK_IDENTIFIER_TK_SQUAREOPEN_TK_SQUARECLOSE_TK_COMMA: //<Array_list1> ::= 'tk_Identifier' 'tk_SquareOpen' <Diap_list> 'tk_SquareClose' 'tk_Comma' <Array_list1> { ident_list _ident_list = new ident_list(); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(0) as ident); indexers_types _indexers_types = GetIndexers(LRParser.GetReductionSyntaxNode(2)); array_type _array_type = new array_type(_indexers_types, null); var_def_statement _var_def_statement = new var_def_statement(_ident_list, _array_type, null, definition_attribute.None, false); variable_definitions _variable_definitions = (LRParser.GetReductionSyntaxNode(5) as variable_definitions); _variable_definitions.var_definitions.Add(_var_def_statement); //_ident_list.source_context = ((ident)LRParser.GetReductionSyntaxNode(0)).source_context; parsertools.create_source_context(_array_type, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_ident_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); //parsertools.create_source_context(LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_indexers_types, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_variable_definitions, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(5)); parsertools.create_source_context(_var_def_statement, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); return _variable_definitions; } case (int)RuleConstants.RULE_ID_LIST2_TK_IDENTIFIER_TK_COMMA: //<Id_list2> ::= 'tk_Identifier' 'tk_Comma' { ident_list _ident_list = new ident_list(); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(0) as ident); _ident_list.source_context = ((ident)LRParser.GetReductionSyntaxNode(0)).source_context; return _ident_list; } case (int)RuleConstants.RULE_ID_LIST2_TK_IDENTIFIER_TK_COMMA2: //<Id_list2> ::= 'tk_Identifier' 'tk_Comma' <Id_list2> { ident_list _ident_list = GetIdents(LRParser.GetReductionSyntaxNode(2)); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(0) as ident); parsertools.create_source_context(_ident_list, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(0))); return _ident_list; } case (int)RuleConstants.RULE_ARRAY_LIST2_TK_IDENTIFIER_TK_SQUAREOPEN_TK_SQUARECLOSE_TK_COMMA: //<Array_list2> ::= 'tk_Identifier' 'tk_SquareOpen' <Diap_list> 'tk_SquareClose' 'tk_Comma' { ident_list _ident_list = new ident_list(); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(0) as ident); indexers_types _indexers_types = GetIndexers(LRParser.GetReductionSyntaxNode(2)); array_type _array_type = new array_type(_indexers_types, null); var_def_statement _var_def_statement = new var_def_statement(_ident_list, _array_type, null, definition_attribute.None, false); variable_definitions _variable_definitions = new variable_definitions(); _variable_definitions.var_definitions.Add(_var_def_statement); //_ident_list.source_context = ((ident)LRParser.GetReductionSyntaxNode(0)).source_context; parsertools.create_source_context(_array_type, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_ident_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); //parsertools.create_source_context(LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_indexers_types, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_variable_definitions, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_var_def_statement, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); return _variable_definitions; } case (int)RuleConstants.RULE_ARRAY_LIST2_TK_IDENTIFIER_TK_SQUAREOPEN_TK_SQUARECLOSE_TK_COMMA2: //<Array_list2> ::= 'tk_Identifier' 'tk_SquareOpen' <Diap_list> 'tk_SquareClose' 'tk_Comma' <Array_list2> { ident_list _ident_list = new ident_list(); _ident_list.idents.Add(LRParser.GetReductionSyntaxNode(0) as ident); indexers_types _indexers_types = GetIndexers(LRParser.GetReductionSyntaxNode(2)); array_type _array_type = new array_type(_indexers_types, null); var_def_statement _var_def_statement = new var_def_statement(_ident_list, _array_type, null, definition_attribute.None, false); variable_definitions _variable_definitions = (LRParser.GetReductionSyntaxNode(5) as variable_definitions); _variable_definitions.var_definitions.Add(_var_def_statement); //_ident_list.source_context = ((ident)LRParser.GetReductionSyntaxNode(0)).source_context; parsertools.create_source_context(_array_type, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_ident_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); //parsertools.create_source_context(LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_indexers_types, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_variable_definitions, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(5)); parsertools.create_source_context(_var_def_statement, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); return _variable_definitions; } case (int)RuleConstants.RULE_VAR_DECLARATIONS1: //<Var_declarations1> ::= <Type> <Id_list1> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(0)).text.ToLower()); var_def_statement _var_def_statement = new var_def_statement(GetIdents(LRParser.GetReductionSyntaxNode(1)), _named_type_reference, null, definition_attribute.None, false); var_statement _var_statement = new var_statement(_var_def_statement); parsertools.create_source_context(_var_def_statement, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_var_statement, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_named_type_reference, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); return _var_statement; } case (int)RuleConstants.RULE_VAR_DECLARATIONS1_TK_ARRAY: //<Var_declarations1> ::= <Type> 'tk_array' <Array_list1> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(0)).text.ToLower()); statement_list var_statement_list = new statement_list(); variable_definitions _variable_definitions = LRParser.GetReductionSyntaxNode(2) as variable_definitions; for (int i = 0; i < _variable_definitions.var_definitions.Count; i++) { ((_variable_definitions.var_definitions[i]).vars_type as array_type).elemets_types = _named_type_reference; var_statement _var_statement = new var_statement((var_def_statement)_variable_definitions.var_definitions[i]); var_statement_list.subnodes.Add(_var_statement); parsertools.create_source_context(_var_statement, _variable_definitions.var_definitions[i], _variable_definitions.var_definitions[i]); } parsertools.create_source_context(_named_type_reference.names[0], LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_variable_definitions, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(var_statement_list, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_named_type_reference, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return var_statement_list; } case (int)RuleConstants.RULE_VAR_DECLARATIONS2: //<Var_declarations2> ::= <Type> <Id_list2> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(0)).text.ToLower()); var_def_statement _var_def_statement = new var_def_statement(GetIdents(LRParser.GetReductionSyntaxNode(1)), _named_type_reference, null, definition_attribute.None, false); var_statement _var_statement = new var_statement(_var_def_statement); parsertools.create_source_context(_var_def_statement, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_var_statement, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_named_type_reference, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); return _var_statement; } case (int)RuleConstants.RULE_VAR_DECLARATIONS2_TK_ARRAY: //<Var_declarations2> ::= <Type> 'tk_array' <Array_list2> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(0)).text.ToLower()); statement_list var_statement_list = new statement_list(); variable_definitions _variable_definitions = LRParser.GetReductionSyntaxNode(2) as variable_definitions; for (int i = 0; i < _variable_definitions.var_definitions.Count; i++) { ((_variable_definitions.var_definitions[i]).vars_type as array_type).elemets_types = _named_type_reference; var_statement _var_statement = new var_statement((var_def_statement)_variable_definitions.var_definitions[i]); var_statement_list.subnodes.Add(_var_statement); parsertools.create_source_context(_var_statement, _variable_definitions.var_definitions[i], _variable_definitions.var_definitions[i]); } parsertools.create_source_context(_named_type_reference.names[0], LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(var_statement_list, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_variable_definitions, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_named_type_reference, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return var_statement_list; } case (int)RuleConstants.RULE_VAR_DECL_LIST1: //<Var_decl_list1> ::= <Var_declarations1> { statement_list var_statement_list = GetStatements(LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(var_statement_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); return var_statement_list; } case (int)RuleConstants.RULE_VAR_DECL_LIST12: //<Var_decl_list1> ::= <Var_decl_list2> <Var_declarations1> { statement_list var_statement_list = GetStatements(LRParser.GetReductionSyntaxNode(0)); var_statement_list.subnodes.AddRange(GetStatements(LRParser.GetReductionSyntaxNode(1)).subnodes); parsertools.create_source_context(var_statement_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return var_statement_list; } case (int)RuleConstants.RULE_VAR_DECL_LIST2: //<Var_decl_list2> ::= <Var_declarations2> { statement_list var_statement_list = GetStatements(LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(var_statement_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); return var_statement_list; } case (int)RuleConstants.RULE_VAR_DECL_LIST22: //<Var_decl_list2> ::= <Var_decl_list2> <Var_declarations2> { statement_list var_statement_list = GetStatements(LRParser.GetReductionSyntaxNode(0)); var_statement_list.subnodes.AddRange(GetStatements(LRParser.GetReductionSyntaxNode(1)).subnodes); parsertools.create_source_context(var_statement_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return var_statement_list; } case (int)RuleConstants.RULE_DECLARATIONS: //<Declarations> ::= <Var_decl_list1> return LRParser.GetReductionSyntaxNode(0); //------------------------- Globals case (int)RuleConstants.RULE_USES_UNITS_TK_USES: //<Uses_units> ::= 'tk_uses' <Id_list1> { if (_units[unit_number - 1] != null) (_units[unit_number - 1] as unit_data).used_units.idents.AddRange(((ident_list)LRParser.GetReductionSyntaxNode(1)).idents); parsertools.create_source_context(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return LRParser.GetReductionSyntaxNode(1); //return null; } case (int)RuleConstants.RULE_GLOBAL_DECL_LIST: //<Global_decl_list> ::= <Global_decl_list> <Separators> <Declarations> { statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(0)); _statement_list.subnodes.AddRange(GetStatements(LRParser.GetReductionSyntaxNode(2)).subnodes); parsertools.create_source_context(_statement_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _statement_list; } case (int)RuleConstants.RULE_GLOBAL_DECL_LIST2: //<Global_decl_list> ::= <Declarations> { // etot kod pohoje inogda ne vipolniaetsia hotia pravilo srabativaet statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(0)); for (int i = 0; i < _statement_list.subnodes.Count; i++) (_units[this.unit_number - 1] as unit_data).sub_progs.defs.Add(_statement_list.subnodes[i] as declaration); parsertools.create_source_context(_statement_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); return _statement_list; } case (int)RuleConstants.RULE_INITIALIZATION_TK_ASSIGN: //<Initialization> ::= <Initialization> <Separators> <Value> 'tk_Assign' <Expression> { assign _assign = new assign((addressed_value)LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(4) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(3)).type); (_units[this.unit_number - 1] as unit_data).initialization.subnodes.Add(_assign); parsertools.create_source_context(_assign, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(4)); return null; } case (int)RuleConstants.RULE_INITIALIZATION_TK_ASSIGN2: //<Initialization> ::= <Value> 'tk_Assign' <Expression> { assign _assign = new assign((addressed_value)LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); (_units[this.unit_number - 1] as unit_data).initialization.subnodes.Add(_assign); parsertools.create_source_context(_assign, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return null; } case (int)RuleConstants.RULE_GLOBAL_VARS: //<Global_vars> ::= <Global_decl_list> <Separators> <Initialization> <Separators> { declarations _declarations = new declarations(); //_declarations.defs.Add((declaration)LRParser.GetReductionSyntaxNode(2)); statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(0)); for (int i = 0; i < _statement_list.subnodes.Count; i++) { (_units[this.unit_number - 1] as unit_data).sub_progs.defs.Add(_statement_list.subnodes[i] as declaration); _declarations.defs.Add(_statement_list.subnodes[i] as declaration); } parsertools.create_source_context(_declarations, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(3)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3), LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(0))); return _declarations; } case (int)RuleConstants.RULE_GLOBAL_VARS2: //<Global_vars> ::= <Global_decl_list> <Separators> { //declarations _declarations = (declarations)LRParser.GetReductionSyntaxNode(0); declarations _declarations = new declarations(); statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(0)); for (int i = 0; i < _statement_list.subnodes.Count; i++) { (_units[this.unit_number - 1] as unit_data).sub_progs.defs.Add(_statement_list.subnodes[i] as declaration); _declarations.defs.Add(_statement_list.subnodes[i] as declaration); } parsertools.create_source_context(_declarations, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(0))); return _declarations; } case (int)RuleConstants.RULE_GLOBAL_PART: //<Global_part> ::= return null; case (int)RuleConstants.RULE_GLOBAL_PART2: //<Global_part> ::= <Uses_units> <Separators> { //declarations _declarations = (declarations)LRParser.GetReductionSyntaxNode(0); //parsertools.create_source_context(_declarations, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(0))); return null; } case (int)RuleConstants.RULE_GLOBAL_PART3: //<Global_part> ::= <Uses_units> <Separators> <Global_vars> { //declarations _declarations = (declarations)LRParser.GetReductionSyntaxNode(0); //_declarations.defs.AddRange(((declarations)LRParser.GetReductionSyntaxNode(2)).defs); //parsertools.create_source_context(_declarations, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(2)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(0))); return null; } case (int)RuleConstants.RULE_GLOBAL_PART4: //<Global_part> ::= <Global_vars> { //declarations _declarations = (declarations)LRParser.GetReductionSyntaxNode(0); //parsertools.create_source_context(_declarations, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); return null; } case (int)RuleConstants.RULE_FORMAL_PARAMETER1: //<Formal_parameter1> ::= <Type> <Id_list1> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(0)).text.ToLower()); ident_list _ident_list = GetIdents(LRParser.GetReductionSyntaxNode(1)); _ident_list.idents.Reverse(); typed_parameters _typed_parametres = new typed_parameters(_ident_list, _named_type_reference, parametr_kind.none, null); formal_parameters _formal_parametres = new formal_parameters(); _formal_parametres.params_list.Add(_typed_parametres); parsertools.create_source_context(_typed_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_PARAMETER1_TK_VAR: //<Formal_parameter1> ::= 'tk_var' <Type> <Id_list1> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(1)).text.ToLower()); ident_list _ident_list = GetIdents(LRParser.GetReductionSyntaxNode(2)); _ident_list.idents.Reverse(); typed_parameters _typed_parametres = new typed_parameters(_ident_list, _named_type_reference, parametr_kind.var_parametr, null); formal_parameters _formal_parametres = new formal_parameters(); _formal_parametres.params_list.Add(_typed_parametres); parsertools.create_source_context(_typed_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_PARAMETER1_TK_ARRAY: //<Formal_parameter1> ::= <Type> 'tk_array' <Array_list1> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(0)).text.ToLower()); variable_definitions _variable_definitions = LRParser.GetReductionSyntaxNode(2) as variable_definitions; formal_parameters _formal_parametres = new formal_parameters(); _variable_definitions.var_definitions.Reverse(); for (int i = 0; i < _variable_definitions.var_definitions.Count; i++) { ((_variable_definitions.var_definitions[i]).vars_type as array_type).elemets_types = _named_type_reference; _formal_parametres.params_list.Add(new typed_parameters((_variable_definitions.var_definitions[i]).vars, (_variable_definitions.var_definitions[i]).vars_type, parametr_kind.none, null)); } _variable_definitions.var_definitions.Clear(); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_variable_definitions, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_named_type_reference, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_PARAMETER1_TK_VAR_TK_ARRAY: //<Formal_parameter1> ::= 'tk_var' <Type> 'tk_array' <Array_list1> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(1)).text.ToLower()); variable_definitions _variable_definitions = LRParser.GetReductionSyntaxNode(3) as variable_definitions; formal_parameters _formal_parametres = new formal_parameters(); _variable_definitions.var_definitions.Reverse(); for (int i = 0; i < _variable_definitions.var_definitions.Count; i++) { ((_variable_definitions.var_definitions[i]).vars_type as array_type).elemets_types = _named_type_reference; _formal_parametres.params_list.Add(new typed_parameters((_variable_definitions.var_definitions[i]).vars, (_variable_definitions.var_definitions[i]).vars_type, parametr_kind.var_parametr, null)); } _variable_definitions.var_definitions.Clear(); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_variable_definitions, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_named_type_reference, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_PARAMETER2: //<Formal_Parameter2> ::= <Type> <Id_list2> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(0)).text.ToLower()); ident_list _ident_list = GetIdents(LRParser.GetReductionSyntaxNode(1)); _ident_list.idents.Reverse(); typed_parameters _typed_parametres = new typed_parameters(_ident_list, _named_type_reference, parametr_kind.none, null); formal_parameters _formal_parametres = new formal_parameters(); _formal_parametres.params_list.Add(_typed_parametres); parsertools.create_source_context(_typed_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_PARAMETER2_TK_VAR: //<Formal_Parameter2> ::= 'tk_var' <Type> <Id_list2> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(1)).text.ToLower()); ident_list _ident_list = GetIdents(LRParser.GetReductionSyntaxNode(2)); _ident_list.idents.Reverse(); typed_parameters _typed_parametres = new typed_parameters(_ident_list, _named_type_reference, parametr_kind.var_parametr, null); formal_parameters _formal_parametres = new formal_parameters(); _formal_parametres.params_list.Add(_typed_parametres); parsertools.create_source_context(_typed_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_PARAMETER2_TK_ARRAY: //<Formal_Parameter2> ::= <Type> 'tk_array' <Array_list2> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(0)).text.ToLower()); variable_definitions _variable_definitions = LRParser.GetReductionSyntaxNode(2) as variable_definitions; formal_parameters _formal_parametres = new formal_parameters(); _variable_definitions.var_definitions.Reverse(); for (int i = 0; i < _variable_definitions.var_definitions.Count; i++) { ((_variable_definitions.var_definitions[i]).vars_type as array_type).elemets_types = _named_type_reference; _formal_parametres.params_list.Add(new typed_parameters((_variable_definitions.var_definitions[i]).vars, (_variable_definitions.var_definitions[i]).vars_type, parametr_kind.none, null)); } _variable_definitions.var_definitions.Clear(); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_variable_definitions, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_PARAMETER2_TK_VAR_TK_ARRAY: //<Formal_Parameter2> ::= 'tk_var' <Type> 'tk_array' <Array_list2> { named_type_reference _named_type_reference = GetType(((token_info)LRParser.GetReductionSyntaxNode(1)).text.ToLower()); variable_definitions _variable_definitions = LRParser.GetReductionSyntaxNode(3) as variable_definitions; formal_parameters _formal_parametres = new formal_parameters(); _variable_definitions.var_definitions.Reverse(); for (int i = 0; i < _variable_definitions.var_definitions.Count; i++) { ((_variable_definitions.var_definitions[i]).vars_type as array_type).elemets_types = _named_type_reference; _formal_parametres.params_list.Add(new typed_parameters((_variable_definitions.var_definitions[i]).vars, (_variable_definitions.var_definitions[i]).vars_type, parametr_kind.var_parametr, null)); } _variable_definitions.var_definitions.Clear(); parsertools.create_source_context(_variable_definitions, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_TYPE_LIST1: //<Formal_type_list1> ::= <Formal_parameter1> { formal_parameters _formal_parametres = GetFormals(LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_TYPE_LIST12: //<Formal_type_list1> ::= <Formal_type_list2> <Formal_parameter1> { formal_parameters _formal_parametres = GetFormals(LRParser.GetReductionSyntaxNode(0)); _formal_parametres.params_list.AddRange(GetFormals(LRParser.GetReductionSyntaxNode(1)).params_list); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_TYPE_LIST2: //<Formal_type_list2> ::= <Formal_Parameter2> { formal_parameters _formal_parametres = GetFormals(LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_TYPE_LIST22: //<Formal_type_list2> ::= <Formal_type_list2> <Formal_Parameter2> { formal_parameters _formal_parametres = GetFormals(LRParser.GetReductionSyntaxNode(0)); _formal_parametres.params_list.AddRange(GetFormals(LRParser.GetReductionSyntaxNode(1)).params_list); parsertools.create_source_context(_formal_parametres, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return _formal_parametres; } case (int)RuleConstants.RULE_FORMAL_LIST: //<Formal_list> ::= return null; case (int)RuleConstants.RULE_FORMAL_LIST2: //<Formal_list> ::= <Formal_type_list1> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_FACT_LIST: //<Fact_list> ::= return null; case (int)RuleConstants.RULE_FACT_LIST2: //<Fact_list> ::= <List_of_expressions> return LRParser.GetReductionSyntaxNode(0); //-------------------------- Operators case (int)RuleConstants.RULE_FREE_OPERATOR: //<Free_operator> ::= return null; case (int)RuleConstants.RULE_CASE_VARIANT_LIST: //<Case_variant_list> ::= <Case_variant> <Case_variant_list> { if_node _if_node1; if (LRParser.GetReductionSyntaxNode(1) is case_variant) { case_variant _case_variant1 = (case_variant)LRParser.GetReductionSyntaxNode(1); _if_node1 = new if_node((expression)_case_variant1.conditions.expressions[0], GetStatements(_case_variant1.exec_if_true), null); parsertools.create_source_context(_if_node1, LRParser.GetReductionSyntaxNode(1),LRParser.GetReductionSyntaxNode(1)); //make } else _if_node1 = LRParser.GetReductionSyntaxNode(1) as if_node; case_variant _case_variant = (case_variant)LRParser.GetReductionSyntaxNode(0); if_node _if_node = new if_node((expression)_case_variant.conditions.expressions[0], _case_variant.exec_if_true, _if_node1); parsertools.create_source_context(_if_node, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(0))); //make return _if_node; } case (int)RuleConstants.RULE_CASE_VARIANT_LIST2: //<Case_variant_list> ::= <Case_variant> { //unreacheable rule.. ? case_variant _case_variant = (case_variant)LRParser.GetReductionSyntaxNode(0); if_node _if_node = new if_node(GetExpressions(_case_variant.conditions), (statement)_case_variant.exec_if_true, null); parsertools.create_source_context(_if_node, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); //make return _if_node; } case (int)RuleConstants.RULE_CASE_VARIANT_TK_CASE_V_TK_COLON: //<Case_variant> ::= 'tk_case_v' <Expression> 'tk_Colon' <Statements> { expression_list _expression_list = GetExpressions(LRParser.GetReductionSyntaxNode(1)); case_variant _case_variant = new case_variant(_expression_list, GetStatements(LRParser.GetReductionSyntaxNode(3))); //_case_variant.source_context = (GetExpressions(LRParser.GetReductionSyntaxNode(1))).source_context; parsertools.create_source_context(_case_variant, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3), LRParser.GetReductionSyntaxNode(2))); return _case_variant; } case (int)RuleConstants.RULE_STATEMENTS: //<Statements> ::= <Statements> <Separators> <Statement> { statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(0)); _statement_list.subnodes.AddRange(GetStatements(LRParser.GetReductionSyntaxNode(2)).subnodes); parsertools.create_source_context(_statement_list, parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(0))); //parsertools.create_source_context(_statement_list, _statement_list, _statement_list); //make return _statement_list; } case (int)RuleConstants.RULE_STATEMENTS2: //<Statements> ::= <Statement> { statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_statement_list, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); return _statement_list; } case (int)RuleConstants.RULE_STATEMENT: //<Statement> ::= <Free_operator> { empty_statement _empty_statement = new empty_statement(); return _empty_statement; } case (int)RuleConstants.RULE_STATEMENT2: //<Statement> ::= <Declarations> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_STATEMENT_TK_ASSIGN: //<Statement> ::= <Value> 'tk_Assign' <Expression> { assign _assign = new assign((addressed_value)LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_assign, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _assign; } case (int)RuleConstants.RULE_STATEMENT_TK_IF_TK_THEN_TK_END_ALL: //<Statement> ::= 'tk_if' <Expression> 'tk_then' <Statements> 'tk_end_all' { if_node _if_node = new if_node((expression)LRParser.GetReductionSyntaxNode(1), GetStatements(LRParser.GetReductionSyntaxNode(3)), null); parsertools.create_source_context(_if_node, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(4), LRParser.GetReductionSyntaxNode(2))); return _if_node; } case (int)RuleConstants.RULE_STATEMENT_TK_IF_TK_THEN_TK_ELSE_TK_END_ALL: //<Statement> ::= 'tk_if' <Expression> 'tk_then' <Statements> 'tk_else' <Statements> 'tk_end_all' { if_node _if_node = new if_node((expression)LRParser.GetReductionSyntaxNode(1), GetStatements(LRParser.GetReductionSyntaxNode(3)), GetStatements(LRParser.GetReductionSyntaxNode(5))); parsertools.create_source_context(_if_node, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(6), LRParser.GetReductionSyntaxNode(2))); return _if_node; } case (int)RuleConstants.RULE_STATEMENT_TK_BEGIN_CYCLE_TK_RAZ_TK_END_CYCLE: //<Statement> ::= 'tk_begin_cycle' <Expression> 'tk_raz' <Statements> 'tk_end_cycle' { // remake without "_system_loop_var_" ! int32_const _int32_const = new int32_const(1); ident loop_var = new ident("&_system_loop_var"); statement_list _statement_list = GetStatements(LRParser.GetReductionSyntaxNode(3)); for_node _for_node = new for_node(loop_var, _int32_const, (expression)LRParser.GetReductionSyntaxNode(1), _statement_list, for_cycle_type.to, null, null, true); parsertools.create_source_context(_for_node, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(4), LRParser.GetReductionSyntaxNode(1))); if ((_statement_list as statement).source_context != null) parsertools.create_source_context(_statement_list, LRParser.GetReductionSyntaxNode(3), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_for_node, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(4)); return _for_node; } case (int)RuleConstants.RULE_STATEMENT_TK_BEGIN_CYCLE_TK_FOR_TK_IDENTIFIER_TK_FROM_TK_TO_TK_END_CYCLE: //<Statement> ::= 'tk_begin_cycle' 'tk_for' 'tk_Identifier' 'tk_from' <Expression> 'tk_to' <Expression> <Statements> 'tk_end_cycle' { for_node _for_node = new for_node((ident)LRParser.GetReductionSyntaxNode(2), (expression)LRParser.GetReductionSyntaxNode(4), (expression)LRParser.GetReductionSyntaxNode(6), GetStatements(LRParser.GetReductionSyntaxNode(7)), for_cycle_type.to, null, null, false); parsertools.create_source_context(_for_node, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(8), LRParser.GetReductionSyntaxNode(1))); parsertools.create_source_context(GetStatements(LRParser.GetReductionSyntaxNode(7)), LRParser.GetReductionSyntaxNode(7), LRParser.GetReductionSyntaxNode(7)); return _for_node; } case (int)RuleConstants.RULE_STATEMENT_TK_BEGIN_CYCLE_TK_WHILE_TK_END_CYCLE: //<Statement> ::= 'tk_begin_cycle' 'tk_while' <Expression> <Statements> 'tk_end_cycle' { while_node _while_node = new while_node((expression)LRParser.GetReductionSyntaxNode(2), GetStatements(LRParser.GetReductionSyntaxNode(3)), WhileCycleType.While); parsertools.create_source_context(_while_node, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(4)); return _while_node; } case (int)RuleConstants.RULE_STATEMENT_TK_CASE_TK_END_ALL: //<Statement> ::= 'tk_case' <Separators Opt> <Case_variant_list> 'tk_end_all' { if_node _if_node; if (LRParser.GetReductionSyntaxNode(2) is case_variant) { case_variant _case_variant = (case_variant)LRParser.GetReductionSyntaxNode(2); _if_node = new if_node((expression)_case_variant.conditions.expressions[0], (statement)_case_variant.exec_if_true, null); parsertools.create_source_context(_if_node, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3), LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(1))); //make return _if_node; } else{ if_node _if_node1; _if_node = (if_node)LRParser.GetReductionSyntaxNode(2); _if_node1 = _if_node; while (_if_node1.else_body is if_node) _if_node1 = _if_node1.else_body as if_node; _if_node1.else_body = null; parsertools.create_source_context(_if_node, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(3), LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(1))); return _if_node; } } case (int)RuleConstants.RULE_STATEMENT_TK_CASE_TK_ELSE_TK_END_ALL: //<Statement> ::= 'tk_case' <Separators Opt> <Case_variant_list> 'tk_else' <Statements> 'tk_end_all' { if_node _if_node; if (LRParser.GetReductionSyntaxNode(2) is case_variant) { case_variant _case_variant = (case_variant)LRParser.GetReductionSyntaxNode(2); _if_node = new if_node((expression)_case_variant.conditions.expressions[0], (statement)_case_variant.exec_if_true, GetStatements(LRParser.GetReductionSyntaxNode(4))); parsertools.create_source_context(_if_node, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(5), LRParser.GetReductionSyntaxNode(4), LRParser.GetReductionSyntaxNode(3), LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(1))); //make return _if_node; } else { if_node _if_node1; _if_node = (if_node)LRParser.GetReductionSyntaxNode(2); _if_node1 = _if_node; while (_if_node1.else_body is if_node) _if_node1 = _if_node1.else_body as if_node; _if_node1.else_body = GetStatements(LRParser.GetReductionSyntaxNode(4)); // _if_node1.else_body.source_context.end_position //parsertools.create_source_context(_if_node1, LRParser.GetReductionSyntaxNode(2), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(5), LRParser.GetReductionSyntaxNode(4), LRParser.GetReductionSyntaxNode(3))); //make parsertools.create_source_context(_if_node, LRParser.GetReductionSyntaxNode(0), parsertools.sc_not_null(LRParser.GetReductionSyntaxNode(5), LRParser.GetReductionSyntaxNode(4), LRParser.GetReductionSyntaxNode(3), LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(1))); //make return _if_node; } } case (int)RuleConstants.RULE_STATEMENT_TK_ASSERT: //<Statement> ::= 'tk_assert' <Expression> { //make it! procedure_call _procedure_call = new procedure_call(); expression_list _expression_list = new expression_list(); _expression_list.expressions.Add((expression)LRParser.GetReductionSyntaxNode(1)); method_call _method_call = new method_call(_expression_list); _method_call.dereferencing_value = new ident("assert"); _procedure_call.func_name = _method_call; parsertools.create_source_context(_method_call.dereferencing_value, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_expression_list, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_method_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_procedure_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return _procedure_call; } case (int)RuleConstants.RULE_STATEMENT_TK_READ: //<Statement> ::= 'tk_read' <Id_list1> { procedure_call _procedure_call = new procedure_call(); expression_list _expression_list = new expression_list(); ident_list _ident_list = GetIdents(LRParser.GetReductionSyntaxNode(1)); for (int i = 0; i < _ident_list.idents.Count; i++) { _expression_list.expressions.Add(_ident_list.idents[i] as expression); } _ident_list.idents.Clear(); method_call _method_call = new method_call(_expression_list); _method_call.dereferencing_value = new ident("read"); _procedure_call.func_name = _method_call; parsertools.create_source_context(_method_call.dereferencing_value, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_ident_list, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_method_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_procedure_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return _procedure_call; } case (int)RuleConstants.RULE_STATEMENT_TK_WRITE: //<Statement> ::= 'tk_write' <List_of_expressions> { procedure_call _procedure_call = new procedure_call(); expression_list _expression_list = GetExpressions(LRParser.GetReductionSyntaxNode(1)); method_call _method_call = new method_call(_expression_list); _method_call.dereferencing_value = new ident("write"); _procedure_call.func_name = _method_call; parsertools.create_source_context(_method_call.dereferencing_value, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_expression_list, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_method_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_procedure_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return _procedure_call; } case (int)RuleConstants.RULE_STATEMENT_TK_IDENTIFIER_TK_ROUNDOPEN_TK_ROUNDCLOSE: //<Statement> ::= 'tk_Identifier' 'tk_RoundOpen' <Fact_list> 'tk_RoundClose' { procedure_call _procedure_call = new procedure_call(); method_call _method_call; expression_list _expression_list; if (LRParser.GetReductionSyntaxNode(2) != null) { _expression_list = GetExpressions(LRParser.GetReductionSyntaxNode(2)); _method_call = new method_call(_expression_list); } else _method_call = new method_call(); _method_call.dereferencing_value = new ident(((ident)LRParser.GetReductionSyntaxNode(0)).name); _procedure_call.func_name = _method_call; parsertools.create_source_context(_method_call.dereferencing_value, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); //parsertools.create_source_context(_expression_list, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_method_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); parsertools.create_source_context(_procedure_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); return _procedure_call; } case (int)RuleConstants.RULE_STATEMENT_TK_IDENTIFIER: //<Statement> ::= 'tk_Identifier' { procedure_call _procedure_call = new procedure_call(); method_call _method_call = new method_call(null); _method_call.dereferencing_value = new ident(((ident)LRParser.GetReductionSyntaxNode(0)).name); _procedure_call.func_name = _method_call; parsertools.create_source_context(_method_call.dereferencing_value, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_method_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); parsertools.create_source_context(_procedure_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); return _procedure_call; } case (int)RuleConstants.RULE_EXPRESSION_TK_GREATER: //<Expression> ::= <Expression> 'tk_Greater' <Add Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPRESSION_TK_LOWER: //<Expression> ::= <Expression> 'tk_Lower' <Add Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPRESSION_TK_LOWEREQUAL: //<Expression> ::= <Expression> 'tk_LowerEqual' <Add Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPRESSION_TK_GREATEREQUAL: //<Expression> ::= <Expression> 'tk_GreaterEqual' <Add Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPRESSION_TK_EQUAL: //<Expression> ::= <Expression> 'tk_Equal' <Add Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPRESSION_TK_NOTEQUAL: //<Expression> ::= <Expression> 'tk_NotEqual' <Add Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_EXPRESSION: //<Expression> ::= <Add Exp> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_ADDEXP_TK_OR: //<Add Exp> ::= <Add Exp> 'tk_or' <Mult Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_ADDEXP_TK_PLUS: //<Add Exp> ::= <Add Exp> 'tk_Plus' <Mult Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_ADDEXP_TK_MINUS: //<Add Exp> ::= <Add Exp> 'tk_Minus' <Mult Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_ADDEXP: //<Add Exp> ::= <Mult Exp> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_MULTEXP_TK_AND: //<Mult Exp> ::= <Mult Exp> 'tk_and' <Power Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_MULTEXP_TK_MULT: //<Mult Exp> ::= <Mult Exp> 'tk_Mult' <Power Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_MULTEXP_TK_DIV: //<Mult Exp> ::= <Mult Exp> 'tk_Div' <Power Exp> { bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _bin_expr; } case (int)RuleConstants.RULE_MULTEXP: //<Mult Exp> ::= <Power Exp> return LRParser.GetReductionSyntaxNode(0); //make it! case (int)RuleConstants.RULE_POWEREXP_TK_POWER: { //<Power Exp> ::= <Negate Exp> 'tk_Power' <Power Exp> expression_list _expression_list = new expression_list(); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(0) as expression); _expression_list.expressions.Add(LRParser.GetReductionSyntaxNode(2) as expression); method_call _method_call = new method_call(_expression_list); _method_call.dereferencing_value = new ident("Power"); parsertools.create_source_context(_method_call.dereferencing_value, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_method_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); return _method_call; //bin_expr _bin_expr = new bin_expr(LRParser.GetReductionSyntaxNode(0) as expression, LRParser.GetReductionSyntaxNode(2) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(1)).type); //parsertools.create_source_context(_bin_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(2)); //return _bin_expr; } case (int)RuleConstants.RULE_POWEREXP: //<Power Exp> ::= <Negate Exp> return LRParser.GetReductionSyntaxNode(0); //make it! case (int)RuleConstants.RULE_NEGATEEXP_TK_MINUS: //<Negate Exp> ::= 'tk_Minus' <Value> { un_expr _un_expr = new un_expr(LRParser.GetReductionSyntaxNode(1) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(0)).type); parsertools.create_source_context(_un_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return _un_expr; } case (int)RuleConstants.RULE_NEGATEEXP_TK_NOT: //<Negate Exp> ::= 'tk_not' <Value> { un_expr _un_expr = new un_expr(LRParser.GetReductionSyntaxNode(1) as expression, ((op_type_node)LRParser.GetReductionSyntaxNode(0)).type); parsertools.create_source_context(_un_expr, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return _un_expr; } case (int)RuleConstants.RULE_NEGATEEXP: //<Negate Exp> ::= <Value> return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VALUE_TK_IDENTIFIER: //<Value> ::= 'tk_Identifier' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VALUE_TK_FUNC_VAL: //<Value> ::= 'tk_func_val' return new ident("result"); case (int)RuleConstants.RULE_VALUE_TK_INTEGER: //<Value> ::= 'tk_integer' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VALUE_TK_REAL: //<Value> ::= 'tk_real' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VALUE_TK_TRUE: //<Value> ::= 'tk_true' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VALUE_TK_FALSE: //<Value> ::= 'tk_false' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VALUE_TK_STRINGLITERAL: //<Value> ::= 'tk_StringLiteral' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VALUE_TK_CHAR: //<Value> ::= 'tk_char' return LRParser.GetReductionSyntaxNode(0); case (int)RuleConstants.RULE_VALUE_TK_EOL: //<Value> ::= 'tk_eol' { literal_const_line _literal_const_line = new literal_const_line(); sharp_char_const _sharp_char_const_13 = new sharp_char_const(13); sharp_char_const _sharp_char_const_10 = new sharp_char_const(10); _literal_const_line.literals.Add(_sharp_char_const_13); _literal_const_line.literals.Add(_sharp_char_const_10); parsertools.create_source_context(_sharp_char_const_13, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); //make parsertools.create_source_context(_sharp_char_const_10, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); //make parsertools.create_source_context(_literal_const_line, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(0)); //make return _literal_const_line; } case (int)RuleConstants.RULE_VALUE_TK_IDENTIFIER_TK_SQUAREOPEN_TK_SQUARECLOSE_TK_SQUAREOPEN_TK_SQUARECLOSE: //<Value> ::= 'tk_Identifier' 'tk_SquareOpen' <Fact_list> 'tk_SquareClose' 'tk_SquareOpen' <Expression> 'tk_SquareClose' { indexer _indexer = new indexer(GetExpressions(LRParser.GetReductionSyntaxNode(2))); indexer _indexer1 = new indexer(GetExpressions(LRParser.GetReductionSyntaxNode(5))); _indexer.dereferencing_value = LRParser.GetReductionSyntaxNode(0) as ident; _indexer1.dereferencing_value = _indexer; parsertools.create_source_context(_indexer, LRParser.GetReductionSyntaxNode(2), LRParser.GetReductionSyntaxNode(2)); parsertools.create_source_context(_indexer, LRParser.GetReductionSyntaxNode(5), LRParser.GetReductionSyntaxNode(5)); return _indexer1; } case (int)RuleConstants.RULE_VALUE_TK_IDENTIFIER_TK_SQUAREOPEN_TK_SQUARECLOSE: //<Value> ::= 'tk_Identifier' 'tk_SquareOpen' <Fact_list> 'tk_SquareClose' { indexer _indexer = new indexer(GetExpressions(LRParser.GetReductionSyntaxNode(2))); _indexer.dereferencing_value = LRParser.GetReductionSyntaxNode(0) as ident; parsertools.create_source_context(_indexer, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(3)); return _indexer; } case (int)RuleConstants.RULE_VALUE_TK_IDENTIFIER_TK_ROUNDOPEN_TK_ROUNDCLOSE: //<Value> ::= 'tk_Identifier' 'tk_RoundOpen' <Fact_list> 'tk_RoundClose' { expression_list _expression_list; method_call _method_call; if (LRParser.GetReductionSyntaxNode(2) != null) { _expression_list = GetExpressions(LRParser.GetReductionSyntaxNode(2)); _method_call = new method_call(_expression_list); } else _method_call = new method_call(); switch (((ident)LRParser.GetReductionSyntaxNode(0)).name) { case "tg": _method_call.dereferencing_value = new ident("tan"); break; case "ctg": _method_call.dereferencing_value = new ident("ctg"); break; case "arctg": _method_call.dereferencing_value = new ident("arctan"); break; case "arcctg": _method_call.dereferencing_value = new ident("arcctg"); break; case "lg": _method_call.dereferencing_value = new ident("log10"); break; case "mod": _method_call.dereferencing_value = new ident("md"); break; case "div": _method_call.dereferencing_value = new ident("dv"); break; case "rnd": _method_call.dereferencing_value = new ident("random"); break; case "int": _method_call.dereferencing_value = new ident("round"); break; default: _method_call.dereferencing_value = new ident(((ident)LRParser.GetReductionSyntaxNode(0)).name); break; } //_method_call.dereferencing_value = LRParser.GetReductionSyntaxNode(0) as ident; parsertools.create_source_context(_method_call.dereferencing_value, LRParser.GetReductionSyntaxNode(1), LRParser.GetReductionSyntaxNode(1)); parsertools.create_source_context(_method_call, LRParser.GetReductionSyntaxNode(0), LRParser.GetReductionSyntaxNode(1)); return _method_call; } case (int)RuleConstants.RULE_VALUE_TK_ROUNDOPEN_TK_ROUNDCLOSE: //<Value> ::= 'tk_RoundOpen' <Expression> 'tk_RoundClose' return LRParser.GetReductionSyntaxNode(1); } throw new RuleException("Unknown rule"); }
//public override void visit(method_call _method_call) public override void visit(procedure_call _proc_call) { if (isForNode) if ((_proc_call.func_name!= null) && (_proc_call.func_name is ident)) { if ((_proc_call.func_name as ident).name.ToLower() == "continue") (_proc_call.func_name as ident).name = "exit"; if ((_proc_call.func_name as ident).name.ToLower() == "break") throw new OpenMPException("Нельзя использовать break в распараллеливаемом цикле", _proc_call.source_context); } base.visit(_proc_call); }
public override void visit(procedure_call _procedure_call) { visit_node(_procedure_call.func_name); }
public override void visit(procedure_call _procedure_call) { //throw new Exception("The method or operation is not implemented."); method_call mc = _procedure_call.func_name as method_call; if (mc != null && mc.parameters != null) { foreach (expression arg in mc.parameters.expressions) { if (arg is function_lambda_definition) arg.visit(this); } } }
public override void visit(procedure_call _procedure_call) { //throw new Exception("The method or operation is not implemented."); }
public override void visit(for_node fn) { ProcessNode(fn.statements); var b = HasStatementVisitor<yield_node>.Has(fn); if (!b) return; var gt1 = goto_statement.New; var gt2 = goto_statement.New; var newNames = this.NewVarNames(fn.loop_variable); var newLoopVar = fn.create_loop_variable ? new ident(newNames.VarName) : fn.loop_variable; // Нужно заменить fn.loop_variable -> newLoopVar в теле цикла var replacerVis = new ReplaceForVariableVisitor(fn.loop_variable, newLoopVar); fn.visit(replacerVis); fn.loop_variable = newLoopVar; var endtemp = new ident(newNames.VarEndName); //new ident(newVarName()); //var ass1 = new var_statement(fn.loop_variable, fn.type_name, fn.initial_value); var ass1 = new var_statement(fn.loop_variable, fn.type_name, fn.initial_value); //var ass2 = new var_statement(endtemp, fn.type_name, fn.finish_value); var if0 = new if_node((fn.cycle_type == for_cycle_type.to) ? bin_expr.Greater(fn.loop_variable, fn.finish_value) : bin_expr.Less(fn.loop_variable, fn.finish_value), gt1); var lb2 = new labeled_statement(gt2.label, if0); var lb1 = new labeled_statement(gt1.label); var Inc = new procedure_call(new method_call((fn.cycle_type == for_cycle_type.to) ? new ident("Inc") : new ident("Dec"), new expression_list(fn.loop_variable))); ReplaceStatement(fn, SeqStatements(ass1, /*ass2,*/ lb2, fn.statements, Inc, gt2, lb1)); // в declarations ближайшего блока добавить описание labels block bl = listNodes.FindLast(x => x is block) as block; bl.defs.Add(new label_definitions(gt1.label, gt2.label)); }
public override void visit(procedure_call _procedure_call) { prepare_node(_procedure_call.func_name,"func_name"); }
public void write_procedure_call(procedure_call _procedure_call) { write_statement(_procedure_call); if (_procedure_call.func_name == null) { bw.Write((byte)0); } else { bw.Write((byte)1); _procedure_call.func_name.visit(this); } }
public override void visit(procedure_call _procedure_call) { }