public for_node NewForStmt(bool opt_var, ident identifier, type_definition for_stmt_decl_or_assign,
                                       expression expr1, for_cycle_type fc_type, expression expr2, token_info opt_tk_do, statement stmt,
                                       LexLocation loc)
            {
                var nfs = new for_node(identifier, expr1, expr2, stmt, fc_type, null, for_stmt_decl_or_assign,
                                       opt_var != false, loc);

                if (opt_tk_do == null)
                {
                    file_position    fp      = expr2.source_context.end_position;
                    syntax_tree_node err_stn = stmt;
                    if (err_stn == null)
                    {
                        err_stn = expr2;
                    }
                    parsertools.errors.Add(new PABCNETUnexpectedToken(parsertools.CurrentFileName,
                                                                      StringResources.Get("TKDO"),
                                                                      new SourceContext(fp.line_num, fp.column_num + 1, fp.line_num, fp.column_num + 1, 0, 0),
                                                                      err_stn));
                }

                if (!opt_var && for_stmt_decl_or_assign == null)
                {
                    parsertools.AddWarningFromResource("USING_UNLOCAL_FOR_VARIABLE", identifier.source_context);
                }
                return(nfs);
            }
Example #2
0
 /// <summary>
 /// Создать цикл for
 /// </summary>
 /// <param name="varName">Имя переменной цикла</param>
 /// <param name="initValue">Начальное значение переменной цикла</param>
 /// <param name="finishValue">Конечное значение переменной цикла</param>
 /// <param name="body">Тело цикла</param>
 /// <param name="type">Тип цикла(to / downto)</param>
 /// <returns></returns>
 public SyntaxTree.for_node CreateFor(string varName, expression initValue, expression finishValue, statement body, for_cycle_type type)
 {
     SyntaxTree.for_node res = new SyntaxTree.for_node();
     res.loop_variable = new ident(varName);
     res.initial_value = initValue;
     res.finish_value = finishValue;
     res.statements = body;
     res.cycle_type = type;
     return res;
 }
Example #3
0
 public for_node NewForStmt(bool opt_var, ident identifier, type_definition for_stmt_decl_or_assign, expression expr1, for_cycle_type fc_type, expression expr2, token_info opt_tk_do, statement stmt, LexLocation loc)
 {
     var nfs = new for_node(identifier, expr1, expr2, stmt, fc_type, null, for_stmt_decl_or_assign, opt_var != false, loc); 
     if (opt_tk_do == null)
     {
         file_position fp = expr2.source_context.end_position;
         syntax_tree_node err_stn = stmt;
         if (err_stn == null)
             err_stn = expr2;
         parsertools.errors.Add(new PABCNETUnexpectedToken(parsertools.CurrentFileName, StringResources.Get("TKDO"), new SourceContext(fp.line_num, fp.column_num + 1, fp.line_num, fp.column_num + 1, 0, 0), err_stn));
     }
     return nfs;
 }
 /// <summary>
 /// Создать цикл for
 /// </summary>
 /// <param name="varName">Имя переменной цикла</param>
 /// <param name="initValue">Начальное значение переменной цикла</param>
 /// <param name="finishValue">Конечное значение переменной цикла</param>
 /// <param name="body">Тело цикла</param>
 /// <param name="type">Тип цикла(to / downto)</param>
 /// <returns></returns>
 public static SyntaxTree.for_node CreateFor(string varName, expression initValue, expression finishValue, statement body, for_cycle_type type)
 {
     SyntaxTree.for_node res = new SyntaxTree.for_node();
     res.loop_variable = new ident(varName);
     res.initial_value = initValue;
     res.finish_value  = finishValue;
     res.statements    = body;
     res.cycle_type    = type;
     return(res);
 }
Example #5
0
		///<summary>
		///Конструктор с параметрами.
		///</summary>
		public for_node(ident _loop_variable,expression _initial_value,expression _finish_value,statement _statements,for_cycle_type _cycle_type,expression _increment_value,type_definition _type_name,bool _create_loop_variable,SourceContext sc)
		{
			this._loop_variable=_loop_variable;
			this._initial_value=_initial_value;
			this._finish_value=_finish_value;
			this._statements=_statements;
			this._cycle_type=_cycle_type;
			this._increment_value=_increment_value;
			this._type_name=_type_name;
			this._create_loop_variable=_create_loop_variable;
			source_context = sc;
		}