示例#1
0
文件: Macro.php 项目: assertchris/yay
 private function lookupTokenType(Token $token) : int
 {
     $type = explode('·', (string) $token)[0];
     if (!defined($type)) {
         $this->fail(self::E_TOKEN_TYPE, $type, $token->line());
     }
     return constant($type);
 }
示例#2
0
 private function lookupContext(Token $token, Context $context, string $error)
 {
     $symbol = (string) $token;
     if (null === ($result = $context->get($symbol))) {
         $this->fail($error, $symbol, $token->line(), json_encode($context->symbols(), self::PRETTY_PRINT));
     }
     return $result;
 }
示例#3
0
文件: Pattern.php 项目: lastguest/yay
 private function lookupParser(Token $token) : string
 {
     $identifier = (string) $token;
     $parser = '\\Yay\\' . explode('·', $identifier)[1];
     if (!function_exists($parser)) {
         $this->fail(self::E_BAD_PARSER_NAME, $identifier, $token->line());
     }
     return $parser;
 }