Discussion:
problem with block start including end of line
Alexey Demakov
2005-03-18 11:45:11 UTC
Permalink
Hi all,

I'm trying to write colorer scheme for my language
which have the following structures:

mykeyword
{
...
}

where '...' may be any code with balanced { }.

<block start="/(mykeyword)\s*(\{)/" end="/\}/"
scheme="code"
region01="def:Keyword" region02="def:SymbolStrong"
region10='def:SymbolStrong' region="def:CommentDoc"
/>

<scheme name="code">
<block start="/\{/" end="/\}/"
scheme="code" region00="def:Symbol"
region10='def:Symbol' region="def:CommentDoc"
/>
</scheme>

It works fine when there are no end of line between 'mykeyword' and '{'.
How can I modify 'start' regexp to match newlines also?
I don't understand why my regexp doesn't work - docs say that

'\s' Whitespace character (tab/space/cr/lf)

May be there are other way?

Regards,
Alexey

-----
Alexey Demakov
TreeDL: Tree Description Language: http://treedl.sourceforge.net
RedVerst Group: http://www.unitesk.com



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Igor Russkih
2005-03-18 11:51:43 UTC
Permalink
Hi Alexey,

Colorer works on a per-line basis - this means that it can't wrap RE
over multiple lines.

There is a possibility to implement such a behaviour with multiple
wrapped schemes - using \M \m and "~" operators. You can check
perl.hrc for some working examples.

AD> Hi all,

AD> I'm trying to write colorer scheme for my language
AD> which have the following structures:

AD> mykeyword
AD> {
AD> ...
AD> }

AD> where '...' may be any code with balanced { }.

AD> <block start="/(mykeyword)\s*(\{)/" end="/\}/"
AD> scheme="code"
AD> region01="def:Keyword" region02="def:SymbolStrong"
AD> region10='def:SymbolStrong' region="def:CommentDoc"
AD> />

AD> <scheme name="code">
AD> <block start="/\{/" end="/\}/"
AD> scheme="code" region00="def:Symbol"
AD> region10='def:Symbol' region="def:CommentDoc"
AD> />
AD> </scheme>

AD> It works fine when there are no end of line between 'mykeyword' and '{'.
AD> How can I modify 'start' regexp to match newlines also?
AD> I don't understand why my regexp doesn't work - docs say that

AD> '\s' Whitespace character (tab/space/cr/lf)

AD> May be there are other way?

AD> Regards,
AD> Alexey

AD> -----
AD> Alexey Demakov
AD> TreeDL: Tree Description Language: http://treedl.sourceforge.net
AD> RedVerst Group: http://www.unitesk.com



AD> -------------------------------------------------------
AD> SF email is sponsored by - The IT Product Guide
AD> Read honest & candid reviews on hundreds of IT Products from real users.
AD> Discover which products truly live up to the hype. Start reading now.
AD> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
AD> _______________________________________________
AD> colorer-talks mailing list
AD> colorer-***@lists.sourceforge.net
AD> https://lists.sourceforge.net/lists/listinfo/colorer-talks
--
Best regards,
Igor mailto:***@nm.ru



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Loading...