当前位置: 首页>>代码示例>>PHP>>正文


PHP Token::getContent方法代码示例

本文整理汇总了PHP中Token::getContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Token::getContent方法的具体用法?PHP Token::getContent怎么用?PHP Token::getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Token的用法示例。


在下文中一共展示了Token::getContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: precedence

 /**
  * Verificação da Precedência
  * @param Token $tokenA Token para Verificação
  * @param Token $tokenB Token para Verificação
  * @throws Exception Token de Tipo Não Operador
  * @return int Comparação de Precedências dos Tokens
  */
 public function precedence($tokenA, $tokenB)
 {
     /* @todo Checar Precedência */
     $precedenceA = $this->_mapper[$tokenA->getContent()];
     $precedenceB = $this->_mapper[$tokenB->getContent()];
     return $precedenceA - $precedenceB;
 }
开发者ID:laiello,项目名称:wanderson,代码行数:14,代码来源:Parser.php

示例2: _getParseTokenFromToken

 protected function _getParseTokenFromToken(Token $token)
 {
     $code = $token->getCode();
     if ($code === "WHILE_START") {
         $code = "WHILE";
     }
     return new ParseToken($code, $token->getContent(), $token->getChar(), $token->getLine());
 }
开发者ID:relaxnow,项目名称:php-brain-fuck,代码行数:8,代码来源:Parser.php

示例3: nest

 /**
  * Given the set of matches, nest them according to their types
  *
  * @param \ArrayIterator $result Iterator of match results
  * @param  \SalesforceEng\Breakout\Token $latest Token instance
  * @return array Set of nested token instances (arrays)
  */
 public function nest(&$result, $latest = null)
 {
     $container = [];
     if (!$result instanceof \ArrayIterator) {
         $result = new \ArrayIterator($result);
     }
     while ($result->valid()) {
         $current = new Token($result->current());
         $result->next();
         if ($current->getType() == 'block') {
             // see if we're closing it out
             $content = trim($current->getContent());
             if ($content !== 'endif' && $content !== 'endfor' && $content !== 'else' && $content !== 'endraw') {
                 $group = [$current];
                 $found = $this->nest($result, $current);
                 $current = array_merge($group, $found);
             } else {
                 if ($latest !== null) {
                     $latestType = explode(' ', trim($latest->getContent()))[0];
                     if ($latestType == 'if' && trim($current->getContent()) == 'endif') {
                         $container[] = $current;
                         return $container;
                     } elseif ($latestType == 'for' && trim($current->getContent()) == 'endfor') {
                         $container[] = $current;
                         return $container;
                     } elseif ($latestType == 'raw' && trim($current->getContent()) == 'endraw') {
                         $container[] = $current;
                         return $container;
                     }
                 }
             }
         }
         $container[] = $current;
     }
     return $container;
 }
开发者ID:salesforceeng,项目名称:breakout,代码行数:43,代码来源:Tokenizer.php


注:本文中的Token::getContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。