pike.git / lib / modules / Parser.pmod / Pike.pmod

version» Context lines:

pike.git/lib/modules/Parser.pmod/Pike.pmod:1:   //   // This file needs to support old pikes that e.g. don't understand   // "#pike". Some of them fail when they see an unknown cpp directive.   //   // #pike __REAL_VERSION__   // - // $Id: Pike.pmod,v 1.38 2005/03/24 16:52:56 nilsson Exp $ + // $Id: Pike.pmod,v 1.39 2005/04/10 17:53:22 nilsson Exp $      //! This module parses and tokenizes Pike source code.      inherit "C.pmod";      array(string) low_split(string data, void|mapping state)   {    if(state && state->remains)    data = m_delete(state, "remains") + data;    array ret;
pike.git/lib/modules/Parser.pmod/Pike.pmod:29:   //! tokens. If the optional argument @[state] is provided the split   //! function is able to pause and resume splitting inside #"" and   //! /**/ tokens. The @[state] argument should be an initially empty   //! mapping, in which split will store its state between successive   //! calls.   array(string) split(string data, void|mapping state) {    array r = low_split(data, state);       array new = ({});    for(int i; i<sizeof(r); i++) -  if(r[i][..2]=="//") { -  new += ({ r[i]+"\n" }); -  i++; -  } +  if(r[i][..1]=="//" && r[i][-1]=='\n') +  new += ({ r[i][..<1], "\n" });    else    new += ({ r[i] });       if(sizeof(new) && (< "\n", " " >)[new[-1]])    new[-1] += "\n";    else    new += ({ "\n" });    return new;   }