/*public class_definition NewRecordType(named_type_reference_list opt_base_classes, where_definition_list opt_where_section, class_body_list component_list_seq, LexLocation loc) * { * var nnrt = new class_definition(opt_base_classes, component_list_seq, class_keyword.Record, null, opt_where_section, class_attribute.None, false, loc); * if (nnrt.body!=null && nnrt.body.class_def_blocks!=null && * nnrt.body.class_def_blocks.Count>0 && nnrt.body.class_def_blocks[0].access_mod==null) * { * nnrt.body.class_def_blocks[0].access_mod = new access_modifer_node(access_modifer.public_modifer); * } * return nnrt; * } */ public token_info NewClassOrInterfaceKeyword(token_info tktemp) { var ncoik = tktemp; ncoik.text = "c"; return(ncoik); }
public virtual token_info create_token_info(string text, LexLocation loc) { token_info ti = new token_info(text); ti.source_context = GetTokenSourceContext(loc); return(ti); }
public token_info NewClassOrInterfaceKeyword(token_info tktemp, string text, LexLocation loc) { var ncoik = tktemp; ncoik.text = text; ncoik.source_context = loc; return(ncoik); }
public procedure_definition lambda(function_lambda_definition _function_lambda_definition) { procedure_definition _func_def = new procedure_definition(); method_name _method_name1 = new method_name(null, null, new ident(_function_lambda_definition.lambda_name), null); //parsertools.create_source_context(_method_name1, _method_name1.meth_name, _method_name1.meth_name); function_header _function_header1 = new function_header(); object rt1 = new object(); _function_header1.name = _method_name1; if (_function_header1.name.meth_name is template_type_name) { _function_header1.template_args = (_function_header1.name.meth_name as template_type_name).template_args; ident id = new ident(_function_header1.name.meth_name.name); //parsertools.create_source_context(id, _function_header1.name.meth_name, _function_header1.name.meth_name); _function_header1.name.meth_name = id; } formal_parameters fps = new PascalABCCompiler.SyntaxTree.formal_parameters(); _function_header1.parameters = _function_lambda_definition.formal_parameters;//fps; /*SyntaxTree.named_type_reference _named_type_reference = new SyntaxTree.named_type_reference(); * SyntaxTree.ident idtype = new SyntaxTree.ident("object"); * _named_type_reference.source_context = idtype.source_context; * _named_type_reference.names.Add(idtype); * rt1 = _named_type_reference; * _function_header1.return_type = (SyntaxTree.type_definition)_named_type_reference;*/ _function_header1.return_type = _function_lambda_definition.return_type; _function_header1.of_object = false; _function_header1.class_keyword = false; token_info _token_info = new token_info("function"); //_token_info.source_context = parsertools.GetTokenSourceContext(); //parsertools.create_source_context(_function_header1, _token_info, _token_info); block _block1 = new block(null, null); statement_list sl1 = new statement_list(); sl1.subnodes.Add(_function_lambda_definition.proc_body); _block1.program_code = sl1; _func_def.proc_header = _function_header1; _func_def.proc_body = (proc_block)_block1; if (_function_lambda_definition.defs != null) { if (((block)_func_def.proc_body).defs == null) { ((block)_func_def.proc_body).defs = new declarations(); } for (int l = 0; l < _function_lambda_definition.defs.Count; l++) { ((block)_func_def.proc_body).defs.defs.Add(_function_lambda_definition.defs[l] as procedure_definition); } } _function_lambda_definition.proc_definition = _func_def; //parsertools.create_source_context(_func_def, _function_header1, _function_header1); return(_func_def); }
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 class_definition NewObjectType(class_attribute class_attributes, token_info class_or_interface_keyword, named_type_reference_list opt_base_classes, where_definition_list opt_where_section, class_body_list opt_not_component_list_seq_end, LexLocation loc) { var nnof = new class_definition(opt_base_classes, opt_not_component_list_seq_end, class_keyword.Class, null, opt_where_section, class_attribute.None, false, loc); string kw = class_or_interface_keyword.text.ToLower(); nnof.attribute = class_attributes; if (kw == "record") { nnof.keyword = class_keyword.Record; } else if (kw == "interface") { nnof.keyword = class_keyword.Interface; } else if (kw == "i") { nnof.keyword = class_keyword.TemplateInterface; } else if (kw == "r") { nnof.keyword = class_keyword.TemplateRecord; } else if (kw == "c") { nnof.keyword = class_keyword.TemplateClass; } if (nnof.body != null && ((class_definition)nnof).body.class_def_blocks != null && ((class_definition)nnof).body.class_def_blocks.Count > 0 && ((class_definition)nnof).body.class_def_blocks[0].access_mod == null) { if (nnof.keyword == class_keyword.Class) { nnof.body.class_def_blocks[0].access_mod = new access_modifer_node(access_modifer.internal_modifer); } else { nnof.body.class_def_blocks[0].access_mod = new access_modifer_node(access_modifer.none); } } return(nnof); }
public override void visit(token_info _token_info) { DefaultVisit(_token_info); pre_do_visit(_token_info); post_do_visit(_token_info); }
public override void visit(token_info _token_info) { }
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 virtual void visit(token_info _token_info) { }
public virtual void visit(token_info _token_info) { DefaultVisit(_token_info); }
public virtual void visit(token_info _token_info) { DefaultVisit(_token_info); }
public override void visit(token_info _token_info) { text = string.Format("text: '{0}'", _token_info.text); }
public virtual void pre_do_visit(token_info _token_info) { }
public override void visit(token_info _token_info) { executer.visit(_token_info); }
public virtual void visit(token_info _token_info) { }
public override void visit(token_info _token_info) { throw new NotImplementedException(); }
public override void visit(token_info n) { fs.WriteLine(n.text); }