---input---
<?php

$disapproval_ಠ_ಠ_of_php = 'unicode var';

$test = function($a) { $lambda = 1; }

/**
 *  Zip class file
 *
 *  @package     fnord.bb
 *  @subpackage  archive
 */

// Unlock?
if(!defined('UNLOCK') || !UNLOCK)
  die();
  
// Load the parent archive class
require_once(ROOT_PATH.'/classes/archive.class.php');

class Zip\Zippಠ_ಠ_ {

}

/**
 *  Zip class
 *
 *  @author      Manni <manni@fnord.name>
 *  @copyright   Copyright (c) 2006, Manni
 *  @version     1.0
 *  @link        http://www.pkware.com/business_and_developers/developer/popups/appnote.txt
 *  @link        http://mannithedark.is-a-geek.net/
 *  @since       1.0
 *  @package     fnord.bb
 *  @subpackage  archive
 */
class Zip extends Archive {
 /**
  *  Outputs the zip file
  *
  *  This function creates the zip file with the dirs and files given.
  *  If the optional parameter $file is given, the zip file is will be
  *  saved at that location. Otherwise the function returns the zip file's content.
  *
  *  @access                   public
  *
  *  @link                     http://www.pkware.com/business_and_developers/developer/popups/appnote.txt
  *  @param  string $filename  The path where the zip file will be saved
  *
  *  @return bool|string       Returns either true if the fil is sucessfully created or the content of the zip file
  */
  function out($filename = false) {
    // Empty output
    $file_data = array(); // Data of the file part
    $cd_data   = array(); // Data of the central directory

    // Sort dirs and files by path length
    uksort($this->dirs,  'sort_by_length');
    uksort($this->files, 'sort_by_length');

    // Handle dirs
    foreach($this->dirs as $dir) {
      $dir .= '/';
      // File part

      // Reset dir data
      $dir_data = '';

      // Local file header
      $dir_data .= "\x50\x4b\x03\x04";      // Local file header signature
      $dir_data .= pack("v", 10);           // Version needed to extract
      $dir_data .= pack("v", 0);            // General purpose bit flag
      $dir_data .= pack("v", 0);            // Compression method
      $dir_data .= pack("v", 0);            // Last mod file time
      $dir_data .= pack("v", 0);            // Last mod file date
      $dir_data .= pack("V", 0);            // crc-32
      $dir_data .= pack("V", 0);            // Compressed size
      $dir_data .= pack("V", 0);            // Uncompressed size
      $dir_data .= pack("v", strlen($dir)); // File name length
      $dir_data .= pack("v", 0);            // Extra field length

      $dir_data .= $dir;                    // File name
      $dir_data .= '';                      // Extra field (is empty)

      // File data
      $dir_data .= '';                      // Dirs have no file data

      // Data descriptor
      $dir_data .= pack("V", 0);            // crc-32
      $dir_data .= pack("V", 0);            // Compressed size
      $dir_data .= pack("V", 0);            // Uncompressed size

      // Save current offset
      $offset = strlen(implode('', $file_data));

      // Append dir data to the file part
      $file_data[] = $dir_data;

      // Central directory

      // Reset dir data
      $dir_data = '';

      // File header
      $dir_data .= "\x50\x4b\x01\x02";      // Local file header signature
      $dir_data .= pack("v", 0);            // Version made by
      $dir_data .= pack("v", 10);           // Version needed to extract
      $dir_data .= pack("v", 0);            // General purpose bit flag
      $dir_data .= pack("v", 0);            // Compression method
      $dir_data .= pack("v", 0);            // Last mod file time
      $dir_data .= pack("v", 0);            // Last mod file date
      $dir_data .= pack("V", 0);            // crc-32
      $dir_data .= pack("V", 0);            // Compressed size
      $dir_data .= pack("V", 0);            // Uncompressed size
      $dir_data .= pack("v", strlen($dir)); // File name length
      $dir_data .= pack("v", 0);            // Extra field length
      $dir_data .= pack("v", 0);            // File comment length
      $dir_data .= pack("v", 0);            // Disk number start
      $dir_data .= pack("v", 0);            // Internal file attributes
      $dir_data .= pack("V", 16);           // External file attributes
      $dir_data .= pack("V", $offset);      // Relative offset of local header

      $dir_data .= $dir;                    // File name
      $dir_data .= '';                      // Extra field (is empty)
      $dir_data .= '';                      // File comment (is empty)

      /*
      // Data descriptor
      $dir_data .= pack("V", 0);            // crc-32
      $dir_data .= pack("V", 0);            // Compressed size
      $dir_data .= pack("V", 0);            // Uncompressed size
      */
      
      // Append dir data to the central directory data
      $cd_data[] = $dir_data;
    }

    // Handle files
    foreach($this->files as $name => $file) {
      // Get values
      $content = $file[0];
    
      // File part

      // Reset file data
      $fd = '';
      
      // Detect possible compressions
      // Use deflate
      if(function_exists('gzdeflate')) {
        $method = 8;

        // Compress file content
        $compressed_data = gzdeflate($content);

      // Use bzip2
      } elseif(function_exists('bzcompress')) {
        $method = 12;

        // Compress file content
        $compressed_data = bzcompress($content);

      // No compression
      } else {
        $method = 0;

        // Do not compress the content :P
        $compressed_data = $content;
      }

      // Local file header
      $fd .= "\x50\x4b\x03\x04";                  // Local file header signature
      $fd .= pack("v", 20);                       // Version needed to extract
      $fd .= pack("v", 0);                        // General purpose bit flag
      $fd .= pack("v", $method);                  // Compression method
      $fd .= pack("v", 0);                        // Last mod file time
      $fd .= pack("v", 0);                        // Last mod file date
      $fd .= pack("V", crc32($content));          // crc-32
      $fd .= pack("V", strlen($compressed_data)); // Compressed size
      $fd .= pack("V", strlen($content));         // Uncompressed size
      $fd .= pack("v", strlen($name));            // File name length
      $fd .= pack("v", 0);                        // Extra field length

      $fd .= $name;                               // File name
      $fd .= '';                                  // Extra field (is empty)

      // File data
      $fd .= $compressed_data;
      
      // Data descriptor
      $fd .= pack("V", crc32($content));          // crc-32
      $fd .= pack("V", strlen($compressed_data)); // Compressed size
      $fd .= pack("V", strlen($content));         // Uncompressed size

      // Save current offset
      $offset = strlen(implode('', $file_data));

      // Append file data to the file part
      $file_data[] = $fd;

      // Central directory

      // Reset file data
      $fd = '';

      // File header
      $fd .= "\x50\x4b\x01\x02";                  // Local file header signature
      $fd .= pack("v", 0);                        // Version made by
      $fd .= pack("v", 20);                       // Version needed to extract
      $fd .= pack("v", 0);                        // General purpose bit flag
      $fd .= pack("v", $method);                  // Compression method
      $fd .= pack("v", 0);                        // Last mod file time
      $fd .= pack("v", 0);                        // Last mod file date
      $fd .= pack("V", crc32($content));          // crc-32
      $fd .= pack("V", strlen($compressed_data)); // Compressed size
      $fd .= pack("V", strlen($content));         // Uncompressed size
      $fd .= pack("v", strlen($name));            // File name length
      $fd .= pack("v", 0);                        // Extra field length
      $fd .= pack("v", 0);                        // File comment length
      $fd .= pack("v", 0);                        // Disk number start
      $fd .= pack("v", 0);                        // Internal file attributes
      $fd .= pack("V", 32);                       // External file attributes
      $fd .= pack("V", $offset);                  // Relative offset of local header

      $fd .= $name;                               // File name
      $fd .= '';                                  // Extra field (is empty)
      $fd .= '';                                  // File comment (is empty)

      /*
      // Data descriptor
      $fd .= pack("V", crc32($content));          // crc-32
      $fd .= pack("V", strlen($compressed_data)); // Compressed size
      $fd .= pack("V", strlen($content));         // Uncompressed size
      */

      // Append file data to the central directory data
      $cd_data[] = $fd;
    }

    // Digital signature
    $digital_signature = '';
    $digital_signature .= "\x50\x4b\x05\x05";  // Header signature
    $digital_signature .= pack("v", 0);        // Size of data
    $digital_signature .= '';                  // Signature data (is empty)

    $tmp_file_data = implode('', $file_data);  // File data
    $tmp_cd_data   = implode('', $cd_data).    // Central directory
                     $digital_signature;       // Digital signature

    // End of central directory
    $eof_cd = '';
    $eof_cd .= "\x50\x4b\x05\x06";                // End of central dir signature
    $eof_cd .= pack("v", 0);                      // Number of this disk
    $eof_cd .= pack("v", 0);                      // Number of the disk with the start of the central directory
    $eof_cd .= pack("v", count($cd_data));        // Total number of entries in the central directory on this disk
    $eof_cd .= pack("v", count($cd_data));        // Total number of entries in the central directory
    $eof_cd .= pack("V", strlen($tmp_cd_data));   // Size of the central directory
    $eof_cd .= pack("V", strlen($tmp_file_data)); // Offset of start of central directory with respect to the starting disk number
    $eof_cd .= pack("v", 0);                      // .ZIP file comment length
    $eof_cd .= '';                                // .ZIP file comment (is empty)

    // Content of the zip file
    $data = $tmp_file_data.
            // $extra_data_record.
            $tmp_cd_data.
            $eof_cd;

    // Return content?
    if(!$filename)
      return $data;
      
    // Write to file
    return file_put_contents($filename, $data);
  }
  
 /**
  *  Load a zip file
  *
  *  This function loads the files and dirs from a zip file from the harddrive.
  *
  *  @access                public
  *
  *  @param  string $file   The path to the zip file
  *  @param  bool   $reset  Reset the files and dirs before adding the zip file's content?
  *
  *  @return bool           Returns true if the file was loaded sucessfully
  */
  function load_file($file, $reset = true) {
    // Check whether the file exists
    if(!file_exists($file))
      return false;

    // Load the files content
    $content = @file_get_contents($file);

    // Return false if the file cannot be opened
    if(!$content)
      return false;

    // Read the zip
    return $this->load_string($content, $reset);
  }
  
 /**
  *  Load a zip string
  *
  *  This function loads the files and dirs from a string
  *
  *  @access                 public
  *
  *  @param  string $string  The string the zip is generated from
  *  @param  bool   $reset   Reset the files and dirs before adding the zip file's content?
  *
  *  @return bool            Returns true if the string was loaded sucessfully
  */
  function load_string($string, $reset = true) {
    // Reset the zip?
    if($reset) {
      $this->dirs  = array();
      $this->files = array();
    }

    // Get the starting position of the end of central directory record
    $start = strpos($string, "\x50\x4b\x05\x06");

    // Error
    if($start === false)
      die('Could not find the end of central directory record');

    // Get the ecdr
    $eof_cd = substr($string, $start+4, 18);

    // Unpack the ecdr infos
    $eof_cd = unpack('vdisc1/'.
                     'vdisc2/'.
                     'ventries1/'.
                     'ventries2/'.
                     'Vsize/'.
                     'Voffset/'.
                     'vcomment_lenght', $eof_cd);

    // Do not allow multi disc zips
    if($eof_cd['disc1'] != 0)
      die('multi disk stuff is not yet implemented :/');

    // Save the interesting values
    $cd_entries = $eof_cd['entries1'];
    $cd_size    = $eof_cd['size'];
    $cd_offset  = $eof_cd['offset'];

    // Get the central directory record
    $cdr = substr($string, $cd_offset, $cd_size);

    // Reset the position and the list of the entries
    $pos     = 0;
    $entries = array();

    // Handle cdr
    while($pos < strlen($cdr)) {
      // Check header signature
      // Digital signature
      if(substr($cdr, $pos, 4) == "\x50\x4b\x05\x05") {
        // Get digital signature size
        $tmp_info = unpack('vsize', substr($cdr, $pos + 4, 2));

        // Read out the digital signature
        $digital_sig = substr($header, $pos + 6, $tmp_info['size']);

        break;
      }

      // Get file header
      $header = substr($cdr, $pos, 46);

      // Unpack the header information
      $header_info = @unpack('Vheader/'.
                             'vversion_made_by/'.
                             'vversion_needed/'.
                             'vgeneral_purpose/'.
                             'vcompression_method/'.
                             'vlast_mod_time/'.
                             'vlast_mod_date/'.
                             'Vcrc32/'.
                             'Vcompressed_size/'.
                             'Vuncompressed_size/'.
                             'vname_length/'.
                             'vextra_length/'.
                             'vcomment_length/'.
                             'vdisk_number/'.
                             'vinternal_attributes/'.
                             'Vexternal_attributes/'.
                             'Voffset',
                             $header);

      // Valid header?
      if($header_info['header'] != 33639248)
        return false;

      // New position
      $pos += 46;

      // Read out the file name
      $header_info['name'] = substr($cdr, $pos, $header_info['name_length']);

      // New position
      $pos += $header_info['name_length'];

      // Read out the extra stuff
      $header_info['extra'] = substr($cdr, $pos, $header_info['extra_length']);

      // New position
      $pos += $header_info['extra_length'];

      // Read out the comment
      $header_info['comment'] = substr($cdr, $pos, $header_info['comment_length']);

      // New position
      $pos += $header_info['comment_length'];

      // Append this file/dir to the entry list
      $entries[] = $header_info;
    }

    // Check whether all entries where read sucessfully
    if(count($entries) != $cd_entries)
      return false;

    // Handle files/dirs
    foreach($entries as $entry) {
      // Is a dir?
      if($entry['external_attributes'] & 16) {
        $this->add_dir($entry['name']);
        continue;
      }

      // Get local file header
      $header = substr($string, $entry['offset'], 30);

      // Unpack the header information
      $header_info = @unpack('Vheader/'.
                             'vversion_needed/'.
                             'vgeneral_purpose/'.
                             'vcompression_method/'.
                             'vlast_mod_time/'.
                             'vlast_mod_date/'.
                             'Vcrc32/'.
                             'Vcompressed_size/'.
                             'Vuncompressed_size/'.
                             'vname_length/'.
                             'vextra_length',
                             $header);

      // Valid header?
      if($header_info['header'] != 67324752)
        return false;

      // Get content start position
      $start = $entry['offset'] + 30 + $header_info['name_length'] + $header_info['extra_length'];

      // Get the compressed data
      $data = substr($string, $start, $header_info['compressed_size']);

      // Detect compression type
      switch($header_info['compression_method']) {
        // No compression
        case 0:
          // Ne decompression needed
          $content = $data;
          break;

        // Gzip
        case 8:
          if(!function_exists('gzinflate'))
            return false;

          // Uncompress data
          $content = gzinflate($data);
          break;

        // Bzip2
        case 12:
          if(!function_exists('bzdecompress'))
            return false;

          // Decompress data
          $content = bzdecompress($data);
          break;

        // Compression not supported -> error
        default:
          return false;
      }

      // Try to add file
      if(!$this->add_file($entry['name'], $content))
        return false;
    }

    return true;
  }
}

function &byref() {
    $x = array();
    return $x;
}

// Test highlighting of magic methods and variables
class MagicClass {
  public $magic_str;
  public $ordinary_str;

  public function __construct($some_var) {
    $this->magic_str = __FILE__;
    $this->ordinary_str = $some_var;
  }

  public function __toString() {
    return $this->magic_str;
  }

  public function nonMagic() {
    return $this->ordinary_str;
  }
}

$magic = new MagicClass(__DIR__);
__toString();
$magic->nonMagic();
$magic->__toString();

     echo <<<EOF

     Test the heredocs...

     EOF;

echo <<<"some_delimiter"
more heredoc testing
continues on this line
some_delimiter;

?>


---tokens---
'<?php'       Comment.Preproc
'\n\n'        Text

'$disapproval_ಠ_ಠ_of_php' Name.Variable
' '           Text
'='           Operator
' '           Text
"'unicode var'" Literal.String.Single
';'           Punctuation
'\n\n'        Text

'$test'       Name.Variable
' '           Text
'='           Operator
' '           Text
'function'    Keyword
'('           Punctuation
'$a'          Name.Variable
')'           Punctuation
' '           Text
'{'           Punctuation
' '           Text
'$lambda'     Name.Variable
' '           Text
'='           Operator
' '           Text
'1'           Literal.Number.Integer
';'           Punctuation
' '           Text
'}'           Punctuation
'\n\n'        Text

'/**\n *  Zip class file\n *\n *  @package     fnord.bb\n *  @subpackage  archive\n */' Literal.String.Doc
'\n\n'        Text

'// Unlock?\n' Comment.Single

'if'          Keyword
'('           Punctuation
'!'           Operator
'defined'     Name.Builtin
'('           Punctuation
"'UNLOCK'"    Literal.String.Single
')'           Punctuation
' '           Text
'||'          Operator
' '           Text
'!'           Operator
'UNLOCK'      Name.Other
')'           Punctuation
'\n  '        Text
'die'         Keyword
'();'         Punctuation
'\n  \n'      Text

'// Load the parent archive class\n' Comment.Single

'require_once' Keyword
'('           Punctuation
'ROOT_PATH'   Name.Other
'.'           Operator
"'/classes/archive.class.php'" Literal.String.Single
');'          Punctuation
'\n\n'        Text

'class'       Keyword
' '           Text
'Zip\\Zippಠ_ಠ_' Name.Class
' '           Text
'{'           Punctuation
'\n\n'        Text

'}'           Punctuation
'\n\n'        Text

'/**\n *  Zip class\n *\n *  @author      Manni <manni@fnord.name>\n *  @copyright   Copyright (c) 2006, Manni\n *  @version     1.0\n *  @link        http://www.pkware.com/business_and_developers/developer/popups/appnote.txt\n *  @link        http://mannithedark.is-a-geek.net/\n *  @since       1.0\n *  @package     fnord.bb\n *  @subpackage  archive\n */' Literal.String.Doc
'\n'          Text

'class'       Keyword
' '           Text
'Zip'         Name.Class
' '           Text
'extends'     Keyword
' '           Text
'Archive'     Name.Other
' '           Text
'{'           Punctuation
'\n '         Text
"/**\n  *  Outputs the zip file\n  *\n  *  This function creates the zip file with the dirs and files given.\n  *  If the optional parameter $file is given, the zip file is will be\n  *  saved at that location. Otherwise the function returns the zip file's content.\n  *\n  *  @access                   public\n  *\n  *  @link                     http://www.pkware.com/business_and_developers/developer/popups/appnote.txt\n  *  @param  string $filename  The path where the zip file will be saved\n  *\n  *  @return bool|string       Returns either true if the fil is sucessfully created or the content of the zip file\n  */" Literal.String.Doc
'\n  '        Text
'function'    Keyword
' '           Text
'out'         Name.Function
'('           Punctuation
'$filename'   Name.Variable
' '           Text
'='           Operator
' '           Text
'false'       Keyword
')'           Punctuation
' '           Text
'{'           Punctuation
'\n    '      Text
'// Empty output\n' Comment.Single

'    '        Text
'$file_data'  Name.Variable
' '           Text
'='           Operator
' '           Text
'array'       Keyword
'();'         Punctuation
' '           Text
'// Data of the file part\n' Comment.Single

'    '        Text
'$cd_data'    Name.Variable
'   '         Text
'='           Operator
' '           Text
'array'       Keyword
'();'         Punctuation
' '           Text
'// Data of the central directory\n' Comment.Single

'\n    '      Text
'// Sort dirs and files by path length\n' Comment.Single

'    '        Text
'uksort'      Name.Builtin
'('           Punctuation
'$this'       Name.Variable
'->'          Operator
'dirs'        Name.Attribute
','           Punctuation
'  '          Text
"'sort_by_length'" Literal.String.Single
');'          Punctuation
'\n    '      Text
'uksort'      Name.Builtin
'('           Punctuation
'$this'       Name.Variable
'->'          Operator
'files'       Name.Attribute
','           Punctuation
' '           Text
"'sort_by_length'" Literal.String.Single
');'          Punctuation
'\n\n    '    Text
'// Handle dirs\n' Comment.Single

'    '        Text
'foreach'     Keyword
'('           Punctuation
'$this'       Name.Variable
'->'          Operator
'dirs'        Name.Attribute
' '           Text
'as'          Keyword
' '           Text
'$dir'        Name.Variable
')'           Punctuation
' '           Text
'{'           Punctuation
'\n      '    Text
'$dir'        Name.Variable
' '           Text
'.='          Operator
' '           Text
"'/'"         Literal.String.Single
';'           Punctuation
'\n      '    Text
'// File part\n' Comment.Single

'\n      '    Text
'// Reset dir data\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'='           Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'\n\n      '  Text
'// Local file header\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'"'           Literal.String.Double
'\\x50'       Literal.String.Escape
'\\x4b'       Literal.String.Escape
'\\x03'       Literal.String.Escape
'\\x04'       Literal.String.Escape
'"'           Literal.String.Double
';'           Punctuation
'      '      Text
'// Local file header signature\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'10'          Literal.Number.Integer
');'          Punctuation
'           ' Text
'// Version needed to extract\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// General purpose bit flag\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Compression method\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Last mod file time\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Last mod file date\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// crc-32\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Compressed size\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Uncompressed size\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$dir'        Name.Variable
'));'         Punctuation
' '           Text
'// File name length\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Extra field length\n' Comment.Single

'\n      '    Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'$dir'        Name.Variable
';'           Punctuation
'                    ' Text
'// File name\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'                      ' Text
'// Extra field (is empty)\n' Comment.Single

'\n      '    Text
'// File data\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'                      ' Text
'// Dirs have no file data\n' Comment.Single

'\n      '    Text
'// Data descriptor\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// crc-32\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Compressed size\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Uncompressed size\n' Comment.Single

'\n      '    Text
'// Save current offset\n' Comment.Single

'      '      Text
'$offset'     Name.Variable
' '           Text
'='           Operator
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'implode'     Name.Builtin
'('           Punctuation
"''"          Literal.String.Single
','           Punctuation
' '           Text
'$file_data'  Name.Variable
'));'         Punctuation
'\n\n      '  Text
'// Append dir data to the file part\n' Comment.Single

'      '      Text
'$file_data'  Name.Variable
'[]'          Punctuation
' '           Text
'='           Operator
' '           Text
'$dir_data'   Name.Variable
';'           Punctuation
'\n\n      '  Text
'// Central directory\n' Comment.Single

'\n      '    Text
'// Reset dir data\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'='           Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'\n\n      '  Text
'// File header\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'"'           Literal.String.Double
'\\x50'       Literal.String.Escape
'\\x4b'       Literal.String.Escape
'\\x01'       Literal.String.Escape
'\\x02'       Literal.String.Escape
'"'           Literal.String.Double
';'           Punctuation
'      '      Text
'// Local file header signature\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Version made by\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'10'          Literal.Number.Integer
');'          Punctuation
'           ' Text
'// Version needed to extract\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// General purpose bit flag\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Compression method\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Last mod file time\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Last mod file date\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// crc-32\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Compressed size\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Uncompressed size\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$dir'        Name.Variable
'));'         Punctuation
' '           Text
'// File name length\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Extra field length\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// File comment length\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Disk number start\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'            ' Text
'// Internal file attributes\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'16'          Literal.Number.Integer
');'          Punctuation
'           ' Text
'// External file attributes\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'$offset'     Name.Variable
');'          Punctuation
'      '      Text
'// Relative offset of local header\n' Comment.Single

'\n      '    Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
'$dir'        Name.Variable
';'           Punctuation
'                    ' Text
'// File name\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'                      ' Text
'// Extra field (is empty)\n' Comment.Single

'      '      Text
'$dir_data'   Name.Variable
' '           Text
'.='          Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'                      ' Text
'// File comment (is empty)\n' Comment.Single

'\n      '    Text
'/*\n      // Data descriptor\n      $dir_data .= pack("V", 0);            // crc-32\n      $dir_data .= pack("V", 0);            // Compressed size\n      $dir_data .= pack("V", 0);            // Uncompressed size\n      */' Comment.Multiline
'\n      \n      ' Text
'// Append dir data to the central directory data\n' Comment.Single

'      '      Text
'$cd_data'    Name.Variable
'[]'          Punctuation
' '           Text
'='           Operator
' '           Text
'$dir_data'   Name.Variable
';'           Punctuation
'\n    '      Text
'}'           Punctuation
'\n\n    '    Text
'// Handle files\n' Comment.Single

'    '        Text
'foreach'     Keyword
'('           Punctuation
'$this'       Name.Variable
'->'          Operator
'files'       Name.Attribute
' '           Text
'as'          Keyword
' '           Text
'$name'       Name.Variable
' '           Text
'=>'          Operator
' '           Text
'$file'       Name.Variable
')'           Punctuation
' '           Text
'{'           Punctuation
'\n      '    Text
'// Get values\n' Comment.Single

'      '      Text
'$content'    Name.Variable
' '           Text
'='           Operator
' '           Text
'$file'       Name.Variable
'['           Punctuation
'0'           Literal.Number.Integer
'];'          Punctuation
'\n    \n      ' Text
'// File part\n' Comment.Single

'\n      '    Text
'// Reset file data\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'='           Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'\n      \n      ' Text
'// Detect possible compressions\n' Comment.Single

'      '      Text
'// Use deflate\n' Comment.Single

'      '      Text
'if'          Keyword
'('           Punctuation
'function_exists' Name.Builtin
'('           Punctuation
"'gzdeflate'" Literal.String.Single
'))'          Punctuation
' '           Text
'{'           Punctuation
'\n        '  Text
'$method'     Name.Variable
' '           Text
'='           Operator
' '           Text
'8'           Literal.Number.Integer
';'           Punctuation
'\n\n        ' Text
'// Compress file content\n' Comment.Single

'        '    Text
'$compressed_data' Name.Variable
' '           Text
'='           Operator
' '           Text
'gzdeflate'   Name.Builtin
'('           Punctuation
'$content'    Name.Variable
');'          Punctuation
'\n\n      '  Text
'// Use bzip2\n' Comment.Single

'      '      Text
'}'           Punctuation
' '           Text
'elseif'      Keyword
'('           Punctuation
'function_exists' Name.Builtin
'('           Punctuation
"'bzcompress'" Literal.String.Single
'))'          Punctuation
' '           Text
'{'           Punctuation
'\n        '  Text
'$method'     Name.Variable
' '           Text
'='           Operator
' '           Text
'12'          Literal.Number.Integer
';'           Punctuation
'\n\n        ' Text
'// Compress file content\n' Comment.Single

'        '    Text
'$compressed_data' Name.Variable
' '           Text
'='           Operator
' '           Text
'bzcompress'  Name.Builtin
'('           Punctuation
'$content'    Name.Variable
');'          Punctuation
'\n\n      '  Text
'// No compression\n' Comment.Single

'      '      Text
'}'           Punctuation
' '           Text
'else'        Keyword
' '           Text
'{'           Punctuation
'\n        '  Text
'$method'     Name.Variable
' '           Text
'='           Operator
' '           Text
'0'           Literal.Number.Integer
';'           Punctuation
'\n\n        ' Text
'// Do not compress the content :P\n' Comment.Single

'        '    Text
'$compressed_data' Name.Variable
' '           Text
'='           Operator
' '           Text
'$content'    Name.Variable
';'           Punctuation
'\n      '    Text
'}'           Punctuation
'\n\n      '  Text
'// Local file header\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'"'           Literal.String.Double
'\\x50'       Literal.String.Escape
'\\x4b'       Literal.String.Escape
'\\x03'       Literal.String.Escape
'\\x04'       Literal.String.Escape
'"'           Literal.String.Double
';'           Punctuation
'                  ' Text
'// Local file header signature\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'20'          Literal.Number.Integer
');'          Punctuation
'                       ' Text
'// Version needed to extract\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// General purpose bit flag\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'$method'     Name.Variable
');'          Punctuation
'                  ' Text
'// Compression method\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// Last mod file time\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// Last mod file date\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'crc32'       Name.Builtin
'('           Punctuation
'$content'    Name.Variable
'));'         Punctuation
'          '  Text
'// crc-32\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$compressed_data' Name.Variable
'));'         Punctuation
' '           Text
'// Compressed size\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$content'    Name.Variable
'));'         Punctuation
'         '   Text
'// Uncompressed size\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$name'       Name.Variable
'));'         Punctuation
'            ' Text
'// File name length\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// Extra field length\n' Comment.Single

'\n      '    Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'$name'       Name.Variable
';'           Punctuation
'                               ' Text
'// File name\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'                                  ' Text
'// Extra field (is empty)\n' Comment.Single

'\n      '    Text
'// File data\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'$compressed_data' Name.Variable
';'           Punctuation
'\n      \n      ' Text
'// Data descriptor\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'crc32'       Name.Builtin
'('           Punctuation
'$content'    Name.Variable
'));'         Punctuation
'          '  Text
'// crc-32\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$compressed_data' Name.Variable
'));'         Punctuation
' '           Text
'// Compressed size\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$content'    Name.Variable
'));'         Punctuation
'         '   Text
'// Uncompressed size\n' Comment.Single

'\n      '    Text
'// Save current offset\n' Comment.Single

'      '      Text
'$offset'     Name.Variable
' '           Text
'='           Operator
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'implode'     Name.Builtin
'('           Punctuation
"''"          Literal.String.Single
','           Punctuation
' '           Text
'$file_data'  Name.Variable
'));'         Punctuation
'\n\n      '  Text
'// Append file data to the file part\n' Comment.Single

'      '      Text
'$file_data'  Name.Variable
'[]'          Punctuation
' '           Text
'='           Operator
' '           Text
'$fd'         Name.Variable
';'           Punctuation
'\n\n      '  Text
'// Central directory\n' Comment.Single

'\n      '    Text
'// Reset file data\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'='           Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'\n\n      '  Text
'// File header\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'"'           Literal.String.Double
'\\x50'       Literal.String.Escape
'\\x4b'       Literal.String.Escape
'\\x01'       Literal.String.Escape
'\\x02'       Literal.String.Escape
'"'           Literal.String.Double
';'           Punctuation
'                  ' Text
'// Local file header signature\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// Version made by\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'20'          Literal.Number.Integer
');'          Punctuation
'                       ' Text
'// Version needed to extract\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// General purpose bit flag\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'$method'     Name.Variable
');'          Punctuation
'                  ' Text
'// Compression method\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// Last mod file time\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// Last mod file date\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'crc32'       Name.Builtin
'('           Punctuation
'$content'    Name.Variable
'));'         Punctuation
'          '  Text
'// crc-32\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$compressed_data' Name.Variable
'));'         Punctuation
' '           Text
'// Compressed size\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$content'    Name.Variable
'));'         Punctuation
'         '   Text
'// Uncompressed size\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$name'       Name.Variable
'));'         Punctuation
'            ' Text
'// File name length\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// Extra field length\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// File comment length\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// Disk number start\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                        ' Text
'// Internal file attributes\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'32'          Literal.Number.Integer
');'          Punctuation
'                       ' Text
'// External file attributes\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'$offset'     Name.Variable
');'          Punctuation
'                  ' Text
'// Relative offset of local header\n' Comment.Single

'\n      '    Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
'$name'       Name.Variable
';'           Punctuation
'                               ' Text
'// File name\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'                                  ' Text
'// Extra field (is empty)\n' Comment.Single

'      '      Text
'$fd'         Name.Variable
' '           Text
'.='          Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'                                  ' Text
'// File comment (is empty)\n' Comment.Single

'\n      '    Text
'/*\n      // Data descriptor\n      $fd .= pack("V", crc32($content));          // crc-32\n      $fd .= pack("V", strlen($compressed_data)); // Compressed size\n      $fd .= pack("V", strlen($content));         // Uncompressed size\n      */' Comment.Multiline
'\n\n      '  Text
'// Append file data to the central directory data\n' Comment.Single

'      '      Text
'$cd_data'    Name.Variable
'[]'          Punctuation
' '           Text
'='           Operator
' '           Text
'$fd'         Name.Variable
';'           Punctuation
'\n    '      Text
'}'           Punctuation
'\n\n    '    Text
'// Digital signature\n' Comment.Single

'    '        Text
'$digital_signature' Name.Variable
' '           Text
'='           Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'\n    '      Text
'$digital_signature' Name.Variable
' '           Text
'.='          Operator
' '           Text
'"'           Literal.String.Double
'\\x50'       Literal.String.Escape
'\\x4b'       Literal.String.Escape
'\\x05'       Literal.String.Escape
'\\x05'       Literal.String.Escape
'"'           Literal.String.Double
';'           Punctuation
'  '          Text
'// Header signature\n' Comment.Single

'    '        Text
'$digital_signature' Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'        '    Text
'// Size of data\n' Comment.Single

'    '        Text
'$digital_signature' Name.Variable
' '           Text
'.='          Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'                  ' Text
'// Signature data (is empty)\n' Comment.Single

'\n    '      Text
'$tmp_file_data' Name.Variable
' '           Text
'='           Operator
' '           Text
'implode'     Name.Builtin
'('           Punctuation
"''"          Literal.String.Single
','           Punctuation
' '           Text
'$file_data'  Name.Variable
');'          Punctuation
'  '          Text
'// File data\n' Comment.Single

'    '        Text
'$tmp_cd_data' Name.Variable
'   '         Text
'='           Operator
' '           Text
'implode'     Name.Builtin
'('           Punctuation
"''"          Literal.String.Single
','           Punctuation
' '           Text
'$cd_data'    Name.Variable
')'           Punctuation
'.'           Operator
'    '        Text
'// Central directory\n' Comment.Single

'                     ' Text
'$digital_signature' Name.Variable
';'           Punctuation
'       '     Text
'// Digital signature\n' Comment.Single

'\n    '      Text
'// End of central directory\n' Comment.Single

'    '        Text
'$eof_cd'     Name.Variable
' '           Text
'='           Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'\n    '      Text
'$eof_cd'     Name.Variable
' '           Text
'.='          Operator
' '           Text
'"'           Literal.String.Double
'\\x50'       Literal.String.Escape
'\\x4b'       Literal.String.Escape
'\\x05'       Literal.String.Escape
'\\x06'       Literal.String.Escape
'"'           Literal.String.Double
';'           Punctuation
'                ' Text
'// End of central dir signature\n' Comment.Single

'    '        Text
'$eof_cd'     Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                      ' Text
'// Number of this disk\n' Comment.Single

'    '        Text
'$eof_cd'     Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                      ' Text
'// Number of the disk with the start of the central directory\n' Comment.Single

'    '        Text
'$eof_cd'     Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'count'       Name.Builtin
'('           Punctuation
'$cd_data'    Name.Variable
'));'         Punctuation
'        '    Text
'// Total number of entries in the central directory on this disk\n' Comment.Single

'    '        Text
'$eof_cd'     Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'count'       Name.Builtin
'('           Punctuation
'$cd_data'    Name.Variable
'));'         Punctuation
'        '    Text
'// Total number of entries in the central directory\n' Comment.Single

'    '        Text
'$eof_cd'     Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$tmp_cd_data' Name.Variable
'));'         Punctuation
'   '         Text
'// Size of the central directory\n' Comment.Single

'    '        Text
'$eof_cd'     Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'V'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$tmp_file_data' Name.Variable
'));'         Punctuation
' '           Text
'// Offset of start of central directory with respect to the starting disk number\n' Comment.Single

'    '        Text
'$eof_cd'     Name.Variable
' '           Text
'.='          Operator
' '           Text
'pack'        Name.Builtin
'('           Punctuation
'"'           Literal.String.Double
'v'           Literal.String.Double
'"'           Literal.String.Double
','           Punctuation
' '           Text
'0'           Literal.Number.Integer
');'          Punctuation
'                      ' Text
'// .ZIP file comment length\n' Comment.Single

'    '        Text
'$eof_cd'     Name.Variable
' '           Text
'.='          Operator
' '           Text
"''"          Literal.String.Single
';'           Punctuation
'                                ' Text
'// .ZIP file comment (is empty)\n' Comment.Single

'\n    '      Text
'// Content of the zip file\n' Comment.Single

'    '        Text
'$data'       Name.Variable
' '           Text
'='           Operator
' '           Text
'$tmp_file_data' Name.Variable
'.'           Operator
'\n            ' Text
'// $extra_data_record.\n' Comment.Single

'            ' Text
'$tmp_cd_data' Name.Variable
'.'           Operator
'\n            ' Text
'$eof_cd'     Name.Variable
';'           Punctuation
'\n\n    '    Text
'// Return content?\n' Comment.Single

'    '        Text
'if'          Keyword
'('           Punctuation
'!'           Operator
'$filename'   Name.Variable
')'           Punctuation
'\n      '    Text
'return'      Keyword
' '           Text
'$data'       Name.Variable
';'           Punctuation
'\n      \n    ' Text
'// Write to file\n' Comment.Single

'    '        Text
'return'      Keyword
' '           Text
'file_put_contents' Name.Builtin
'('           Punctuation
'$filename'   Name.Variable
','           Punctuation
' '           Text
'$data'       Name.Variable
');'          Punctuation
'\n  '        Text
'}'           Punctuation
'\n  \n '     Text
"/**\n  *  Load a zip file\n  *\n  *  This function loads the files and dirs from a zip file from the harddrive.\n  *\n  *  @access                public\n  *\n  *  @param  string $file   The path to the zip file\n  *  @param  bool   $reset  Reset the files and dirs before adding the zip file's content?\n  *\n  *  @return bool           Returns true if the file was loaded sucessfully\n  */" Literal.String.Doc
'\n  '        Text
'function'    Keyword
' '           Text
'load_file'   Name.Function
'('           Punctuation
'$file'       Name.Variable
','           Punctuation
' '           Text
'$reset'      Name.Variable
' '           Text
'='           Operator
' '           Text
'true'        Keyword
')'           Punctuation
' '           Text
'{'           Punctuation
'\n    '      Text
'// Check whether the file exists\n' Comment.Single

'    '        Text
'if'          Keyword
'('           Punctuation
'!'           Operator
'file_exists' Name.Builtin
'('           Punctuation
'$file'       Name.Variable
'))'          Punctuation
'\n      '    Text
'return'      Keyword
' '           Text
'false'       Keyword
';'           Punctuation
'\n\n    '    Text
'// Load the files content\n' Comment.Single

'    '        Text
'$content'    Name.Variable
' '           Text
'='           Operator
' '           Text
'@'           Operator
'file_get_contents' Name.Builtin
'('           Punctuation
'$file'       Name.Variable
');'          Punctuation
'\n\n    '    Text
'// Return false if the file cannot be opened\n' Comment.Single

'    '        Text
'if'          Keyword
'('           Punctuation
'!'           Operator
'$content'    Name.Variable
')'           Punctuation
'\n      '    Text
'return'      Keyword
' '           Text
'false'       Keyword
';'           Punctuation
'\n\n    '    Text
'// Read the zip\n' Comment.Single

'    '        Text
'return'      Keyword
' '           Text
'$this'       Name.Variable
'->'          Operator
'load_string' Name.Attribute
'('           Punctuation
'$content'    Name.Variable
','           Punctuation
' '           Text
'$reset'      Name.Variable
');'          Punctuation
'\n  '        Text
'}'           Punctuation
'\n  \n '     Text
"/**\n  *  Load a zip string\n  *\n  *  This function loads the files and dirs from a string\n  *\n  *  @access                 public\n  *\n  *  @param  string $string  The string the zip is generated from\n  *  @param  bool   $reset   Reset the files and dirs before adding the zip file's content?\n  *\n  *  @return bool            Returns true if the string was loaded sucessfully\n  */" Literal.String.Doc
'\n  '        Text
'function'    Keyword
' '           Text
'load_string' Name.Function
'('           Punctuation
'$string'     Name.Variable
','           Punctuation
' '           Text
'$reset'      Name.Variable
' '           Text
'='           Operator
' '           Text
'true'        Keyword
')'           Punctuation
' '           Text
'{'           Punctuation
'\n    '      Text
'// Reset the zip?\n' Comment.Single

'    '        Text
'if'          Keyword
'('           Punctuation
'$reset'      Name.Variable
')'           Punctuation
' '           Text
'{'           Punctuation
'\n      '    Text
'$this'       Name.Variable
'->'          Operator
'dirs'        Name.Attribute
'  '          Text
'='           Operator
' '           Text
'array'       Keyword
'();'         Punctuation
'\n      '    Text
'$this'       Name.Variable
'->'          Operator
'files'       Name.Attribute
' '           Text
'='           Operator
' '           Text
'array'       Keyword
'();'         Punctuation
'\n    '      Text
'}'           Punctuation
'\n\n    '    Text
'// Get the starting position of the end of central directory record\n' Comment.Single

'    '        Text
'$start'      Name.Variable
' '           Text
'='           Operator
' '           Text
'strpos'      Name.Builtin
'('           Punctuation
'$string'     Name.Variable
','           Punctuation
' '           Text
'"'           Literal.String.Double
'\\x50'       Literal.String.Escape
'\\x4b'       Literal.String.Escape
'\\x05'       Literal.String.Escape
'\\x06'       Literal.String.Escape
'"'           Literal.String.Double
');'          Punctuation
'\n\n    '    Text
'// Error\n'  Comment.Single

'    '        Text
'if'          Keyword
'('           Punctuation
'$start'      Name.Variable
' '           Text
'==='         Operator
' '           Text
'false'       Keyword
')'           Punctuation
'\n      '    Text
'die'         Keyword
'('           Punctuation
"'Could not find the end of central directory record'" Literal.String.Single
');'          Punctuation
'\n\n    '    Text
'// Get the ecdr\n' Comment.Single

'    '        Text
'$eof_cd'     Name.Variable
' '           Text
'='           Operator
' '           Text
'substr'      Name.Builtin
'('           Punctuation
'$string'     Name.Variable
','           Punctuation
' '           Text
'$start'      Name.Variable
'+'           Operator
'4'           Literal.Number.Integer
','           Punctuation
' '           Text
'18'          Literal.Number.Integer
');'          Punctuation
'\n\n    '    Text
'// Unpack the ecdr infos\n' Comment.Single

'    '        Text
'$eof_cd'     Name.Variable
' '           Text
'='           Operator
' '           Text
'unpack'      Name.Builtin
'('           Punctuation
"'vdisc1/'"   Literal.String.Single
'.'           Operator
'\n                     ' Text
"'vdisc2/'"   Literal.String.Single
'.'           Operator
'\n                     ' Text
"'ventries1/'" Literal.String.Single
'.'           Operator
'\n                     ' Text
"'ventries2/'" Literal.String.Single
'.'           Operator
'\n                     ' Text
"'Vsize/'"    Literal.String.Single
'.'           Operator
'\n                     ' Text
"'Voffset/'"  Literal.String.Single
'.'           Operator
'\n                     ' Text
"'vcomment_lenght'" Literal.String.Single
','           Punctuation
' '           Text
'$eof_cd'     Name.Variable
');'          Punctuation
'\n\n    '    Text
'// Do not allow multi disc zips\n' Comment.Single

'    '        Text
'if'          Keyword
'('           Punctuation
'$eof_cd'     Name.Variable
'['           Punctuation
"'disc1'"     Literal.String.Single
']'           Punctuation
' '           Text
'!='          Operator
' '           Text
'0'           Literal.Number.Integer
')'           Punctuation
'\n      '    Text
'die'         Keyword
'('           Punctuation
"'multi disk stuff is not yet implemented :/'" Literal.String.Single
');'          Punctuation
'\n\n    '    Text
'// Save the interesting values\n' Comment.Single

'    '        Text
'$cd_entries' Name.Variable
' '           Text
'='           Operator
' '           Text
'$eof_cd'     Name.Variable
'['           Punctuation
"'entries1'"  Literal.String.Single
'];'          Punctuation
'\n    '      Text
'$cd_size'    Name.Variable
'    '        Text
'='           Operator
' '           Text
'$eof_cd'     Name.Variable
'['           Punctuation
"'size'"      Literal.String.Single
'];'          Punctuation
'\n    '      Text
'$cd_offset'  Name.Variable
'  '          Text
'='           Operator
' '           Text
'$eof_cd'     Name.Variable
'['           Punctuation
"'offset'"    Literal.String.Single
'];'          Punctuation
'\n\n    '    Text
'// Get the central directory record\n' Comment.Single

'    '        Text
'$cdr'        Name.Variable
' '           Text
'='           Operator
' '           Text
'substr'      Name.Builtin
'('           Punctuation
'$string'     Name.Variable
','           Punctuation
' '           Text
'$cd_offset'  Name.Variable
','           Punctuation
' '           Text
'$cd_size'    Name.Variable
');'          Punctuation
'\n\n    '    Text
'// Reset the position and the list of the entries\n' Comment.Single

'    '        Text
'$pos'        Name.Variable
'     '       Text
'='           Operator
' '           Text
'0'           Literal.Number.Integer
';'           Punctuation
'\n    '      Text
'$entries'    Name.Variable
' '           Text
'='           Operator
' '           Text
'array'       Keyword
'();'         Punctuation
'\n\n    '    Text
'// Handle cdr\n' Comment.Single

'    '        Text
'while'       Keyword
'('           Punctuation
'$pos'        Name.Variable
' '           Text
'<'           Operator
' '           Text
'strlen'      Name.Builtin
'('           Punctuation
'$cdr'        Name.Variable
'))'          Punctuation
' '           Text
'{'           Punctuation
'\n      '    Text
'// Check header signature\n' Comment.Single

'      '      Text
'// Digital signature\n' Comment.Single

'      '      Text
'if'          Keyword
'('           Punctuation
'substr'      Name.Builtin
'('           Punctuation
'$cdr'        Name.Variable
','           Punctuation
' '           Text
'$pos'        Name.Variable
','           Punctuation
' '           Text
'4'           Literal.Number.Integer
')'           Punctuation
' '           Text
'=='          Operator
' '           Text
'"'           Literal.String.Double
'\\x50'       Literal.String.Escape
'\\x4b'       Literal.String.Escape
'\\x05'       Literal.String.Escape
'\\x05'       Literal.String.Escape
'"'           Literal.String.Double
')'           Punctuation
' '           Text
'{'           Punctuation
'\n        '  Text
'// Get digital signature size\n' Comment.Single

'        '    Text
'$tmp_info'   Name.Variable
' '           Text
'='           Operator
' '           Text
'unpack'      Name.Builtin
'('           Punctuation
"'vsize'"     Literal.String.Single
','           Punctuation
' '           Text
'substr'      Name.Builtin
'('           Punctuation
'$cdr'        Name.Variable
','           Punctuation
' '           Text
'$pos'        Name.Variable
' '           Text
'+'           Operator
' '           Text
'4'           Literal.Number.Integer
','           Punctuation
' '           Text
'2'           Literal.Number.Integer
'));'         Punctuation
'\n\n        ' Text
'// Read out the digital signature\n' Comment.Single

'        '    Text
'$digital_sig' Name.Variable
' '           Text
'='           Operator
' '           Text
'substr'      Name.Builtin
'('           Punctuation
'$header'     Name.Variable
','           Punctuation
' '           Text
'$pos'        Name.Variable
' '           Text
'+'           Operator
' '           Text
'6'           Literal.Number.Integer
','           Punctuation
' '           Text
'$tmp_info'   Name.Variable
'['           Punctuation
"'size'"      Literal.String.Single
']);'         Punctuation
'\n\n        ' Text
'break'       Keyword
';'           Punctuation
'\n      '    Text
'}'           Punctuation
'\n\n      '  Text
'// Get file header\n' Comment.Single

'      '      Text
'$header'     Name.Variable
' '           Text
'='           Operator
' '           Text
'substr'      Name.Builtin
'('           Punctuation
'$cdr'        Name.Variable
','           Punctuation
' '           Text
'$pos'        Name.Variable
','           Punctuation
' '           Text
'46'          Literal.Number.Integer
');'          Punctuation
'\n\n      '  Text
'// Unpack the header information\n' Comment.Single

'      '      Text
'$header_info' Name.Variable
' '           Text
'='           Operator
' '           Text
'@'           Operator
'unpack'      Name.Builtin
'('           Punctuation
"'Vheader/'"  Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vversion_made_by/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vversion_needed/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vgeneral_purpose/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vcompression_method/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vlast_mod_time/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vlast_mod_date/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'Vcrc32/'"   Literal.String.Single
'.'           Operator
'\n                             ' Text
"'Vcompressed_size/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'Vuncompressed_size/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vname_length/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vextra_length/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vcomment_length/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vdisk_number/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vinternal_attributes/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'Vexternal_attributes/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'Voffset'"   Literal.String.Single
','           Punctuation
'\n                             ' Text
'$header'     Name.Variable
');'          Punctuation
'\n\n      '  Text
'// Valid header?\n' Comment.Single

'      '      Text
'if'          Keyword
'('           Punctuation
'$header_info' Name.Variable
'['           Punctuation
"'header'"    Literal.String.Single
']'           Punctuation
' '           Text
'!='          Operator
' '           Text
'33639248'    Literal.Number.Integer
')'           Punctuation
'\n        '  Text
'return'      Keyword
' '           Text
'false'       Keyword
';'           Punctuation
'\n\n      '  Text
'// New position\n' Comment.Single

'      '      Text
'$pos'        Name.Variable
' '           Text
'+='          Operator
' '           Text
'46'          Literal.Number.Integer
';'           Punctuation
'\n\n      '  Text
'// Read out the file name\n' Comment.Single

'      '      Text
'$header_info' Name.Variable
'['           Punctuation
"'name'"      Literal.String.Single
']'           Punctuation
' '           Text
'='           Operator
' '           Text
'substr'      Name.Builtin
'('           Punctuation
'$cdr'        Name.Variable
','           Punctuation
' '           Text
'$pos'        Name.Variable
','           Punctuation
' '           Text
'$header_info' Name.Variable
'['           Punctuation
"'name_length'" Literal.String.Single
']);'         Punctuation
'\n\n      '  Text
'// New position\n' Comment.Single

'      '      Text
'$pos'        Name.Variable
' '           Text
'+='          Operator
' '           Text
'$header_info' Name.Variable
'['           Punctuation
"'name_length'" Literal.String.Single
'];'          Punctuation
'\n\n      '  Text
'// Read out the extra stuff\n' Comment.Single

'      '      Text
'$header_info' Name.Variable
'['           Punctuation
"'extra'"     Literal.String.Single
']'           Punctuation
' '           Text
'='           Operator
' '           Text
'substr'      Name.Builtin
'('           Punctuation
'$cdr'        Name.Variable
','           Punctuation
' '           Text
'$pos'        Name.Variable
','           Punctuation
' '           Text
'$header_info' Name.Variable
'['           Punctuation
"'extra_length'" Literal.String.Single
']);'         Punctuation
'\n\n      '  Text
'// New position\n' Comment.Single

'      '      Text
'$pos'        Name.Variable
' '           Text
'+='          Operator
' '           Text
'$header_info' Name.Variable
'['           Punctuation
"'extra_length'" Literal.String.Single
'];'          Punctuation
'\n\n      '  Text
'// Read out the comment\n' Comment.Single

'      '      Text
'$header_info' Name.Variable
'['           Punctuation
"'comment'"   Literal.String.Single
']'           Punctuation
' '           Text
'='           Operator
' '           Text
'substr'      Name.Builtin
'('           Punctuation
'$cdr'        Name.Variable
','           Punctuation
' '           Text
'$pos'        Name.Variable
','           Punctuation
' '           Text
'$header_info' Name.Variable
'['           Punctuation
"'comment_length'" Literal.String.Single
']);'         Punctuation
'\n\n      '  Text
'// New position\n' Comment.Single

'      '      Text
'$pos'        Name.Variable
' '           Text
'+='          Operator
' '           Text
'$header_info' Name.Variable
'['           Punctuation
"'comment_length'" Literal.String.Single
'];'          Punctuation
'\n\n      '  Text
'// Append this file/dir to the entry list\n' Comment.Single

'      '      Text
'$entries'    Name.Variable
'[]'          Punctuation
' '           Text
'='           Operator
' '           Text
'$header_info' Name.Variable
';'           Punctuation
'\n    '      Text
'}'           Punctuation
'\n\n    '    Text
'// Check whether all entries where read sucessfully\n' Comment.Single

'    '        Text
'if'          Keyword
'('           Punctuation
'count'       Name.Builtin
'('           Punctuation
'$entries'    Name.Variable
')'           Punctuation
' '           Text
'!='          Operator
' '           Text
'$cd_entries' Name.Variable
')'           Punctuation
'\n      '    Text
'return'      Keyword
' '           Text
'false'       Keyword
';'           Punctuation
'\n\n    '    Text
'// Handle files/dirs\n' Comment.Single

'    '        Text
'foreach'     Keyword
'('           Punctuation
'$entries'    Name.Variable
' '           Text
'as'          Keyword
' '           Text
'$entry'      Name.Variable
')'           Punctuation
' '           Text
'{'           Punctuation
'\n      '    Text
'// Is a dir?\n' Comment.Single

'      '      Text
'if'          Keyword
'('           Punctuation
'$entry'      Name.Variable
'['           Punctuation
"'external_attributes'" Literal.String.Single
']'           Punctuation
' '           Text
'&'           Operator
' '           Text
'16'          Literal.Number.Integer
')'           Punctuation
' '           Text
'{'           Punctuation
'\n        '  Text
'$this'       Name.Variable
'->'          Operator
'add_dir'     Name.Attribute
'('           Punctuation
'$entry'      Name.Variable
'['           Punctuation
"'name'"      Literal.String.Single
']);'         Punctuation
'\n        '  Text
'continue'    Keyword
';'           Punctuation
'\n      '    Text
'}'           Punctuation
'\n\n      '  Text
'// Get local file header\n' Comment.Single

'      '      Text
'$header'     Name.Variable
' '           Text
'='           Operator
' '           Text
'substr'      Name.Builtin
'('           Punctuation
'$string'     Name.Variable
','           Punctuation
' '           Text
'$entry'      Name.Variable
'['           Punctuation
"'offset'"    Literal.String.Single
'],'          Punctuation
' '           Text
'30'          Literal.Number.Integer
');'          Punctuation
'\n\n      '  Text
'// Unpack the header information\n' Comment.Single

'      '      Text
'$header_info' Name.Variable
' '           Text
'='           Operator
' '           Text
'@'           Operator
'unpack'      Name.Builtin
'('           Punctuation
"'Vheader/'"  Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vversion_needed/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vgeneral_purpose/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vcompression_method/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vlast_mod_time/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vlast_mod_date/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'Vcrc32/'"   Literal.String.Single
'.'           Operator
'\n                             ' Text
"'Vcompressed_size/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'Vuncompressed_size/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vname_length/'" Literal.String.Single
'.'           Operator
'\n                             ' Text
"'vextra_length'" Literal.String.Single
','           Punctuation
'\n                             ' Text
'$header'     Name.Variable
');'          Punctuation
'\n\n      '  Text
'// Valid header?\n' Comment.Single

'      '      Text
'if'          Keyword
'('           Punctuation
'$header_info' Name.Variable
'['           Punctuation
"'header'"    Literal.String.Single
']'           Punctuation
' '           Text
'!='          Operator
' '           Text
'67324752'    Literal.Number.Integer
')'           Punctuation
'\n        '  Text
'return'      Keyword
' '           Text
'false'       Keyword
';'           Punctuation
'\n\n      '  Text
'// Get content start position\n' Comment.Single

'      '      Text
'$start'      Name.Variable
' '           Text
'='           Operator
' '           Text
'$entry'      Name.Variable
'['           Punctuation
"'offset'"    Literal.String.Single
']'           Punctuation
' '           Text
'+'           Operator
' '           Text
'30'          Literal.Number.Integer
' '           Text
'+'           Operator
' '           Text
'$header_info' Name.Variable
'['           Punctuation
"'name_length'" Literal.String.Single
']'           Punctuation
' '           Text
'+'           Operator
' '           Text
'$header_info' Name.Variable
'['           Punctuation
"'extra_length'" Literal.String.Single
'];'          Punctuation
'\n\n      '  Text
'// Get the compressed data\n' Comment.Single

'      '      Text
'$data'       Name.Variable
' '           Text
'='           Operator
' '           Text
'substr'      Name.Builtin
'('           Punctuation
'$string'     Name.Variable
','           Punctuation
' '           Text
'$start'      Name.Variable
','           Punctuation
' '           Text
'$header_info' Name.Variable
'['           Punctuation
"'compressed_size'" Literal.String.Single
']);'         Punctuation
'\n\n      '  Text
'// Detect compression type\n' Comment.Single

'      '      Text
'switch'      Keyword
'('           Punctuation
'$header_info' Name.Variable
'['           Punctuation
"'compression_method'" Literal.String.Single
'])'          Punctuation
' '           Text
'{'           Punctuation
'\n        '  Text
'// No compression\n' Comment.Single

'        '    Text
'case'        Keyword
' '           Text
'0'           Literal.Number.Integer
':'           Operator
'\n          ' Text
'// Ne decompression needed\n' Comment.Single

'          '  Text
'$content'    Name.Variable
' '           Text
'='           Operator
' '           Text
'$data'       Name.Variable
';'           Punctuation
'\n          ' Text
'break'       Keyword
';'           Punctuation
'\n\n        ' Text
'// Gzip\n'   Comment.Single

'        '    Text
'case'        Keyword
' '           Text
'8'           Literal.Number.Integer
':'           Operator
'\n          ' Text
'if'          Keyword
'('           Punctuation
'!'           Operator
'function_exists' Name.Builtin
'('           Punctuation
"'gzinflate'" Literal.String.Single
'))'          Punctuation
'\n            ' Text
'return'      Keyword
' '           Text
'false'       Keyword
';'           Punctuation
'\n\n          ' Text
'// Uncompress data\n' Comment.Single

'          '  Text
'$content'    Name.Variable
' '           Text
'='           Operator
' '           Text
'gzinflate'   Name.Builtin
'('           Punctuation
'$data'       Name.Variable
');'          Punctuation
'\n          ' Text
'break'       Keyword
';'           Punctuation
'\n\n        ' Text
'// Bzip2\n'  Comment.Single

'        '    Text
'case'        Keyword
' '           Text
'12'          Literal.Number.Integer
':'           Operator
'\n          ' Text
'if'          Keyword
'('           Punctuation
'!'           Operator
'function_exists' Name.Builtin
'('           Punctuation
"'bzdecompress'" Literal.String.Single
'))'          Punctuation
'\n            ' Text
'return'      Keyword
' '           Text
'false'       Keyword
';'           Punctuation
'\n\n          ' Text
'// Decompress data\n' Comment.Single

'          '  Text
'$content'    Name.Variable
' '           Text
'='           Operator
' '           Text
'bzdecompress' Name.Builtin
'('           Punctuation
'$data'       Name.Variable
');'          Punctuation
'\n          ' Text
'break'       Keyword
';'           Punctuation
'\n\n        ' Text
'// Compression not supported -> error\n' Comment.Single

'        '    Text
'default'     Keyword
':'           Operator
'\n          ' Text
'return'      Keyword
' '           Text
'false'       Keyword
';'           Punctuation
'\n      '    Text
'}'           Punctuation
'\n\n      '  Text
'// Try to add file\n' Comment.Single

'      '      Text
'if'          Keyword
'('           Punctuation
'!'           Operator
'$this'       Name.Variable
'->'          Operator
'add_file'    Name.Attribute
'('           Punctuation
'$entry'      Name.Variable
'['           Punctuation
"'name'"      Literal.String.Single
'],'          Punctuation
' '           Text
'$content'    Name.Variable
'))'          Punctuation
'\n        '  Text
'return'      Keyword
' '           Text
'false'       Keyword
';'           Punctuation
'\n    '      Text
'}'           Punctuation
'\n\n    '    Text
'return'      Keyword
' '           Text
'true'        Keyword
';'           Punctuation
'\n  '        Text
'}'           Punctuation
'\n'          Text

'}'           Punctuation
'\n\n'        Text

'function'    Keyword
' '           Text
'&'           Operator
'byref'       Name.Function
'()'          Punctuation
' '           Text
'{'           Punctuation
'\n    '      Text
'$x'          Name.Variable
' '           Text
'='           Operator
' '           Text
'array'       Keyword
'();'         Punctuation
'\n    '      Text
'return'      Keyword
' '           Text
'$x'          Name.Variable
';'           Punctuation
'\n'          Text

'}'           Punctuation
'\n\n'        Text

'// Test highlighting of magic methods and variables\n' Comment.Single

'class'       Keyword
' '           Text
'MagicClass'  Name.Class
' '           Text
'{'           Punctuation
'\n  '        Text
'public'      Keyword
' '           Text
'$magic_str'  Name.Variable
';'           Punctuation
'\n  '        Text
'public'      Keyword
' '           Text
'$ordinary_str' Name.Variable
';'           Punctuation
'\n\n  '      Text
'public'      Keyword
' '           Text
'function'    Keyword
' '           Text
'__construct' Name.Function.Magic
'('           Punctuation
'$some_var'   Name.Variable
')'           Punctuation
' '           Text
'{'           Punctuation
'\n    '      Text
'$this'       Name.Variable
'->'          Operator
'magic_str'   Name.Attribute
' '           Text
'='           Operator
' '           Text
'__FILE__'    Name.Constant
';'           Punctuation
'\n    '      Text
'$this'       Name.Variable
'->'          Operator
'ordinary_str' Name.Attribute
' '           Text
'='           Operator
' '           Text
'$some_var'   Name.Variable
';'           Punctuation
'\n  '        Text
'}'           Punctuation
'\n\n  '      Text
'public'      Keyword
' '           Text
'function'    Keyword
' '           Text
'__toString'  Name.Function.Magic
'()'          Punctuation
' '           Text
'{'           Punctuation
'\n    '      Text
'return'      Keyword
' '           Text
'$this'       Name.Variable
'->'          Operator
'magic_str'   Name.Attribute
';'           Punctuation
'\n  '        Text
'}'           Punctuation
'\n\n  '      Text
'public'      Keyword
' '           Text
'function'    Keyword
' '           Text
'nonMagic'    Name.Function
'()'          Punctuation
' '           Text
'{'           Punctuation
'\n    '      Text
'return'      Keyword
' '           Text
'$this'       Name.Variable
'->'          Operator
'ordinary_str' Name.Attribute
';'           Punctuation
'\n  '        Text
'}'           Punctuation
'\n'          Text

'}'           Punctuation
'\n\n'        Text

'$magic'      Name.Variable
' '           Text
'='           Operator
' '           Text
'new'         Keyword
' '           Text
'MagicClass'  Name.Other
'('           Punctuation
'__DIR__'     Name.Constant
');'          Punctuation
'\n'          Text

'__toString'  Name.Other
'();'         Punctuation
'\n'          Text

'$magic'      Name.Variable
'->'          Operator
'nonMagic'    Name.Attribute
'();'         Punctuation
'\n'          Text

'$magic'      Name.Variable
'->'          Operator
'__toString'  Name.Attribute
'();'         Punctuation
'\n\n     '   Text
'echo'        Keyword
' '           Text
'<<<'         Literal.String
'EOF'         Literal.String.Delimiter
'\n\n     Test the heredocs...\n\n     ' Literal.String
'EOF'         Literal.String.Delimiter
';'           Punctuation
'\n'          Text

'\n'          Text

'echo'        Keyword
' '           Text
'<<<'         Literal.String
'"'           Literal.String
'some_delimiter' Literal.String.Delimiter
'"\nmore heredoc testing\ncontinues on this line\n' Literal.String

'some_delimiter' Literal.String.Delimiter
';'           Punctuation
'\n'          Text

'\n'          Text

'?>'          Comment.Preproc
'\n'          Other
