The Twelf Project:GeSHi Twelf extension
From The Twelf Project
This is Rob's first attempt at a Twelf highlighting module for the | GeSHi extension. You probably are more interested in the page about syntax highlighting, especially because this highlighter is depreciated and the syntax highlighter for TwelfTag is now written in Haskell.
NOTES:
- September 30, 2006 - When I upgraded from MediaWiki 1.6 to MediaWiki 1.7, I was getting the error messages that looked like this:
Warning: Cannot modify header information - headers already sent by (output started at /usr0/www/twelf/mediawiki-1.7.1/extensions/geshi/twelf.php:174) in /usr0/www/twelf/mediawiki-1.7.1/includes/OutputPage.php on line 588
When I removed the trailing ?> from the end of the file, those errors seemed to go away, but I have no idea why.
<?php /******************************************************************************* * twelf.php * -------- * Author: Robert Simmons (http://www.cs.cmu.edu/~rjsimmon/) * Copyright: (c) 2006 Robert Simmons (http://www.cs.cmu.edu/~rjsimmon/) * Release version: 1.0.0 * Date Started: 2006/09/02 * Last Modified: 2006/09/02 * * Twelf language file for GeSHi. * * CHANGES * ------- * 2004/07/14 (1.0.0) * - First Release * * TODO * ---- ******************************************************************************* * * 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' => 'Twelf', 'COMMENT_SINGLE' => array(1 => '% ', 2 => '%%'), 'COMMENT_MULTI' => array('%{' => '}%'), 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, 'QUOTEMARKS' => array('"'), 'ESCAPE_CHAR' => '', 'KEYWORDS' => array( 1 => array('type'), 2 => array('->','<-'), 3 => array('_'), 4 => array('='), 5 => array('%abbrev','%mode','%worlds','%solve', '%total','%deterministic','%name', '%prove', '%covers', '%terminates', '%trustme', '%freeze') ), 'SYMBOLS' => array(':', '.', '(', ')', '[', ']', '{', '}' ), 'CASE_SENSITIVE' => array( GESHI_COMMENTS => false, 1 => false, 2 => false, 3 => false, 4 => false ), 'STYLES' => array( 'KEYWORDS' => array( 1 => 'font-weight: bold;', 2 => '', 3 => '', 4 => '', 5 => 'color: #6633FF;' ), 'COMMENTS' => array( 1 => 'color: #990000;', 2 => 'color: #990000;', 'MULTI' => 'color: #990000;' ), 'ESCAPE_CHAR' => array( 0 => '' ), 'BRACKETS' => array( 0 => '' ), 'STRINGS' => array( 0 => 'color: #006666;' ), 'NUMBERS' => array( 0 => '' ), 'METHODS' => array( 0 => '' ), 'SYMBOLS' => array( 0 => '' ), 'REGEXPS' => array( 0 => 'color: #6633FF;', 1 => 'color: #000099;', 2 => 'color: #990000;', 3 => 'color: #990000;', 4 => 'color: #990000;', 5 => 'color: #009900;' ), 'SCRIPT' => array( 0 => '', 1 => '', 2 => '', 3 => '' ) ), 'URLS' => array( 1 => '', 2 => '', 3 => '', 4 => '' ), 'OOLANG' => false, 'OBJECT_SPLITTER' => '', 'REGEXPS' => array( // Catches all the %keyword items - BROKEN, use // keyword matching instead /*0 => array( GESHI_SEARCH => '(%[a-z]+)', GESHI_REPLACE => '\\1', GESHI_MODIFIERS => '', GESHI_BEFORE => '', GESHI_AFTER => ''),*/ // Capitalized identifiers 1 => array( GESHI_SEARCH => '([A-Z][A-Za-z0-9\'_]*)', GESHI_REPLACE => '\\1', GESHI_MODIFIERS => '', GESHI_BEFORE => '', GESHI_AFTER => ''), // Primary identifier catcher 2 => array( GESHI_SEARCH => '([.\n][ \t]*)([a-zA-Z][/a-zA-Z0-9_\-]*)', GESHI_REPLACE => '\\2', GESHI_MODIFIERS => '', GESHI_BEFORE => '\\1', GESHI_AFTER => ''), // Special duplicate version catches indentifiers after // comments and at the beginning of the file (I think) 3 => array( GESHI_SEARCH => '(^[ \t]*)([a-zA-Z][/a-zA-Z0-9_\-]*)', GESHI_REPLACE => '\\2', GESHI_MODIFIERS => '', GESHI_BEFORE => '\\1', GESHI_AFTER => ''), // Third duplicate version catches identifiers shielded by // %abbrev declarations 4 => array( GESHI_SEARCH => '(%abbrev[ \t]*)([a-zA-Z][/a-zA-Z0-9_\-]*)', GESHI_REPLACE => '\\2', GESHI_MODIFIERS => '', GESHI_BEFORE => '\\1', GESHI_AFTER => ''), // Catch things in [] or {} brackets (bound identifiers) 5 => array( GESHI_SEARCH => '([\[\{][ \t]*)([a-zA-Z][/a-zA-Z0-9_\-]*)', GESHI_REPLACE => '\\2', GESHI_MODIFIERS => '', GESHI_BEFORE => '\\1', GESHI_AFTER => '') ), 'STRICT_MODE_APPLIES' => GESHI_NEVER, 'SCRIPT_DELIMITERS' => array(), 'HIGHLIGHT_STRICT_BLOCK' => array() ); ?>
