query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Generate a const table
def gen_const_table file_content table = {} @content.scan(%r{ ((?>^\s*/\*.*?\*/\s+)) rb_define_(\w+)\((?:\s*(?:\w+),)?\s* "(\w+)"\s*, .*?\)\s*; | Document-(?:const|global|variable):\s ((?:\w+::)*\w+) \s*?\n((?>.*?\*/)) }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constants_table; end", "def make_const(prop, data, name)\n if name.empty?\n puts \"\\n/* '#{prop}' */\"\n else\n puts \"\\n/* '#{prop}': #{name} */\"\n end\n if origprop = $const_cache.key(data)\n puts \"#define CR_#{prop} CR_#{origprop}\"\n else\n $const_cache[prop] = data\n pairs = pair...
[ "0.74932253", "0.64316005", "0.60967916", "0.6081231", "0.6068655", "0.5947871", "0.5914613", "0.58930993", "0.5841916", "0.5745132", "0.5716589", "0.57129186", "0.5707312", "0.57018596", "0.569794", "0.56363666", "0.5603203", "0.5603203", "0.5603203", "0.5603203", "0.5591328...
0.71454924
1
Finds a comment matching +type+ and +const_name+ either above the comment or in the matching Document section.
def find_const_comment(type, const_name, class_name = nil) @const_table ||= {} @const_table[@content] ||= gen_const_table @content table = @const_table[@content] comment = table[[type, const_name]] || (class_name && table[class_name + "::" + const_name]) || table[const_name] || ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup_comment\n lookup_general(Comment)\n end", "def handle_constants(type, var_name, const_name, definition)\n class_name = @known_classes[var_name]\n\n return unless class_name\n\n class_obj = find_class var_name, class_name\n\n unless class_obj then\n @options.warn 'Enclosing class o...
[ "0.6506173", "0.5911765", "0.57144845", "0.5706579", "0.5570783", "0.5568508", "0.5531993", "0.5524385", "0.5486085", "0.5480465", "0.5446421", "0.5427813", "0.5340925", "0.52374494", "0.5227844", "0.5204522", "0.51414514", "0.5129032", "0.5114891", "0.51080614", "0.508936", ...
0.7942557
0
Handles modifiers in +comment+ and updates +meth_obj+ as appropriate.
def find_modifiers comment, meth_obj comment.normalize comment.extract_call_seq meth_obj look_for_directives_in meth_obj, comment end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_modifiers(comment, meth_obj)\n if comment.sub!(/:nodoc:\\s*^\\s*\\*?\\s*$/m, '') or\n comment.sub!(/\\A\\/\\*\\s*:nodoc:\\s*\\*\\/\\Z/, '')\n meth_obj.document_self = false\n end\n if comment.sub!(/call-seq:(.*?)^\\s*\\*?\\s*$/m, '') or\n comment.sub!(/\\A\\/\\*\\s*ca...
[ "0.71303815", "0.61820865", "0.5401606", "0.5384905", "0.53515106", "0.5274381", "0.5237648", "0.5208794", "0.51427716", "0.5104611", "0.50995904", "0.50895995", "0.50606984", "0.505675", "0.5037081", "0.5037081", "0.5037081", "0.5037081", "0.5037081", "0.5037081", "0.5037081...
0.6897252
1
Finds a Documentmethod override for +meth_obj+ on +class_name+
def find_override_comment class_name, meth_obj name = Regexp.escape meth_obj.name prefix = Regexp.escape meth_obj.name_prefix comment = if @content =~ %r%Document-method: \s+#{class_name}#{prefix}#{name} \s*?\n((?>.*?\*/))%xm then ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_class_method_named(name)\n @method_list.find { |meth| meth.singleton && meth.name == name }\n end", "def def_finder_method(mod, meth, type)\n # SEQUEL5: Remove\n mod.send(:define_method, meth){|*args, &block| finder_for(meth).send(type, *args, &block)}\n end", "def method_missin...
[ "0.6304432", "0.63014853", "0.62502223", "0.6154294", "0.6116545", "0.607798", "0.6052024", "0.60217535", "0.5999168", "0.59435034", "0.58690625", "0.5847818", "0.5847818", "0.58205694", "0.5812479", "0.58071697", "0.58066386", "0.5803314", "0.57976025", "0.57604355", "0.5749...
0.6959186
0
Creates a new RDoc::Attr +attr_name+ on class +var_name+ that is either +read+, +write+ or both
def handle_attr(var_name, attr_name, read, write) rw = '' rw += 'R' if '1' == read rw += 'W' if '1' == write class_name = @known_classes[var_name] return unless class_name class_obj = find_class var_name, class_name return unless class_obj comment = find_attr_comment var_name, attr_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_attr( name , ro = false)\n unless ro\n create_method( \"#{name}=\".to_sym ) { |val| \n instance_variable_set( \"@\" + name, val)\n }\n end\n\n create_method( name.to_sym ) { \n instance_variable_get( \"@\" + name )\n }\n end", "def find_attr_comment...
[ "0.73709965", "0.66132706", "0.66130245", "0.62781847", "0.60982144", "0.6050836", "0.5996356", "0.598724", "0.59769017", "0.5951394", "0.5949554", "0.59410495", "0.5909596", "0.5893285", "0.5841954", "0.5833875", "0.5804347", "0.58005375", "0.5781013", "0.5775328", "0.575608...
0.7819094
0
Creates a new RDoc::NormalClass or RDoc::NormalModule based on +type+ named +class_name+ in +parent+ which was assigned to the C +var_name+.
def handle_class_module(var_name, type, class_name, parent, in_module) parent_name = @known_classes[parent] || parent if in_module then enclosure = @classes[in_module] || @store.find_c_enclosure(in_module) if enclosure.nil? and enclosure = @known_classes[in_module] then enc_type = /^rb_m/ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(type, parent, lineno: nil, filename: nil)\n klass = registered_types[type]\n\n raise ::KeyError, \"Undefined node type #{type.inspect}\" if klass.nil?\n\n klass.new(type, parent, lineno: lineno, filename: filename)\n end", "def create_class(name, parent: Object, &bloc...
[ "0.6533963", "0.6499815", "0.62570345", "0.6147424", "0.6112326", "0.60554796", "0.60509723", "0.59156865", "0.58377486", "0.57313913", "0.56742996", "0.5645806", "0.56343645", "0.56343645", "0.55440706", "0.5495189", "0.54340255", "0.5424126", "0.53979", "0.5378245", "0.5340...
0.6708436
0
Adds constants. By providing some_value: at the start of the comment you can override the C value of the comment to give a friendly definition. / 300: The perfect score in bowling rb_define_const(cFoo, "PERFECT", INT2FIX(300)); Will override INT2FIX(300) with the value +300+ in the output RDoc. Values may include quote...
def handle_constants(type, var_name, const_name, definition) class_name = @known_classes[var_name] return unless class_name class_obj = find_class var_name, class_name unless class_obj then @options.warn 'Enclosing class or module %p is not known' % [const_name] return end commen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_constant constant\n return constant unless @document_self\n\n # HACK: avoid duplicate 'PI' & 'E' in math.c (1.8.7 source code)\n # (this is a #ifdef: should be handled by the C parser)\n known = @constants_hash[constant.name]\n\n if known then\n known.comment = constant.comment if known...
[ "0.66469806", "0.6027877", "0.579831", "0.5756918", "0.56349486", "0.5621613", "0.5612918", "0.55889183", "0.55647755", "0.55594796", "0.54946923", "0.54932916", "0.5439619", "0.5429148", "0.53247356", "0.53033227", "0.52818924", "0.5280254", "0.52362126", "0.52161103", "0.51...
0.64131236
1
Removes ifdefs that would otherwise confuse us
def handle_ifdefs_in(body) body.gsub(/^#ifdef HAVE_PROTOTYPES.*?#else.*?\n(.*?)#endif.*?\n/m, '\1') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fremover(fname, sname)\n if fexistrx fname, sname\n if eval \"$#{fname}['#{sname},facets'].include? 'ifremover'\"\n eval \"eval $#{fname}['#{sname},ifremover']\"\n end\n eval \"${fname}.delete('#{sname},ref')\"\n eval \"${fname}['#{sname},facets'].delete('ref')\"\n return true\n else\n ...
[ "0.6248675", "0.59211195", "0.5673764", "0.5610609", "0.5515402", "0.55146784", "0.5491707", "0.5428487", "0.54244095", "0.5418769", "0.5343474", "0.5338421", "0.532939", "0.5307105", "0.52198875", "0.52187866", "0.51739013", "0.5172147", "0.5145389", "0.5143451", "0.511944",...
0.5370013
10
Adds an RDoc::AnyMethod +meth_name+ defined on a class or module assigned to +var_name+. +type+ is the type of method definition function used. +singleton_method+ and +module_function+ create a singleton method.
def handle_method(type, var_name, meth_name, function, param_count, source_file = nil) class_name = @known_classes[var_name] singleton = @singleton_classes.key? var_name @methods[var_name][function] << meth_name return unless class_name class_obj = find_class var_name, class_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_method method\n return method unless @document_self\n\n # HACK: avoid duplicate 'new' in io.c & struct.c (1.8.7 source code)\n key = method.pretty_name\n known = @methods_hash[key]\n\n if known then\n if @store then # otherwise we are loading\n known.comment = method.comment if k...
[ "0.5665209", "0.5586359", "0.53914386", "0.53514755", "0.5269347", "0.5250941", "0.5243214", "0.52247065", "0.5198394", "0.51886284", "0.5186002", "0.5169629", "0.5156895", "0.5153444", "0.5128596", "0.5111714", "0.506577", "0.5063124", "0.50457746", "0.5033719", "0.50264835"...
0.6690124
0
Registers a singleton class +sclass_var+ as a singleton of +class_var+
def handle_singleton sclass_var, class_var class_name = @known_classes[class_var] @known_classes[sclass_var] = class_name @singleton_classes[sclass_var] = class_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(as_type, klass, constuctor_args = {})\n fail \"Registry key #{as_type} already taken - please use a different one because all subclass keys are shared\" if @@class_registry.key?(as_type.to_sym)\n @@class_registry[as_type.to_sym] = { klass: klass, args: constuctor_args }\nend", "def register_instan...
[ "0.675332", "0.664784", "0.6517434", "0.6353443", "0.6208425", "0.6074685", "0.5947813", "0.58806044", "0.582923", "0.57818145", "0.5778223", "0.57519513", "0.574561", "0.57347673", "0.57220554", "0.57143867", "0.5658857", "0.56583667", "0.5626152", "0.56062603", "0.55970365"...
0.791638
0
Normalizes tabs in +body+
def handle_tab_width(body) if /\t/ =~ body tab_width = @options.tab_width body.split(/\n/).map do |line| 1 while line.gsub!(/\t+/) do ' ' * (tab_width * $&.length - $`.length % tab_width) end && $~ line end.join "\n" else body end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_tab(tab)\n format_tab(parse_tabs(tab)[0])\nend", "def delete_tabs\n end", "def update_tabs\n return unless @handles\n handles.items = tabs.map { |item| { id: item[:tab_id], title: item[:tab_title] } }.uniq\n return if handles.selected || handles.children.empty?\n handles.sel...
[ "0.6366245", "0.60397875", "0.57563245", "0.57401055", "0.56575954", "0.5643598", "0.5642493", "0.5597408", "0.5585712", "0.5566386", "0.55050546", "0.54943854", "0.5487905", "0.54726934", "0.5457124", "0.5441386", "0.54385364", "0.538701", "0.5384314", "0.53044254", "0.53008...
0.6432211
0
Loads the variable map with the given +name+ from the RDoc::Store, if present.
def load_variable_map map_name return {} unless files = @store.cache[map_name] return {} unless name_map = files[@file_name] class_map = {} name_map.each do |variable, name| next unless mod = @store.find_class_or_module(name) class_map[variable] = if map_name == :c_class_variables then ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(name); end", "def load(name, env = default_environment)\n # This block autoloads appropriate file each time a missing macro is\n # requested from hash.\n path = name.split('::').join('/')\n load_from_file(name, path, env)\n end", "def read(name)\n @memonized ||= {}\n @...
[ "0.6392049", "0.6375972", "0.6095665", "0.5870908", "0.569042", "0.5632186", "0.5598127", "0.559211", "0.5574016", "0.5549888", "0.5531416", "0.54934907", "0.5468455", "0.54386", "0.5433754", "0.5400241", "0.5374772", "0.53645015", "0.5356174", "0.53368896", "0.53305143", "...
0.66063356
0
Look for directives in a normal comment block: / :title: My Awesome Project This method modifies the +comment+
def look_for_directives_in context, comment @preprocess.handle comment, context do |directive, param| case directive when 'main' then @options.main_page = param '' when 'title' then @options.default_title = param if @options.respond_to? :default_title= '' end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def look_for_directives_in container, comment\n @preprocess.handle comment, container do |directive, param|\n case directive\n when 'method', 'singleton-method',\n 'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then\n false # handled elsewhere\n when 'section' then\n ...
[ "0.6743804", "0.6682694", "0.65690404", "0.6558076", "0.6558076", "0.6558076", "0.6558076", "0.6540796", "0.64760715", "0.6416021", "0.6416021", "0.6416021", "0.6416021", "0.639193", "0.6322291", "0.62906086", "0.62906086", "0.62906086", "0.62906086", "0.62906086", "0.6290608...
0.71623397
0
Extracts parameters from the +method_body+ and returns a method parameter string. Follows 1.9.3dev's scanargspec, see README.EXT
def rb_scan_args method_body method_body =~ /rb_scan_args\((.*?)\)/m return '(*args)' unless $1 $1.split(/,/)[2] =~ /"(.*?)"/ # format argument format = $1.split(//) lead = opt = trail = 0 if format.first =~ /\d/ then lead = $&.to_i format.shift if format.first =~ /\d/ then ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_method_parameters method\n res = parse_method_or_yield_parameters method\n\n res = \"(#{res})\" unless res =~ /\\A\\(/\n method.params = res unless method.params\n\n return if method.block_params\n\n skip_tkspace_without_nl\n read_documentation_modifiers method, RDoc::METHOD_MODIFIERS\...
[ "0.71618676", "0.68246007", "0.63913727", "0.6227753", "0.62231886", "0.61931264", "0.6156769", "0.6065443", "0.598895", "0.5903911", "0.57701427", "0.5742503", "0.5710703", "0.56780905", "0.5657447", "0.56381595", "0.5618641", "0.55940557", "0.5575933", "0.5551875", "0.55504...
0.6962336
1
Removes lines that are commented out that might otherwise get picked up when scanning for classes and methods
def remove_commented_out_lines @content = @content.gsub(%r%//.*rb_define_%, '//') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def without_comment_markers(text)\n text.to_s.lines.map do |line|\n line.strip.gsub(/^(\\s*(\\/\\*+|\\/\\/|\\*+\\/|\\*)+\\s?)/m, '')\n end.join(\"\\n\").strip\n end", "def remove_commented_out_lines\n @body.gsub!(%r{//.*rb_define_}, '//')\n end", "def...
[ "0.7377322", "0.72988325", "0.7230099", "0.7187225", "0.71092135", "0.7108943", "0.70779085", "0.6851336", "0.6837101", "0.68002117", "0.6798213", "0.6736803", "0.67065316", "0.66862744", "0.6523202", "0.6515975", "0.65152556", "0.65031546", "0.64819723", "0.64437956", "0.644...
0.7664573
0
Extracts the classes, modules, methods, attributes, constants and aliases from a C file and returns an RDoc::TopLevel for this file
def scan remove_commented_out_lines do_classes_and_modules do_missing do_constants do_methods do_includes do_aliases do_attrs @store.add_c_variables self @top_level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file filename\n encoding = @options.encoding\n filename = filename.encode encoding\n\n @stats.add_file filename\n\n return if RDoc::Parser.binary? filename\n\n content = RDoc::Encoding.read_file filename, encoding\n\n return unless content\n\n filename_path = Pathname(filename).expan...
[ "0.5585037", "0.5475439", "0.5466074", "0.54367965", "0.536601", "0.5358013", "0.5323153", "0.53202105", "0.5279821", "0.52793586", "0.52555704", "0.5165224", "0.5155533", "0.511676", "0.5105719", "0.50805116", "0.5078207", "0.50711906", "0.50361943", "0.50176316", "0.5011108...
0.54799706
1
Creates a new Ruby parser.
def initialize(top_level, file_name, content, options, stats) super if /\t/ =~ content then tab_width = @options.tab_width content = content.split(/\n/).map do |line| 1 while line.gsub!(/\t+/) { ' ' * (tab_width*$&.length - $`.length % tab_width) } && $~ line ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby_parser\n @ruby_parser ||= parser_for_version ruby_version\n end", "def parser( &block )\n nested_class( 'Parser', Yacl::Define::Cli::Parser, &block )\n end", "def build_parser\n code = ''\n\n %w[opal/ruby/nodes opal/ruby/parser opal/ruby/ruby_parser].each do |src|\n ...
[ "0.72392833", "0.6732056", "0.66550815", "0.6561602", "0.64493173", "0.64493173", "0.6401928", "0.6401928", "0.6327902", "0.63190365", "0.6293566", "0.6275481", "0.6147237", "0.60630697", "0.60513407", "0.59610695", "0.5906517", "0.58943623", "0.58921677", "0.5887894", "0.588...
0.0
-1
Retrieves the read token stream and replaces +pattern+ with +replacement+ using gsub. If the result is only a ";" returns an empty string.
def get_tkread_clean pattern, replacement # :nodoc: read = get_tkread.gsub(pattern, replacement).strip return '' if read == ';' read end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_tokenize(pattern)\n PatternTokenizer.new(data_reader, full_tokenizer).tokenize(pattern)\n end", "def gsub(pattern, replace)\n lambda do |rec, acc|\n acc.collect! { |v| v.gsub(pattern, replace) }\n end\n end", "def rsub(pattern, replacement)\n if i = rinde...
[ "0.57301223", "0.55218077", "0.5469206", "0.5451378", "0.54479545", "0.54479545", "0.5216834", "0.5215447", "0.5206331", "0.5090026", "0.5078724", "0.5078724", "0.4965998", "0.49345377", "0.49316567", "0.4914904", "0.48814526", "0.48630327", "0.48506236", "0.48154765", "0.481...
0.6991671
0
Extracts the visibility information for the visibility token +tk+ and +single+ class type identifier. Returns the visibility type (a string), the visibility (a symbol) and +singleton+ if the methods following should be converted to singleton methods.
def get_visibility_information tk, single # :nodoc: vis_type = tk[:text] singleton = single == SINGLE vis = case vis_type when 'private' then :private when 'protected' then :protected when 'public' then :public when 'private_class_method' then singleton = true ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_visibility(container, single, tk)\n vis_type, vis, singleton = get_visibility_information tk, single\n\n skip_tkspace_comment false\n\n ptk = peek_tk\n # Ryan Davis suggested the extension to ignore modifiers, because he\n # often writes\n #\n # protected unless $TESTING\n #\n ...
[ "0.73448527", "0.6498404", "0.576168", "0.5502199", "0.54804635", "0.54431736", "0.5355091", "0.5251596", "0.5241176", "0.5241176", "0.52309376", "0.52309376", "0.51752067", "0.5172724", "0.51583266", "0.51442564", "0.51442564", "0.50423944", "0.50311875", "0.5015701", "0.498...
0.846342
0
Look for the first comment in a file that isn't a shebang line.
def collect_first_comment skip_tkspace comment = ''.dup comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding first_line = true first_comment_tk_kind = nil line_no = nil tk = get_tk while tk && (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) comment_body ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_comment?(line)\n line =~ /^\\s*#/\n end", "def strip_comments(line)\n if line.include?('#')\n line.split(\"#\", 2)[0]\n else\n line\n end\n end", "def is_comment?(line)\n true if line =~ /^\\#.*$/\n end", "def ignore_comment\n\traise 'Expected #' if gets[ 0 ] != '#'...
[ "0.65237117", "0.6450984", "0.6427392", "0.6289673", "0.6239734", "0.62018263", "0.60657465", "0.6047484", "0.60309464", "0.60238504", "0.6009673", "0.58454144", "0.58250564", "0.5824391", "0.5808794", "0.5807183", "0.57459605", "0.5732136", "0.5727074", "0.5714801", "0.57064...
0.6232415
5
Consumes trailing whitespace from the token stream
def consume_trailing_spaces # :nodoc: skip_tkspace_without_nl end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consume_whitespace(input)\n while /\\s/ =~ input.look_ahead do\n input.consume\n end\n end", "def consume!\n empty_line ||\n name_token ||\n comment_token ||\n whitespace_token ||\n line_token ||\n heredoc_token ||\n string_token ...
[ "0.6522796", "0.64408904", "0.6435621", "0.6319579", "0.6229622", "0.61653006", "0.60958725", "0.6078429", "0.6047994", "0.60386986", "0.60190594", "0.60164076", "0.5920181", "0.59066993", "0.5894016", "0.5887166", "0.58723724", "0.5842783", "0.584238", "0.5796459", "0.579355...
0.6654712
0
Creates a new attribute in +container+ with +name+.
def create_attr container, single, name, rw, comment # :nodoc: att = RDoc::Attr.new get_tkread, name, rw, comment, single == SINGLE record_location att container.add_attribute att @stats.add_attribute att att end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_attribute(name, type)\n attributes[name] = type\n define_attr_reader(name)\n define_attr_writer(name, type)\n name\n end", "def createAttribute(name)\n ret = Attr.new(name)\n ret.ownerDocument = self\n ret\n end", "def setAttrib(name,value)\n\t\t@attribu...
[ "0.7099514", "0.7063513", "0.6672722", "0.666569", "0.66382694", "0.6617557", "0.6530502", "0.6505383", "0.6493476", "0.6452982", "0.6449649", "0.6368778", "0.6363584", "0.6363584", "0.6363584", "0.6345438", "0.63322014", "0.63319176", "0.6331066", "0.63087744", "0.62679076",...
0.66351855
5
Creates a module alias in +container+ at +rhs_name+ (or at the toplevel for "::") with the name from +constant+.
def create_module_alias container, constant, rhs_name # :nodoc: mod = if rhs_name =~ /^::/ then @store.find_class_or_module rhs_name else container.find_module_named rhs_name end container.add_module_alias mod, rhs_name, constant, @top_level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_module_alias from, from_name, to, file\n return from if @done_documenting\n\n to_full_name = child_name to.name\n\n # if we already know this name, don't register an alias:\n # see the metaprogramming in lib/active_support/basic_object.rb,\n # where we already know BasicObject is a class whe...
[ "0.5911489", "0.53923243", "0.5369851", "0.53243273", "0.52932966", "0.5265915", "0.5211019", "0.515208", "0.50909877", "0.5043483", "0.5036635", "0.5027133", "0.49715587", "0.4943425", "0.49234208", "0.4920804", "0.49186316", "0.49186316", "0.48925784", "0.48551947", "0.4848...
0.8827283
0
Looks for a true or false token.
def get_bool skip_tkspace tk = get_tk if :on_kw == tk[:kind] && 'true' == tk[:text] true elsif :on_kw == tk[:kind] && ('false' == tk[:text] || 'nil' == tk[:text]) false else unget_tk tk true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boolval \n\n\t$cst.add_branch(\"boolval\")\n\n\tmatch_token(\"T_BOOLEAN\", $tokens[$index])\n\t\n\t$cst.ascend\n\nend", "def token?(token)\n return false\n end", "def read_bool\n read_word == \"true\"\n end", "def token?\n @token && !@token.empty?\n end", "def parse_bo...
[ "0.735152", "0.72603095", "0.70159084", "0.6823212", "0.6813276", "0.67546356", "0.65767264", "0.6502919", "0.6482398", "0.6482398", "0.6478162", "0.6478162", "0.6478162", "0.6478162", "0.6478162", "0.6468532", "0.6404286", "0.639425", "0.639425", "0.639425", "0.63930064", ...
0.63113123
26
Look for the name of a class of module (optionally with a leading :: or with :: separated named) and return the ultimate name, the associated container, and the given name (with the ::).
def get_class_or_module container, ignore_constants = false skip_tkspace name_t = get_tk given_name = ''.dup # class ::A -> A is in the top level if :on_op == name_t[:kind] and '::' == name_t[:text] then # bug name_t = get_tk container = @top_level given_name << '::' end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n has_module?(klass) ? klass[(klass.index(\"::\")+2)..-1] : klass\n end", "def find_class_or_module name\n name = $' if name =~ /^::/\n @classes_hash[name] || @modules_hash[name]\n end", "def split_class_name(cname)\n parts = cname.split('::')\n class_name = parts.pop\n\n rv ...
[ "0.7330122", "0.7318569", "0.7011843", "0.69739044", "0.6940742", "0.68252456", "0.6815596", "0.6799424", "0.67576903", "0.66836905", "0.6680574", "0.66559076", "0.6608835", "0.6527163", "0.6527163", "0.65193754", "0.6488753", "0.6475736", "0.6431482", "0.64274144", "0.642198...
0.6191427
43
Skip opening parentheses and yield the block. Skip closing parentheses too when exists.
def skip_parentheses(&block) left_tk = peek_tk if :on_lparen == left_tk[:kind] get_tk ret = skip_parentheses(&block) right_tk = peek_tk if :on_rparen == right_tk[:kind] get_tk end ret else yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conditional_parentheses(flag)\n if flag\n parentheses { yield }\n else\n yield\n end\n end", "def paren\n res = yield.to_s.strip\n res.empty? ? nil : \"(#{res})\"\n end", "def _nested_paren\n\n _save = self.pos\n while true # sequence\n _tmp = mat...
[ "0.66284186", "0.6482465", "0.6250128", "0.61307955", "0.59138936", "0.5811415", "0.57722515", "0.5763003", "0.5758118", "0.5667147", "0.56548464", "0.56548464", "0.56548464", "0.5619472", "0.5603642", "0.5573531", "0.5563014", "0.5558865", "0.55308545", "0.553042", "0.551176...
0.7322404
0
Return a superclass, which can be either a constant of an expression
def get_class_specification tk = peek_tk if tk.nil? return '' elsif :on_kw == tk[:kind] && 'self' == tk[:text] return 'self' elsif :on_gvar == tk[:kind] return '' end res = get_constant skip_tkspace_without_nl get_tkread # empty out read buffer tk = get_tk r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inspect_superclass\n parent = nil\n\n if constant.respond_to?(:superclass) \\\n and constant.superclass \\\n and constant.superclass.name\n return constant.superclass\n end\n\n return parent\n end", "def inspect_superclass\n return constant.respond_to?(:superclass...
[ "0.6541288", "0.65187836", "0.63798374", "0.6251585", "0.6251585", "0.6224513", "0.6166414", "0.61636156", "0.6113097", "0.6096017", "0.6085122", "0.60555303", "0.5920803", "0.5777051", "0.5765046", "0.57371914", "0.5706314", "0.5646447", "0.56111836", "0.55783796", "0.557208...
0.0
-1
Parse a constant, which might be qualified by one or more class or module names
def get_constant res = "" skip_tkspace_without_nl tk = get_tk while tk && ((:on_op == tk[:kind] && '::' == tk[:text]) || :on_const == tk[:kind]) do res += tk[:text] tk = get_tk end unget_tk(tk) res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_const(expr)\n if expr.first == :var_ref\n expr[1][1]\n elsif expr.first == :@const\n expr[1]\n elsif expr.first == :const_path_ref\n expr[1..-1].map(&method(:parse_const)).join(\"::\")\n end\n end", "def constantize(str)\n\t\t\...
[ "0.7170559", "0.68305886", "0.650861", "0.6450468", "0.6448902", "0.6443419", "0.6442813", "0.642725", "0.642725", "0.642725", "0.6398883", "0.6396942", "0.63947666", "0.63926023", "0.6390267", "0.63671994", "0.6317759", "0.6295774", "0.6279247", "0.62666714", "0.62666714", ...
0.5499236
74
Get an included module that may be surrounded by parens
def get_included_module_with_optional_parens skip_tkspace_without_nl get_tkread tk = get_tk end_token = get_end_token tk return '' unless end_token nest = 0 continue = false only_constant = true while tk != nil do is_element_of_constant = false case tk[:kind] when...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def included(a_module)\n end", "def included(mod); end", "def included_modules() end", "def module\n return @module if @module\n\n # search the current context\n return @name unless parent\n full_name = parent.child_name(@name)\n @module = @store.modules_hash[full_name]\n return @module if...
[ "0.6691057", "0.6509467", "0.63780224", "0.63274795", "0.6276137", "0.6232055", "0.62257904", "0.6202518", "0.6182731", "0.6145765", "0.6145678", "0.61059636", "0.5776562", "0.57204264", "0.5674033", "0.5635632", "0.5633474", "0.56102204", "0.55656826", "0.55656826", "0.55476...
0.68365484
0
Little hack going on here. In the statement: f = 2(1+yield) We see the RPAREN as the next token, so we need to exit early. This still won't catch all cases (such as "a = yield + 1"
def get_end_token tk # :nodoc: case tk[:kind] when :on_lparen token = RDoc::Parser::RipperStateLex::Token.new token[:kind] = :on_rparen token[:text] = ')' token when :on_rparen nil else token = RDoc::Parser::RipperStateLex::Token.new token[:kind] = :on_nl ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yield_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n return_value = YieldStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last ...
[ "0.6768025", "0.6361524", "0.62124044", "0.62034667", "0.61551833", "0.6149901", "0.60108334", "0.59830534", "0.5961321", "0.5921778", "0.5809036", "0.58031857", "0.5770699", "0.5757914", "0.5743777", "0.57050073", "0.56981647", "0.56971073", "0.5693473", "0.56927645", "0.568...
0.0
-1
Retrieves the method container for a singleton method.
def get_method_container container, name_t # :nodoc: prev_container = container container = container.find_module_named(name_t[:text]) unless container then constant = prev_container.constants.find do |const| const.name == name_t[:text] end if constant then parse_method_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_method_container\n unless @instance_method_container\n @instance_method_container = Module.new\n include @instance_method_container\n end\n @instance_method_container\n end", "def method_context_class\n SingletonMethodContext\n end", "def sin...
[ "0.7039419", "0.67149985", "0.65001994", "0.6320825", "0.6142831", "0.60696316", "0.6039068", "0.58752453", "0.5802919", "0.5798469", "0.57871056", "0.5781719", "0.5652466", "0.5649524", "0.56451905", "0.56081265", "0.559175", "0.55785537", "0.5559611", "0.5514422", "0.550134...
0.6028226
7
Extracts a name or symbol from the token stream.
def get_symbol_or_name tk = get_tk case tk[:kind] when :on_symbol then text = tk[:text].sub(/^:/, '') next_tk = peek_tk if next_tk && :on_op == next_tk[:kind] && '=' == next_tk[:text] then get_tk text << '=' end text when :on_ident, :on_const, :on_gvar, :o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_symbol\n token = @tokens.next\n\n case token\n when :symbol then\n [:symbol, *parse_symbol]\n when :symbol_link then\n [:symbol_link, @tokens.next]\n else\n raise ArgumentError, \"expected SYMBOL or SYMLINK, got #{token.inspect}\"\n end\n end", "def name\n @token\n ...
[ "0.6574641", "0.6388567", "0.6219757", "0.6188843", "0.60848236", "0.603896", "0.59493405", "0.58964556", "0.5810034", "0.57746637", "0.5739919", "0.57109755", "0.57078415", "0.56909436", "0.5670458", "0.56373113", "0.56190264", "0.5585237", "0.55710655", "0.55623657", "0.555...
0.5914079
7
Marks containers between +container+ and +ancestor+ as ignored
def suppress_parents container, ancestor # :nodoc: while container and container != ancestor do container.suppress unless container.documented? container = container.parent end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore_container\n depth = 1\n\n increase_depth_on = [ StartObject.empty, StartArray.empty ]\n decrease_depth_on = [ EndObject.empty, EndArray.empty ]\n\n while depth > 0\n event = next_event\n\n if increase_depth_on.include?(event)\n depth += 1\n elsif decreas...
[ "0.64610904", "0.6332082", "0.6292288", "0.6249054", "0.6179171", "0.5881887", "0.5879865", "0.56696355", "0.5608635", "0.5590554", "0.55581343", "0.55377406", "0.5503135", "0.55025166", "0.55020356", "0.5475685", "0.5462397", "0.53606415", "0.5333745", "0.52946436", "0.52944...
0.76874495
0
Look for directives in a normal comment block: :stopdoc: Don't display comment from this point forward This routine modifies its +comment+ parameter.
def look_for_directives_in container, comment @preprocess.handle comment, container do |directive, param| case directive when 'method', 'singleton-method', 'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then false # handled elsewhere when 'section' then break unle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def look_for_directives_in context, comment\n @preprocess.handle comment, context do |directive, param|\n case directive\n when 'main' then\n @options.main_page = param\n ''\n when 'title' then\n @options.default_title = param if @options.respond_to? :default_title=\n ...
[ "0.68803036", "0.64808285", "0.6244019", "0.6191421", "0.6187328", "0.61758775", "0.61758363", "0.6157844", "0.61381984", "0.61295164", "0.6105887", "0.6100703", "0.60917664", "0.60560447", "0.60488176", "0.60401684", "0.60261095", "0.6010908", "0.6009067", "0.60060376", "0.6...
0.75215703
0
Adds useful info about the parser to +message+
def make_message message prefix = "#{@file_name}:".dup tk = peek_tk prefix << "#{tk[:line_no]}:#{tk[:char_no]}:" if tk "#{prefix} #{message}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info(message)\n add(:info, message)\n end", "def info(message)\n add(:info, message)\n end", "def info(message)\n @message = message\n end", "def info(message)\n write_message message, 'info'\n end", "def info message\n message = \"INFO: \" + process_message(message...
[ "0.7272854", "0.7272854", "0.7133363", "0.68350464", "0.64292276", "0.6405814", "0.6345911", "0.6342071", "0.6342071", "0.6321406", "0.6314533", "0.62541497", "0.6218915", "0.6209803", "0.6206321", "0.61907697", "0.61441106", "0.6126183", "0.6104706", "0.608417", "0.6061094",...
0.0
-1
Creates a comment with the correct format
def new_comment comment, line_no = nil c = RDoc::Comment.new comment, @top_level, :ruby c.line = line_no c.format = @markup c end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_comment(string, &block); end", "def create_comment(string, &block); end", "def format_comment(comment)\n comment\n end", "def add_comment comment\n \"\\n###### #{comment} ######\\n\" \n end", "def create_comment(content)\n DOM(`#@native.createComment(#{content})`)\n end", "def comm...
[ "0.78751373", "0.78751373", "0.7601167", "0.7424286", "0.7338427", "0.7171227", "0.70875496", "0.70875496", "0.70875496", "0.70875496", "0.70672065", "0.7020904", "0.69986564", "0.69760865", "0.6930977", "0.6891768", "0.68774974", "0.6863623", "0.6850908", "0.6759943", "0.669...
0.7322233
5
Creates an RDoc::Attr for the name following +tk+, setting the comment to +comment+.
def parse_attr(context, single, tk, comment) line_no = tk[:line_no] args = parse_symbol_arg 1 if args.size > 0 then name = args[0] rw = "R" skip_tkspace_without_nl tk = get_tk if :on_comma == tk[:kind] then rw = "RW" if get_bool else unget_tk tk en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_comment_attr container, type, name, comment # :nodoc:\n return if name.empty?\n\n rw = case type\n when 'attr_reader' then 'R'\n when 'attr_writer' then 'W'\n else 'RW'\n end\n\n create_attr container, NORMAL, name, rw, comment\n end", "def find_attr_comment va...
[ "0.64967304", "0.6064064", "0.5918431", "0.5890683", "0.58290803", "0.5674815", "0.5655676", "0.56079555", "0.5289822", "0.52065605", "0.52058053", "0.51685196", "0.51306814", "0.5113213", "0.5064585", "0.5059195", "0.49942264", "0.4931759", "0.4927542", "0.49020803", "0.4875...
0.60986
1
Creates an RDoc::Attr for each attribute listed after +tk+, setting the comment for each to +comment+.
def parse_attr_accessor(context, single, tk, comment) line_no = tk[:line_no] args = parse_symbol_arg rw = "?" tmp = RDoc::CodeObject.new read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS # TODO In most other places we let the context keep track of document_self # and add found items a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_attr(context, single, tk, comment)\n line_no = tk[:line_no]\n\n args = parse_symbol_arg 1\n if args.size > 0 then\n name = args[0]\n rw = \"R\"\n skip_tkspace_without_nl\n tk = get_tk\n\n if :on_comma == tk[:kind] then\n rw = \"RW\" if get_bool\n else\n ...
[ "0.6208481", "0.60608953", "0.5990595", "0.5717918", "0.56109315", "0.5379246", "0.51726663", "0.50925875", "0.4998201", "0.49937242", "0.49855778", "0.4949486", "0.48953015", "0.4874018", "0.48676658", "0.48574004", "0.4840683", "0.48197782", "0.4816823", "0.48100784", "0.48...
0.61292964
1
Parses an +alias+ in +context+ with +comment+
def parse_alias(context, single, tk, comment) line_no = tk[:line_no] skip_tkspace if :on_lparen === peek_tk[:kind] then get_tk skip_tkspace end new_name = get_symbol_or_name skip_tkspace if :on_comma === peek_tk[:kind] then get_tk skip_tkspace end begin ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_alias_comment class_name, new_name, old_name\n content =~ %r%((?>/\\*.*?\\*/\\s+))\n rb_define_alias\\(\\s*#{Regexp.escape class_name}\\s*,\n \\s*\"#{Regexp.escape new_name}\"\\s*,\n \\s*\"#{Regexp.escape old_name}\"\\...
[ "0.62170833", "0.5915766", "0.59144557", "0.5694254", "0.56931144", "0.56261253", "0.56261253", "0.56261253", "0.56227225", "0.56227225", "0.56227225", "0.55874205", "0.5585745", "0.5583367", "0.5551463", "0.55154204", "0.5507191", "0.5507191", "0.5507191", "0.5477134", "0.54...
0.71535593
0
Extracts call parameters from the token stream.
def parse_call_parameters(tk) end_token = case tk[:kind] when :on_lparen :on_rparen when :on_rparen return "" else :on_nl end nest = 0 loop do break if tk.nil? case tk[:kind] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_parameters(superstring); end", "def parse_parameters; end", "def introspect_params\n params = self.class.instance_method(:call).parameters\n return context.keys if params.map(&:first).include?(:keyrest)\n\n params.map(&:last)\n end", "def extract_params(idx)\n params ...
[ "0.6247305", "0.6089163", "0.5981203", "0.58875847", "0.58205384", "0.5776732", "0.56713843", "0.5604207", "0.5575419", "0.5499164", "0.54937035", "0.5489219", "0.5401092", "0.53677803", "0.5366151", "0.53587365", "0.535799", "0.53259975", "0.53231335", "0.53056127", "0.52975...
0.592777
3
Parses a class in +context+ with +comment+
def parse_class container, single, tk, comment line_no = tk[:line_no] declaration_context = container container, name_t, given_name, = get_class_or_module container if name_t[:kind] == :on_const cls = parse_class_regular container, declaration_context, single, name_t, given_name, comment...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_with_comments(source); end", "def each_class(text)\n\tscan_ignore_comments(/(struct|class)\\s+(\\w+)[^\\{\\;]*?\\{/m, text) do |match|\n\n\t\toffset = match.pre_match.length\n\t\tblock_start = offset + match[0].length\n\n\t\tname = match[2]\n\t\tend_offset = find_block_end(text, offset)\n\t\tbody = tex...
[ "0.62133825", "0.6196383", "0.60821515", "0.60821515", "0.60821515", "0.60778457", "0.59979624", "0.59622383", "0.58792007", "0.5817034", "0.57147", "0.5714199", "0.5698132", "0.5669659", "0.5662689", "0.5662689", "0.5610929", "0.56100327", "0.54625046", "0.5438687", "0.54208...
0.57159084
10
Parses and creates a regular class
def parse_class_regular container, declaration_context, single, # :nodoc: name_t, given_name, comment superclass = '::Object' if given_name =~ /^::/ then declaration_context = @top_level given_name = $' end tk = peek_tk if tk[:kind] == :on_op && tk[:text] == '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_class\n attributes = content['attributes']\n mod.const_set class_name, Class.new(parent_class) {\n attr_accessor(*attributes)\n # include Concerns::Extendable\n }\n end", "def class() end", "def parse_class\n [object_ref, @tokens.next]\n end", "def create_class(classname, s...
[ "0.6724937", "0.65959316", "0.65755576", "0.6527671", "0.64859605", "0.6280242", "0.6278257", "0.6246333", "0.62423986", "0.6228098", "0.621363", "0.61836857", "0.61563885", "0.61542314", "0.6131676", "0.6130701", "0.61283475", "0.6104437", "0.61044055", "0.6050105", "0.60403...
0.61535335
14
Parses a singleton class in +container+ with the given +name+ and +comment+.
def parse_class_singleton container, name, comment # :nodoc: other = @store.find_class_named name unless other then if name =~ /^::/ then name = $' container = @top_level end other = container.add_module RDoc::NormalModule, name record_location other # class << $...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_class container, single, tk, comment\n line_no = tk[:line_no]\n\n declaration_context = container\n container, name_t, given_name, = get_class_or_module container\n\n if name_t[:kind] == :on_const\n cls = parse_class_regular container, declaration_context, single,\n name_t, given_...
[ "0.6138343", "0.59911245", "0.581156", "0.5731901", "0.5647469", "0.56316835", "0.55032104", "0.5413997", "0.5263884", "0.5227182", "0.5174387", "0.5133051", "0.5043829", "0.5006838", "0.49939805", "0.49733818", "0.49567097", "0.48992845", "0.48872736", "0.48059663", "0.47775...
0.7569695
0
Parses a constant in +context+ with +comment+. If +ignore_constants+ is true, no found constants will be added to RDoc.
def parse_constant container, tk, comment, ignore_constants = false line_no = tk[:line_no] name = tk[:text] skip_tkspace_without_nl return unless name =~ /^\w+$/ new_modules = [] if :on_op == peek_tk[:kind] && '::' == peek_tk[:text] then unget_tk tk container, name_t, _, new_modu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_constants(type, var_name, const_name, definition)\n class_name = @known_classes[var_name]\n\n return unless class_name\n\n class_obj = find_class var_name, class_name\n\n unless class_obj then\n @options.warn 'Enclosing class or module %p is not known' % [const_name]\n return\n ...
[ "0.6007023", "0.5726383", "0.5617698", "0.53549635", "0.52407545", "0.52316594", "0.5215286", "0.51646423", "0.51597464", "0.510127", "0.5080305", "0.49708372", "0.49540913", "0.49534675", "0.4820932", "0.48144436", "0.47495854", "0.47295132", "0.47173113", "0.4706107", "0.47...
0.69301254
0
Generates an RDoc::Method or RDoc::Attr from +comment+ by looking for :method: or :attr: directives in +comment+.
def parse_comment container, tk, comment return parse_comment_tomdoc container, tk, comment if @markup == 'tomdoc' column = tk[:char_no] line_no = comment.line.nil? ? tk[:line_no] : comment.line comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3') singleton = !!$~ co = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def look_for_directives_in container, comment\n @preprocess.handle comment, container do |directive, param|\n case directive\n when 'method', 'singleton-method',\n 'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then\n false # handled elsewhere\n when 'section' then\n ...
[ "0.6479363", "0.6381403", "0.63300085", "0.6120347", "0.6069235", "0.6044684", "0.60269463", "0.55982184", "0.5360526", "0.53465116", "0.5263864", "0.5253165", "0.51682496", "0.51548326", "0.51140237", "0.5066984", "0.5024728", "0.49968386", "0.49864963", "0.49608126", "0.494...
0.58044577
7
Parse a comment that is describing an attribute in +container+ with the given +name+ and +comment+.
def parse_comment_attr container, type, name, comment # :nodoc: return if name.empty? rw = case type when 'attr_reader' then 'R' when 'attr_writer' then 'W' else 'RW' end create_attr container, NORMAL, name, rw, comment end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_attr_comment var_name, attr_name, read = nil, write = nil\n attr_name = Regexp.escape attr_name\n\n rw = if read and write then\n /\\s*#{read}\\s*,\\s*#{write}\\s*/xm\n else\n /.*?/m\n end\n\n comment = if @content =~ %r%((?>/\\*.*?\\*/\\s+))\n ...
[ "0.6085999", "0.58868337", "0.55739933", "0.54443616", "0.543241", "0.53765017", "0.52698255", "0.52600026", "0.52359", "0.5230571", "0.51294434", "0.5118494", "0.5113957", "0.5108397", "0.508605", "0.50503623", "0.5038075", "0.5015292", "0.5013636", "0.49763718", "0.49761587...
0.78295255
0
Creates an RDoc::Method on +container+ from +comment+ if there is a Signature section in the comment
def parse_comment_tomdoc container, tk, comment return unless signature = RDoc::TomDoc.signature(comment) column = tk[:char_no] line_no = tk[:line_no] name, = signature.split %r%[ \(]%, 2 meth = RDoc::GhostMethod.new get_tkread, name record_location meth meth.line = line_no meth...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_method(container, single, tk, comment)\n singleton = nil\n added_container = false\n name = nil\n column = tk[:char_no]\n line_no = tk[:line_no]\n\n start_collecting_tokens\n add_token tk\n\n token_listener self do\n prev_container = container\n name, container, singlet...
[ "0.66982687", "0.64511245", "0.5982499", "0.595756", "0.5871106", "0.5460732", "0.53987503", "0.53292865", "0.5245285", "0.5240775", "0.51835287", "0.514798", "0.5052503", "0.50520074", "0.49626952", "0.49066064", "0.4903234", "0.48999515", "0.48981765", "0.48733005", "0.4842...
0.6786044
0
Parses an +include+ or +extend+, indicated by the +klass+ and adds it to +container+ with +comment+
def parse_extend_or_include klass, container, comment # :nodoc: loop do skip_tkspace_comment name = get_included_module_with_optional_parens unless name.empty? then obj = container.add klass, name, comment record_location obj end return if peek_tk.nil? || :on_comma !...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add klass, name, comment\n if RDoc::Extend == klass then\n ext = RDoc::Extend.new name, comment\n add_extend ext\n elsif RDoc::Include == klass then\n incl = RDoc::Include.new name, comment\n add_include incl\n else\n raise NotImplementedError, \"adding a #{klass} is not imple...
[ "0.6792038", "0.56801075", "0.56801075", "0.5604397", "0.558445", "0.5569023", "0.55377823", "0.5511886", "0.54525197", "0.5412452", "0.53824234", "0.53734726", "0.53427696", "0.53399277", "0.5338677", "0.5269899", "0.52368796", "0.523337", "0.52075255", "0.5205799", "0.51866...
0.70060545
0
Parses an +included+ with a block feature of ActiveSupport::Concern.
def parse_included_with_activesupport_concern container, comment # :nodoc: skip_tkspace_without_nl tk = get_tk unless tk[:kind] == :on_lbracket || (tk[:kind] == :on_kw && tk[:text] == 'do') unget_tk tk return nil # should be a block end parse_statements container container end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def when_included(&block)\n @cautious_included_block = block\n end", "def on_include(&block)\n self.inclusion = block\n self\n end", "def add_includes(&block)\n if include_associations = options.delete(:include)\n base_only_or_except = { :except => options[:except],\n ...
[ "0.7320031", "0.69508266", "0.63409746", "0.6278399", "0.6222394", "0.6222394", "0.6185613", "0.6185613", "0.60870004", "0.6048606", "0.60411656", "0.5962075", "0.59447235", "0.59067553", "0.5871601", "0.5864193", "0.5854808", "0.5799863", "0.57893026", "0.5749467", "0.568638...
0.66670024
2
Parses identifiers that can create new methods or change visibility. Returns true if the comment was not consumed.
def parse_identifier container, single, tk, comment # :nodoc: case tk[:text] when 'private', 'protected', 'public', 'private_class_method', 'public_class_method', 'module_function' then parse_visibility container, single, tk return true when 'private_constant', 'public_constant' p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_has_identifier?(line, id)\n while (index = line.index(String_regex)) != nil\n line.insert(index, line.slice!(String_regex)[0..0])\n line.slice!(/^\"/)\n end\n line.slice!(Comment)\n return line.include?(id)\n end", "def allow_comments?\n case @comments\n when :guess\...
[ "0.62226206", "0.606034", "0.5881045", "0.58113545", "0.5782588", "0.57657397", "0.57372636", "0.56964415", "0.55999976", "0.55858606", "0.5519435", "0.5500723", "0.549845", "0.5494689", "0.5494689", "0.54825807", "0.5462447", "0.5449253", "0.5449253", "0.5442513", "0.5431779...
0.6998837
0
Parses a metaprogrammed attribute and creates an RDoc::Attr. To create foo and bar attributes on class C with comment "My attributes": class C :attr: My attributes my_attr :foo, :bar end To create a foo attribute on class C with comment "My attribute": class C :attr: foo My attribute my_attr :foo, :bar end
def parse_meta_attr(context, single, tk, comment) args = parse_symbol_arg rw = "?" # If nodoc is given, don't document any of them tmp = RDoc::CodeObject.new read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS regexp = /^# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i if regexp ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_attr(context, single, tk, comment)\n line_no = tk[:line_no]\n\n args = parse_symbol_arg 1\n if args.size > 0 then\n name = args[0]\n rw = \"R\"\n skip_tkspace_without_nl\n tk = get_tk\n\n if :on_comma == tk[:kind] then\n rw = \"RW\" if get_bool\n else\n ...
[ "0.67523134", "0.6559966", "0.6490781", "0.64381945", "0.63626987", "0.6337031", "0.6233094", "0.6094426", "0.6091338", "0.5942916", "0.58804494", "0.582665", "0.5779327", "0.576599", "0.57618165", "0.5726342", "0.56643283", "0.56598157", "0.56598157", "0.5614399", "0.5604013...
0.71816325
0
Parses a metaprogrammed method
def parse_meta_method(container, single, tk, comment) column = tk[:char_no] line_no = tk[:line_no] start_collecting_tokens add_token tk add_token_listener self skip_tkspace_without_nl comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3') singleton = !!$~ name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parsed_methods\n parsed_include(:method)\n end", "def parse_meta_method_name comment, tk # :nodoc:\n if comment.text.sub!(/^# +:?method: *(\\S*).*?\\n/i, '') then\n return $1 unless $1.empty?\n end\n\n name_t = get_tk\n\n if :on_symbol == name_t[:kind] then\n name_t[:text][1..-1]\n ...
[ "0.6668761", "0.6667623", "0.6618519", "0.63853705", "0.6384206", "0.6384206", "0.6261398", "0.6238485", "0.61872727", "0.61761343", "0.61532634", "0.61452717", "0.612635", "0.6060767", "0.604764", "0.6046472", "0.60411423", "0.6029652", "0.6010994", "0.6004052", "0.60035014"...
0.65662444
3
Parses the name of a metaprogrammed method. +comment+ is used to determine the name while +tk+ is used in an error message if the name cannot be determined.
def parse_meta_method_name comment, tk # :nodoc: if comment.text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then return $1 unless $1.empty? end name_t = get_tk if :on_symbol == name_t[:kind] then name_t[:text][1..-1] elsif :on_tstring == name_t[:kind] then name_t[:text][1..-2] el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_method_name_regular container, name_t # :nodoc:\n if :on_op == name_t[:kind] && (%w{* & [] []= <<}.include?(name_t[:text])) then\n name_t[:text]\n else\n unless [:on_kw, :on_const, :on_ident].include?(name_t[:kind]) then\n warn \"expected method name token, . or ::, got #{name_t.in...
[ "0.6545497", "0.63553095", "0.62348783", "0.62271774", "0.62043023", "0.6143019", "0.6030282", "0.6005208", "0.59898204", "0.5944339", "0.5904404", "0.5897018", "0.586873", "0.5818459", "0.5818459", "0.58157176", "0.57910585", "0.56988794", "0.5695988", "0.5679075", "0.565775...
0.85154796
0
Parses the parameters and block for a metaprogrammed method.
def parse_meta_method_params container, single, meth, tk, comment # :nodoc: token_listener meth do meth.params = '' look_for_directives_in meth, comment comment.normalize comment.extract_call_seq meth container.add_method meth last_tk = tk while tk = get_tk do i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_yield(context, single, tk, method)\n return if method.block_params\n\n get_tkread\n method.block_params = parse_method_or_yield_parameters\n end", "def parse_method_parameters method\n res = parse_method_or_yield_parameters method\n\n res = \"(#{res})\" unless res =~ /\\A\\(/\n metho...
[ "0.68551785", "0.6828097", "0.67346746", "0.6507807", "0.64953", "0.6438656", "0.6265241", "0.610634", "0.6035046", "0.60201263", "0.6013904", "0.59456295", "0.5883589", "0.5847644", "0.58473253", "0.58356714", "0.58289254", "0.58177125", "0.579763", "0.5793682", "0.5790586",...
0.7148821
0
Parses a normal method defined by +def+
def parse_method(container, single, tk, comment) singleton = nil added_container = false name = nil column = tk[:char_no] line_no = tk[:line_no] start_collecting_tokens add_token tk token_listener self do prev_container = container name, container, singleton = parse_method...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_method_declaration\n if peek?(:KW_MAIN)\n parse_main_declaration\n elsif peek?(:KW_CONSTRUCTOR)\n parse_constructor_declaration\n else\n method = DefMethod.new(nil, nil,nil, nil, nil)\n @methods << method\n\n name = expect(:ID)\n params = parse_params\n\n expec...
[ "0.6693684", "0.6406025", "0.6309633", "0.6276104", "0.6267963", "0.6220933", "0.6120349", "0.60928226", "0.60928226", "0.6080407", "0.6040918", "0.5959008", "0.5925475", "0.5909265", "0.59005105", "0.5863605", "0.58630013", "0.58471155", "0.58471155", "0.58471155", "0.584711...
0.6532714
1
Parses the parameters and body of +meth+
def parse_method_params_and_body container, single, meth, added_container token_listener meth do parse_method_parameters meth if meth.document_self or not @track_visibility then container.add_method meth elsif added_container then container.document_self = false end #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_method_parameters method\n res = parse_method_or_yield_parameters method\n\n res = \"(#{res})\" unless res =~ /\\A\\(/\n method.params = res unless method.params\n\n return if method.block_params\n\n skip_tkspace_without_nl\n read_documentation_modifiers method, RDoc::METHOD_MODIFIERS\...
[ "0.7092992", "0.6708926", "0.6417247", "0.640042", "0.640042", "0.6375848", "0.62684155", "0.6226555", "0.62135065", "0.6165263", "0.61206394", "0.60683256", "0.60644853", "0.60627764", "0.60484666", "0.603039", "0.6011305", "0.59985816", "0.59284943", "0.5922742", "0.5914896...
0.74724305
0
Parses a method that needs to be ignored.
def parse_method_dummy container dummy = RDoc::Context.new dummy.parent = container dummy.store = container.store skip_method dummy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_method container\n meth = RDoc::AnyMethod.new \"\", \"anon\"\n parse_method_parameters meth\n parse_statements container, false, meth\n end", "def skip_method(a,b,c)\nend", "def ignore_me\nend", "def ignore_unexpected_calls!\n return if @ignoring_unexpected_calls # do it once!\n\n @i...
[ "0.7020883", "0.67038256", "0.63525933", "0.628275", "0.62645525", "0.6239535", "0.61835736", "0.6182465", "0.61541647", "0.6125929", "0.6109212", "0.60520566", "0.60144466", "0.5992664", "0.5945329", "0.59179944", "0.59178746", "0.5901919", "0.5888931", "0.58728814", "0.5824...
0.5869084
20
Parses the name of a method in +container+. Returns the method name, the container it is in (for def Foo.name) and if it is a singleton or regular method.
def parse_method_name container # :nodoc: skip_tkspace name_t = get_tk back_tk = skip_tkspace_without_nl singleton = false dot = get_tk if dot[:kind] == :on_period || (dot[:kind] == :on_op && dot[:text] == '::') then singleton = true name, container = parse_method_name_singleton co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_method_name_singleton container, name_t # :nodoc:\n skip_tkspace\n name_t2 = get_tk\n\n if (:on_kw == name_t[:kind] && 'self' == name_t[:text]) || (:on_op == name_t[:kind] && '%' == name_t[:text]) then\n # NOTE: work around '[' being consumed early\n if :on_lbracket == name_t2[:kind]\n...
[ "0.7249396", "0.6976085", "0.6447905", "0.6224817", "0.59114504", "0.5884652", "0.5802565", "0.57084686", "0.5691729", "0.56900704", "0.5649514", "0.5624378", "0.5533593", "0.5533593", "0.5523585", "0.54893273", "0.5467783", "0.5448504", "0.54382163", "0.53718054", "0.5359812...
0.75991553
0
For the given +container+ and initial name token +name_t+ the method name is parsed from the token stream for a regular method.
def parse_method_name_regular container, name_t # :nodoc: if :on_op == name_t[:kind] && (%w{* & [] []= <<}.include?(name_t[:text])) then name_t[:text] else unless [:on_kw, :on_const, :on_ident].include?(name_t[:kind]) then warn "expected method name token, . or ::, got #{name_t.inspect}" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_method_name_singleton container, name_t # :nodoc:\n skip_tkspace\n name_t2 = get_tk\n\n if (:on_kw == name_t[:kind] && 'self' == name_t[:text]) || (:on_op == name_t[:kind] && '%' == name_t[:text]) then\n # NOTE: work around '[' being consumed early\n if :on_lbracket == name_t2[:kind]\n...
[ "0.7575515", "0.74534637", "0.66433734", "0.66387284", "0.61425585", "0.5779912", "0.5752673", "0.57323235", "0.5517132", "0.5499782", "0.54851353", "0.5460683", "0.5442985", "0.54070044", "0.5350293", "0.53220326", "0.5318191", "0.5283153", "0.52636683", "0.52511674", "0.524...
0.79082364
0
For the given +container+ and initial name token +name_t+ the method name and the new +container+ (if necessary) are parsed from the token stream for a singleton method.
def parse_method_name_singleton container, name_t # :nodoc: skip_tkspace name_t2 = get_tk if (:on_kw == name_t[:kind] && 'self' == name_t[:text]) || (:on_op == name_t[:kind] && '%' == name_t[:text]) then # NOTE: work around '[' being consumed early if :on_lbracket == name_t2[:kind] get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_method_name container # :nodoc:\n skip_tkspace\n name_t = get_tk\n back_tk = skip_tkspace_without_nl\n singleton = false\n\n dot = get_tk\n if dot[:kind] == :on_period || (dot[:kind] == :on_op && dot[:text] == '::') then\n singleton = true\n\n name, container = parse_method_na...
[ "0.75179094", "0.71131164", "0.6926567", "0.657851", "0.6531603", "0.6374776", "0.5948388", "0.5849525", "0.5476892", "0.54694736", "0.5436261", "0.5434734", "0.541796", "0.5364601", "0.52738845", "0.5267065", "0.5220471", "0.5219742", "0.5203743", "0.518672", "0.5178093", ...
0.8235377
0
Extracts +yield+ parameters from +method+
def parse_method_or_yield_parameters(method = nil, modifiers = RDoc::METHOD_MODIFIERS) skip_tkspace_without_nl tk = get_tk end_token = get_end_token tk return '' unless end_token nest = 0 continue = false while tk != nil do case tk[:kind] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_yield(context, single, tk, method)\n return if method.block_params\n\n get_tkread\n method.block_params = parse_method_or_yield_parameters\n end", "def my_method(*args)\n # yield()\n # yield(self)\n # yield(\"booyaka\")\n # yield(\"booyaka\", \"come and get it\")\n yield(args)\nend", "...
[ "0.7150234", "0.6516576", "0.65004075", "0.6440853", "0.64310855", "0.6380683", "0.6297841", "0.62541413", "0.6251062", "0.62438667", "0.62182206", "0.61944836", "0.61800796", "0.61507547", "0.6130087", "0.6118264", "0.60875636", "0.6084897", "0.60157573", "0.6001188", "0.600...
0.62447256
9
Capture the method's parameters. Along the way, look for a comment containing: yields: .... and add this as the block_params for the method
def parse_method_parameters method res = parse_method_or_yield_parameters method res = "(#{res})" unless res =~ /\A\(/ method.params = res unless method.params return if method.block_params skip_tkspace_without_nl read_documentation_modifiers method, RDoc::METHOD_MODIFIERS end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_with_params\n puts \"Before calling block\"\n yield(123)\n yield(:test)\n yield([:a])\n puts \"After calling block\"\nend", "def yield_block_example()\n puts \"Start of yield block example\"\n yield('example of param passing')\n puts \"End of yield block example\"\nend", "def block_with...
[ "0.69157946", "0.68842614", "0.686983", "0.6717127", "0.6656927", "0.66435", "0.66375583", "0.6480308", "0.647116", "0.63822067", "0.63224494", "0.62710536", "0.6261897", "0.62326413", "0.6223104", "0.6179735", "0.6178659", "0.61480576", "0.61389077", "0.61315113", "0.6119637...
0.6538619
7
Parses an RDoc::NormalModule in +container+ with +comment+
def parse_module container, single, tk, comment container, name_t, = get_class_or_module container name = name_t[:text] mod = container.add_module RDoc::NormalModule, name mod.ignore unless container.document_children record_location mod read_documentation_modifiers mod, RDoc::CLASS_MODIFIERS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_comment container, tk, comment\n return parse_comment_tomdoc container, tk, comment if @markup == 'tomdoc'\n column = tk[:char_no]\n line_no = comment.line.nil? ? tk[:line_no] : comment.line\n\n comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\\1\\3')\n singleton = !!$~\...
[ "0.678577", "0.6580594", "0.6545471", "0.6050397", "0.60236526", "0.596945", "0.5929851", "0.5800363", "0.5649645", "0.56434804", "0.5608972", "0.5602033", "0.559525", "0.55779326", "0.5545021", "0.5528128", "0.55144924", "0.5513507", "0.54924226", "0.5474163", "0.5469459", ...
0.782039
0
Parses an RDoc::Require in +context+ containing +comment+
def parse_require(context, comment) skip_tkspace_comment tk = get_tk if :on_lparen == tk[:kind] then skip_tkspace_comment tk = get_tk end name = tk[:text][1..-2] if :on_tstring == tk[:kind] if name then @top_level.add_require RDoc::Require.new(name, comment) else u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_require\n skip_tkspace false\n\n tk = get_tk\n\n name = tk.text if TkSTRING === tk\n\n if name then\n @container.add_require RDoc::Require.new(name, '')\n else\n unget_tk tk\n end\n end", "def parse_comment(comment)\n return nil if comment.blank?\n contexts = comm...
[ "0.65837586", "0.6022424", "0.5943098", "0.5860604", "0.5816498", "0.5816498", "0.5816498", "0.58034927", "0.57896733", "0.5597085", "0.5564825", "0.5562513", "0.55513334", "0.5521821", "0.54887754", "0.5440255", "0.5430636", "0.54271495", "0.5360661", "0.53349483", "0.533220...
0.82544166
0
Retrieve comment body without =begin/=end
def retrieve_comment_body(tk) if :on_embdoc == tk[:kind] tk[:text].gsub(/\A=begin.*\n/, '').gsub(/=end\n?\z/, '') else tk[:text] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment_body\n if read_attribute('comment_body') =~ COMMENT_BODY_PARSER\n $2\n else\n read_attribute('comment_body')\n end\n end", "def comment_body(comment=@comment)\n filter(comment.body, *Wink.comment_filters)\n end", "def comment_body(comment=@comment)\n filter(comment.body, ...
[ "0.7436332", "0.68700635", "0.68700635", "0.6601793", "0.6590298", "0.6590298", "0.6590298", "0.6590298", "0.6563125", "0.6563125", "0.6535706", "0.6522066", "0.6522066", "0.6522066", "0.6522066", "0.6522066", "0.646871", "0.64558077", "0.64276654", "0.6412259", "0.6412259", ...
0.824244
0
The core of the Ruby parser.
def parse_statements(container, single = NORMAL, current_method = nil, comment = new_comment('')) raise 'no' unless RDoc::Comment === comment comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding nest = 1 save_visibility = container.visibility non_comment_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby_parser\n @ruby_parser ||= parser_for_version ruby_version\n end", "def parser; end", "def parser; end", "def parser; end", "def parser; end", "def parse_code(code)\n p Parser::CurrentRuby.parse(code)\n end", "def parser (tokens)\n\n\t# create the new, concrete syntax tree\n\t# maki...
[ "0.65257317", "0.6470573", "0.6470573", "0.6470573", "0.6470573", "0.61919165", "0.6115068", "0.59924906", "0.5987398", "0.5987398", "0.5987398", "0.5987398", "0.5961991", "0.59403586", "0.59287906", "0.59194034", "0.5865672", "0.5841657", "0.5826383", "0.5812447", "0.5770485...
0.0
-1
Parse up to +no+ symbol arguments
def parse_symbol_arg(no = nil) skip_tkspace_comment tk = get_tk if tk[:kind] == :on_lparen parse_symbol_arg_paren no else parse_symbol_arg_space no, tk end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_symbol_arg_space no, tk # :nodoc:\n args = []\n\n unget_tk tk\n if tk = parse_symbol_in_arg\n args.push tk\n return args if no and args.size >= no\n end\n\n loop do\n skip_tkspace_without_nl\n\n tk1 = get_tk\n if tk1.nil? || :on_comma != tk1[:kind] then\n un...
[ "0.7182359", "0.71686065", "0.69569355", "0.64545697", "0.63543314", "0.6328899", "0.62445027", "0.6229395", "0.6204448", "0.618052", "0.6158109", "0.6114515", "0.6046857", "0.60452515", "0.60152847", "0.5995254", "0.5995063", "0.5995063", "0.59925926", "0.5977783", "0.597778...
0.75236714
0
Parses up to +no+ symbol arguments surrounded by () and places them in +args+.
def parse_symbol_arg_paren no # :nodoc: args = [] loop do skip_tkspace_comment if tk1 = parse_symbol_in_arg args.push tk1 break if no and args.size >= no end skip_tkspace_comment case (tk2 = get_tk)[:kind] when :on_rparen break when :on_comma ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_symbol_arg(no = nil)\n skip_tkspace_comment\n\n tk = get_tk\n if tk[:kind] == :on_lparen\n parse_symbol_arg_paren no\n else\n parse_symbol_arg_space no, tk\n end\n end", "def parse_symbol_arg_space no, tk # :nodoc:\n args = []\n\n unget_tk tk\n if tk = parse_symbol_in...
[ "0.7016732", "0.692089", "0.6520967", "0.6386649", "0.63588643", "0.5995578", "0.59450406", "0.5887532", "0.58803356", "0.58037245", "0.57656777", "0.5765643", "0.57438964", "0.5743001", "0.5715371", "0.57104033", "0.569217", "0.5673888", "0.5670584", "0.5648248", "0.56089383...
0.72910607
0
Parses up to +no+ symbol arguments separated by spaces and places them in +args+.
def parse_symbol_arg_space no, tk # :nodoc: args = [] unget_tk tk if tk = parse_symbol_in_arg args.push tk return args if no and args.size >= no end loop do skip_tkspace_without_nl tk1 = get_tk if tk1.nil? || :on_comma != tk1[:kind] then unget_tk tk1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_symbol_arg(no = nil)\n skip_tkspace_comment\n\n tk = get_tk\n if tk[:kind] == :on_lparen\n parse_symbol_arg_paren no\n else\n parse_symbol_arg_space no, tk\n end\n end", "def parse_symbol_arg_paren no # :nodoc:\n args = []\n\n loop do\n skip_tkspace_comment\n i...
[ "0.705791", "0.6991943", "0.657214", "0.6500732", "0.64180857", "0.62655723", "0.5993293", "0.5952421", "0.59519947", "0.5944208", "0.5905961", "0.5903122", "0.5886039", "0.58747685", "0.5862383", "0.58373874", "0.5823866", "0.57888496", "0.5787938", "0.57773095", "0.57559294...
0.76248837
0
Returns symbol text from the next token
def parse_symbol_in_arg tk = get_tk if :on_symbol == tk[:kind] then tk[:text].sub(/^:/, '') elsif :on_tstring == tk[:kind] then tk[:text][1..-2] elsif :on_dstring == tk[:kind] or :on_ident == tk[:kind] then nil # ignore else warn("Expected symbol or string, got #{tk.inspect}"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTokenText()\r\n return @curr_token.text\r\n end", "def next_token; end", "def next_token\n tokens.shift\n end", "def next_token\n @tokens.shift\n end", "def current_symbol\n current_data ? current_data[:symbol] : nil\n end", "def current_symbol\r\n current_data ? current_data[:s...
[ "0.74384075", "0.71095914", "0.70452917", "0.69140154", "0.6872971", "0.6864488", "0.6846781", "0.68213195", "0.6807607", "0.6763118", "0.6716852", "0.6716852", "0.66207504", "0.66207504", "0.66207504", "0.66207504", "0.66207504", "0.66207504", "0.66084576", "0.66012764", "0....
0.0
-1
Parses statements in the toplevel +container+
def parse_top_level_statements container comment = collect_first_comment look_for_directives_in container, comment throw :eof if container.done_documenting @markup = comment.format # HACK move if to RDoc::Context#comment= container.comment = comment if container.document_self unless comment....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_statements(context = nil, single = NORMAL, &block)\n begin\n\t\t\t\tlast_seekpos = -1\n nest = 1\n\n while tk = get_tk\n case tk\n when TkCLASS\n parse_class(context, single, tk, &block)\n when TkMODULE\n parse_module(context, single, tk...
[ "0.6664613", "0.6624182", "0.6189767", "0.60557145", "0.6005377", "0.5938823", "0.58617836", "0.5782384", "0.5744478", "0.5720046", "0.57184607", "0.56901705", "0.560284", "0.5579499", "0.5575839", "0.5574849", "0.5563357", "0.5557261", "0.5513829", "0.5489954", "0.5481897", ...
0.72791606
0
Determines the visibility in +container+ from +tk+
def parse_visibility(container, single, tk) vis_type, vis, singleton = get_visibility_information tk, single skip_tkspace_comment false ptk = peek_tk # Ryan Davis suggested the extension to ignore modifiers, because he # often writes # # protected unless $TESTING # if [:on_nl, :o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visible?\n el.displayed?\n end", "def visibility(name)\n Tk.execute_only(:tkwait, :visibility, name)\n end", "def element_is_visible(name, tag, container, yes = true)\n elem = wait_visibility(name, tag, container, yes)\n elem ? true : false\n end", "def get_visibility_information...
[ "0.63818485", "0.6222444", "0.6081506", "0.6019512", "0.60117936", "0.5886179", "0.5866968", "0.585527", "0.5743116", "0.5704156", "0.56595606", "0.5638481", "0.5632402", "0.5604017", "0.56037563", "0.5599528", "0.5569154", "0.55626607", "0.55626607", "0.5560832", "0.55326855...
0.67844415
0
Parses a Moduleprivate_constant or Modulepublic_constant call from +tk+.
def parse_constant_visibility(container, single, tk) args = parse_symbol_arg case tk[:text] when 'private_constant' vis = :private when 'public_constant' vis = :public else raise RDoc::Error, 'Unreachable' end container.set_constant_visibility_for args, vis end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_constant container, tk, comment, ignore_constants = false\n line_no = tk[:line_no]\n\n name = tk[:text]\n skip_tkspace_without_nl\n\n return unless name =~ /^\\w+$/\n\n new_modules = []\n if :on_op == peek_tk[:kind] && '::' == peek_tk[:text] then\n unget_tk tk\n\n container, n...
[ "0.64348227", "0.63417614", "0.584775", "0.5665769", "0.551708", "0.5416631", "0.53757757", "0.5244607", "0.5242221", "0.5234016", "0.52296853", "0.5185298", "0.5152835", "0.5118722", "0.5099419", "0.5057126", "0.5033763", "0.50176346", "0.4982449", "0.49789685", "0.4970866",...
0.6126528
2
Determines the block parameter for +context+
def parse_yield(context, single, tk, method) return if method.block_params get_tkread method.block_params = parse_method_or_yield_parameters end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_block_context(context:, block_param_node:)\n binds = ArgumentsBinder.new(generator: generator).bind(types: method_types, arguments: block_param_node.parameter)\n\n Contexts::BlockContext.new(parent: context, registry: registry, receiver: context.receiver, binds: binds)\n end",...
[ "0.6809328", "0.66295916", "0.66295916", "0.6441874", "0.6188241", "0.61020136", "0.594191", "0.5936131", "0.5936131", "0.5936131", "0.5936131", "0.5936131", "0.5936131", "0.5936131", "0.5936131", "0.5936131", "0.5936131", "0.5920638", "0.59201175", "0.5898776", "0.5884494", ...
0.538561
77
Directives are modifier comments that can appear after class, module, or method names. For example: def fred :yields: a, b or: class MyClass :nodoc: We return the directive name and any parameters as a two element array if the name is in +allowed+. A directive can be found anywhere up to the end of the current line.
def read_directive allowed tokens = [] while tk = get_tk do tokens << tk if :on_nl == tk[:kind] or (:on_kw == tk[:kind] && 'def' == tk[:text]) then return elsif :on_comment == tk[:kind] or :on_embdoc == tk[:kind] then return unless tk[:text] =~ /\s*:?([\w-]+):\s*(.*)/ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directives\n @directives ||= begin\n matches = []\n\n text.scan(DIRECTIVE_REGEXP) do\n offset = Regexp.last_match.offset(0)\n matches << loc.expression.adjust(begin_pos: offset.first)\n .with(end_pos: loc.expression...
[ "0.67958724", "0.6372087", "0.6111582", "0.6111582", "0.6073845", "0.60584867", "0.6036335", "0.5868041", "0.58358264", "0.5765031", "0.5479444", "0.5390216", "0.53359073", "0.524462", "0.5076944", "0.5047847", "0.5013514", "0.4956973", "0.49423024", "0.49123207", "0.49104103...
0.73283917
0
Handles directives following the definition for +context+ (any RDoc::CodeObject) if the directives are +allowed+ at this point. See also RDoc::Markup::PreProcesshandle_directive
def read_documentation_modifiers context, allowed skip_tkspace_without_nl directive, value = read_directive allowed return unless directive @preprocess.handle_directive '', directive, value, context do |dir, param| if %w[notnew not_new not-new].include? dir then context.dont_rename_initi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def look_for_directives_in context, comment\n @preprocess.handle comment, context do |directive, param|\n case directive\n when 'main' then\n @options.main_page = param\n ''\n when 'title' then\n @options.default_title = param if @options.respond_to? :default_title=\n ...
[ "0.6607004", "0.63881403", "0.57778007", "0.5447713", "0.53890866", "0.5350326", "0.5179142", "0.5079202", "0.50584435", "0.50584435", "0.50450236", "0.4935108", "0.4821722", "0.47424322", "0.4679924", "0.463413", "0.46032882", "0.45975214", "0.45559373", "0.4552361", "0.4546...
0.62406147
2
Records the location of this +container+ in the file for this parser and adds it to the list of classes and modules in the file.
def record_location container # :nodoc: case container when RDoc::ClassModule then @top_level.add_to_classes_or_modules container end container.record_location @top_level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file\n add FileCursor.new\n end", "def add_location_to_context(iLocation)\n # * *iLocation* (_String_): Directory\n $LOAD_PATH << iLocation\n end", "def record_location(top_level)\n @in_files << top_level unless @in_files.include?(top_level)\n end", "def record_location(top...
[ "0.5236287", "0.5221462", "0.5179875", "0.5179875", "0.51240057", "0.50877345", "0.5000053", "0.49362427", "0.49232125", "0.48551494", "0.48276913", "0.48256123", "0.47997227", "0.47880122", "0.4784349", "0.4784349", "0.47842932", "0.4757468", "0.47412", "0.4734427", "0.47247...
0.7418836
0
Scans this Ruby file for Ruby constructs
def scan reset catch :eof do begin parse_top_level_statements @top_level rescue StandardError => e if @content.include?('<%') and @content.include?('%>') then # Maybe, this is ERB. $stderr.puts "\033[2KRDoc detects ERB file. Skips it for compatibility:" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute!\n line_n = 0\n level = 0\n classes = []\n @source.each_line do |line|\n line_n += 1\n line.chomp!\n # indentify scopes\n level = line_level line\n\n # ignore comments!\n next if @comment_lines.include? line_n\n\n [\n [@class...
[ "0.67721796", "0.65552354", "0.64747727", "0.6470646", "0.6410685", "0.62785757", "0.6103886", "0.60892147", "0.6060944", "0.6055909", "0.59651256", "0.5936904", "0.59201336", "0.5903516", "0.58989704", "0.5897947", "0.58933234", "0.5887464", "0.5860573", "0.5839704", "0.5807...
0.6079539
8
while, until, and for have an optional do
def skip_optional_do_after_expression skip_tkspace_without_nl tk = get_tk b_nest = 0 nest = 0 loop do break unless tk case tk[:kind] when :on_semicolon, :on_nl, :on_ignored_nl then break if b_nest.zero? when :on_lparen then nest += 1 when :on_rparen th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_while(&blk)\n s = self.ensure_enum\n Enumerator.new do |out|\n while s.has_next?\n break unless blk.call(s.peek)\n out.yield s.next\n end\n end\n end", "def my_while(cond, &body)\n while cond.call\n body.call\n end\nend", "def do_until(&blk)\n s = self.ensure_en...
[ "0.75999665", "0.70625925", "0.7012288", "0.69138753", "0.6827395", "0.6763315", "0.66611606", "0.66258323", "0.6613375", "0.6600136", "0.65900344", "0.65806913", "0.65760857", "0.6532302", "0.65182006", "0.6496484", "0.641192", "0.63496786", "0.6348495", "0.6234113", "0.6225...
0.0
-1
skip the var [in] part of a 'for' statement
def skip_for_variable skip_tkspace_without_nl get_tk skip_tkspace_without_nl tk = get_tk unget_tk(tk) unless :on_kw == tk[:kind] and 'in' == tk[:text] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skippable_loop(skip: [], hash: false)\n @args.each_with_object(hash ? {} : []) do |(key, val), obj|\n next obj if skip_in_html?(key: key, val: val, skips: skip)\n yield(\n [\n key,\n val\n ],\n obj\n )\n end\n ...
[ "0.57100785", "0.56740445", "0.5418094", "0.5368285", "0.53305894", "0.5292543", "0.528546", "0.528546", "0.5268825", "0.5165807", "0.5156578", "0.51323617", "0.51065594", "0.5042904", "0.49984035", "0.49838307", "0.4970451", "0.49640712", "0.4949818", "0.4944321", "0.491515"...
0.6233386
0
Skips the next method in +container+
def skip_method container meth = RDoc::AnyMethod.new "", "anon" parse_method_parameters meth parse_statements container, false, meth end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip\n end", "def skip\n end", "def skips; end", "def skipped; end", "def skipped!; end", "def skip!\n not_implemented\n end", "def skip_method(a,b,c)\nend", "def _skip_next\n @index += 1\n\n self\n end", "def skip_leader\n raise NotImplementedError...
[ "0.6850338", "0.6850338", "0.66348577", "0.6540678", "0.6533494", "0.64541084", "0.6376682", "0.6333892", "0.6297025", "0.62625784", "0.62528247", "0.62349033", "0.6218549", "0.6218549", "0.61726546", "0.61726546", "0.61726546", "0.61726546", "0.60834724", "0.606774", "0.6062...
0.71386015
0
Skip spaces until a comment is found
def skip_tkspace_comment(skip_nl = true) loop do skip_nl ? skip_tkspace : skip_tkspace_without_nl next_tk = peek_tk return if next_tk.nil? || (:on_comment != next_tk[:kind] and :on_embdoc != next_tk[:kind]) get_tk end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_whitespace\n while @char =~ /[\\s,;#]/\n # Comments begin with a semicolon and extend to the end of the line\n # Treat #! as a comment for shebang lines\n if @char == ';' || (@char == '#' && peek_char == '!')\n while @char && @char != \"\\n\"\n next_char\n ...
[ "0.7509144", "0.7256787", "0.7104865", "0.69332004", "0.6794521", "0.67592555", "0.67581993", "0.6743178", "0.6730674", "0.6628303", "0.6561796", "0.6560144", "0.653662", "0.653662", "0.651041", "0.6509988", "0.6503041", "0.64853334", "0.6466457", "0.6398066", "0.63686025", ...
0.64469755
19
Updates visibility in +container+ from +vis_type+ and +vis+.
def update_visibility container, vis_type, vis, singleton # :nodoc: new_methods = [] case vis_type when 'module_function' then args = parse_symbol_arg container.set_visibility_for args, :private, false container.methods_matching args do |m| s_m = m.dup record_location s_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visible=(vis)\n if vis\n show\n else\n hide\n end\n end", "def update_visibility(attributes)\n interpret_visibility(attributes) # relies on CurationConcerns::ManagesEmbargoesActor to interpret and apply visibility\n end", "def modify_visibility\n @...
[ "0.61902505", "0.61479324", "0.6094971", "0.6069317", "0.6069317", "0.6058636", "0.5883041", "0.57759", "0.57391644", "0.5601422", "0.5600656", "0.5551539", "0.544247", "0.544247", "0.54253227", "0.54248476", "0.53699064", "0.5328227", "0.53186524", "0.53143907", "0.5239738",...
0.69680285
0
Prints +message+ to +$stderr+ unless we're being quiet
def warn message @options.warn make_message message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message(msg)\n $stdout.puts(msg) unless $options['quiet']\nend", "def report(message)\n puts message unless quiet? #or trial?\n end", "def err(message)\n stderr.puts message\n end", "def warn(message, color = :yellow)\n return if quiet?\n say(message, color)\n end", "def...
[ "0.7315755", "0.69214994", "0.661772", "0.65136826", "0.65077627", "0.6500099", "0.6472437", "0.6447302", "0.64242303", "0.6424012", "0.6414257", "0.6388734", "0.63283616", "0.6290802", "0.6282995", "0.6239091", "0.6229705", "0.6227951", "0.6226011", "0.6214857", "0.6194355",...
0.0
-1
Creates a new WEBrick servlet. Use +mount_path+ when mounting the servlet somewhere other than /. Use +extra_doc_dirs+ for additional documentation directories. +server+ is provided automatically by WEBrick when mounting. +stores+ and +cache+ are provided automatically by the servlet.
def initialize server, stores, cache, mount_path = nil, extra_doc_dirs = [] super server @cache = cache @mount_path = mount_path @extra_doc_dirs = extra_doc_dirs @stores = stores @options = RDoc::Options.new @options.op_dir = '.' darkfish_dir = nil # HACK dup $LOAD_P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_server\n begin\n require 'webrick'\n rescue LoadError\n abort \"webrick is not found. You may need to `gem install webrick` to install webrick.\"\n end\n\n server = WEBrick::HTTPServer.new :Port => @server\n\n extra_doc_dirs = @stores.map {|s| s.type == :extra ? s.path : nil}.com...
[ "0.6990185", "0.58074665", "0.55489016", "0.5547709", "0.5531563", "0.5497224", "0.54682857", "0.54607236", "0.536128", "0.5360634", "0.5223294", "0.51667196", "0.51583314", "0.51498145", "0.5146279", "0.5144472", "0.5140524", "0.5128239", "0.50611717", "0.50527775", "0.50173...
0.55275655
5
Serves the asset at the path in +req+ for +generator_name+ via +res+.
def asset generator_name, req, res asset_dir = @asset_dirs[generator_name] asset_path = File.join asset_dir, req.path if_modified_since req, res, asset_path res.body = File.read asset_path res.content_type = case req.path when /\.css\z/ then 'text/css' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serve_asset(asset_name)\n asset_path = local_asset_path(asset_name)\n\n # Rudimentary mime type detection\n mime = 'application/octet-stream'\n map = {\n 'ico' => 'image/vnd.microsoft.icon',\n 'png' => 'image/png',\n 'css' => 'text/css'\n ...
[ "0.63820755", "0.62234145", "0.61339116", "0.6040912", "0.5819967", "0.57977194", "0.57494354", "0.573101", "0.5678036", "0.5517204", "0.54119605", "0.53677946", "0.53659993", "0.53526753", "0.53366816", "0.5283897", "0.525769", "0.52282673", "0.5221869", "0.5208047", "0.5170...
0.7930759
0
GET request entry point. Fills in +res+ for the path, etc. in +req+.
def do_GET req, res req.path.sub!(/\A#{Regexp.escape @mount_path}/, '') if @mount_path case req.path when '/' then root req, res when '/js/darkfish.js', '/js/jquery.js', '/js/search.js', %r%^/css/%, %r%^/images/%, %r%^/fonts/% then asset :darkfish, req, res when '/js/navigation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(req)\n req = Request.new(req) if req.kind_of?(Hash)\n action = if req.kind_of?(Request) then req.action else '(string)' end\n debug(\"#{action}: #{req.inspect}\")\n begin\n res = get_response(req)\n info(\"#{action}: #{res.inspect}\")\n rescue Error::Casual => ex\...
[ "0.702806", "0.6978514", "0.6965742", "0.69291383", "0.69291383", "0.68339837", "0.68314826", "0.67630345", "0.67630345", "0.6753989", "0.6736863", "0.6734012", "0.6732959", "0.6725931", "0.66675067", "0.666445", "0.6652401", "0.6636592", "0.66131204", "0.65748817", "0.657298...
0.7266601
0
Fills in +res+ with the class, module or page for +req+ from +store+. +path+ is relative to the mount_path and is used to determine the class, module or page name (/RDoc/Servlet.html becomes RDoc::Servlet). +generator+ is used to create the page.
def documentation_page store, generator, path, req, res text_name = path.chomp '.html' name = text_name.gsub '/', '::' if klass = store.find_class_or_module(name) then res.body = generator.generate_class klass elsif page = store.find_text_page(name.sub(/_([^_]*)\z/, '.\1')) then res.body = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generator_for store\n generator = RDoc::Generator::Darkfish.new store, @options\n generator.file_output = false\n generator.asset_rel_path = '..'\n\n rdoc = RDoc::RDoc.new\n rdoc.store = store\n rdoc.generator = generator\n rdoc.options = @options\n\n @options.main_page = store.ma...
[ "0.55314493", "0.5088531", "0.49927816", "0.49114263", "0.4868726", "0.48330313", "0.46823105", "0.46088186", "0.46078342", "0.45895666", "0.4570177", "0.45207345", "0.45180017", "0.44889152", "0.44634587", "0.44633546", "0.44496423", "0.4448895", "0.44339493", "0.441946", "0...
0.64756805
0
Creates the JSON search index on +res+ for the given +store+. +generator+ must respond to \json_index to build. +req+ is ignored.
def documentation_search store, generator, req, res json_index = @cache[store].fetch :json_index do @cache[store][:json_index] = JSON.dump generator.json_index.build_index end res.content_type = 'application/javascript' res.body = "var search_data = #{json_index}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate\n debug_msg \"Generating JSON index\"\n\n debug_msg \" writing search index to %s\" % SEARCH_INDEX_FILE\n data = build_index\n\n return if @options.dry_run\n\n out_dir = @base_dir + @options.op_dir\n index_file = out_dir + SEARCH_INDEX_FILE\n\n FileUtils.mkdir_p index_file.dirnam...
[ "0.6193645", "0.54304993", "0.54260164", "0.5194951", "0.5147952", "0.5095658", "0.50393605", "0.50337964", "0.4975851", "0.4969537", "0.49575934", "0.49117023", "0.48543072", "0.48391065", "0.48109552", "0.47540995", "0.47097248", "0.46274447", "0.46261576", "0.4614251", "0....
0.73521817
0
Returns the RDoc::Store and path relative to +mount_path+ for documentation at +path+.
def documentation_source path _, source_name, path = path.split '/', 3 store = @stores[source_name] return store, path if store store = store_for source_name store.load_all @stores[source_name] = store return store, path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_for source_name\n case source_name\n when 'home' then\n RDoc::Store.new RDoc::RI::Paths.home_dir, :home\n when 'ruby' then\n RDoc::Store.new RDoc::RI::Paths.system_dir, :system\n when 'site' then\n RDoc::Store.new RDoc::RI::Paths.site_dir, :site\n when /\\Aextra-(\\d+)\\z/ t...
[ "0.599061", "0.59669024", "0.5714597", "0.5659187", "0.5500828", "0.5358129", "0.5348698", "0.53395283", "0.5324261", "0.5276761", "0.5275904", "0.52516043", "0.5251337", "0.51950425", "0.5194364", "0.5149756", "0.5135308", "0.5133742", "0.5118714", "0.51153195", "0.51119417"...
0.6741467
0
Generates an error page for the +exception+ while handling +req+ on +res+.
def error exception, req, res backtrace = exception.backtrace.join "\n" res.content_type = 'text/html' res.status = 500 res.body = <<-BODY <!DOCTYPE html> <html> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> <title>Error - #{ERB::Util.html_escape exception.class}</title> ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serve_exception(_exception); end", "def render_exception(e)\n @message = e.message\n @backtrace = e.backtrace\n\n response_erb = ERB.new(File.read(\"../lib/templates/rescue.html.erb\"))\n response_text = response_erb.result(binding)\n response = ['500', {'Content-type' => 'text/html'}, [respon...
[ "0.69052786", "0.68585616", "0.677678", "0.6734516", "0.6622825", "0.6571957", "0.649209", "0.645996", "0.64100546", "0.6408608", "0.6408211", "0.64016527", "0.6366947", "0.6316545", "0.6312417", "0.6284092", "0.62401587", "0.62363315", "0.61835825", "0.6179368", "0.6158391",...
0.74698365
0
Instantiates a Darkfish generator for +store+
def generator_for store generator = RDoc::Generator::Darkfish.new store, @options generator.file_output = false generator.asset_rel_path = '..' rdoc = RDoc::RDoc.new rdoc.store = store rdoc.generator = generator rdoc.options = @options @options.main_page = store.main @options...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store; shrine_class.new(store_key); end", "def generator(menu, theme=nil, options={})\r\n self.new( theme, menu, options)\r\n end", "def generator(menu, theme=nil, options={})\r\n self.new( theme, menu, options)\r\n end", "def initialize(gender=\"male\")\n self.gender = gen...
[ "0.5873638", "0.56850266", "0.56850266", "0.54292643", "0.5375117", "0.53489316", "0.5304897", "0.5289225", "0.5270506", "0.5260038", "0.5248652", "0.52389973", "0.5215759", "0.5153966", "0.5149246", "0.51428986", "0.5133785", "0.5133785", "0.5123366", "0.5079833", "0.5078673...
0.61121637
0
Handles the IfModifiedSince HTTP header on +req+ for +path+. If the file has not been modified a Not Modified response is returned. If the file has been modified a LastModified header is added to +res+.
def if_modified_since req, res, path = nil last_modified = File.stat(path).mtime if path res['last-modified'] = last_modified.httpdate return unless ims = req['if-modified-since'] ims = Time.parse ims unless ims < last_modified then res.body = '' raise WEBrick::HTTPStatus::NotModifie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_modified(time)\n response['Last-Modified'] = time\n if reqeust.env['HTTP_IF_MODIFIED_SINCE'] > time\n throw :halt, response\n end\nend", "def http_if_modified_since?(path)\n if since = request.env['HTTP_IF_MODIFIED_SINCE']\n begin\n require 'time'\n ...
[ "0.75117445", "0.7082384", "0.7024073", "0.6970804", "0.68916243", "0.68518764", "0.66428787", "0.6604622", "0.65964836", "0.65641993", "0.6527573", "0.6444327", "0.63494676", "0.6212827", "0.6089118", "0.6034832", "0.6023464", "0.5984043", "0.59787554", "0.5967075", "0.59501...
0.7978922
0
Returns an Array of installed documentation. Each entry contains the documentation name (gem name, 'Ruby Documentation', etc.), the path relative to the mount point, whether the documentation exists, the type of documentation (See RDoc::RI::Pathseach) and the filesystem to the RDoc::Store for the documentation.
def installed_docs extra_counter = 0 ri_paths.map do |path, type| store = RDoc::Store.new path, type exists = File.exist? store.cache_path case type when :gem then gem_path = path[%r%/([^/]*)/ri$%, 1] [gem_path, "#{gem_path}/", exists, type, path] when :system then...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def docs\n unless @docs\n @docs = []\n content().each_line do |l|\n next unless l =~ %r{/usr/share/doc/packages}\n @docs << l\n end\n end\n @docs\n end", "def docs\n @docs ||= []\n end", "def add_gem_paths\n require 'rubygems'\n gem_paths = []\n ...
[ "0.77624315", "0.6584109", "0.63396484", "0.6322593", "0.6309276", "0.6051748", "0.59611505", "0.5888744", "0.58785313", "0.58312553", "0.5789306", "0.5772147", "0.57182163", "0.5695582", "0.5673991", "0.56600004", "0.56600004", "0.5652004", "0.56240165", "0.5593366", "0.5556...
0.8343652
0
Returns a 404 page built by +generator+ for +req+ on +res+.
def not_found generator, req, res, message = nil message ||= "The page <kbd>#{ERB::Util.h req.path}</kbd> was not found" res.body = generator.generate_servlet_not_found message res.status = 404 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(req, res)\n route = match(req)\n if route\n route.run(req, res)\n else\n res.status = 404\n controller = Controller::Base.new(req, res)\n controller.render_content(\"404: Unable to find page '#{req.path}' \", 'text/html')\n end\n end", "def create_Not_Fo...
[ "0.6681289", "0.62889194", "0.6190302", "0.6181942", "0.6175605", "0.61623126", "0.61604464", "0.61059344", "0.6100097", "0.60373557", "0.6022043", "0.60128224", "0.600126", "0.5999842", "0.59879816", "0.5965302", "0.59334594", "0.59334594", "0.5933172", "0.59264237", "0.5924...
0.76317483
0
Enumerates the ri paths. See RDoc::RI::Pathseach
def ri_paths &block RDoc::RI::Paths.each true, true, true, :all, *@extra_doc_dirs, &block #TODO: pass extra_dirs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_paths\n found_paths = []\n \n explore(found_paths, nil, @start_node)\n \n found_paths\n end", "def each(&blk)\n Utils::Kernel.Array(self).each do |path|\n blk.call Utils::Kernel.Pathname(path).realpath\n end\n end", "def each_object_path (path=@basepath,...
[ "0.64634496", "0.6438699", "0.63313836", "0.6327356", "0.6298029", "0.62977695", "0.62977695", "0.62977695", "0.62977695", "0.62977695", "0.6281685", "0.62085557", "0.6202587", "0.6201695", "0.61941016", "0.6166267", "0.61604697", "0.6120448", "0.60584956", "0.60282683", "0.5...
0.76779735
0
Generates the root page on +res+. +req+ is ignored.
def root req, res generator = RDoc::Generator::Darkfish.new nil, @options res.body = generator.generate_servlet_root installed_docs res.content_type = 'text/html' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root\n get '/'\n end", "def root\n get \"/\"\n end", "def root\n get \"/\"\n end", "def run(req, res)\n route = match(req)\n if route\n route.run(req, res)\n else\n res.status = 404\n controller = Controller::Base.new(req, res)\n controll...
[ "0.6276187", "0.62235177", "0.62235177", "0.5989327", "0.5847257", "0.57532644", "0.5748748", "0.56703407", "0.5662295", "0.5643853", "0.56084186", "0.5526044", "0.5462702", "0.539875", "0.5310344", "0.5309652", "0.5307936", "0.53070384", "0.53023326", "0.5268981", "0.5262146...
0.7094283
0
Generates a search index for the root page on +res+. +req+ is ignored.
def root_search req, res search_index = [] info = [] installed_docs.map do |name, href, exists, type, path| next unless exists search_index << name case type when :gem gemspec = path.gsub(%r%/doc/([^/]*?)/ri$%, '/specifications/\1.gemspe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root req, res\n generator = RDoc::Generator::Darkfish.new nil, @options\n\n res.body = generator.generate_servlet_root installed_docs\n\n res.content_type = 'text/html'\n end", "def do_GET req, res\n req.path.sub!(/\\A#{Regexp.escape @mount_path}/, '') if @mount_path\n\n case req.path\n wh...
[ "0.6516037", "0.6407718", "0.6262238", "0.61197716", "0.6103933", "0.6084873", "0.6047586", "0.5933076", "0.5892537", "0.5877988", "0.58718425", "0.5869888", "0.5752134", "0.57462865", "0.5744155", "0.5711134", "0.5699755", "0.5693672", "0.5690775", "0.5690418", "0.56874925",...
0.7268798
0
Displays documentation for +req+ on +res+, whether that be HTML or some asset.
def show_documentation req, res store, path = documentation_source req.path if_modified_since req, res, store.cache_path generator = generator_for store case path when nil, '', 'index.html' then res.body = generator.generate_index when 'table_of_contents.html' then res.body = gene...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_GET req, res\n req.path.sub!(/\\A#{Regexp.escape @mount_path}/, '') if @mount_path\n\n case req.path\n when '/' then\n root req, res\n when '/js/darkfish.js', '/js/jquery.js', '/js/search.js',\n %r%^/css/%, %r%^/images/%, %r%^/fonts/% then\n asset :darkfish, req, res\n when ...
[ "0.6509233", "0.6417485", "0.6411939", "0.63999707", "0.629638", "0.6262149", "0.62395835", "0.6220973", "0.6220973", "0.6155404", "0.61314964", "0.59806186", "0.5940737", "0.5931754", "0.5914572", "0.58089", "0.5807903", "0.58012676", "0.5759946", "0.5744239", "0.5740555", ...
0.81036973
0
Returns an RDoc::Store for the given +source_name+ ('ruby' or a gem name).
def store_for source_name case source_name when 'home' then RDoc::Store.new RDoc::RI::Paths.home_dir, :home when 'ruby' then RDoc::Store.new RDoc::RI::Paths.system_dir, :system when 'site' then RDoc::Store.new RDoc::RI::Paths.site_dir, :site when /\Aextra-(\d+)\z/ then index ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def documentation_source path\n _, source_name, path = path.split '/', 3\n\n store = @stores[source_name]\n return store, path if store\n\n store = store_for source_name\n\n store.load_all\n\n @stores[source_name] = store\n\n return store, path\n end", "def find_store name\n @stores.each...
[ "0.7474501", "0.6692944", "0.6072944", "0.5483653", "0.5349324", "0.5312938", "0.5262103", "0.5162732", "0.51300406", "0.50677806", "0.50381386", "0.5012988", "0.4995547", "0.4993105", "0.49857777", "0.49788755", "0.49668333", "0.4940441", "0.49273977", "0.4895734", "0.488186...
0.8144301
0