Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 434029

Summary: Implementing the Syntax Highlighting for Erlang for Orion Editor
Product: [ECD] Orion Reporter: Hongying Zhang <zhysophie2014>
Component: EditorAssignee: Hongying Zhang <zhysophie2014>
Status: RESOLVED FIXED QA Contact: Grant Gayed <grant_gayed>
Severity: normal    
Priority: P3 CC: grant_gayed, ken_walker, zhysophie2014
Version: unspecified   
Target Milestone: 7.0   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
The View of the Syntax highlighting for an example Erlang code(*.erl)
none
feedback patch
none
method highlighting for erl(I uploaded the wrong screen shot which does not have the method highlighting) none

Description Hongying Zhang CLA 2014-05-02 20:48:05 EDT
Created attachment 242643 [details]
The View of the Syntax highlighting for an example Erlang code(*.erl)

Implementing the Syntax Highlighting for Erlang for Orion Editor
Comment 1 Hongying Zhang CLA 2014-05-04 06:41:35 EDT
Committed here:

https://github.com/hongying1124/orion.client/pull/1
Comment 2 Grant Gayed CLA 2014-05-16 00:25:51 EDT
Created attachment 243154 [details]
feedback patch

I've done a similar pass here as I did earlier with XQuery.  The attached patch contains changes I've made that you should just take.  Summary of the patch:

- renamed "erl" to "erlang" in various places and filenames
- mime type is text/x-erlang
- associated extensions are ["erl", "hrl"]
- changed the style of hyphenStuff matches to be keywords

In addition, syntax.js had some rules that I think are wrong, though since I don't have a history of using erlang, I could be mistaken (let me know if this is the case).  These are changes that I think you need to make:

- the set of keywords seems incomplete, there appears to be a full list at http://books.google.ca/books?id=KZe6DhzPwl8C&pg=PA172#v=onepage&q&f=false (and again please sort them)
- I don't think erlang recognizes $variables (xquery variable), 0x hex numbers (orion.lib#number_hex), or single-quote strings (orion.lib#string_singleQuote)
- erlang's double-quote strings seem to be multi-line, similar to XQuery, but quotes and backslashes in erlang strings CAN be escaped, so your end match needs to detect a quote that is not immediately preceded by an odd number of '\' characters (you can see the implementation of one of the orion.lib#string* patterns for end-quote detection that considers escaped characters)
- no /* */ comments in erlang (orion.lib#doc_block)
- don't do #arrow or sign.erl, none of the other languages style punctuation like this
- method.erl does not seem to be working (?) (I'm actually not too concerned with this one, again, because the other languages don't tend to style these)
Comment 3 Hongying Zhang CLA 2014-05-19 15:37:16 EDT
Hi Grant,

Sorry for the delay, I sort of directly replied to bugzilla-daemon@eclipse.org and just realized it....

Thank you for looking at my code:). I was wondering for the keywords, should I include "Common functions" and shell commands(A-1)? or just those in table A-2, A-3, and A-4? The method highlighting seems work for me...may be I did not commit the right thing...I guess
Comment 4 Hongying Zhang CLA 2014-05-19 15:41:08 EDT
Created attachment 243264 [details]
method highlighting for erl(I uploaded the wrong screen shot which does not have the method highlighting)
Comment 5 Grant Gayed CLA 2014-05-23 15:42:35 EDT
(In reply to Hongying Zhang from comment #3)

Table A-2 contains the set of keywords to define.
Comment 6 Hongying Zhang CLA 2014-05-27 05:50:44 EDT
Hi Grant, I have finished fixing the code: https://github.com/hongying1124/orion.client/pull/4

However, it might look a little bit messy because I forgot to delete previous files with incorrect filename names like the syntax.js in application_erl and although I did not "git add" them, somehow they all got turned in...I tried delete them and push again but they are still there...
Comment 7 Grant Gayed CLA 2014-07-02 11:01:58 EDT
I've pushed your change (after first removing the XQuery parts) and a final set of touch-ups to master.  The commits are:

- http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=331e1be6c2bc2b591cef3d28e548356dff750122
- http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=98dc72e92ce1db617b70ab8046f31e287b713825

Fixed > 20140702.  Thanks for your contribution!