Lets try to understand how to plug the new programming language. I'm selecting the "Panini" as my new programming language. First we try to understand how to plug the new syntax to Notepad++. This is very easy task but its very useful for the users who is going to develop software by using this language.
1. Notepad++ expose the grate feature to define your own language. Go to Notepad++ and follow the direction.
Language->Define your Language
Here you can define the language as you wish. But most convenient way is import the language settings from out side xml file. why I'm saying that people who are new to the language they don't know how to configure this by them selves but think about this if some one can provide the configuration file then they can import it in simply.
So then I'm going to discuss the second method.
2. First you have to define the userDefineLanguage.xml file with your new syntax as follows.
[code language="xml"]
<?xml version="1.0" encoding="Windows-1252" ?>
<NotepadPlus>
<UserLang name="Panini" ext="java">
<Settings>
<Global caseIgnored="no" />
<TreatAsSymbol comment="no" commentLine="no"/>
<Prefix words1="no" words2="no" words3="yes" words4="yes"/>
</Settings>
<KeywordLists>
<Keywords name="Folder+">{</Keywords>
<Keywords name="Folder-">}</Keywords>
<Keywords name="Operators">- ( ) * , . / : ? @ [ ] + =</Keywords>
<Keywords name="Comment">//</Keywords>
<Keywords name="Words1"></Keywords>
<Keywords name="Words2"></Keywords>
<Keywords name="Words3">instanceof assert if else switch case default break goto return for while do continue new throw throws try catch finally this super extends implements import true false null</Keywords>
<Keywords name="Words4">capsule design package transient strictfp void char short int long double float const static volatile byte boolean class interface native private protected public final abstract synchronized enum</Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="9" />
<WordsStyle name="FOLDEROPEN" styleID="12" fgColor="808040" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="14" keywordClass="Folder+"/>
<WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="808040" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="14" keywordClass="Folder-" />
<WordsStyle name="KEYWORD3" styleID="7" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" keywordClass="Words3"/>
<WordsStyle name="KEYWORD4" styleID="8" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" keywordClass="Words4"/>/>
<WordsStyle name="COMMENT" styleID="1" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" keywordClass="Comment"/>
<WordsStyle name="COMMENT LINE" styleID="2" fgColor="008000" bgColor="FFFFFF" fontName="Comic Sans MS" fontStyle="0" fontSize="" keywordClass="Comment"/>
<WordsStyle name="NUMBER" styleID="4" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WordsStyle name="OPERATOR" styleID="10" fgColor="804000" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
</Styles>
</UserLang>
</NotepadPlus>
[/code]
In above xml structure there is Keyword list as well as Styles as it is you can define the new keyword and colors. Once you complete your keywords you can import the file and restart the Notepad++ then you can see "Panini" Language is available in the language list as follows.
3. Create new file and select "Panini" as the language. then feel the "Panini" syntax highlighting feature.
No comments:
Post a Comment