[Geany-devel] Erlang support patch

Etienne Girondel etienne.girondel at xxxxx
Sat Jul 18 21:38:38 UTC 2009


Hi all,

- some example files would be helpful because most of us probably don't
> know Erlang (at least me)
>

You'll find attached some source code from Twoorl (Twoorl is an open source
Twitter clone written in Erlang using the ErlyWeb framework), this is the
code I used to build this lexer. I slightly modified them to check some
features. You can find the original source code here :
http://code.google.com/p/twoorl/

 - what about the Scintilla Erlang Lexer? The copyright notice in the
> lexer in your patch states you wrote it?


Waow, my fault :( I indeed wrote it, because I thought if it wasn't included
in Geany, it wasn't in Scite/Scintilla too...


> What's wrong with the Erlang
> lexer available in Scintilla? Is it a different one? Is one the both
> better? Why another one?


So, yes, it is a different one. Maybe not so better, but here is a short
comparison :

Both supports :
- Comment, Module Attributes, Preprocessor, Functions, Numbers, Var, String,
Char

Scite/Scintilla only :
- Code folding
- Exponent in numbers
- Node name (somename at somewhere)
- Parse error mode

Mine only :
- Separate colors for module:function_name
- Detects built-in functions
- Handle "_" as catch-all var
- EDoc (Javadoc like, for erlang)
- EDoc macros
- Support for Erlang Header files (*.hrl)
- Support 3 comment levels (EOL comments, Function comments and Module
comments)

I don't really know if mine is "better" according to the code, but it seems
to include more features.
I use 6 lists of "keywords" (Reserved words, BIFs, Module attributes,
Preprocessor, Edoc, Edoc macro) while Scite/Scintilla use only one to detect
reserved  words. So one can simply add a keyword... and can have differents
colors for each categories, rather than only one and for reserved words.

Also, Scite Lexer color erlang atoms. But, atoms, module name, and functions
are colored the same way. I think that it is better to consider them
independently to improve document reading.

- I forgot to add node name support and didn't know how to add code folding
support too. But I can try to add them looking at Scite code...
- Doh. Forgot exponent in number too!
- I'll have some more work for parsing error. I didn't need it, but I will
have a look.

- when creating patches, the unified diff format is preferred (-u
> option for the diff command) or even simpler use: 'svn diff'


Okay, next time will be the good one!

Please feel free to report me any bugs (for those who knows Erlang :))

Next step will be to add some support for Erlang templates (*.et).

Regards,
lenain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20090718/ad33bfec/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twitter.erl
Type: application/octet-stream
Size: 2036 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090718/ad33bfec/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twoorl.erl
Type: application/octet-stream
Size: 3066 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090718/ad33bfec/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twoorl.hrl
Type: application/octet-stream
Size: 902 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090718/ad33bfec/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twoorl_app.hrl
Type: application/octet-stream
Size: 286 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090718/ad33bfec/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twoorl_app_controller.erl
Type: application/octet-stream
Size: 2595 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090718/ad33bfec/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twoorl_util.erl
Type: application/octet-stream
Size: 7693 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090718/ad33bfec/attachment-0005.obj>


More information about the Devel mailing list