DCPU-16 плагин для Geshi

При создании форума для 0x10c.ws не нашёл никакого плагина для подсветки синтаксиса DCPU-16, написал свой. Цвета точь-в-точь как на 0x10co.de, к ним многие уже успели привыкнуть, поэтому так:).

Пример

; Try some basic stuff
      SET A, 0x30      ; 7c01 0030
      SET [0x1000], 0x20       ; 7de1 1000 0020
      SUB A, [0x1000]  ; 7803 1000
      IFN A, 0x10      ; c00d 
      SET PC, crash ; 7dc1 001a [*]
 
; Do a loopy thing
      SET I, 10; a861
      SET A, 0x2000    ; 7c01 2000
:loop SET [0x2000+I], [A]      ; 2161 2000
      SUB I, 1 ; 8463
      IFN I, 0 ; 806d
      SET PC, loop  ; 7dc1 000d [*]
 
; Call a subroutine
      SET X, 0x4       ; 9031
      JSR testsub      ; 7c10 0018 [*]
      SET PC, crash    ; 7dc1 001a [*]
 
:testsub      SHL X, 4 ; 9037
      SET PC, POP      ; 61c1
 
; Hang forever. X should now be 0x40 if everything went right.
:crash     SET PC, crash    ; 7dc1 001a [*]
 
; [*]: Note that these can be one word shorter and one cycle faster by using the short form (0x00-0x1f) of literals,
;      but my assembler doesn't support short form labels yet.

Исходный код плагина

<?php
/*************************************************************************************
 * dcpu-16.php
 * -------
 * Author: Sergey Marochkin (xziggix@gmail.com)
 * Copyright: (c) 2012 Sergey Marochkin (http://ziggi.org/)
 * Special for http://0x10c.ws/
 * Release Version: 1.1.0.0
 * Date Started: 2012/04/21
 *************************************************************************************
 *
 *	 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' => 'DCPU-16',
	'COMMENT_SINGLE' => array(1 => ';'),
	'COMMENT_MULTI' => array(),
	'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
	'QUOTEMARKS' => array("'", '"'),
	'ESCAPE_CHAR' => '',
	'KEYWORDS' => array(
		/*CPU*/
		1 => array(
			'set','add','sub','mul','div','mod','shl','shr','and','bor','xor',
			'ifb','ifc','ife','ifn','ifg','ifa','ifb','ifl','ifu',
			'adx','sbx','sti','std','jsr','dat','int','iag','ias','rfi','iaq','hwn','hwq','hwi'
			),
		/*registers*/
		2 => array('a','b','c','x','y','z','i','j' ),
		),
	'SYMBOLS' => array(
		'[', ']', '(', ')'
		),
	'CASE_SENSITIVE' => array(
		GESHI_COMMENTS => false,
		1 => false,
		2 => false,
		3 => false,
		),
	'STYLES' => array(
		'KEYWORDS' => array(
			1 => 'color: #708;',
			2 => 'color: #000;',
			),
		'COMMENTS' => array(
			1 => 'color: #a50;',
			),
		'ESCAPE_CHAR' => array(
			0 => 'color: #000099;'
			),
		'BRACKETS' => array(
			0 => 'color: #000;'
			),
		'STRINGS' => array(
			0 => 'color: #164;'
			),
		'NUMBERS' => array(
			0 => 'color: #164;'
			),
		'METHODS' => array(
			),
		'SYMBOLS' => array(
			0 => 'color: #164;'
			),
		'REGEXPS' => array(
			0 => 'color: #164;'
			),
		'SCRIPT' => array(
			)
		),
	'URLS' => array(
		1 => '',
		2 => '',
		3 => ''
		),
	'OOLANG' => false,
	'OBJECT_SPLITTERS' => array(
		),
	'REGEXPS' => array(
		//Hex numbers
		0 => '0x[0-9a-fA-F]+'
		),
	'STRICT_MODE_APPLIES' => GESHI_NEVER,
	'SCRIPT_DELIMITERS' => array(
		),
	'HIGHLIGHT_STRICT_BLOCK' => array(
		),
	'TAB_WIDTH' => 2
);
 
?>

Pastebin

Для светлого фона
Для тёмного фона

Перейти к верхней панели