Builds an integer token from the given match of PATTERN_INTEGER.

@param array<string> $m
@return AnnotationToken
553968
protected function getIntegerToken(array $m)
	{
		$sign = (isset($m['sign']) && $m['sign'] == '-') ? -1 : 1;
		
		if(isset($m['oct']) && $m['oct'] != '')
		{
			return new AnnotationToken(AnnotationToken::T_INTEGER, $sign * intval($m['oct'], 8));
		}
		
		if(isset($m['bin']) && $m['bin'] != '')
		{
			return new AnnotationToken(AnnotationToken::T_INTEGER, $sign * intval($m['bin'], 2));
		}
		
		if(isset($m['hex']) && $m['hex'] != '')
		{
			return new AnnotationToken(AnnotationToken::T_INTEGER, $sign * intval($m['hex'], 16));
		}
		
		return new AnnotationToken(AnnotationToken::T_INTEGER, $sign * (int)$m['dec']);
	}
1355173
public static function TokenizeWithFlags( $arg1, $arg2, $flagString )
	{
		if ( $arg1 instanceof Undefined || empty( $arg1 ) )
		{
			return EmptyIterator::$Shared;
		}

		$input = $arg1 . "";

		if ( $arg2 instanceof Undefined )
		{
			throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::XPTY0004, array( "empty-sequence()", "xs:string in fn:tokenize" ) );
		}

	    $flagString = ExtFuncs::PrepareRegexFlags( $flagString );
	    $pattern = ExtFuncs::PrepareRegexPattern( $arg2 . "", $flagString );

		if (  preg_match( "/$pattern/", "" ) )
		{
			throw XPath2Exception::withErrorCodeAndParam( "FORX0003", Resources::FORX0003, $pattern );
		}

		return new NodeIterator( function() use( $input, $pattern, $flagString )
		{
			return ExtFuncs::StringEnumerator( $input, $pattern, $flagString );
		} );
	}
314175
public function match($source, TokenFactoryInterface $factory)
    {
        preg_match_all($this->regex, $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);

        $callable = $this->callable;
        foreach ($matches as $match) {
            foreach($callable($match, $factory) as $token) {
                yield $token;
            }
        }
    }
106695
private function findMatchingToken($input)
    {
        // Check with all tokenDefinitions
        foreach ($this->tokenDefinitions as $tokenDefinition) {
            $token = $tokenDefinition->match($input);

            // Return the first token that was matched.
            if ($token) {
                return $token;
            }
        }

        // Return null if no tokens were matched.

        return null;
    }
932691
public function parseDelimiter()
    {
        $idx = 0;

        while ($idx < $this->delimiterLen && $this->last + $idx < $this->len) {
            if ($this->delimiter[$idx] !== $this->str[$this->last + $idx]) {
                return null;
            }
            ++$idx;
        }

        $this->last += $this->delimiterLen - 1;

        return new Token($this->delimiter, Token::TYPE_DELIMITER);
    }
6206
protected function foldConstantXPathExpression(array $m)
	{
		$expr = $m[0];
		if ($this->isConstantExpression($expr))
		{
			$result = $this->evaluate($expr);
			if ($this->canBeSerialized($result))
			{
				$foldedExpr = XPath::export($result);
				if (strlen($foldedExpr) < strlen($expr))
				{
					$expr = $foldedExpr;
				}
			}
		}

		return $expr;
	}
960532
public static function integer($min=NULL,$max=NULL,$prompt=NULL){
		if(\is_int($min) && \is_int($max))
			return new Rule("integer[{$min}..{$max}]",$prompt);
		return new Rule("integer",$prompt);
	}
629639
protected function _parseBlockCallback($m) {
        if (!class_exists('block' . $m[1])) {
            $blockFunction = '<?php class block' . $m[1] . ' extends \Gcs\Framework\Core\Gcs\Framework\Core\Template\Template { public static function ' . $m[1] . '(){ ?> ';
            $blockFunction .= $m[2];
            $blockFunction .= ' <?php } } ?>';

            return $blockFunction;
        }
        else {
            $this->addError('the class "block' . $m[1] . '" already exists', __FILE__, __LINE__, ERROR_FATAL);

            return '';
        }
    }
697128
private function generateToken()
    {
        return Hash::hash256(self::getHa1()->getHash(), $this->getNonce(), $this->getRounds());
    }
827753
protected function doShortcodeTag($m)
    {
        // allow [[foo]] syntax for escaping a tag
        if ($m[1] == '[' && $m[6] == ']') {
            return substr($m[0], 1, -1);
        }

        $tag = $m[2];
        $attr = $this->parseAttributes($m[3]);

        $callback = $this->_shortcodes[$tag]['callback'];
        $config = $this->_shortcodes[$tag]['config'];

        $attr = ArrayHelper::merge($config, $attr);
        $content = isset($m[5]) ? $m[5] : null;

        $attr['content'] = $content;
        $this->addToPool($tag);
        return $m[1] . call_user_func($callback, $attr, $content, $tag) . $m[6];
    }
731137
private function parseToken(array $token): string
    {
        list($id, $content) = $token;

        if ($id == T_INLINE_HTML) {
            $content = $this->compileVerbatim($content);

            foreach ($this->compilers as $callable) {
                if (!is_callable($callable) and is_scalar($callable)) {
                    $callable = [$this, $callable];
                }

                $content = (string) call_user_func_array($callable, [$content]);
            }

            $content = $this->restoreVerbatim($content);
        }

        return $content;
    }
802730
protected function getTokenSplitPattern()
    {
        $sChars = implode('|', $this->getAllTokenSeparators());
        $mimePartPattern = MimeLiteralPart::MIME_PART_PATTERN;
        return '~(' . $mimePartPattern . '|\\\\.|' . $sChars . ')~';
    }
1021387
protected function build($m)
    {
        $string = $m[1];

        if (substr($string, 0, 1) != '<') {
            // We matched a lone ">" character.
            return '&gt;';
        } elseif (strlen($string) == 1) {
            // We matched a lone "<" character.
            return '&lt;';
        }

        if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9\-]+)([^>]*)>?|(<!--.*?-->)$%', $string, $matches)) {
            // Seriously malformed.
            return '';
        }

        $slash = trim($matches[1]);
        $elem = &$matches[2];
        $attrlist = &$matches[3];
        $comment = &$matches[4];

        if ($comment) {
            $elem = '!--';
        }

        if (!in_array(strtolower($elem), $this->tags, true)) {
            return ''; // Disallowed HTML element.
        }

        if ($comment) {
            return $comment;
        }

        if ($slash != '') {
            return "</$elem>";
        }

        // Is there a closing XHTML slash at the end of the attributes?
        $attrlist = preg_replace('%(\s?)/\s*$%', '\1', $attrlist, -1, $count);
        $xhtml_slash = $count ? ' /' : '';

        // Clean up attributes.
        $attr2 = implode(' ', $this->explodeAttributes($attrlist));
        $attr2 = preg_replace('/[<>]/', '', $attr2);
        $attr2 = strlen($attr2) ? ' ' . $attr2 : '';

        return "<$elem$attr2$xhtml_slash>";
    }
1352996
private function ANNOTATION() {
        $text = '';
        do {
            $text .= $this->ch;
            $this->consume();
        } while ($this->isLETTER());

        $tokenType = null;
        switch ($text) {
            case '@var':
                $tokenType = Token::T_VAR;
                break;
            case '@get':
            case '@post':
            case '@request':
            case '@session':
            case '@config':
            case '@service':
            case '@currentEvent':
                $tokenType = Token::T_PROPERTY_INJECTOR;
                break;
            case '@keepDefault':
            case '@queued':
            case '@queue':
                $tokenType = Token::T_ACTION;
                break;
            default:
                $tokenType = Token::T_UNKNOWN_ANNOTATION;
        }
        return new Token($tokenType, $text);
    }
127544
protected static function _doShortcode($m)
    {
        // allow {{foo}} syntax for escaping a tag
        if ($m[1] == '{' && $m[6] == '}') {
            return substr($m[0], 1, -1);
        }

        $tag = $m[2];
        $atts = static::_parseAttributes($m[3]);
        $listeners = EventDispatcher::instance('Shortcode')
            ->eventManager()
            ->listeners($tag);

        if (!empty($listeners)) {
            $options = [
                'atts' => (array)$atts,
                'content' => null,
                'tag' => $tag
            ];

            if (isset($m[5])) {
                $options['content'] = $m[5];
            }

            $result = EventDispatcher::instance('Shortcode')
                ->triggerArray([$tag, static::cache('context')], $options)
                ->result;

            return $m[1] . $result . $m[6];
        }

        return '';
    }
1073717
private static function tokenize($pattern)
	{
		if(!($n=self::$_mbstringAvailable ? mb_strlen($pattern,Yii::app()->charset) : strlen($pattern)))
			return array();
		$tokens=array();
		$c0=self::$_mbstringAvailable ? mb_substr($pattern,0,1,Yii::app()->charset) : substr($pattern,0,1);

		for($start=0,$i=1;$i<$n;++$i)
		{
			$c=self::$_mbstringAvailable ? mb_substr($pattern,$i,1,Yii::app()->charset) : substr($pattern,$i,1);
			if($c!==$c0)
			{
				$tokens[]=self::$_mbstringAvailable ? mb_substr($pattern,$start,$i-$start,Yii::app()->charset) : substr($pattern,$start,$i-$start);
				$c0=$c;
				$start=$i;
			}
		}
		$tokens[]=self::$_mbstringAvailable ? mb_substr($pattern,$start,$n-$start,Yii::app()->charset) : substr($pattern,$start,$n-$start);
		return $tokens;
	}
836460
protected function _parseLangCallBackNoEcho($m) {
        $a = explode(':', $m[2]); //we separate the two sections

        if ($m[1] == ':') {
            $type = '';
        }
        else {
            $type = ', \Gcs\Framework\Core\Lang\Lang::USE_TPL';
        }

        if (isset($a[1])) {
            if (!preg_match('#\$#', $a[0])) {
                return '$this->useLang(\'' . trim($a[0]) . '\',array(' . trim($a[1]) . ')' . $type . ')';
            }
            else {
                return '$this->useLang(' . trim($a[0]) . ',array(' . trim($a[1]) . ')' . $type . ')';
            }
        }
        else {
            if (!preg_match('#\$#', $a[0])) {
                return '$this->useLang(\'' . trim($a[0]) . '\',array()' . $type . ')';
            }
            else {
                return '$this->useLang(' . trim($a[0]) . ',array()' . $type . ')';
            }
        }
    }