[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Syntax highlighting for fortran 90
From:       Franchin Matteo <fnch () libero ! it>
Date:       2004-11-26 19:14:18
Message-ID: 1101496448.4950.81.camel () asus ! home
[Download RAW message or body]

Hi all,
I'm writing the syntax highlight file for fortran 90. I added many new
keywords (all the intrinsic procedures of standard f90), but I would
like to use a more context-based highlighting!
I hope someone will help me to find an answer to these 2 questions.

1) Is it possible to define a list as:
    <list name="keyword">
      <item> token1 </item>
      <item> token2 </item>
      <item> token3 </item>
    </list>
and then use it inside a regexp?
In paricular what I need is to highlight a keyword only if followed by a
"(". I know that it is possible to use the following regexp:
"(token1|token2|token3)(?=[(])", but I would like to use something like
"{keyword}(?=[(])" (using the notation "{...}" taken from lex syntax!).

This is the second question:
2) I didn't understand the role of the rule "LineContinue".
I'm trying to learn from examples, but I'm not able to understand how
"c.xml" can highlight correctly the preprocessor lines! This is the part
of "c.xml" I'm focusing on:

<contexts>
  <context attribute="Normal Text" lineEndContext="#stay" name="Normal">
    ....
    <RegExpr attribute="Preprocessor" context="Outscoped"
String="^\s*#\s*if\s+0" beginRegion="Outscoped"/>
    <RegExpr attribute="Preprocessor" context="Preprocessor"
String="^\s*#"/>
    ...
  </context>
  
  ...
  
  <context attribute="Preprocessor" lineEndContext="#pop"
name="Preprocessor">
    <LineContinue attribute="Preprocessor" context="#stay"/>
    <RegExpr attribute="Preprocessor" context="Define"
String="define.*((?=\\))"/>
    <RegExpr attribute="Preprocessor" context="#stay"
String="define.*"/>
    <RangeDetect attribute="Prep. Lib" context="#stay" char="&quot;"
char1="&quot;"/>
    <RangeDetect attribute="Prep. Lib" context="#stay" char="&lt;"
char1="&gt;"/>
    <Detect2Chars attribute="Comment" context="Commentar/Preprocessor"
char="/" char1="*" beginRegion="Comment2"/>
  </context>
  
  <context attribute="Preprocessor" lineEndContext="#pop" name="Define">
    <LineContinue attribute="Preprocessor" context="#stay"/>
  </context>
</contexts>

Kate uses green color to highlight the following 2 lines:

# \
 blabla

But which rule does match the "\" character?
The regexp "define.*((?=\\))" shouldn't match, because there is no
"define" after "#"
Is it "((?=\\))" different from "(?=\\)" ?

Thank you.

Matteo


_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic