query
stringlengths
7
9.5k
document
stringlengths
10
1.07M
negatives
listlengths
19
19
metadata
dict
Creates an RDoc::Markup::ListItem by parsing the `unparsed` content from the first parsing pass.
def list_item_from unparsed parsed = inner_parse unparsed.join RDoc::Markup::ListItem.new nil, *parsed end
[ "def [](idx)\n Object::PageObject::Elements::ListItem.new(children[idx])\n end", "def build_list_item indent, item_type = nil\n p :list_item_start => [indent, item_type] if @debug\n\n list_item = RDoc::Markup::ListItem.new item_type\n\n until @tokens.empty? do\n type, data, column = get\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stores `label` as a note and fills in previously unknown note references.
def note label #foottext = "rdoc-label:foottext-#{label}:footmark-#{label}" #ref.replace foottext if ref = @unlinked_notes.delete(label) @notes[label] = foottext #"{^1}[rdoc-label:footmark-#{label}:foottext-#{label}] " end
[ "def add_label(label)\n @label_by_id[label.id] = label if !@label_by_id.include?(label.id)\n end", "def label=(new_label)\r\n @label = new_label\r\n end", "def label=(lab) @label = lab end", "def label(label = nil)\n @label = label if label\n @label\n end", "def add_label label\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new link for the footnote `reference` and adds the reference to the note order list for proper display at the end of the document.
def note_for ref @note_order << ref label = @note_order.length "{*#{label}}[rdoc-label:foottext-#{label}:footmark-#{label}]" end
[ "def action_insert_link_ref\n if @lines[-1] && @last_link_index\n @lines[-1] << '[%d]' % @last_link_index\n end\n end", "def footnote_ref(number)\n ref = number.to_s\n return \"<sup id='fnref#{ref}'>\n <a href='javascript: void(0)' data-toggle='popover' data-co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
:nodoc: Creates an RDoc::Markup::Paragraph from `parts` and including extensionspecific behavior
def paragraph parts parts = parts.map do |part| if "\n" == part then RDoc::Markup::HardBreak.new else part end end if break_on_newline? RDoc::Markup::Paragraph.new(*parts) end
[ "def parse_paragraph; end", "def part(partspec, params = {})\n params[:session] ||= current_session\n pebbles.parts.markup(partspec, params)\n end", "def parse_paragraph_from(p_node)\r\n Elements::Containers::Paragraph.new(p_node)\r\n end", "def parse_paragraph_from(p_node)\n E...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stores `label` as a reference to `link` and fills in previously unknown link references.
def reference label, link if ref = @unlinked_references.delete(label) then ref.replace link end @references[label] = link end
[ "def resolve_link(label)\n label = label.to_sym unless label.nil?\n lnk = @links[label] || @links[nil]\n return nil if lnk.nil?\n set_link_target(lnk) if lnk.target.nil?\n lnk\n end", "def link(label, target, op, flow_name=nil)\n label = label.to_sym unless label.nil?\n op = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wraps `text` in strike markup for rdoc inline formatting
def strike text if text =~ /\A[a-z\d.\/-]+\z/i then "~#{text}~" else "<s>#{text}</s>" end end
[ "def wrapText; end", "def wrap_text(text,wrapper)\n wrapped_text = \"#{wrapper}#{text}#{wrapper}\"\nend", "def double_emphasis(text)\n \"<strong>#{do_not_break_string(text)}</strong>\"\n end", "def custom_markdown(text)\n wrap_quotes(text)\n end", "def wrap(text)\n return text if @done\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SetextHeading = (SetextHeading1 | SetextHeading2)
def _SetextHeading _save = self.pos while true # choice _tmp = apply(:_SetextHeading1) break if _tmp self.pos = _save _tmp = apply(:_SetextHeading2) break if _tmp self.pos = _save break end # end choice set_failed_rule :_SetextHeading unless _tmp return _t...
[ "def _Heading\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_SetextHeading)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_AtxHeading)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_Heading unless _tmp\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Heading = (SetextHeading | AtxHeading)
def _Heading _save = self.pos while true # choice _tmp = apply(:_SetextHeading) break if _tmp self.pos = _save _tmp = apply(:_AtxHeading) break if _tmp self.pos = _save break end # end choice set_failed_rule :_Heading unless _tmp return _tmp end
[ "def _SetextHeading\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_SetextHeading1)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_SetextHeading2)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_SetextHeading unless ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlAnchor = HtmlOpenAnchor (HtmlAnchor | !HtmlCloseAnchor .) HtmlCloseAnchor
def _HtmlAnchor _save = self.pos while true # sequence _tmp = apply(:_HtmlOpenAnchor) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlAnchor) break if _tmp self.pos ...
[ "def anchor; end", "def anchor(anchor_name)\n \"<a name='#{anchor_name}'></a>\"\n end", "def is_anchor?\n start_with?('#')\n end", "def anchor(anchor_name, options = {})\n tag(:a, options.merge(:name => anchor_name)) do\n \"\"\n end\n end", "def anchors; end", "def anch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockAddress = HtmlBlockOpenAddress (HtmlBlockAddress | !HtmlBlockCloseAddress .) HtmlBlockCloseAddress
def _HtmlBlockAddress _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenAddress) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockAddress) break if _tmp ...
[ "def is_block_element; false; end", "def _HtmlBlockInTags\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_HtmlAnchor)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockAddress)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockBlockquote)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockCenter = HtmlBlockOpenCenter (HtmlBlockCenter | !HtmlBlockCloseCenter .) HtmlBlockCloseCenter
def _HtmlBlockCenter _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenCenter) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockCenter) break if _tmp ...
[ "def layout_full_center\n nil\n end", "def activate_centering\n @center = true\n self\n end", "def center\n\t\t@sub_cursor = SUB_NONE\n\tend", "def center_horizontally(hcenter = nil)\n if hcenter.nil?\n @hcenter = 1\n else\n @hcenter = hcenter\n end\n end", "def center_horizon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockDir = HtmlBlockOpenDir (HtmlBlockDir | !HtmlBlockCloseDir .) HtmlBlockCloseDir
def _HtmlBlockDir _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenDir) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockDir) break if _tmp sel...
[ "def close_directory(baton)\n @indent.chop!\n end", "def goto_dir\n return\nend", "def bp_mock_directory_index\n\n tree_hash = BP.same_level_views(\"/mocks\")\n\n out = \"<ul>\"\n\n tree_hash.keys.each do |tree_hash_key|\n thk = tree_hash_key.gsub(\".html.erb\", \"\")\n thk = thk.gsub(\"/mocks...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockDiv = HtmlBlockOpenDiv (HtmlBlockDiv | !HtmlBlockCloseDiv .) HtmlBlockCloseDiv
def _HtmlBlockDiv _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenDiv) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockDiv) break if _tmp sel...
[ "def is_block_element; false; end", "def html_blocklike_show(title, content)\n render('layouts/block', :title => title, :content => content) unless content.blank?\n end", "def snippet_tag\n :div\n end", "def conditional_div(condition, attributes, &block)\n if condition\n haml_tag :di...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockDl = HtmlBlockOpenDl (HtmlBlockDl | !HtmlBlockCloseDl .) HtmlBlockCloseDl
def _HtmlBlockDl _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenDl) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockDl) break if _tmp self.p...
[ "def _HtmlBlockDd\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenDd)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockDd)\n break if _t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockFieldset = HtmlBlockOpenFieldset (HtmlBlockFieldset | !HtmlBlockCloseFieldset .) HtmlBlockCloseFieldset
def _HtmlBlockFieldset _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenFieldset) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockFieldset) break if _tm...
[ "def form_fieldset(&block)\n klass = \"fieldset\"\n content_tag(:fieldset, capture(&block), class: klass)\n end", "def html_fieldset\n content_tag(:fieldset,\n html_legend <<\n content_tag(:table, \n content_tag(:tr,\n content_tag(:td, html_filters) <<\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockForm = HtmlBlockOpenForm (HtmlBlockForm | !HtmlBlockCloseForm .) HtmlBlockCloseForm
def _HtmlBlockForm _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenForm) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockForm) break if _tmp ...
[ "def page_wrapping_form *args, &block\n f = nil\n content_for :content_wrapper_top do\n raw simple_form_for(*args){ |frm| f = frm }.gsub(\"</form>\", \"\")\n end\n content_for :content_wrapper_bottom do \n raw \"</form>\"\n end\n yield f\n end", "def start_form_block (params = {})\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockH1 = HtmlBlockOpenH1 (HtmlBlockH1 | !HtmlBlockCloseH1 .) HtmlBlockCloseH1
def _HtmlBlockH1 _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenH1) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockH1) break if _tmp self.p...
[ "def html_blocklike_show(title, content)\n render('layouts/block', :title => title, :content => content) unless content.blank?\n end", "def widget_header_html(&block)\n @widget_options[:header_html] = content_tag :div, capture(&block), :class => :header_right\n end", "def _HtmlBlockH2\n\n _save = s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockH2 = HtmlBlockOpenH2 (HtmlBlockH2 | !HtmlBlockCloseH2 .) HtmlBlockCloseH2
def _HtmlBlockH2 _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenH2) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockH2) break if _tmp self.p...
[ "def toggle_block(options={}, &block)\n visible = options.has_key?(:visible) ? options[:visible] : true\n escapable = options.has_key?(:escapable) ? options[:escapable] : false\n out = \"<span class='toggle_block'>\"\n if options[:handle]\n out << \"<span class='toggle_block_content'>#{capture(visi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockH3 = HtmlBlockOpenH3 (HtmlBlockH3 | !HtmlBlockCloseH3 .) HtmlBlockCloseH3
def _HtmlBlockH3 _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenH3) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockH3) break if _tmp self.p...
[ "def _HtmlBlockH2\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenH2)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockH2)\n break if _t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockH4 = HtmlBlockOpenH4 (HtmlBlockH4 | !HtmlBlockCloseH4 .) HtmlBlockCloseH4
def _HtmlBlockH4 _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenH4) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockH4) break if _tmp self.p...
[ "def _HtmlBlockH2\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenH2)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockH2)\n break if _t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockH5 = HtmlBlockOpenH5 (HtmlBlockH5 | !HtmlBlockCloseH5 .) HtmlBlockCloseH5
def _HtmlBlockH5 _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenH5) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockH5) break if _tmp self.p...
[ "def _HtmlBlockH6\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenH6)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockH6)\n break if _t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockH6 = HtmlBlockOpenH6 (HtmlBlockH6 | !HtmlBlockCloseH6 .) HtmlBlockCloseH6
def _HtmlBlockH6 _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenH6) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockH6) break if _tmp self.p...
[ "def _HtmlBlockH2\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenH2)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockH2)\n break if _t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockMenu = HtmlBlockOpenMenu (HtmlBlockMenu | !HtmlBlockCloseMenu .) HtmlBlockCloseMenu
def _HtmlBlockMenu _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenMenu) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockMenu) break if _tmp ...
[ "def menu_bar(&block)\n content_for :menue do\n MenuBar.new(&block).html\n end\n end", "def happy_menu(html_options={}, menu_options={}, &block)\n return unless block_given?\n \n updated_menu_options = menu_options.symbolize_keys.reverse_merge HappyMenu::Base.menu_options\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockNoframes = HtmlBlockOpenNoframes (HtmlBlockNoframes | !HtmlBlockCloseNoframes .) HtmlBlockCloseNoframes
def _HtmlBlockNoframes _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenNoframes) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockNoframes) break if _tm...
[ "def iframes; end", "def _HtmlBlockInTags\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_HtmlAnchor)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockAddress)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockBlockquote)\n break if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockNoscript = HtmlBlockOpenNoscript (HtmlBlockNoscript | !HtmlBlockCloseNoscript .) HtmlBlockCloseNoscript
def _HtmlBlockNoscript _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenNoscript) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockNoscript) break if _tm...
[ "def disable_js_markup; end", "def no_javascript # :nologin: :norobots:\n end", "def skip_html_injection=(_arg0); end", "def noscript_warning\n unless current_page?(:controller => 'pages', :action => 'no_javascript')\n <<-HTML\n<noscript>\n <meta http-equiv=\"refresh\" content=\"0; URL=#{url_for(:co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockOl = HtmlBlockOpenOl (HtmlBlockOl | !HtmlBlockCloseOl .) HtmlBlockCloseOl
def _HtmlBlockOl _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenOl) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockOl) break if _tmp self.p...
[ "def _HtmlBlockInTags\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_HtmlAnchor)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockAddress)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockBlockquote)\n break if _tmp\n self.pos =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockP = HtmlBlockOpenP (HtmlBlockP | !HtmlBlockCloseP .) HtmlBlockCloseP
def _HtmlBlockP _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenP) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockP) break if _tmp self.pos ...
[ "def is_block_element; false; end", "def _HtmlBlockNoscript\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenNoscript)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockPre = HtmlBlockOpenPre (HtmlBlockPre | !HtmlBlockClosePre .) HtmlBlockClosePre
def _HtmlBlockPre _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenPre) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockPre) break if _tmp sel...
[ "def pre_block\n end", "def process_pre_tag(pre)\n content_tag = pre.children.filter('code').first || pre\n lines = content_tag.inner_html.split(NEWLINE_REGEX, -1)\n\n pre.add_previous_sibling(lines.join(\"\\n\"))\n pre.remove\n end", "def _HtmlBlockNoscript\n\n _save = self.pos\n while tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockTable = HtmlBlockOpenTable (HtmlBlockTable | !HtmlBlockCloseTable .) HtmlBlockCloseTable
def _HtmlBlockTable _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenTable) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockTable) break if _tmp ...
[ "def build_table \n <<-HTML.strip_heredoc.html_safe\n <div class='table-me'>\n #{table_filters}\n <div class=\"table-me-table #{'with-filters' if table_builder.filters}\">\n #{table_pagination.pagination_info}\n <table>\n <thead>\n <tr>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockUl = HtmlBlockOpenUl (HtmlBlockUl | !HtmlBlockCloseUl .) HtmlBlockCloseUl
def _HtmlBlockUl _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenUl) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockUl) break if _tmp self.p...
[ "def _HtmlBlockLi\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenLi)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockLi)\n break if _t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockDd = HtmlBlockOpenDd (HtmlBlockDd | !HtmlBlockCloseDd .) HtmlBlockCloseDd
def _HtmlBlockDd _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenDd) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockDd) break if _tmp self.p...
[ "def _HtmlBlockInTags\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_HtmlAnchor)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockAddress)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockBlockquote)\n break if _tmp\n self.pos =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockDt = HtmlBlockOpenDt (HtmlBlockDt | !HtmlBlockCloseDt .) HtmlBlockCloseDt
def _HtmlBlockDt _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenDt) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockDt) break if _tmp self.p...
[ "def _HtmlBlockDd\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenDd)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockDd)\n break if _t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockLi = HtmlBlockOpenLi (HtmlBlockLi | !HtmlBlockCloseLi .) HtmlBlockCloseLi
def _HtmlBlockLi _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenLi) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockLi) break if _tmp self.p...
[ "def _HtmlBlockUl\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenUl)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockUl)\n break if _t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockTbody = HtmlBlockOpenTbody (HtmlBlockTbody | !HtmlBlockCloseTbody .) HtmlBlockCloseTbody
def _HtmlBlockTbody _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenTbody) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockTbody) break if _tmp ...
[ "def get_table_contents(&block)\n TableBodyDSL.new(&block).elements\n end", "def body(options = {}, &block)\n when_not_empty do\n reset_cell_count\n sanitize = options.delete(:sanitize) or false\n open_tag(start_tag(:tbody, options))\n \n @collection.each do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockTd = HtmlBlockOpenTd (HtmlBlockTd | !HtmlBlockCloseTd .) HtmlBlockCloseTd
def _HtmlBlockTd _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenTd) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockTd) break if _tmp self.p...
[ "def _HtmlBlockTbody\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenTbody)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockTbody)\n br...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockTh = HtmlBlockOpenTh (HtmlBlockTh | !HtmlBlockCloseTh .) HtmlBlockCloseTh
def _HtmlBlockTh _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenTh) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockTh) break if _tmp self.p...
[ "def widget_header_html(&block)\n @widget_options[:header_html] = content_tag :div, capture(&block), :class => :header_right\n end", "def toggle_block(options={}, &block)\n visible = options.has_key?(:visible) ? options[:visible] : true\n escapable = options.has_key?(:escapable) ? options[:escapable] : ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockThead = HtmlBlockOpenThead (HtmlBlockThead | !HtmlBlockCloseThead .) HtmlBlockCloseThead
def _HtmlBlockThead _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenThead) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockThead) break if _tmp ...
[ "def _HtmlBlockHead\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenHead)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _save3 = self.pos\n _tmp = apply(:_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockTr = HtmlBlockOpenTr (HtmlBlockTr | !HtmlBlockCloseTr .) HtmlBlockCloseTr
def _HtmlBlockTr _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenTr) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # choice _tmp = apply(:_HtmlBlockTr) break if _tmp self.p...
[ "def BlockTagNewTrTd(tdstyle = nil)\n mytr = BlockTag.new(\"tr\")\n mytd = BlockTagNewTd(tdstyle)\n return [mytr,mytd]\n end", "def tr(options = {}, &block)\n reset_cell_count\n options = {:object_html => @object}.merge(options)\n options.update(:class => odd_or_even) unless o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockScript = HtmlBlockOpenScript (!HtmlBlockCloseScript .) HtmlBlockCloseScript
def _HtmlBlockScript _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenScript) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # sequence _save3 = self.pos _tmp = apply(:_HtmlBlockCloseS...
[ "def _HtmlBlockNoscript\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenNoscript)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockNoscript)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockHead = HtmlBlockOpenHead (!HtmlBlockCloseHead .) HtmlBlockCloseHead
def _HtmlBlockHead _save = self.pos while true # sequence _tmp = apply(:_HtmlBlockOpenHead) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # sequence _save3 = self.pos _tmp = apply(:_HtmlBlockCloseHead)...
[ "def _HtmlBlockThead\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenThead)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockThead)\n br...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockInTags = (HtmlAnchor | HtmlBlockAddress | HtmlBlockBlockquote | HtmlBlockCenter | HtmlBlockDir | HtmlBlockDiv | HtmlBlockDl | HtmlBlockFieldset | HtmlBlockForm | HtmlBlockH1 | HtmlBlockH2 | HtmlBlockH3 | HtmlBlockH4 | HtmlBlockH5 | HtmlBlockH6 | HtmlBlockMenu | HtmlBlockNoframes | HtmlBlockNoscript | HtmlBlock...
def _HtmlBlockInTags _save = self.pos while true # choice _tmp = apply(:_HtmlAnchor) break if _tmp self.pos = _save _tmp = apply(:_HtmlBlockAddress) break if _tmp self.pos = _save _tmp = apply(:_HtmlBlockBlockquote) break if _tmp self.pos = _save _tmp...
[ "def parse_block_html; end", "def first_tag_is_a_block_tag(html)\n blockelems = [\"P\", \"H1\", \"H2\", \"H3\", \"H4\", \"H5\", \"H6\", \"OL\", \"UL\", \"PRE\", \"DL\", \"DIV\", \"NOSCRIPT\", \"BLOCKQUOTE\", \"FORM\", \"HR\", \"TABLE\", \"FIELDSET\", \"ADDRESS\"]\n r = /<(\\w+).*>/\n res = r.match(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlUnclosedType = ("HR" | "hr")
def _HtmlUnclosedType _save = self.pos while true # choice _tmp = match_string("HR") break if _tmp self.pos = _save _tmp = match_string("hr") break if _tmp self.pos = _save break end # end choice set_failed_rule :_HtmlUnclosedType unless _tmp return _tmp ...
[ "def hr\n \"<hr />\"\n end", "def hr\n \"<hr />\".html_safe\n end", "def hr\n \"<hr />\"\n end", "def display_two_items_w_hr( text1, text2 )\n html = String.new\n html += text1.to_s\n unless text2.blank?\n html += raw('<hr style=\"margin: 0.5em 0\"/>') \n html += text2.t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HtmlBlockType = ("ADDRESS" | "BLOCKQUOTE" | "CENTER" | "DD" | "DIR" | "DIV" | "DL" | "DT" | "FIELDSET" | "FORM" | "FRAMESET" | "H1" | "H2" | "H3" | "H4" | "H5" | "H6" | "HR" | "ISINDEX" | "LI" | "MENU" | "NOFRAMES" | "NOSCRIPT" | "OL" | "P" | "PRE" | "SCRIPT" | "TABLE" | "TBODY" | "TD" | "TFOOT" | "TH" | "THEAD" | "TR"...
def _HtmlBlockType _save = self.pos while true # choice _tmp = match_string("ADDRESS") break if _tmp self.pos = _save _tmp = match_string("BLOCKQUOTE") break if _tmp self.pos = _save _tmp = match_string("CENTER") break if _tmp self.pos = _save _tmp = ...
[ "def _HtmlBlockInTags\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_HtmlAnchor)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockAddress)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockBlockquote)\n break if _tmp\n self.pos =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
InStyleTags = StyleOpen (!StyleClose .) StyleClose
def _InStyleTags _save = self.pos while true # sequence _tmp = apply(:_StyleOpen) unless _tmp self.pos = _save break end while true _save2 = self.pos while true # sequence _save3 = self.pos _tmp = apply(:_StyleClose) _tmp = ...
[ "def close_script_style\n tag = @tag_stack.last\n\n # See http://www.w3.org/TR/xhtml1/#C_4 for character sequences not allowed within an element body.\n if @already =~ /<|&|\\]\\]>|--/\n new_already = script_style_cdata_start(tag)\n new_already << \"\\n\" unless @already.start_with?(\"\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Emph = (EmphStar | EmphUl)
def _Emph _save = self.pos while true # choice _tmp = apply(:_EmphStar) break if _tmp self.pos = _save _tmp = apply(:_EmphUl) break if _tmp self.pos = _save break end # end choice set_failed_rule :_Emph unless _tmp return _tmp end
[ "def _Emph\n\n begin # choice\n _tmp = apply(:_EmphStar)\n break if _tmp\n _tmp = apply(:_EmphUl)\n end while false # end choice\n\n set_failed_rule :_Emph unless _tmp\n return _tmp\n end", "def hr?\n hr_admin? || hr_supervisor? || hr_employee?\n end", "def or_hl\n end", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Strong = (StrongStar | StrongUl)
def _Strong _save = self.pos while true # choice _tmp = apply(:_StrongStar) break if _tmp self.pos = _save _tmp = apply(:_StrongUl) break if _tmp self.pos = _save break end # end choice set_failed_rule :_Strong unless _tmp return _tmp end
[ "def _Strong\n\n begin # choice\n _tmp = apply(:_StrongStar)\n break if _tmp\n _tmp = apply(:_StrongUl)\n end while false # end choice\n\n set_failed_rule :_Strong unless _tmp\n return _tmp\n end", "def strong(txt)\n enclose('strong', txt)\n end", "def antisymmetric?; end", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Link = (ExplicitLink | ReferenceLink | AutoLink)
def _Link _save = self.pos while true # choice _tmp = apply(:_ExplicitLink) break if _tmp self.pos = _save _tmp = apply(:_ReferenceLink) break if _tmp self.pos = _save _tmp = apply(:_AutoLink) break if _tmp self.pos = _save break end # end choice ...
[ "def link?\n type == LINK_TYPE\n end", "def link!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n type = LINK\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 159:8: 'link'\n m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ReferenceLink = (ReferenceLinkDouble | ReferenceLinkSingle)
def _ReferenceLink _save = self.pos while true # choice _tmp = apply(:_ReferenceLinkDouble) break if _tmp self.pos = _save _tmp = apply(:_ReferenceLinkSingle) break if _tmp self.pos = _save break end # end choice set_failed_rule :_ReferenceLink unless _tmp ...
[ "def _Link\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_ExplicitLink)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_ReferenceLink)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_AutoLink)\n break if _tmp\n self.pos = _save\n break\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SourceContents = ((!"(" !")" !">" Nonspacechar)+ | "(" SourceContents ")")
def _SourceContents while true _save1 = self.pos while true # choice _save2 = self.pos _save3 = self.pos while true # sequence _save4 = self.pos _tmp = match_string("(") _tmp = _tmp ? nil : true self.pos = _save4 unless _tmp ...
[ "def Paren(lparen, contents); end", "def on_paren(contents); end", "def on_mlhs_paren(contents); end", "def non_verbatim_text\n end", "def stringexpr \n\t\n\t$cst.add_branch(\"StringExpr\")\n\t\n\tmatch_token(\"T_QUOTE\", $tokens[$index])\n\tcharList\n\tmatch_token(\"T_QUOTE\", $tokens[$index])\n\n\t$cst.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AutoLink = (AutoLinkUrl | AutoLinkEmail)
def _AutoLink _save = self.pos while true # choice _tmp = apply(:_AutoLinkUrl) break if _tmp self.pos = _save _tmp = apply(:_AutoLinkEmail) break if _tmp self.pos = _save break end # end choice set_failed_rule :_AutoLink unless _tmp return _tmp end
[ "def auto_link(text)\n auto_link_email_addresses(auto_link_urls(text))\n end", "def auto_link(text, link = :all, href_options = {}, &block)\n return '' if text.blank?\n case link\n when :all then auto_link_email_addresses(auto_link_urls(text, href_options, &block), &bloc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RefTitle = (RefTitleSingle | RefTitleDouble | RefTitleParens | EmptyTitle)
def _RefTitle _save = self.pos while true # choice _tmp = apply(:_RefTitleSingle) break if _tmp self.pos = _save _tmp = apply(:_RefTitleDouble) break if _tmp self.pos = _save _tmp = apply(:_RefTitleParens) break if _tmp self.pos = _save _tmp = apply(:...
[ "def extended_title_from_doc doc, title\n alternativeTitle = alternative_title_from_doc doc\n if alternativeTitle != ''\n title += '<br/><br/>' + alternativeTitle\n end\n\n title\n end", "def title_comp; end", "def captioned_title\n %(#{@caption}#{title})\n end", "def full_title\n (de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
References = (Reference | SkipBlock)
def _References while true _save1 = self.pos while true # choice _tmp = apply(:_Reference) break if _tmp self.pos = _save1 _tmp = apply(:_SkipBlock) break if _tmp self.pos = _save1 break end # end choice break unless _tmp end ...
[ "def references = @references ||= ReferenceSet.new", "def block_reference_count; end", "def objects_with_references\n end", "def references\n @references ||= Comment.find(:all, :conditions => [\"(comments.commentable_type = ? AND comments.commentable_id = ?) AND comments.position IN (?)\", self.commenta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ticks1 = "`" !"`"
def _Ticks1 _save = self.pos while true # sequence _tmp = match_string("`") unless _tmp self.pos = _save break end _save1 = self.pos _tmp = match_string("`") _tmp = _tmp ? nil : true self.pos = _save1 unless _tmp self.pos = _save end...
[ "def appendTicks(ticks)\r\n\t\t@ticks.concat(ticks)\r\n\tend", "def _Ticks2\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"``\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = match_string(\"`\")\n _tmp = _tmp ? n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ticks2 = "``" !"`"
def _Ticks2 _save = self.pos while true # sequence _tmp = match_string("``") unless _tmp self.pos = _save break end _save1 = self.pos _tmp = match_string("`") _tmp = _tmp ? nil : true self.pos = _save1 unless _tmp self.pos = _save en...
[ "def _Ticks1\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"`\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = match_string(\"`\")\n _tmp = _tmp ? nil : true\n self.pos = _save1\n unless _tmp\n sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ticks3 = "```" !"`"
def _Ticks3 _save = self.pos while true # sequence _tmp = match_string("```") unless _tmp self.pos = _save break end _save1 = self.pos _tmp = match_string("`") _tmp = _tmp ? nil : true self.pos = _save1 unless _tmp self.pos = _save e...
[ "def _Ticks5\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"`````\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = match_string(\"`\")\n _tmp = _tmp ? nil : true\n self.pos = _save1\n unless _tmp\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ticks4 = "````" !"`"
def _Ticks4 _save = self.pos while true # sequence _tmp = match_string("````") unless _tmp self.pos = _save break end _save1 = self.pos _tmp = match_string("`") _tmp = _tmp ? nil : true self.pos = _save1 unless _tmp self.pos = _save ...
[ "def _Ticks5\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"`````\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = match_string(\"`\")\n _tmp = _tmp ? nil : true\n self.pos = _save1\n unless _tmp\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ticks5 = "`````" !"`"
def _Ticks5 _save = self.pos while true # sequence _tmp = match_string("`````") unless _tmp self.pos = _save break end _save1 = self.pos _tmp = match_string("`") _tmp = _tmp ? nil : true self.pos = _save1 unless _tmp self.pos = _save ...
[ "def _Ticks3\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"```\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = match_string(\"`\")\n _tmp = _tmp ? nil : true\n self.pos = _save1\n unless _tmp\n s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IndentedLine = Indent Line
def _IndentedLine _save = self.pos while true # sequence _tmp = apply(:_Indent) unless _tmp self.pos = _save break end _tmp = apply(:_Line) unless _tmp self.pos = _save end break end # end sequence set_failed_rule :_IndentedLine unless ...
[ "def indent(distance); end", "def indent_new_line\n tab_width > 0 ? (\"\\n\" + (' ' * tab_width * depth)) : ''\n end", "def relativeIndent; end", "def _OptionallyIndentedLine\n\n _save = self.pos\n while true # sequence\n _save1 = self.pos\n _tmp = apply(:_Indent)\n unless _tmp\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OptionallyIndentedLine = Indent? Line
def _OptionallyIndentedLine _save = self.pos while true # sequence _save1 = self.pos _tmp = apply(:_Indent) unless _tmp _tmp = true self.pos = _save1 end unless _tmp self.pos = _save break end _tmp = apply(:_Line) unless _tmp ...
[ "def _OptionallyIndentedLine\n\n _save = self.pos\n begin # sequence\n # optional\n _tmp = apply(:_Indent)\n _tmp = true # end optional\n break unless _tmp\n _tmp = apply(:_Line)\n end while false\n unless _tmp\n self.pos = _save\n end # end sequence\n\n set_failed_ru...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Notes = (Note | SkipBlock)
def _Notes while true _save1 = self.pos while true # choice _tmp = apply(:_Note) break if _tmp self.pos = _save1 _tmp = apply(:_SkipBlock) break if _tmp self.pos = _save1 break end # end choice break unless _tmp end _tmp = tru...
[ "def notes(filters={})\n get_blocks(\"Note\", filters)\n end", "def note\n value('NOTE')\n end", "def note_state\n state if note\n end", "def note\n value(\"NOTE\")\n end", "def body\n c = note.content and c =~ /.*\\n/ and $'\n end", "def note\n DBC.require( bu?, \"V...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attaches the +continuation+ of the previous line to the +entry_body+. Continued function listings are joined together as a single entry. Continued descriptions are joined to make a single paragraph.
def continue_entry_body entry_body, continuation return unless last = entry_body.last if last =~ /\)\s*\z/ and continuation =~ /\A\(/ then last.sub!(/\)\s*\z/, ',') continuation = continuation.sub(/\A\(/, '') end if last =~ /\s\z/ then last << continuation else last << ' ' ...
[ "def continue_entry_body entry_body, continuation\n return unless last = entry_body.last\n\n if last =~ /\\)\\s*\\z/ and continuation =~ /\\A\\(/ then\n last.sub!(/\\)\\s*\\z/, ',')\n continuation.sub!(/\\A\\(/, '')\n end\n\n if last =~ /\\s\\z/ then\n last << continuation\n else\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an RDoc::Markup::Document given the +groups+ of ChangeLog entries.
def create_document groups doc = RDoc::Markup::Document.new doc.omit_headings_below = 2 doc.file = @top_level doc << RDoc::Markup::Heading.new(1, File.basename(@file_name)) doc << RDoc::Markup::BlankLine.new groups.sort_by do |day,| day end.reverse_each do |day, entries| doc << RDoc::Mar...
[ "def join_groups(groups)\n groups.each do |lines|\n line = lines.first\n\n # Handle the case of multiple groups in a a row\n # if one is already replaced, move on\n next if @document[line.index].empty?\n\n # Join group into the first line\n @document[line.index] = Code...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a list of ChangeLog entries an RDoc::Markup nodes for the given +entries+.
def create_entries entries out = [] entries.each do |entry, items| out << RDoc::Markup::Heading.new(3, entry) out << RDoc::Markup::BlankLine.new out << create_items(items) end out end
[ "def entries\n return @options[:entries] unless @options == nil\n\n entries_xml = @xml.css('entry')\n\n entries_xml.map do |entry|\n OStatus::Entry.new(entry)\n end\n end", "def entries\n @entries ||= Scraper.instance.get_all(Entry, @path, [\n [:reflex, 'td[2]/text()'],\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an RDoc::Markup::List containing the given +items+ in the ChangeLog
def create_items items list = RDoc::Markup::List.new :NOTE items.each do |item| item =~ /\A(.*?(?:\([^)]+\))?):\s*/ title = $1 body = $' paragraph = RDoc::Markup::Paragraph.new body list_item = RDoc::Markup::ListItem.new title, paragraph list << list_item end list...
[ "def list(items)\n items = items.map do |item|\n new_item = {title: {text: item[:text], highlight: item[:highlight] || false}}\n new_item.merge!(description: item[:description]) unless item[:description].nil?\n new_item.merge!(label: item[:label]) unless item[:label].nil?\n new_item...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Groups +entries+ by date.
def group_entries entries @time_cache ||= {} entries.group_by do |title, _| begin time = @time_cache[title] (time || parse_date(title)).strftime '%Y-%m-%d' rescue NoMethodError, ArgumentError time, = title.split ' ', 2 parse_date(time).strftime '%Y-%m-%d' end ...
[ "def group\n records.group_by{|r| r[:date]}\n end", "def group_by_date(records)\n new_records = []\n\n records.each do |record|\n key = record.created_at.strftime(\"%Y-%m-%d\")\n record_group = new_records.collect { |records| records.last if records.first == key }.flatten.compact << record...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses the entries in the ChangeLog. Returns an Array of each ChangeLog entry in order of parsing. A ChangeLog entry is an Array containing the ChangeLog title (date and committer) and an Array of ChangeLog items (file and function changed with description). An example result would be:
def parse_entries @time_cache ||= {} if /\A((?:.*\n){,3})commit\s/ =~ @content class << self; prepend Git; end parse_info($1) return parse_entries end entries = [] entry_name = nil entry_body = [] @content.each_line do |line| case line when /^\s*$/ then ...
[ "def parse_changelog(changelog, latest_version_only, verbose)\n # split on the entry-separating lines\n changelog_entries = changelog.split(/\\n\\n+/)\n latest_version = nil # 1st version found is latest version\n prev_entry_date = nil\n changelogs = []\n changelog_entries.each do |entry|\n #...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the encoding magic comment from +text+
def remove_coding_comment text text.sub(/\A# .*coding[=:].*$/, '') end
[ "def strip_comments(text)\r\n text.gsub!(/<!--(.*?)-->[\\n]?/m, \"\")\r\n text.gsub!(/<!(.*?)>[\\n]?/m, \"\")\r\n return text\r\n end", "def without_comment_markers(text)\n text.to_s.lines.map do |line|\n line.strip.gsub(/^(\\s*(\\/\\*+|\\/\\/|\\*+\\/|\\*)+\\s?)/m, '')\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes private comments. Unlike RDoc::Commentremove_private this implementation only looks for two dashes at the beginning of the line. Three or more dashes are considered to be a rule and ignored.
def remove_private_comment comment # Workaround for gsub encoding for Ruby 1.9.2 and earlier empty = '' empty = RDoc::Encoding.change_encoding empty, comment.encoding comment = comment.gsub(%r%^--\n.*?^\+\+\n?%m, empty) comment.sub(%r%^--\n.*%m, empty) end
[ "def remove_private_comments(comment)\n comment.gsub!(/\\/?\\*--\\n(.*?)\\/?\\*\\+\\+/m, '')\n comment.sub!(/\\/?\\*--\\n.*/m, '')\n end", "def remove_private\n # Workaround for gsub encoding for Ruby 1.9.2 and earlier\n empty = ''\n empty = RDoc::Encoding.change_encoding empty, @text.encoding\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the token listener +obj+
def remove_token_listener(obj) @token_listeners.delete(obj) end
[ "def token_listener(obj)\n add_token_listener obj\n yield\n ensure\n remove_token_listener obj\n end", "def unregister(obj)\n if @observers.include?(obj) then \n @observers.delete_at(@observers.index(obj))\n @logger.debug \"Removed observing object #{obj} from the list\" if not self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Has +obj+ listen to tokens
def token_listener(obj) add_token_listener obj yield ensure remove_token_listener obj end
[ "def add_token_listener(obj)\n @token_listeners ||= []\n @token_listeners << obj\n end", "def receive_object(obj); end", "def save_token(obj)\n if @token\n @tokens ||= {}\n @tokens[obj.object_id] = @token\n end\n end", "def registered(obj)\n @obj = obj\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans content for rb_define_alias
def do_aliases @content.scan(/rb_define_alias\s*\( \s*(\w+), \s*"(.+?)", \s*"(.+?)" \s*\)/xm) do |var_name, new_name, old_name| class_name = @known_classes[var_name] unless class_name then @options.warn "Enclosing class...
[ "def do_aliases\n @content.scan(/%alias\\s+(\\w+)\\s+\"([^\"]+)\";/) do |old_name, new_name| # \"\n# class_name = @known_classes[var_name]\n#\n# unless class_name then\n# warn \"Enclosing class/module %p for alias %s %s not known\" % [\n# var_name, new_name, old_name]\n# next\n# ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans content for rb_attr and rb_define_attr
def do_attrs @content.scan(/rb_attr\s*\( \s*(\w+), \s*([\w"()]+), \s*([01]), \s*([01]), \s*\w+\);/xm) do |var_name, attr_name, read, write| handle_attr var_name, attr_name, read, write end @content.scan(%r%...
[ "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 if @content =~ %r%((?>/\\*.*?\\*/\\s+))\n rb_de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans content for boot_defclass
def do_boot_defclass @content.scan(/(\w+)\s*=\s*boot_defclass\s*\(\s*"(\w+?)",\s*(\w+?)\s*\)/) do |var_name, class_name, parent| parent = nil if parent == "0" handle_class_module(var_name, :class, class_name, parent, nil) end end
[ "def do_classes content\n found = false\n# puts \"do_classes #{content.inspect}\"\n content.scan(/%extend\\s+(\\w+)(.*)/m) do |class_name, ext_content|\n real_name = (@renames[class_name]) ? @renames[class_name][0] : nil\n klass = handle_class_module(class_name, \"class\", real_name, @module)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans content for rb_define_class, boot_defclass, rb_define_class_under and rb_singleton_class
def do_classes_and_modules do_boot_defclass if @file_name == "class.c" @content.scan( %r( (?<open>\s*\(\s*) {0} (?<close>\s*\)\s*) {0} (?<name>\s*"(?<class_name>\w+)") {0} (?<parent>\s*(?: (?<parent_name>[\w\*\s\(\)\.\->]+) | rb_path2class\s*\(\s*"(?<pa...
[ "def do_classes content\n found = false\n# puts \"do_classes #{content.inspect}\"\n content.scan(/%extend\\s+(\\w+)(.*)/m) do |class_name, ext_content|\n real_name = (@renames[class_name]) ? @renames[class_name][0] : nil\n klass = handle_class_module(class_name, \"class\", real_name, @module)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans content for rb_define_variable, rb_define_readonly_variable, rb_define_const and rb_define_global_const
def do_constants @content.scan(%r%\Wrb_define_ ( variable | readonly_variable | const | global_const ) \s*\( (?:\s*(\w+),)? \s*"(\w+)", \s*(...
[ "def do_constants\n # %constant <type>[*] <name> = <c-constant>;\n\n @content.scan(/(\\/\\*.*?\\*\\/)?\\s*%constant\\s+(\\w+)([\\s\\*]+)(\\w+)\\s*=\\s*(\\w+);/) do |comment, type, pointer, const_name, definition|\n# puts \"\\nConst #{const_name} : #{comment.inspect}\"\n handle_constants comment, con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans content for rb_include_module
def do_includes @content.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m| next unless cls = @classes[c] m = @known_classes[m] || m comment = new_comment '', @top_level, :c incl = cls.add_include RDoc::Include.new(m, comment) incl.record_location @top_level end end
[ "def defined_modules\n # TODO: check content type before scanning\n content.scan(/\\s*module\\s+([A-Za-z0-9_\\.]*)/).flatten\n end", "def find_includes source_raw\n source=scrub_source_file(source_raw).join(\"\\n\")\n #parse out includes\n includes = source.scan(/^\\s*#include\\s+\\\"\\s*(.+\\.[hH])\\s*...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scans content for rb_define_method, rb_define_singleton_method, rb_define_module_function, rb_define_private_method, rb_define_global_function and define_filetest_function
def do_methods @content.scan(%r%rb_define_ ( singleton_method | method | module_function | private_method ) \s*\(\s*([\w\.]+), \s*"([^"]+)"...
[ "def defined_methods\n # TODO: check content type before scanning\n content.scan(/\\s*def\\s+([A-Za-z0-9_\\.]*)/).flatten\n end", "def do_classes_and_modules\n do_boot_defclass if @file_name == \"class.c\"\n\n @content.scan(\n %r(\n (?<open>\\s*\\(\\s*) {0}\n (?<close>\\s*\\)\\s*) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the comment for an alias on +class_name+ from +new_name+ to +old_name+
def find_alias_comment class_name, new_name, old_name content =~ %r%((?>/\*.*?\*/\s+)) rb_define_alias\(\s*#{Regexp.escape class_name}\s*, \s*"#{Regexp.escape new_name}"\s*, \s*"#{Regexp.escape old_name}"\s*\);%xm new_comme...
[ "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}\"\\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds a comment for rb_define_attr, rb_attr or Documentattr. +var_name+ is the C class variable the attribute is defined on. +attr_name+ is the attribute's name. +read+ and +write+ are the read/write flags ('1' or '0'). Either both or neither must be provided.
def find_attr_comment var_name, attr_name, read = nil, write = nil attr_name = Regexp.escape attr_name rw = if read and write then /\s*#{read}\s*,\s*#{write}\s*/xm else /.*?/m end comment = if @content =~ %r%((?>/\*.*?\*/\s+)) rb_defi...
[ "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 if @content =~ %r%((?>/\\*.*?\\*/\\s+))\n rb_de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds a RDoc::NormalClass or RDoc::NormalModule for +raw_name+
def find_class(raw_name, name) unless @classes[raw_name] if raw_name =~ /^rb_m/ container = @top_level.add_module RDoc::NormalModule, name else container = @top_level.add_class RDoc::NormalClass, name end container.record_location @top_level @classes[raw_name] = contai...
[ "def find_class_or_module_named(symbol)\n RDoc::TopLevel.classes_hash.each_value do |c|\n return c if c.full_name == symbol\n end\n\n RDoc::TopLevel.modules_hash.each_value do |m|\n return m if m.full_name == symbol\n end\n\n nil\n end", "def get_complete_class_name(class_or_module, name...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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((?>.*?\*/)) }...
[ "def constants_table; end", "def make_const(prop, pairs, name)\n puts \"\\n/* '#{prop}': #{name} */\"\n puts \"static const OnigCodePoint CR_#{prop}[] = {\"\n # The first element of the constant is the number of pairs of codepoints\n puts \"\\t#{pairs.size},\"\n pairs.each do |pair|\n pair.map! { |c| c =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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] || ...
[ "def find_const_comment(type, const_name)\n if @body =~ %r{((?>^\\s*/\\*.*?\\*/\\s+))\n\t %constant\\s+(\\w+)\\s+#{const_name}\\s*=\\s*(\\w+)\\s*;}xmi\n $1\n elsif @body =~ %r{Document-(?:const|global|variable):\\s#{const_name}\\s*?\\n((?>.*?\\*/))}m\n $1\n else\n ''\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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
[ "def find_modifiers comment, meth_obj\n # we must handle situations like the above followed by an unindented first\n # comment. The difficulty is to make sure not to match lines starting\n # with ARGF at the same indent, but that are after the first description\n # paragraph.\n\n if comment =~ /call...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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 ...
[ "def find_override_comment class_name, meth_obj\n name = Regexp.escape meth_obj.name\n prefix = Regexp.escape meth_obj.name_prefix\n\n if @content =~ %r%Document-method:\\s+#{class_name}#{prefix}#{name}\\s*?\\n((?>.*?\\*/))%m then\n $1\n elsif @content =~ %r%Document-method:\\s#{name}\\s*?\\n((?>.*...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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_...
[ "def handle_attr(var_name, attr_name, read, write)\n rw = ''\n rw << 'R' if '1' == read\n rw << 'W' if '1' == write\n\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 return unless class_obj\n\n comment = find_attr_comme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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/ ...
[ "def nested_class( name, parent, &block )\n unless const_defined?( name ) then\n klass = Class.new( parent )\n klass.class_eval( &block ) if block_given?\n const_set( name , klass )\n end\n return const_get( name )\n end", "def create_class(classname, superclas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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...
[ "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...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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_...
[ "def handle_method(type, klass_name, meth_name, function, param_count, content = nil,\n source_file = nil)\n ruby_name = (@renames[meth_name]) ? @renames[meth_name][0] : meth_name\n# STDERR.puts \"\\n\\thandle_method #{type},#{klass_name},#{meth_name}[#{ruby_name}],#{function},#{param_count} a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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
[ "def register_instance(as_type, instance)\n @@class_registry[as_type.to_sym] = { instance: instance }\nend", "def register(klass)\n raise TypeError, \"Can only register classes\" unless klass.is_a? Class\n raise ArgumentError, \"To register, a class must have TYPE defined\" unless klass.const_defin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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
[ "def wrapt_styled_tabs_1(tabs)\n content = capture_haml do\n content_tag :div, class: 'wrapt-styled-tabs-1', role: 'tablist' do\n tabs.each do |tab|\n tab_classes = tab[:active] ? \"wrapt-styled-tabs-1__tab active\" : \"wrapt-styled-tabs-1__tab\"\n concat content_tag :div, bootstrap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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 ...
[ "def load(name = \"\")\n if @variables.has_key?(name)\n return @variables[name]\n else\n raise @err_class, name + \" is not defined!\"\n end\n end", "def load(name, env = default_environment)\n # This block autoloads appropriate file each time a missing macro is\n # requested from ha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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 ...
[ "def visit_comment(node); end", "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\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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 ...
[ "def rb_scan_args method_body\n method_body =~ /rb_scan_args\\((.*?)\\)/m\n return '(*args)' unless $1\n\n $1.split(/,/)[2] =~ /\"(.*?)\"/ # format argument\n format = $1.split(//)\n\n lead = opt = trail = 0\n\n if format.first =~ /\\d/ then\n lead = $&.to_i\n format.shift\n if form...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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
[ "def strip_comments ruby\n ruby.gsub!(/^[ \\t]*#[^{@$].*?\\r?\\n/, '')\n ruby.gsub!(/[ \\t]*#[^{@$].*?$/, '')\n ruby\n end", "def strip_comments\n\t\t# removes whole lines only, doesn't remove inline comments\n\t\tcode_to_be_obfu = ''\n\t\t@code.each_line do |line|\n\t\t\tif (not line =~ /^\\s*\\/\\// a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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
[ "def parse\n objectlist = []\n if !cfile?\n raise \"#{@fn} is not a Source C document!\"\n end\n blocklist = split_on_curlybrace0(@fn)\n\n # now we have the preamble + code, so let's split out the main remarks\n # The first block gets special treatment, so as to pull out the file\n # heade...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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
[ "def gsub(pattern, replacement = UNDEFINED, &block)\n if UNDEFINED.equal? replacement\n if block_given?\n copy_with @message.gsub(pattern, &block).freeze\n else\n enum_for(__method__)\n end\n else\n copy_with @message.gsub(pattern, replacement, &block).freeze\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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 ...
[ "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 ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Consumes trailing whitespace from the token stream
def consume_trailing_spaces # :nodoc: skip_tkspace_without_nl end
[ "def next_token_ignoring_whitespace\n t = @tokens.next\n while Tokens.ignore_whitespace?(t)\n t = @tokens.next\n end\n t\n end", "def parse_whitespace\n @lexer.next! while @lexer.get and @lexer.get.type == :whitespace\n true\n end", "def skip_whitespace...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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
[ "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...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
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
[ "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 = match_string(\"(\")\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }