/** * Performs lexical analyze of pointcut * * @param Aspect $aspect Instance of aspect * @param ReflectionMethod|ReflectionProperty $reflection * @param Annotation\BaseAnnotation $metaInformation * * @return TokenStream * @throws \UnexpectedValueException */ protected function makeLexicalAnalyze(Aspect $aspect, $reflection, $metaInformation) { try { $resolvedThisPointcut = str_replace('$this', get_class($aspect), $metaInformation->value); $stream = $this->pointcutLexer->lex($resolvedThisPointcut); } catch (RecognitionException $e) { $message = "Can not recognize the lexical structure `%s` before %s, defined in %s:%d"; $message = sprintf($message, $metaInformation->value, (isset($reflection->class) ? $reflection->class . '->' : '') . $reflection->name, method_exists($reflection, 'getFileName') ? $reflection->getFileName() : $reflection->getDeclaringClass()->getFileName(), method_exists($reflection, 'getStartLine') ? $reflection->getStartLine() : 0); throw new \UnexpectedValueException($message, 0, $e); } return $stream; }
/** * Tests parsing * * @dataProvider validPointcutDefinitions */ public function testParsingExpression($pointcutExpression) { $stream = $this->lexer->lex($pointcutExpression); $result = $this->parser->parse($stream); $this->assertNotNull($result); }