| 2 | 
           ddelon | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
           /*
  | 
        
        
           | 431 | 
           mathias | 
           3 | 
           * $Id: coloration_delphi.php,v 1.1 2005/09/22 14:02:49 ddelon Exp $
  | 
        
        
           | 2 | 
           ddelon | 
           4 | 
           *
  | 
        
        
            | 
            | 
           5 | 
           * Souligneur syntaxique Delphi
  | 
        
        
            | 
            | 
           6 | 
           *
  | 
        
        
            | 
            | 
           7 | 
           * copyrigth Eric Feldstein 2003 2004 mailto:garfield_fr@tiscali.fr
  | 
        
        
            | 
            | 
           8 | 
           *
  | 
        
        
            | 
            | 
           9 | 
           * Licence : la meme que wikini (voir le fichier LICENCE).
  | 
        
        
            | 
            | 
           10 | 
           * Vous êtes libre d'utiliser et de modifier ce code à condition de laisser le copyright
  | 
        
        
            | 
            | 
           11 | 
           * d'origine. Vous pouvez  bien sur vous ajouter à la liste des auteurs.
  | 
        
        
            | 
            | 
           12 | 
           *
  | 
        
        
            | 
            | 
           13 | 
           * Installation : copier le fichier dans le repertoire "formatters" de WikiNi
  | 
        
        
            | 
            | 
           14 | 
           */
  | 
        
        
            | 
            | 
           15 | 
           include_once('formatters/hightlighter.class.inc');
  | 
        
        
            | 
            | 
           16 | 
              | 
        
        
            | 
            | 
           17 | 
           $DH = new Hightlighter();
  | 
        
        
            | 
            | 
           18 | 
           $DH->isCaseSensitiv = false;
  | 
        
        
            | 
            | 
           19 | 
              | 
        
        
            | 
            | 
           20 | 
           //************* commentaires *************
  | 
        
        
            | 
            | 
           21 | 
           $DH->comment = array('({[^$][^}]*})',			//commentaires: { ... }
  | 
        
        
            | 
            | 
           22 | 
           					'(\(\*[^$](.*)\*\))'		      //commentaires: (* ... *)
  | 
        
        
            | 
            | 
           23 | 
                           );
  | 
        
        
            | 
            | 
           24 | 
           $DH->commentLine = array('(//.*\n)'); 			//commentaire //
  | 
        
        
            | 
            | 
           25 | 
           $DH->commentStyle = "color: red; font-style: italic";	//style CSS pour balise SPAN
  | 
        
        
            | 
            | 
           26 | 
              | 
        
        
            | 
            | 
           27 | 
           //************* directives de compilation *************
  | 
        
        
            | 
            | 
           28 | 
           $DH->directive = array('({\\$[^{}]*})',			//directive {$....}
  | 
        
        
            | 
            | 
           29 | 
           					'(\(\*\\$(.*)\*\))'			      //directive (*$....*)
  | 
        
        
            | 
            | 
           30 | 
           				);
  | 
        
        
            | 
            | 
           31 | 
           $DH->directiveStyle = "color: green";			   //style CSS pour balise SPAN
  | 
        
        
            | 
            | 
           32 | 
              | 
        
        
            | 
            | 
           33 | 
           //************* chaines de caracteres *************
  | 
        
        
            | 
            | 
           34 | 
           $DH->string = array("('[^']*')",'(#\d+)');		//chaine = 'xxxxxxxx' ou #23
  | 
        
        
            | 
            | 
           35 | 
           $DH->stringStyle = "background: yellow";
  | 
        
        
            | 
            | 
           36 | 
              | 
        
        
            | 
            | 
           37 | 
           //************* nombres *************
  | 
        
        
            | 
            | 
           38 | 
           $DH->number[] = '(\b\d+(\.\d*)?([eE][+-]?\d+)?)';	//123 ou 123. ou 123.456 ou 123.E-34 ou 123.e-34 123.45E+34 ou 4e54
  | 
        
        
            | 
            | 
           39 | 
           $DH->number[] = '(\$[0-9A-Fa-f]+\b)';				//ajout des nombres hexadecimaux : $AF
  | 
        
        
            | 
            | 
           40 | 
           $DH->numberStyle = 'color: blue';
  | 
        
        
            | 
            | 
           41 | 
              | 
        
        
            | 
            | 
           42 | 
           //************* mots clé *************
  | 
        
        
            | 
            | 
           43 | 
           $DH->keywords['MotCle']['words'] = array('absolute','abstract','and','array','as','asm',
  | 
        
        
            | 
            | 
           44 | 
           						'begin',
  | 
        
        
            | 
            | 
           45 | 
           						'case','class','const','constructor',
  | 
        
        
            | 
            | 
           46 | 
           						'default','destructor','dispinterface','div','do','downto',
  | 
        
        
            | 
            | 
           47 | 
           						'else','end','except','exports','external',
  | 
        
        
            | 
            | 
           48 | 
           						'file','finalization','finally','for','function',
  | 
        
        
            | 
            | 
           49 | 
           						'goto',
  | 
        
        
            | 
            | 
           50 | 
           						'if','implementation','inherited','initialization','inline','interface','is',
  | 
        
        
            | 
            | 
           51 | 
           						'label','library','loop','message',
  | 
        
        
            | 
            | 
           52 | 
           						'mod',
  | 
        
        
            | 
            | 
           53 | 
           						'nil','not',
  | 
        
        
            | 
            | 
           54 | 
           						'object','of','or','out','overload','override',
  | 
        
        
            | 
            | 
           55 | 
           						'packed','private','procedure','program','property','protected','public','published',
  | 
        
        
            | 
            | 
           56 | 
           						'raise','read','record','repeat','resourcestring',
  | 
        
        
            | 
            | 
           57 | 
           						'set','shl','shr','stdcall','string',
  | 
        
        
            | 
            | 
           58 | 
           						'then','threadvar','to','try','type','unit','until',
  | 
        
        
            | 
            | 
           59 | 
           						'use','uses',
  | 
        
        
            | 
            | 
           60 | 
           						'var','virtual','while',
  | 
        
        
            | 
            | 
           61 | 
           						'with','write',
  | 
        
        
            | 
            | 
           62 | 
           						'xor'
  | 
        
        
            | 
            | 
           63 | 
           					);
  | 
        
        
            | 
            | 
           64 | 
           $DH->keywords['MotCle']['style'] = 'font-weight: bold';   //style CSS pour balise SPAN
  | 
        
        
            | 
            | 
           65 | 
              | 
        
        
            | 
            | 
           66 | 
           //************* liste des symboles *************
  | 
        
        
            | 
            | 
           67 | 
           $DH->symboles = array('#','$','&','(','(.',')','*','+',',','-','.','.)','..',
  | 
        
        
            | 
            | 
           68 | 
           					'/',':',':=',';','<','<=','<>','=','>','>=','@','[',']','^');
  | 
        
        
            | 
            | 
           69 | 
           $DH->symbolesStyle = '';
  | 
        
        
            | 
            | 
           70 | 
              | 
        
        
            | 
            | 
           71 | 
           //************* identifiants *************
  | 
        
        
            | 
            | 
           72 | 
           $DH->identifier = array('[_A-Za-z]?[_A-Za-z0-9]+');
  | 
        
        
            | 
            | 
           73 | 
           $DH->identStyle = '';
  | 
        
        
            | 
            | 
           74 | 
              | 
        
        
            | 
            | 
           75 | 
           echo "<pre>".$DH->Analyse($text)."</pre>";
  | 
        
        
            | 
            | 
           76 | 
           unset($DH);
  | 
        
        
            | 
            | 
           77 | 
           ?>
  |