static function translateSimpleExpSegs (array $segments)
  {
    if (count ($segments) == 1) {
      $seg = $segments[0];

      if ($seg[0] == '#')
        return sprintf ('%s->renderBlock("%s")', self::BINDER_PARAM, substr ($seg, 1));

      PhpCode::evalConstant ($seg, $ok);
      if ($ok) return $seg;
      if (is_callable ($seg))
        return "$seg()";
    }

    $exp   = self::BINDER_PARAM;
    $unary = '';
    foreach ($segments as $i => $seg) {
      if ($i)
        $exp = $seg[0] == '@'
          ? sprintf ('_g(%s,%s)', $exp, self::compileReadProp ($seg))
          : "_g($exp, '" . trim ($seg, "'\"") . "')";
      else {
        list (, $unary, $seg) = str_match ($seg, '/^(!*)(.*)/', 2);
        // If not a constant value, convert it to a property access expression fragment.
        if ($seg[0] == '"' || $seg[0] == "'" || ctype_digit ($seg))
          $exp = $seg;
        else $exp = $seg[0] == '@'
          ? self::compileReadProp ($seg)
          : $exp = "_g($exp,'$seg')";
      }
    }
    $exp = "$unary$exp";
    if (!PhpCode::validateExpression ($exp))
      throw new DataBindingException(sprintf ("Invalid expression <kbd>%s</kbd>.<p>Evaluating <kbd>%s</kbd></p>", implode ('.', $segments), $exp));
    return $exp;
  }
static function translateSimpleExpSegs (array $segments)
  {
    if (count ($segments) == 1) {
      $seg = $segments[0];

      if ($seg[0] == '#')
        return sprintf ('%s->renderBlock("%s")', self::BINDER_PARAM, substr ($seg, 1));

      PhpCode::evalConstant ($seg, $ok);
      if ($ok) return $seg;
      if (is_callable ($seg))
        return "$seg()";
    }

    $exp   = self::BINDER_PARAM;
    $unary = '';
    foreach ($segments as $i => $seg) {
      if ($i)
        $exp = $seg[0] == '@'
          ? sprintf ('_g(%s,%s)', $exp, self::compileReadProp ($seg))
          : "_g($exp, '" . trim ($seg, "'\"") . "')";
      else {
        list (, $unary, $seg) = str_match ($seg, '/^(!*)(.*)/', 2);
        // If not a constant value, convert it to a property access expression fragment.
        if ($seg[0] == '"' || $seg[0] == "'" || ctype_digit ($seg))
          $exp = $seg;
        else $exp = $seg[0] == '@'
          ? self::compileReadProp ($seg)
          : $exp = "_g($exp,'$seg')";
      }
    }
    $exp = "$unary$exp";
    if (!PhpCode::validateExpression ($exp))
      throw new DataBindingException(sprintf ("Invalid expression <kbd>%s</kbd>.<p>Evaluating <kbd>%s</kbd></p>", implode ('.', $segments), $exp));
    return $exp;
  }
static function translateSimpleExpSegs ( array $ segments ) { if ( count ( $ segments ) == 1 ) { $ seg = $ segments [ 0 ] ; if ( $ seg [ 0 ] == '#' ) return sprintf ( '%s->renderBlock("%s")' , self :: BINDER_PARAM , substr ( $ seg , 1 ) ) ; PhpCode :: evalConstant ( $ seg , $ ok ) ; if ( $ ok ) return $ seg ; if ( is_callable ( $ seg ) ) return "$seg()" ; } $ exp = self :: BINDER_PARAM ; $ unary = '' ; foreach ( $ segments as $ i => $ seg ) { if ( $ i ) $ exp = $ seg [ 0 ] == '@' ? sprintf ( '_g(%s,%s)' , $ exp , self :: compileReadProp ( $ seg ) ) : "_g($exp, '" . trim ( $ seg , "'\"" ) . "')" ; else { list ( , $ unary , $ seg ) = str_match ( $ seg , '/^(!*)(.*)/' , 2 ) ; // If not a constant value, convert it to a property access expression fragment. if ( $ seg [ 0 ] == '"' || $ seg [ 0 ] == "'" || ctype_digit ( $ seg ) ) $ exp = $ seg ; else $ exp = $ seg [ 0 ] == '@' ? self :: compileReadProp ( $ seg ) : $ exp = "_g($exp,'$seg')" ; } } $ exp = "$unary$exp" ; if ( ! PhpCode :: validateExpression ( $ exp ) ) throw new DataBindingException ( sprintf ( "Invalid expression <kbd>%s</kbd>.<p>Evaluating <kbd>%s</kbd></p>" , implode ( '.' , $ segments ) , $ exp ) ) ; return $ exp ; }
Pre-compiles the given simple binding expression.

<p>Simple expressions do not have operators or filters. They are comprised of constants or property access chains
only.

<p>**Ex:** `'a.b.c'`, `'123'`, `'"text"'`, `'false'`, `'Class::constant'`, '&#64;prop', `'#block'`.

> <p>**Note:** simple expressions are used on the main part of a databinding expression and as expression filter
arguments.

@param string[] $segments Expression segments split by dot.
@return string
@throws DataBindingException
Pre - compiles the given simple binding expression .