[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: matching the newline character...
From: Franchin Matteo <fnch () libero ! it>
Date: 2005-03-06 15:22:04
Message-ID: 1110122540.28209.6.camel () asus ! home
[Download RAW message or body]
Hi all,
I'm developing the syntax highlighting for fortran and I'm trying to solve the \
problem of line continuation. In fortran (90/95) you can continue a line with an \
amperstand '&', as in the following example:
real(1) r ! r is a real variable of kind 1
r = & ! <-- this statement doesn't end here!
real(1) ! real(1) is a function that returns 1 converted to real
I highlight these lines using this idea: if real(...) is at the beginning of the \
line, it is a declaration, otherwise it is a function. The problem is that a \
statement can be continued, so this idea doesn't work in cases like the previous. The \
simpler thing to do is this:
<context attribute="Normal Text" lineEndContext="#stay" name="first_line" >
<RegExpr attribute="Data Type" context="#stay" String="^\s*real[(][^)]*[)]" \
insensitive="TRUE"/> <RegExpr attribute="Function" context="#stay" String="real" \
insensitive="TRUE"/> <RegExpr attribute="Keyword" context="next_line" \
String="&\s*\n"/> </context>
<context attribute="Normal Text" lineEndContext="#pop" name="next_line" >
<RegExpr attribute="Function" context="#stay" String="real" insensitive="TRUE"/>
<RegExpr attribute="Keyword" context="#stay" String="&\s*\n"/>
</context>
But this doesn't work: kate doesn't match the newline character (\n) in the regexp \
"&\s*\n". I tried several other solutions, but none of them works (I also tried \
to use lineBeginContext, but it seems that kate simply ignores it!).
I need help: is there a rule that matches the '\n' and eats it?
It would be very nice something like that:
<RegExpr attribute="..." context="..." String="...$$"/>
where the $$ in the regexp is very similar to the assertion $, but tells kate to eat \
the newline character. With this my problem will be solved!
Thanks
_______________________________________________
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