Skip to content

Instantly share code, notes, and snippets.

@akuznecov
Created June 25, 2013 05:40
Show Gist options
  • Save akuznecov/5856184 to your computer and use it in GitHub Desktop.
Save akuznecov/5856184 to your computer and use it in GitHub Desktop.
GeSHi syntax file for Varnish configuration language (VCL)
<?php
/*************************************************************************************
* varnish.php
* ------
* Author: Alexander Kuznetcov ([email protected])
* Copyright: (c) Alexander Kuznetcov (http://blog.tenya.me)
* Release Version: 1.0.0.0
* Date Started: 2013/06/25
*
* Varnish 3.x language file for GeSHi.
*
* CHANGES
* -------
* 2013/06/25
* - First Release
*
*************************************************************************************
*
* This file is part of GeSHi.
*
* GeSHi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GeSHi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GeSHi; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
************************************************************************************/
$language_data = array (
'LANG_NAME' => 'varnish',
'COMMENT_SINGLE' => array(1 => '#'),
'COMMENT_MULTI' => array('/*' => '*/'),
'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
'QUOTEMARKS' => array("'", '"'),
'ESCAPE_CHAR' => '\\',
'KEYWORDS' => array(
1 => array( // subroutines
'vcl_recv',
'vcl_init',
'vcl_pipe',
'vcl_pass',
'vcl_hash',
'vcl_hit',
'vcl_miss',
'vcl_fetch',
'vcl_deliver',
'vcl_error',
'vcl_fini',
),
2 => array( // declarations
'backend',
'acl',
'include',
'director',
'sub',
'import',
),
3 => array( // configuration variables
'.host',
'.port',
'.connect_timeout',
'.first_byte_timeout',
'.between_bytes_timeout',
'.retries',
'.weight',
'.backend',
'.ttl',
'.suffix',
'.list',
'.host_header',
'.probe',
'.url',
'.timeout',
'.window',
'.threshold',
'.initial',
'.expected_response',
'.request',
),
4 => array( // functions
'hash_data',
'regsub',
'regsuball',
'ban',
'ban_url',
'call',
'return',
'error',
'set',
'unset',
'remove',
'purge',
'synthetic',
),
5 => array( // varibles
'now',
'client.ip',
'client.identity',
'server.hostname',
'server.identity',
'source_charset',
'server.ip',
'server.port',
'req.request',
'req.url',
'req.proto',
'req.backend',
'req.backend.healthy',
'req.hash_always_miss',
'req.hash_ignore_busy',
'req.can_gzip',
'req.restarts',
'req.esi',
'req.esi_level',
'req.grace',
'req.xid',
'bereq.request',
'bereq.url',
'bereq.proto',
'bereq.connect_timeout',
'bereq.first_byte_timeout',
'beresp.do_stream',
'beresp.do_esi',
'beresp.do_gzip',
'beresp.do_gunzip',
'beresp.proto',
'beresp.status',
'beresp.response',
'beresp.ttl',
'beresp.grace',
'beresp.saintmode',
'beresp.backend.name',
'beresp.backend.ip',
'beresp.backend.port',
'beresp.storage',
'obj.proto',
'obj.status',
'obj.response',
'obj.ttl',
'obj.lastuse',
'obj.hits',
'obj.grace',
'req.hash',
'resp.proto',
'resp.status',
'resp.response',
),
6 => array( // condition statements
'if',
'elsif',
'else',
),
7 => array( // http status codes
'100', '101', '102', '105', '200', '201', '202', '203', '204', '205', '206', '207', '226',
'300', '301', '302', '302', '303', '304', '305', '306', '307', '400', '401', '402', '403',
'404', '405', '406', '407', '408', '409', '410', '411', '412', '413', '414', '415', '416',
'417', '422', '423', '424', '425', '426', '428', '429', '431', '449', '451', '456', '499',
'500', '501', '502', '503', '504', '505', '506', '507', '508', '509', '510', '511',
),
8 => array( // return statements
'deliver',
'fetch',
'hash',
'hit_for_pass',
'lookup',
'ok',
'pipe',
'pass',
'restart',
),
),
'SYMBOLS' => array(
'(', ')', '{', '}', '=', '==', '>=', '<=', '~', ';', '||', '&&', '+', '!~',
),
'CASE_SENSITIVE' => array(
GESHI_COMMENTS => true,
1 => true,
2 => true,
3 => true,
4 => true,
5 => true,
6 => true,
7 => true,
8 => true,
),
'STYLES' => array(
'KEYWORDS' => array(
1 => 'color: #b1b100; font-weight:bold;',
2 => 'color: #dc143c; font-weight:bold;',
3 => 'color: #993333;',
4 => 'color: #000066;',
5 => 'color: #0000ff;',
6 => 'color: #ff7700;',
7 => 'color: #008000; font-weight: bold;',
8 => 'color: #008000;',
),
'COMMENTS' => array(
1 => 'color: #808080; font-style: italic;',
'MULTI' => 'color: #808080; font-style: italic;',
),
'ESCAPE_CHAR' => array(
0 => 'color: #000099; font-weight: bold;'
),
'BRACKETS' => array(
0 => 'color: #66cc66;'
),
'STRINGS' => array(
0 => 'color: #ff0000;'
),
'NUMBERS' => array(
),
'METHODS' => array(
1 => 'color: #202020;',
2 => 'color: #202020;'
),
'SYMBOLS' => array(
0 => 'color: #66cc66;'
),
'REGEXPS' => array(
0 => 'color: #0000ff;',
1 => 'color: #000066; font-weight: bold;',
),
'SCRIPT' => array()
),
'URLS' => array(
1 => '',
2 => '',
3 => '',
4 => '',
5 => '',
6 => '',
7 => '',
8 => '',
),
'OOLANG' => false,
'OBJECT_SPLITTERS' => array(),
'REGEXPS' => array(
0 => '(req|beresp|bereq|resp|obj)\.http\.[a-zA-Z0-9_\-]*',
1 => '[0-9]{1,}(s|m|h|d|y)',
),
'STRICT_MODE_APPLIES' => GESHI_NEVER,
'SCRIPT_DELIMITERS' => array(),
'HIGHLIGHT_STRICT_BLOCK' => array()
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment