public while_node NewWhileStmt(token_info tkWhile, expression expr, token_info opt_tk_do, statement stmt, LexLocation loc) { var nws = new while_node(expr, stmt, WhileCycleType.While, loc); if (opt_tk_do == null) { file_position fp = expr.source_context.end_position; syntax_tree_node err_stn = stmt; if (err_stn == null) { err_stn = expr; } 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(nws); }
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); }
public static procedure_definition BuildShortProcFuncDefinitionNoSC(procedure_header header, statement st) { var stlist = new statement_list(st, st.source_context); var b = new block(null, stlist, st.source_context); return(new procedure_definition(header, b, true, BuildGenSC)); }
virtual public void statement(statement ast, int indent) { statement(ast, indent, true); }
public override void visit(statement _statement) { DefaultVisit(_statement); pre_do_visit(_statement); post_do_visit(_statement); }
/// <summary> /// Создать условный оператор /// </summary> /// <param name="condition">Условие</param> /// <param name="thenBody">Тело, выполняемое если условие истино</param> /// <param name="elseBody">Тело, выполняемое если условие ложно</param> /// <returns></returns> public SyntaxTree.if_node CreateIf(expression condition, statement thenBody, statement elseBody) { return(CreateIfElse(condition, thenBody, elseBody)); }
public virtual void statement(statement ast) { if (ast is block_statement) { block_statement((block_statement)ast); } else if (ast is break_statement) { break_statement((break_statement)ast); } else if (ast is checked_statement) { statement(((checked_statement)ast).stmt); } else if (ast is const_statement) { const_statement((const_statement)ast); } else if (ast is continue_statement) { break_statement((break_statement)ast); } else if (ast is do_statement) { do_statement((do_statement)ast); } else if (ast is empty_statement) { ; } else if (ast is expression_statement) { expression_statement((expression_statement)ast); } else if (ast is fixed_statement) { fixed_statement((fixed_statement)ast); } else if (ast is for_statement) { for_statement((for_statement)ast); } else if (ast is foreach_statement) { foreach_statement((foreach_statement)ast); } else if (ast is goto_case_statement) { goto_case_statement((goto_case_statement)ast); } else if (ast is goto_default_statement) { goto_default_statement((goto_default_statement)ast); } else if (ast is goto_statement) { goto_statement((goto_statement)ast); } else if (ast is if_statement) { if_statement((if_statement)ast); } else if (ast is labeled_statement) { statement(((labeled_statement)ast).stmt); } else if (ast is local_statement) { local_statement((local_statement)ast); } else if (ast is lock_statement) { lock_statement((lock_statement)ast); } else if (ast is return_statement) { return_statement((return_statement)ast); } else if (ast is switch_statement) { switch_statement((switch_statement)ast); } else if (ast is throw_statement) { throw_statement((throw_statement)ast); } else if (ast is try_statement) { try_statement((try_statement)ast); } else if (ast is unchecked_statement) { statement(((unchecked_statement)ast).stmt); } else if (ast is unsafe_statement) { statement(((unsafe_statement)ast).block); } else if (ast is using_statement) { using_statement((using_statement)ast); } else if (ast is while_statement) { while_statement((while_statement)ast); } else { throw new ArgumentException(); } }
public virtual void visit(statement _statement) { DefaultVisit(_statement); }
/// <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); }
private SyntaxTree.if_node CreateIfElse(expression condition, statement thenBody, statement elseBody) { SyntaxTree.if_node res = new SyntaxTree.if_node(); res.condition = condition; res.then_body = thenBody; res.else_body = elseBody; return(res); }
public procedure_definition CreateFunctionDefinitionNode(string methName, formal_parameters formalPars, bool classKeyword, statement procBody, type_definition returnType) { return(InternalCreateFunctionDefinitionNode(methName, formalPars, classKeyword, procBody, returnType, null)); }
private procedure_definition InternalCreateFunctionDefinitionNode(string methName, formal_parameters formalPars, bool classKeyword, statement procBody, type_definition returnType, SourceContext sc) { return(LambdaHelper.SyntaxTreeNodesConstructor.CreateFunctionDefinitionNode(new method_name(methName), formalPars, false, classKeyword, procBody, returnType, sc)); }
public procedure_definition CreateProcedureDefinitionNode(string methName, formal_parameters formalPars, bool classKeyword, statement procBody, SourceContext sc) { return(InternalCreateProcedureDefinitionNode(methName, formalPars, classKeyword, procBody, sc)); }
public bool DeleteInStatementList(statement st) { var stl = UpperNodeAs <statement_list>(); return(stl.Remove(st)); }
public override void visit(statement _statement) { executer.visit(_statement); if (_statement.attributes != null) this.visit((dynamic)_statement.attributes); }
public static procedure_definition CreateFunctionDefinitionNode(method_name methName, formal_parameters formalPars, bool ofObject, bool classKeyword, statement procBody, type_definition returnType, SourceContext sc) { procedure_definition procDef = new procedure_definition(); function_header procHeader = new function_header(); procHeader.name = methName; procHeader.source_context = sc; if (procHeader.name.meth_name is template_type_name) { procHeader.template_args = (procHeader.name.meth_name as template_type_name).template_args; ident id = new ident(procHeader.name.meth_name.name); procHeader.name.meth_name = id; } procHeader.parameters = formalPars; procHeader.of_object = ofObject; procHeader.class_keyword = classKeyword; procHeader.return_type = returnType; statement_list stmtList = new statement_list(); stmtList.subnodes.Add(procBody); block bl = new block(null, null); bl.program_code = stmtList; procDef.proc_header = procHeader; procDef.proc_body = (proc_block)bl; return(procDef); }
public virtual void visit(statement _statement) { }
public static procedure_definition BuildShortProcDefinition(formal_parameters fp, procedure_attributes_list att, method_name name, statement st, where_definition_list wdl, SourceContext headsc) { var ff = new procedure_header(fp, att, name, wdl, headsc); return(BuildShortProcFuncDefinition(ff, st)); }
public virtual void post_do_visit(statement _statement) { }