Discussion › Forums › discussion › customize highlighting
This topic contains 0 voices and has 5 replies.
| Author | Posts |
|---|---|
| Author | Posts |
| August 1, 2006 at 3:56 pm #94 | |
|
Holger Member
|
Hi, I want to use PN2 as a highlighting editor for my own configuration language. Therefor I have to define my own keywords; comments ars c-like. I tried to use a customized copy of “vhdl.schemedef” but had no success. Which lexer can I use or must I write my own one (seems to be to difficult for my claim)? How does “Customscheme.lexer” work? This is an short example of my configuration language: javisWindows.UserScreen [ name = "anyName"; // a comment element = rovScreenElements.RovLabel [ textID = 123; ] ] Thanks for your help. |
| August 2, 2006 at 9:08 am #15056 | |
|
simon Key Master
|
Can you post your attempt at customising vhdl.schemedef? It should be more than capable of highlighting your language. Thanks. |
| August 3, 2006 at 6:34 am #15057 | |
|
Holger Member
|
Hello Simon, this is my customized schemedef (Javis.schemedef): <?xml version=”1.0″ ?> <Scheme> <keyword-classes> <keyword-class name=”userScreen”> javisWindows UserScreen name element </keyword-class> <keyword-class name=”rovLabel”> rovScreenElements RovLabel textID </keyword-class> </keyword-classes> <schemedef name=”javis” title=”Javis” author=”Holger Weis” url=”http://www.rovema.de/” version=”1″ casesensitive=”false” braces=”{[]}”> <strings> <stringtype id=”0″ start=”"” end=”"” multiline=”false” escape=”" /> </strings> <identifiers start=”[`a-zA-Z]” /> <comments> <line start=”//” /> </comments> <numbers start=”[0-9]” content=”[0-9]” /> <lexer name=”vhdl” /> <use-styles> <style name=”Default” key=”32″ /> <style name=”Line Comment” key=”1″ class=”comment” /> <!– <style name=”Block Comment” key=”2″ class=”comment” /> –> <style name=”Identifier” key=”3″ /> <style name=”Number” key=”4″ class=”number” /> <style name=”Keywords” key=”5″ class=”keyword” /> <style name=”Keywords 2″ key=”6″ class=”keyword” fore=”f80000″ /> <style name=”String” key=”10″ class=”string” /> <style name=”Pre-Processor” key=”12″ class=”preprocessor” /> <style name=”Special Identifier” key=”13″ fore=”478698″ /> </use-styles> <use-keywords> <keyword key=”0″ name=”Keywords” class=”userScreen”/> <keyword key=”1″ name=”Keywords 2″ class=”rovLabel”/> </use-keywords> </schemedef> </Scheme> The keywords “name” and “element” are highlighted (probably known in vhdl), others not. A line-comment starting with “//” isn’t recognized, opposite to comments starting with “–”. If we can solve this problem I’ve one more question: How do I configure block-comments like used in C++? Thanks. |
| August 4, 2006 at 9:21 am #15058 | |
|
simon Key Master
|
A couple of problems with this one: When using the quotes symbol in XML attributes you need to use " – although perhaps you’ve done that and the forums software is converting them! Next, the lexer name is vhdl which is why you’re seeing vhdl behaviour. Change the lexer line to look like this: <lexer name=”javis”/> Finally, the reason the keywords are not working is that you have casesensitive=”false” which requires all keywords to be specified in lowercase. If your keywords are case sensitive then you need to set casesensitive=”true” otherwise change all keywords to all lowercase. |
| August 4, 2006 at 10:29 am #15059 | |
|
Holger Member
|
The quotes symbol seams to be a problem of the forums software (but your quoted string “javis” was correctly shown to me). I changed the lexers name and it works. Additionally I changed the schemedef’s attribute casesensitive to true and also keywords with uppercase letters are highlighted correctly ==> no bug. At last I need to know how to configure block-comments. If you still can tell me I’m really grateful. |
| August 7, 2006 at 1:10 pm #15060 | |
|
simon Key Master
|
Comment blocks work like this:
<block start="/*" end="*/"/> </comments> |
You must be logged in to reply to this topic.