Notepad++ est un éditeur de texte puissant et libre, sous MS Windows.
Il s'agit de colorer les mots-clés du langage Scol pour les fichiers d'extensions *.pkg (codes sources des applications réalisées avec ce langage).
Lancez Notepad++ et ouvrez le fichier %AppData%\Notepad++\userDefineLang.xml où %AppData% est le dossier des données d'applications, par défaut sous XP, C:\Documents and Settings\Votre_login\Application Data\Notepad++. Si ce fichier n'existe pas, créez-le.
À la fin de ce fichier, ajoutez :
<NotepadPlus> <UserLang name='Scol' ext='pkg'> <Settings> <Global caseIgnored='no' /> <TreatAsSymbol comment='no' commentLine='no' /> <Prefix words1='no' words2='no' words3='no' words4='no' /> </Settings> <KeywordLists> <Keywords name='Delimiters'>'00'00</Keywords> <Keywords name='Folder+'></Keywords> <Keywords name='Folder-'></Keywords> <Keywords name='Operators'></Keywords> <Keywords name='Comment'>1/* 2*/ 0//</Keywords> <Keywords name='Words1'>fun typeof typedef var struct proto defcom ;;</Keywords> <Keywords name='Words2'>set let -> <- mutate in</Keywords> <Keywords name='Words3'>if else then while do</Keywords> <Keywords name='Words4'></Keywords> </KeywordLists> <Styles> <WordsStyle name='DEFAULT' styleID='11' fgColor='000000' bgColor='FFFFFF' fontName='' fontStyle='0' /> <WordsStyle name='FOLDEROPEN' styleID='12' fgColor='000000' bgColor='FFFFFF' fontName='' fontStyle='0' /> <WordsStyle name='FOLDERCLOSE' styleID='13' fgColor='000000' bgColor='FFFFFF' fontName='' fontStyle='0' /> <WordsStyle name='KEYWORD1' styleID='5' fgColor='FF0000' bgColor='FFFFFF' fontName='' fontStyle='1' /> <WordsStyle name='KEYWORD2' styleID='6' fgColor='800000' bgColor='FFFFFF' fontName='' fontStyle='1' /> <WordsStyle name='KEYWORD3' styleID='7' fgColor='0000FF' bgColor='FFFFFF' fontName='' fontStyle='0' /> <WordsStyle name='KEYWORD4' styleID='8' fgColor='000000' bgColor='FFFFFF' fontName='' fontStyle='0' /> <WordsStyle name='COMMENT' styleID='1' fgColor='008000' bgColor='FFFFFF' fontName='' fontStyle='0' /> <WordsStyle name='COMMENT LINE' styleID='2' fgColor='008000' bgColor='FFFFFF' fontName='' fontStyle='0' /> <WordsStyle name='NUMBER' styleID='4' fgColor='FF8040' bgColor='FFFFFF' fontName='' fontStyle='1' /> <WordsStyle name='OPERATOR' styleID='10' fgColor='000000' bgColor='FFFFFF' fontName='' fontStyle='0' /> <WordsStyle name='DELIMINER1' styleID='14' fgColor='808080' bgColor='FFFFFF' fontName='' fontStyle='0' /> <WordsStyle name='DELIMINER2' styleID='15' fgColor='000000' bgColor='FFFFFF' fontName='' fontStyle='0' /> <WordsStyle name='DELIMINER3' styleID='16' fgColor='000000' bgColor='FFFFFF' fontName='' fontStyle='0' /> </Styles> </UserLang> </NotepadPlus>
Vous pouvez personnaliser les mots-clé mis en évidence en modifiant les valeurs des clefs xml keywords.
Enregistrez et relancez Notepad++.
Notez que vous pouvez aussi le faire graphiquement, depuis l'interface graphique de Notepad++ (Paramètres > Langages > Custom language).
Ce plugin affiche et tri les fonctions, classes, variables, ... contenues dans un fichier source. Configurez-le afin qu'il reconnaisse également le code source Scol
Vous pouvez la télécharger sur le site de SourceForge : http://sourceforge.net/tracker/?func=detail&aid=2879685&group_id=189927&atid=931291 (version 2)
Copiez la dll dans le dossier Plugins de Notepad++ (sauvegardez l'ancienne éventuellement) et les autres fichiers (surtout 'FunctionListRules.xml' dans le dossier %AppData%\Notepad++\Plugins\Config (par défaut sous XP : C:\Documents and Settings\Votre_nom_d'utilisateur\Applications Datas\Notepad++\Plugins\Config\) et/ou dans le dossier d'installation de Notepad++ (%AppInstall%\Notepad++\plugins\config\).
Ouvrez ce fichier FunctionListRules.xml avec Notepad++. Ajoutez la prise en compte du langage Scol par ce plugin. Pour cela, copiez simplement juste avant le "" final
<Language name='Scol' imagelistpath=''>
<CommList param1='//' param2='' />
<CommList param1='/\*' param2='\*/' />
<Group name='FUNCTION' subgroup='' icon='0' child='0' autoexp='0' matchcase='1' fendtobbeg='' bbegtobend=''>
<Rules regexbeg='^[ ]*fun[ ]+' regexfunc='[a-zA-Z0-9_]+' regexend='' bodybegin='\=' bodyend=';;' sep='' />
</Group>
<Group name='TYPEOF' subgroup='' icon='0' child='0' autoexp='0' matchcase='1' fendtobbeg='' bbegtobend=''>
<Rules regexbeg='^[ ]*typeof[ ]+' regexfunc='[a-zA-Z0-9_]+' regexend='' bodybegin='\=' bodyend=';;' sep='' />
</Group>
<Group name='VAR' subgroup='' icon='0' child='0' autoexp='0' matchcase='1' fendtobbeg='' bbegtobend=''>
<Rules regexbeg='^[ ]*var[ ]+' regexfunc='[a-zA-Z0-9_]+' regexend='' bodybegin='\=' bodyend=';;' sep='' />
</Group>
<Group name='PROTO' subgroup='' icon='0' child='0' autoexp='0' matchcase='1' fendtobbeg='' bbegtobend=''>
<Rules regexbeg='^[ ]*proto[ ]+' regexfunc='[a-zA-Z0-9_]+' regexend='' bodybegin='\=' bodyend=';;' sep='' />
</Group>
<Group name='STRUCT' subgroup='' icon='0' child='0' autoexp='0' matchcase='1' fendtobbeg='' bbegtobend=''>
<Rules regexbeg='^[ ]*struct[ ]+' regexfunc='[a-zA-Z0-9_]+' regexend='' bodybegin='\=' bodyend=';;' sep='' />
</Group>
<Group name='TYPEDEF' subgroup='' icon='0' child='0' autoexp='0' matchcase='1' fendtobbeg='' bbegtobend=''>
<Rules regexbeg='^[ ]*typedef[ ]+' regexfunc='[a-zA-Z0-9_]+' regexend='' bodybegin='\=' bodyend=';;' sep='' />
</Group>
<Group name='DEFCOM' subgroup='' icon='0' child='0' autoexp='0' matchcase='1' fendtobbeg='' bbegtobend=''>
<Rules regexbeg='^[ ]*defcom[ ]+' regexfunc='[a-zA-Z0-9_]+' regexend='' bodybegin='\=' bodyend=';;' sep='' />
</Group>
<Group name='DEFCOMVAR' subgroup='' icon='0' child='0' autoexp='0' matchcase='1' fendtobbeg='' bbegtobend=''>
<Rules regexbeg='^[ ]*defcomvar[ ]+' regexfunc='[a-zA-Z0-9_]+' regexend='' bodybegin='\=' bodyend=';;' sep='' />
</Group>
</Language>
Ceci est modifiable à souhait : on peut ajouter de nouveaux groupes ou en supprimer pour mettre en évidence tel ou tel bloc d'instructions, voire de les grouper en sous-groupe, etc. Avec la définition ci-dessus, seront listés les fonctions (fun), déclarations de variables (typeof et var), de communications (defcom et defcomvar), les créations de types (typedef et struct) et les prototypes (proto).
Voici ce que cela donne (cliquez pour agrandir) :
Pour avoir plus d'informations à ce sujet, visitez la partie Programmation Scol d'iriZone, à cette adresse : http://www.irizone.net/didacticiels/tutnotepad/.