Sha256: 32809ac793391123f716ad75824a5a1de0a7871e0785af77bdec27a9b358879f

Contents?: true

Size: 932 Bytes

Versions: 10

Compression:

Stored size: 932 Bytes

Contents

<?php

namespace CoffeeScript;

class yy_Slice extends yy_Base
{
  public $children = array('range');

  function constructor($range)
  {
    $this->range = $range;

    return $this;
  }

  function compile_node($options)
  {
    $to = $this->range->to;
    $from = $this->range->from;

    $from_str = $from ? $from->compile($options, LEVEL_PAREN) : '0';
    $compiled = $to ? $to->compile($options, LEVEL_PAREN) : '';

    if ($to && ! ( ! $this->range->exclusive && intval($compiled) === -1))
    {
      $to_str = ', ';

      if ($this->range->exclusive)
      {
        $to_str .= $compiled;
      }
      else if (preg_match(SIMPLENUM, $compiled))
      {
        $to_str .= (intval($compiled) + 1);
      }
      else
      {
        $compiled = $to->compile($options, LEVEL_ACCESS);
        $to_str .= "{$compiled} + 1 || 9e9";
      }
    }

    return ".slice({$from_str}".(isset($to_str) ? $to_str : '').')';
  }
}

?>

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
guard-mthaml-0.4.0 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php
guard-mthaml-0.3.1 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php
guard-mthaml-0.3.0 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php
guard-mthaml-0.2.5 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php
guard-mthaml-0.2.4 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php
guard-mthaml-0.2.3 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php
guard-mthaml-0.2.2 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php
guard-mthaml-0.2.1 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php
guard-mthaml-0.2.0 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php
guard-mthaml-0.1.0 vendor/coffeescript/coffeescript/src/CoffeeScript/yy/Slice.php