protected function getValue(Token $token, $value = null)
    {
        $value = $value ?: $token->match['value'];
        $type  = $token->match['type'];

        switch (true) {
            case $type === 'int':
                return (int) $value;
            case $type === 'char' &&
                 preg_match('(^(?P<value>-?\\d+)%2F100$)', $value, $match):
                return $match['value'] / 100;
            case $type === 'char':
                return (string) urldecode($value);
            default:
                throw new \RuntimeException(
                    "Unknown value type $type in line {$token->line} at position {$token->position}."
                );
        }
    }