[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: Re: About Kate highlighting :-)
From: Anders Lund <anders () alweb ! dk>
Date: 2005-06-27 18:06:28
Message-ID: 200506272006.32049.anders () alweb ! dk
[Download RAW message or body]
On Monday 27 June 2005 17:50, Seed95@free.fr wrote:
> Hello,
>
> First i would like to thank you and your team for the (kate|kwrite)
> highlighter witch is very good.
> I am french so sorry for my english, i will try to explain you what i don't
> understand.
>
> For instance I have this xml code :
> <context name="CDATA" attribute="Normal Text" lineEndContext="#stay">
> <DetectSpaces />
> <DetectIdentifier />
> <StringDetect attribute="CDATA" context="#pop" String="]]>"
> endRegion="cdata" />
> <StringDetect attribute="EntityRef" context="#stay" String="]]&gt;"
> /> </context>
>
> So when we enter in the CDATA context the spaces and the identifier are
> highlight as "Normal Text", after as soon as we found "]]>" we pop to the
> previous context?
> But in this case the next rule will never be parsed expect if the file
> don't contain this string ("]]>")?
Correct.
> Else if i have this xml code :
> In the main context :
> <DetectChar attribute="String" context="String" char="""/>
> And in the String context :
> <context attribute="String" lineEndContext="#pop" name="String">
> <LineContinue attribute="String" context="#stay"/>
> <HlCStringChar attribute="String Char" context="#stay"/>
> <DetectChar attribute="String" context="#pop" char="""/>
> </context>
> So here, as soon as we meet a \n we pop to the previous context
> (lineEndContext attribute)
> but after we see a LineContinue with a #stay so that is opposed of the
> lineEndContext context attribute, which is the rule which has the proirity?
> And more interresant the HLCStringChar rule :
> it match all escaped chars but in this case it will highlight escaped char
> in all the file? how this rule knows that it stops its analyzing?
> Because if the analysed code is :
>
> char string[128] = "Hello World \n\"Kate is the best\"";
> char string2[128] = "No,\n\"kwrite is the best\"";
>
> So we enter in the String context when we found the first '"' after we
> search all escaped chars so if we don't pop at the time of end line (\n)
> the string2 escaped chars will be highlighted too.
> The string context capture will be "Hello World \n\"Kate is the best\"";
> char string2[128] = "No,\n\"kwrite is the best\""
>
> I am not sure that you will understand what i want but I would be delighted
> that you bring an answer to me.
>
> Please could you tell me if the parses i just write is true.
> Thank you very much.
the LineContinue test matches a backslash at the end of a line. It is common
in many text parsers to ignore \n if it follows a backslash, and that is what
the LineContinue rule is for.
-anders
--
www: http://alweb.dk
jabber: anderslund@jabber.dk
_______________________________________________
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