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


PHP Parser::getLexer方法代码示例

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


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

示例1: parse

 /**
  * (non-PHPdoc)
  * @see \Doctrine\ORM\Query\AST\Functions\FunctionNode::parse()
  */
 public function parse(\Doctrine\ORM\Query\Parser $parser)
 {
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     do {
         $this->_aColumns[] = $parser->StateFieldPathExpression();
         $parser->match(Lexer::T_COMMA);
     } while ($parser->getLexer()->isNextToken(Lexer::T_IDENTIFIER));
     $this->_oNeedle = $parser->InParameter();
     while ($parser->getLexer()->isNextToken(Lexer::T_STRING)) {
         $this->_oMode = $parser->Literal();
     }
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:m3uzz,项目名称:onionfw,代码行数:18,代码来源:MatchAgainst.php

示例2: parse

 public function parse(\Doctrine\ORM\Query\Parser $parser)
 {
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     // Add the concat separator to the values array.
     $this->values[] = $parser->ArithmeticExpression();
     // Add the rest of the strings to the values array. CONCAT_WS must
     // be used with at least 2 strings not including the separator.
     $lexer = $parser->getLexer();
     while (count($this->values) < 3 || $lexer->lookahead['type'] == Lexer::T_COMMA) {
         $parser->match(Lexer::T_COMMA);
         $peek = $lexer->glimpse();
         $this->values[] = $peek['value'] == '(' ? $parser->FunctionDeclaration() : $parser->ArithmeticExpression();
     }
     while ($lexer->lookahead['type'] == Lexer::T_IDENTIFIER) {
         switch (strtolower($lexer->lookahead['value'])) {
             case 'notempty':
                 $parser->match(Lexer::T_IDENTIFIER);
                 $this->notEmpty = true;
                 break;
             default:
                 // Identifier not recognized (causes exception).
                 $parser->match(Lexer::T_CLOSE_PARENTHESIS);
                 break;
         }
     }
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:digvijaymohite,项目名称:e-tender,代码行数:28,代码来源:ConcatWs.php

示例3: parse

 /**
  * @override
  */
 public function parse(\Doctrine\ORM\Query\Parser $parser)
 {
     $lexer = $parser->getLexer();
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     if (strcasecmp('leading', $lexer->lookahead['value']) === 0) {
         $parser->match(Lexer::T_LEADING);
         $this->leading = true;
     } else {
         if (strcasecmp('trailing', $lexer->lookahead['value']) === 0) {
             $parser->match(Lexer::T_TRAILING);
             $this->trailing = true;
         } else {
             if (strcasecmp('both', $lexer->lookahead['value']) === 0) {
                 $parser->match(Lexer::T_BOTH);
                 $this->both = true;
             }
         }
     }
     if ($lexer->isNextToken(Lexer::T_STRING)) {
         $parser->match(Lexer::T_STRING);
         $this->trimChar = $lexer->token['value'];
     }
     if ($this->leading || $this->trailing || $this->both || $this->trimChar) {
         $parser->match(Lexer::T_FROM);
     }
     $this->stringPrimary = $parser->StringPrimary();
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:manish436,项目名称:zform,代码行数:32,代码来源:TrimFunction.php

示例4: parse

 /**
  * @param Parser $parser
  */
 public function parse(Parser $parser)
 {
     // match
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     // first Path Expression is mandatory
     $this->pathExp = array();
     $this->pathExp[] = $parser->StateFieldPathExpression();
     // Subsequent Path Expressions are optional
     $lexer = $parser->getLexer();
     while ($lexer->isNextToken(Lexer::T_COMMA)) {
         $parser->match(Lexer::T_COMMA);
         $this->pathExp[] = $parser->StateFieldPathExpression();
     }
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
     // against
     if (strtolower($lexer->lookahead['value']) !== 'against') {
         $parser->syntaxError('against');
     }
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     $this->against = $parser->StringPrimary();
     if (strtolower($lexer->lookahead['value']) === 'boolean') {
         $parser->match(Lexer::T_IDENTIFIER);
         $this->booleanMode = true;
     }
     if (strtolower($lexer->lookahead['value']) === 'expand') {
         $parser->match(Lexer::T_IDENTIFIER);
         $this->queryExpansion = true;
     }
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:Avazanga1,项目名称:Sylius,代码行数:35,代码来源:MatchAgainstFunction.php

示例5: parse

 public function parse(Parser $parser)
 {
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     $this->expressions[] = $parser->ArithmeticFactor();
     $lexer = $parser->getLexer();
     if ($lexer->lookahead['type'] === Lexer::T_COMMA) {
         $parser->match(Lexer::T_COMMA);
         $this->expressions[] = $parser->ArithmeticFactor();
     }
     if ($lexer->lookahead['type'] === Lexer::T_COMMA) {
         $parser->match(Lexer::T_COMMA);
         $this->expressions[] = $parser->ArithmeticFactor();
     }
     if ($lexer->lookahead['type'] === Lexer::T_COMMA) {
         $parser->match(Lexer::T_COMMA);
         $this->expressions[] = $parser->ArithmeticFactor();
     }
     if ($lexer->lookahead['type'] === Lexer::T_COMMA) {
         $parser->match(Lexer::T_COMMA);
         $this->expressions[] = $parser->ArithmeticFactor();
     }
     if ($lexer->lookahead['type'] === Lexer::T_COMMA) {
         $parser->match(Lexer::T_COMMA);
         $this->expressions[] = $parser->ArithmeticFactor();
     }
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:novikovsergey,项目名称:doctrine-postgis,代码行数:28,代码来源:ST_AsGML.php

示例6: parse

 /**
  * @override
  */
 public function parse(\Doctrine\ORM\Query\Parser $parser)
 {
     $lexer = $parser->getLexer();
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:nvdnkpr,项目名称:symfony-demo,代码行数:10,代码来源:CurrentDateFunction.php

示例7: parse

 /**
  * {@inheritdoc}
  */
 public function parse(Parser $parser)
 {
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     $this->parameters[self::PARAMETER_KEY] = $parser->ArithmeticPrimary();
     $parser->match(Lexer::T_AS);
     $parser->match(Lexer::T_IDENTIFIER);
     $lexer = $parser->getLexer();
     $type = $lexer->token['value'];
     if ($lexer->isNextToken(Lexer::T_OPEN_PARENTHESIS)) {
         $parser->match(Lexer::T_OPEN_PARENTHESIS);
         /** @var Literal $parameter */
         $parameter = $parser->Literal();
         $parameters = array($parameter->value);
         if ($lexer->isNextToken(Lexer::T_COMMA)) {
             while ($lexer->isNextToken(Lexer::T_COMMA)) {
                 $parser->match(Lexer::T_COMMA);
                 $parameter = $parser->Literal();
                 $parameters[] = $parameter->value;
             }
         }
         $parser->match(Lexer::T_CLOSE_PARENTHESIS);
         $type .= '(' . implode(', ', $parameters) . ')';
     }
     if (!$this->checkType($type)) {
         $parser->syntaxError(sprintf('Type unsupported. Supported types are: "%s"', implode(', ', $this->supportedTypes)), $lexer->token);
     }
     $this->parameters[self::TYPE_KEY] = $type;
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:sblmasta,项目名称:doctrine-extensions,代码行数:33,代码来源:Cast.php

示例8: parse

 /**
  * @inheritdoc
  */
 public function parse(Parser $parser)
 {
     $this->match = [];
     $this->mode = null;
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     $lexer = $parser->getLexer();
     for (;;) {
         $this->match[] = $parser->StateFieldPathExpression();
         if (!$lexer->isNextToken(Lexer::T_COMMA)) {
             break;
         }
         $parser->match(Lexer::T_COMMA);
     }
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
     if (strtoupper($lexer->lookahead['value']) !== 'AGAINST') {
         $parser->syntaxError('AGAINST');
     }
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     $this->against = $parser->StringPrimary();
     if ($lexer->isNextToken(Lexer::T_STRING)) {
         $parser->match(Lexer::T_STRING);
         $this->mode = $lexer->token['value'];
     }
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:brick,项目名称:brick,代码行数:30,代码来源:MatchAgainstFunction.php

示例9: parse

 /**
  * @url http://sysmagazine.com/posts/181666/
  *
  * {@inheritdoc}
  */
 public function parse(Parser $parser)
 {
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     $lexer = $parser->getLexer();
     if ($lexer->isNextToken(Lexer::T_DISTINCT)) {
         $parser->match(Lexer::T_DISTINCT);
         $this->parameters[self::DISTINCT_KEY] = true;
     }
     // first Path Expression is mandatory
     $this->parameters[self::PARAMETER_KEY] = array();
     $this->parameters[self::PARAMETER_KEY][] = $parser->SingleValuedPathExpression();
     while ($lexer->isNextToken(Lexer::T_COMMA)) {
         $parser->match(Lexer::T_COMMA);
         $this->parameters[self::PARAMETER_KEY][] = $parser->StringPrimary();
     }
     if ($lexer->isNextToken(Lexer::T_ORDER)) {
         $this->parameters[self::ORDER_KEY] = $parser->OrderByClause();
     }
     if ($lexer->isNextToken(Lexer::T_IDENTIFIER)) {
         if (strtolower($lexer->lookahead['value']) !== 'separator') {
             $parser->syntaxError('separator');
         }
         $parser->match(Lexer::T_IDENTIFIER);
         $this->parameters[self::SEPARATOR_KEY] = $parser->StringPrimary();
     }
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:Hikariii,项目名称:doctrine-extensions,代码行数:33,代码来源:GroupConcat.php

示例10: parse

 public function parse(\Doctrine\ORM\Query\Parser $parser)
 {
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     $lexer = $parser->getLexer();
     if ($lexer->isNextToken(Lexer::T_DISTINCT)) {
         $parser->match(Lexer::T_DISTINCT);
         $this->isDistinct = true;
     }
     // first Path Expression is mandatory
     $this->pathExp = array();
     $this->pathExp[] = $parser->SingleValuedPathExpression();
     while ($lexer->isNextToken(Lexer::T_COMMA)) {
         $parser->match(Lexer::T_COMMA);
         $this->pathExp[] = $parser->StringPrimary();
     }
     if ($lexer->isNextToken(Lexer::T_ORDER)) {
         $this->orderBy = $parser->OrderByClause();
     }
     if ($lexer->isNextToken(Lexer::T_IDENTIFIER)) {
         if (strtolower($lexer->lookahead['value']) !== 'separator') {
             $parser->syntaxError('separator');
         }
         $parser->match(Lexer::T_IDENTIFIER);
         $this->separator = $parser->StringPrimary();
     }
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:digvijaymohite,项目名称:e-tender,代码行数:28,代码来源:GroupConcat.php

示例11: parse

 /**
  * @param Parser $parser
  * @throws QueryException
  */
 public function parse(Parser $parser)
 {
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     $lexer = $parser->getLexer();
     if ($lexer->isNextToken(Lexer::T_DISTINCT)) {
         $parser->match(Lexer::T_DISTINCT);
         $this->isDistinct = true;
     }
     $this->pathExpressions[] = $parser->SingleValuedPathExpression();
     while ($lexer->isNextToken(Lexer::T_COMMA)) {
         $parser->match(Lexer::T_COMMA);
         $this->pathExpressions[] = $parser->StringPrimary();
     }
     if ($lexer->isNextToken(Lexer::T_ORDER)) {
         $this->orderBy = $parser->OrderByClause();
     }
     if ($lexer->isNextToken(Lexer::T_IDENTIFIER)) {
         if (strtolower($lexer->lookahead['value']) !== self::T_SEPARATOR) {
             $parser->syntaxError(self::T_SEPARATOR);
         }
         $parser->match(Lexer::T_IDENTIFIER);
         $this->separator = $parser->StringPrimary();
     }
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:Maksold,项目名称:platform,代码行数:30,代码来源:GroupConcat.php

示例12: parse

 /**
  * @override
  */
 public function parse(Parser $parser)
 {
     $lexer = $parser->getLexer();
     $parser->match(Lexer::T_IDENTIFIER);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     $this->stringPrimary = $parser->StringPrimary();
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:pepesalcedo,项目名称:SEIP,代码行数:11,代码来源:Md5.php

示例13: parse

 /**
  * @override
  */
 public function parse(\Doctrine\ORM\Query\Parser $parser)
 {
     $lexer = $parser->getLexer();
     $parser->match($lexer->lookahead['value']);
     $parser->match('(');
     $this->_collectionPathExpression = $parser->_CollectionValuedPathExpression();
     $parser->match(')');
 }
开发者ID:jackbravo,项目名称:doctrine,代码行数:11,代码来源:SizeFunction.php

示例14: parse

 /**
  * @override
  */
 public function parse(\Doctrine\ORM\Query\Parser $parser)
 {
     $lexer = $parser->getLexer();
     $parser->match(Lexer::T_SIZE);
     $parser->match(Lexer::T_OPEN_PARENTHESIS);
     $this->collectionPathExpression = $parser->CollectionValuedPathExpression();
     $parser->match(Lexer::T_CLOSE_PARENTHESIS);
 }
开发者ID:nvdnkpr,项目名称:symfony-demo,代码行数:11,代码来源:SizeFunction.php

示例15: parse

 /**
  * @override
  */
 public function parse(\Doctrine\ORM\Query\Parser $parser)
 {
     $lexer = $parser->getLexer();
     $parser->match($lexer->lookahead['value']);
     $parser->match('(');
     $this->_stringPrimary = $parser->_StringPrimary();
     $parser->match(')');
 }
开发者ID:jackbravo,项目名称:doctrine,代码行数:11,代码来源:LowerFunction.php


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