Nom de la contribution : ColorationSyntaxiqueOz
Description : Coloration syntaxique du langage de programmation Oz.
Type de contribution : coloration syntaxique
Fonctionne avec : WikiNi 0.4.3
Intégration technique : placer le fichier
coloration_oz.php dans le répertoire
formatters/
Mainteneur : LordFarquaad
Licence : GPL
Dernière version : 0.1.0
Dernière livraison : 27/12/2004
Accès au code et mise en oeuvre : ColorationSyntaxiqueOz
Démonstration : http://fsa.notredomaine.org/wiki/TestColorationOz
Intégration au projet WikiNi :
Bugs: signaler ici les bugs
Description détaillée:
Cette coloration utilise le classe
Hightlighter de
WikiNi et essaie d'imiter la coloration de
Mozart:
- Les chaines de carractères (Strings & Atoms) sont en brun
- Les commentaires sont mis en brun. Attention: on ne peut pas faire de commentaires commençant par (ou contenant) %% puisque c'est la syntaxe de WikiNi pour délimiter du code...
- les mots cles sont mis en mauve, mais il en manque sûrement... voici la liste que j'ai reprise:
- andthen
- attr
- at
- case
- class
- declare
- define
- div
- do
- else
- elseif
- end
- export
- for
- from
- fun
- functor
- if
- import
- in
- local
- meth
- mod
- of
- orelse
- proc
- then
- thread
- les symboles sont mis en mauve, idem:
- '==', '-', '+', '*', '/', '=<', '>=', '<=', '\=', '<', '>', '=', '~', '|', '@', ':=', '[]', '#', '.', '?', '!'
Ce qu'elle ne fait pas:
- Mettre le nom des procédures et des méthodes en bleu lors de leur déclaration
- Mettre les noms des classes en vert lors de leur déclaration
- Mettre en brun les atomes qui ne sont pas entourés de guillemets simples
Cela ne me paraît pas possible avec la classe
Hightlighter
Telechargement:
http://contributions-wikini.notredomaine.org/ColorationSyntaxiqueOz-v.0.1.0-20041227.zip
Code source:
<?php
/*
colration_oz.php : coloration syntaxique de l'oz pour WikiNi
Copyright 2004 Didier Loiseau
This program 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.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
if (!defined('WIKINI_VERSION'))
die ('accès direct interdit');
include_once('formatters/hightlighter.class.inc');
$oz = new Hightlighter();
$oz->isCaseSensitiv = true;
$oz->commentLine[] = "(\\%.*(\n|$))";
$oz->commentStyle = 'color: #b22222;';
$oz->string[] = "('(.*[^\\\\])?(\\\\\\\\)*')";
$oz->string[] = '("(.*[^\\\\])?(\\\\\\\\)*")';
$oz->stringStyle = 'color: #bc8f8f;';
$oz->keywords['Commands']['words'] = array(
'andthen',
'attr',
'at',
'case',
'class',
'declare',
'define',
'div',
'do',
'else',
'elseif',
'end',
'export',
'for',
'from',
'fun',
'functor',
'if',
'import',
'in',
'local',
'meth',
'mod',
'of',
'orelse',
'proc',
'then',
'thread'
);
$oz->keywords['Commands']['style'] = 'color: #a020f0;';
$oz->symboles = array('==', '-', '+', '*', '/', '=<', '>=', '<=', '\=', '<', '>', '=', '~', '|', '@', ':=', '[]', '#', '.', '?', '!' );
$oz->symbolesStyle = 'color: #a020f0;';
$oz->identifier = array('([A_Z][[:alnum:]]+|\$)');
$oz->identStyle = '';
echo '<pre>' . $oz->Analyse($text) . '</pre>';
unset($oz);
?>