new language support (erlang)

35 views
Skip to first unread message

Todd Greenwood-Geer

unread,
Dec 1, 2012, 10:56:12 AM12/1/12
to leo-e...@googlegroups.com
I'd like to add basic language support for erlang (.erl/.hrl) files.

I see this in the docs... but the web link on sourceforge is dead. Could someone point me at the appropriate docs?

-Todd


http://webpages.charter.net/edreamleo/FAQ.html#how-can-i-use-leo-with-unsupported-languages
"""

How can I use Leo with unsupported languages?

Here is a posting which might be helpful: http://sourceforge.net/forum/message.php?msg_id=2300457 The @first directive is the key to output usable code in unsupported languages. For example, to use Leo with the Basic language, use the following:

@first $IFDEF LEOHEADER
@delims '
@c
$ENDIF

So this would enable a basic compiler to “jump” over the “true” LEO-header-lines. Like this:

$IFDEF LEOHEADER <-conditional compilation directive
#@+leo-ver=4 <-these lines not compiled
#@+node:@file QParser005.INC
#@@first
#@delims '
'@@c
$ENDIF <-... Until here!
<rest of derived code file ... >

This changes the comment symbol the apostrophe, making comments parseable by a BASIC (or other language.)

"""

Matt Wilkie

unread,
Dec 2, 2012, 2:17:36 AM12/2/12
to leo-e...@googlegroups.com
Here's the opening post of that thread courtesy of The Wayback Machine (http://web.archive.org/web/20081210195031/http://sourceforge.net/forum/message.php?msg_id=2300457). Unfortunately the 6 replies don't seem to have been captured. However it gives the date, time & subject so maybe someone else can use that to pull out more.

{{{
Have discoverd & started using LEO 2 days ago
By: Nobody/Anonymous (nobody) - 2003-11-23 04:44
I really like the concept, literate prog, and i find it delivers. 
 
I have easily made some code with it for some other languages and have found that the "@first" directive is the key to output useable code in unsupported languages. 
...as example, for a BASIC language compiler:  
->body of a "@file" header: 
-----------------------------Snippet 

@first $IFDEF LEOHEADER 
@delims ' 
@c 
$ENDIF 
-----------------------------End of snippet 
So this would enable a basic compiler to "jump" over the "true" LEO-header-lines; wich gives you: 
-----------------------Derived file begins with: 
$IFDEF LEOHEADER <-conditionnal compilation directive  

#@+leo-ver=4 <-these lines not compiled 
#@+node:@file QParser005.INC 
#@@first 
#@delims '  
'@@c 
$ENDIF <-... Until here! 
<rest of derived code file ... > 
-----------------------end of snippet 
The thing it does is mostly changing the comment symbol to " ' " apostrophe... making comments parseable by a BASIC (or other language.) 
 
The thing that I really like is the fact that LEO untangles my code if I change it externally, in an IDE or editor of some kind!  
 
hope this helps, if you have any tricks to share for adding compatibility / productivity using LEO, please tell me! 
 
-- 
bolt 
}}}

Edward K. Ream

unread,
Dec 3, 2012, 8:51:04 AM12/3/12
to leo-e...@googlegroups.com
On Sat, Dec 1, 2012 at 9:56 AM, Todd Greenwood-Geer <t.green...@gmail.com> wrote:
I'd like to add basic language support for erlang (.erl/.hrl) files.

It appears that erlang already has basic support.  See the helper functions of g.app.__init__:

    @file leoApp.py-->class LeoApp-->app.__init__

There are entries for erlang in g.app.language_delims_dict, g.app.language_extension_dict and g.app.extension_dict.

Edward
Reply all
Reply to author
Forward
0 new messages