- Subject: Re: [Jed-users-l] New mode for n3 / turtle
- From: Alain Nadeau <nadeau@xxxxxxxxxxx>
- Date: Sat, 24 Mar 2012 09:29:06 +0100
Hi John,
Thanks for the ref. to dfa.txt. After all these years working with jed I
had never known it was there.
And thanks for giving me a starting mode. With a few tweeks I now have a
working n3 mode. Excellent. But not everything is working as expected.
Could it have to do with the fact that I'm still using 0.99.13?
Best regards,
Alain
On Tue, Mar 20, 2012 at 18:51, John E. Davis <davis@xxxxxxxxxxxxx> wrote:
> Alain Nadeau <nadeau@xxxxxxxxxxx> wrote:
> > I'm basically seeking something like the very nice n3 mode offered by
> emacs
> >
> > http://larve.net/people/hugo/2003/scratchpad/NotationThreeEmacsMode.html
> >
> > Notice how this one has the following features:
> >
> > - chars in one color before a colon, and in another after the colon...
> >
> > - URLs in one color, from the starting "<" to the closing ">", even and
> > including a "#" sign before the closing ">".
> >
> > - how keyword "@prefix" is all in one color, including the "@"...
> >
> > All seemingly easy stuff. Until one tries to achieve that.
> >
> > I have no problems (duh!) with defining keywords through
> define_keywords_n.
> >
> > But everything that has to do with dfa_define_highlight_rule in order to
> > obtain the features described above has been a failure. I fail to grasp
> the
> > regex vocabulary needed.
>
> See doc/txt/dfa.txt for a description of the dfa RE syntax. Here is
> something that I threw together this morning that you might find
> helpful. --John
>
> create_syntax_table ("n3");
> define_syntax ("A-Za-z", 'w', "n3");
>
> #ifdef HAS_DFA_SYNTAX
> %%% DFA_CACHE_BEGIN %%%
> private define setup_dfa_callback (name)
> {
> dfa_define_highlight_rule ("^#.*", "comment", name);
> dfa_define_highlight_rule ("@prefix", "keyword", name);
> dfa_define_highlight_rule ("<[^>]*>", "url", name);
> dfa_define_highlight_rule ("[ \t]+[a-zA-Z]*:", "Qkeyword1", name);
> dfa_define_highlight_rule ("\"[^\"]*\"", "string", name);
> dfa_build_highlight_table (name);
> }
> dfa_set_init_callback (&setup_dfa_callback, "n3");
> %%% DFA_CACHE_END %%%
> #endif
>
> define n3_mode ()
> {
> variable n3 = "n3";
> no_mode (); % reset
> set_mode(n3, 1);
> use_syntax_table (n3);
> use_dfa_syntax (1);
> run_mode_hooks ("n3_mode_hook");
> }
> _______________________________________________
> Jed-users-l mailing list
> Jed-users-l@xxxxxxxx
> http://mailman.jtan.com/mailman/listinfo/jed-users-l
>
[2012 date index]
[2012 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]