Option "s" with regex for GtkSourceView language definition
- From: jpfleury <contact jpfleury net>
- To: gnome-devtools gnome org
- Subject: Option "s" with regex for GtkSourceView language definition
- Date: Wed, 11 Mar 2009 22:58:32 -0400
Hi,
I'm working on a new version of the Markdown language definition for
gedit (see <http://live.gnome.org/Gedit/MarkdownSupport> for the actual
version).
I try to use the regex option to make the metacharacter "." match the
"\n". According to GtkSourceView's language definition tutorial,
<http://library.gnome.org/devel/gtksourceview/stable/lang-tutorial.html>,
we can use the option "s", but I'm not able. Say we have this little
example of mylanguage.lang put on
~/.local/share/gtksourceview-2.0/language-specs:
<?xml version="1.0" encoding="UTF-8"?>
<language id="mylanguage" _name="My language" version="2.0"
_section="Others">
<metadata>
<property name="mimetypes">text/x-mylanguage</property>
<property name="globs">*.mylang</property>
</metadata>
<styles>
<style id="case-insensitive" _name="Case insensitive" map-to="def:note"/>
<style id="metacharacter" _name="Metacharacter"
map-to="def:special-char"/>
</styles>
<definitions>
<context id="mylanguage">
<include>
<context id="case-insensitive" style-ref="case-insensitive">
<match>(?i)test one</match>
</context>
<context id="metacharacter" style-ref="metacharacter">
<match>(?s)test.two</match>
</context>
</include>
</context>
</definitions>
</language>
The context case-insensitive works well, so I can type:
test one
Test one
Test One
and these 3 lines will be highlighted. However, the context
metacharacter doesn't match the "\n". For example:
test two
will be highlighted, but not:
test
two
What's wrong?
Also, in the gtksourceview-1.90.1's changelog:
<http://ftp.gnome.org/pub/GNOME/sources/gtksourceview/1.90/gtksourceview-1.90.1.changes>
I've read this:
> 2007-05-27 Yevgen Muntyan <muntyan tamu edu>
>
> * gtksourceview/language-specs/def.lang:
> * gtksourceview/language-specs/javascript.lang:
> * gtksourceview/language-specs/po.lang:
> * gtksourceview/language-specs/sql.lang:
> added FIXME comments where \n is used in patterns. Lame, indeed.
It's not possible to use "\n" in patterns?
Thanks a lot,
Jean-Philippe
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]