pike.git / lib / modules / __builtin.pmod / Range.pike

version» Context lines:

pike.git/lib/modules/__builtin.pmod/Range.pike:4:   //! Generic lightweight range type.   //! @note   //! Can only contain a single contiguous range.      //!   mixed from;      //!   mixed till;    - //! + //! @param from + //! Lower inclusive limit for the interval. Specify no lower-limit + //! by filling in @expr{-Math.inf@}. + //! @param till + //! Upper exclusive limit for the interval. Specify no upper-limit + //! by filling in @expr{Math.inf@}. + //! @seealso + //! [Math.inf]   protected variant void create(mixed from, mixed till) {    this::from = from;    this::till = till;   }   protected variant void create(object/*this_program*/ copy) {    from = copy->from;    till = copy->till;   }   protected variant void create() {   }
pike.git/lib/modules/__builtin.pmod/Range.pike:69:      protected int(0..1) `==(mixed that) {    return objectp(that)    && from == ([object]that)->from && till == ([object]that)->till;   }      //!   protected mixed cast(string to) {    if (to == "string")    return from >= till ? "empty" : sprintf("%c%s,%s)", -  from == Val.neginfty ? '(' : '[', (string)from, (string)till); +  from == -Math.inf ? '(' : '[', from == -Math.inf ? "" : (string)from, +  till == Math.inf ? "" : (string)till);    return UNDEFINED;   }      protected string _sprintf(int fmt, mapping(string:mixed) params) {    switch (fmt) {    case 'O': return sprintf("this_program( %s )", (string)this);    case 's': return (string)this;    }    return sprintf(sprintf("%%*%c", fmt), params, 0);   }