pike.git / lib / modules / Tools.pmod / Standalone.pmod / autodoc_to_html.pike

version» Context lines:

pike.git/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike:475:    rows += ({ ({ elems, parse_text(d->get_first_element("text")) }) });    else    rows += ({ ({ elems }) });    }    nicebox(rows, ret);   }      // type(min..max)   string range_type( string type, Node min, Node max )   { -  if( !min && !max ) +  // Work with plain text; if there's no node, that's the same as an empty node. +  string min_text = min ? parse_text(min) : ""; +  string max_text = max ? parse_text(max) : ""; +  if( min_text == "" && max_text == "" )    return type; -  if( !min ) -  return type+"(.."+parse_text(max)+")"; -  if( !max ) -  return type+"("+parse_text(min)+"..)"; +  if( min_text == "" ) +  return type+"(.."+max_text+")"; +  if( max_text == "" ) +  return type+"("+min_text+"..)";    -  int low = (int)parse_text(min); -  int high = (int)parse_text(max); +  int low = (int)min_text; +  int high = (int)max_text;    -  if( low == 0 && (high+1)->popcount() == 1 ) +  if( low == 0 && high && (high+1)->popcount() == 1 )    {    return type+"("+strlen((high)->digits(2))+"bit)";    }    return type+"("+low+".."+high+")";   }      //! Typically called with a <group/> node or a sub-node that is a container.   string parse_text(Node n, void|String.Buffer ret) {    if(n->get_node_type()==XML_TEXT && n->get_text()) {    if(ret)