Hi,
This is my first try to contribute to an open source project, so i hope that everything is fine! :)
You'll find my patch to introduce Erlang support, made against SVN n3981, in attached file.
This patch includes support for : - Reserved words - Built-in functions (BIFs) - Preprocessor instructions - Modules / compilator attributes - EDoc ( http://erlang.org/doc/apps/edoc/index.html ) - EDoc Macros - Module compilation ( erlc "%f" ) - Running a module, module must have a main/0 entry point ( erl -noshell -run "%e" main -run erlang halt )
Please, can someone check this patch and maybe commit it?
Thanks,
lenain
On Fri, 17 Jul 2009 01:07:42 +0200, Etienne wrote:
Hi,
You'll find my patch to introduce Erlang support, made against SVN n3981, in attached file.
Cool, thanks.
Please, can someone check this patch and maybe commit it?
It looks good so far. Just a few questions/comments:
- some example files would be helpful because most of us probably don't know Erlang (at least me)
- what about the Scintilla Erlang Lexer? The copyright notice in the lexer in your patch states you wrote it? What's wrong with the Erlang lexer available in Scintilla? Is it a different one? Is one the both better? Why another one?
- when creating patches, the unified diff format is preferred (-u option for the diff command) or even simpler use: 'svn diff'
Regards, Enrico
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@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
On Sat, 18 Jul 2009 23:38:38 +0200, Etienne wrote:
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/
Thanks.
What's wrong with the Erlang lexer available in Scintilla? Is it a different one? Is one the both better? Why another one?
[...]
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.
Ok, seems like now there are two good Erlang Scintilla lexers. I suggest to contact the Scintilla project (via mailing list, bug tracker, whatever) to discuss about merging the two lexers or at least get some of the features of your version into the Scintilla lexer. Then we can simply use the Scintilla lexer in Geany (we try to not modify our Scintilla when it can be avoided).
Sorry about the confusion with the lexer itself, we remove any lexers from our Scintilla copy we don't use. So, usually there are way more lexers available in upstream Scintilla than we actually have in Geany.
Regards, Enrico