[erlang-questions] 2018: A Year for wxErlang

Script Culture erlang@REDACTED
Thu Jan 11 03:27:01 CET 2018


Elegance is not optional.

The changes you requested have been made to make the wxErlang scripts
easier on the eyes. However, this is just a temporary band-aid as I
construct a real solution.

My problem is I am relying on SublimeText's Syntax Highlighter -to HTML- 
package for my Erlang HTML.
The classes that Sublime's Highlighter cooks up are a pitiful match to 
Erlang's syntax/lexicon.
It doesn't even distinguish a function_name()  correctly.

For building HTML scripts, all that needs to be actively 
generated/output is the :
      — body format class at the top
    &    wrapped-tokens at the bottom.

/       Classes string format:/
             body .n { color: #fb660a; font-weight: bold } /* Keyword */

/        Token String Format: /
            <span class="n">module_md5</span>


I can imagine writing a lexical scanner to do this with two passes.
  - One to get the classes to be colored.
  - The other to apply the HTML bracket-format.

/But I want Elegance.../
What's the best attack strategy if I want to scrape the code to get real 
syntax highlighting?
I would like to do this in Erlang, that is, versus the traditional 
formal grammar file method.


· Should I take the AST as input...and do what?...recursively scan the 
tuple branches?
       {op,1,'-',{call,1,{atom,1,module},[{var,1,'ModuleName'}]}}

     I've checked out wrangler_parse, wrangler_syntax_lib &
     a good amount of our syntax tools to no avail, maybe I missed it.


· Or should I attempt to write functions based around scanning for unique
    tokens patterns, identifying terminal/terminals and compare adjacent 
tokens.
    I imagine i would have to follow expression reduction priority here.
    Then deducing the token into a given color.
    I don't mind wrapping all of Erlang in its own 'grammar logic'.

Is there a library out there to obtain/explode the AST into 
syntactically correct tagged tokens?


Cheers,


Robert C.




On 1/9/18 6:01 PM, Richard O'Keefe wrote:
> You hero, sir!
>
> Except, I looked at https://scriptculture.com/wxevent.html
> and it was the reverse of beautiful.  In fact, it was very nearly
> (physically) unreadable.  The least important thing, the line numbers,
> was in brilliant white.  The most important thing, the text, was in
> medium grey against a dark grey or black background, very poor
> contrast, real eyestrain territory.  I am willing to take it on faith
> that you have made the code, qua code, beautiful.
>
> On 7 January 2018 at 11:38, Robert Carbone <erlang@REDACTED 
> <mailto:erlang@REDACTED>> wrote:
>
>     Hi Fellow Erlang-Mailing-Listers:
>
>     Foremost, to this entire community; thank you for being there,
>     lending advice, and producing an amazing archive of helpful Erlang
>     content.
>     As a relative beginner, this treasure trove of information has
>     been very helpful on numerous occasions.
>     If you are interested in GUI programming, the following is sure to
>     start your New Year out on a great note.
>
>
>     For quite some time, I have been silently hacking away at wxErlang.
>     A few days ago, I have launched an effort to teach wxErlang.
>
>     My short-term goal is to alleviate the largest-barrier-to-entry
>     for wxErlang.
>     That is, the documentation is completely-scattered or non-existent.
>
>
>     I have started this endeavor by publishing:
>     - A diagram of the class-inheritance structure
>     - Three edited libraries (first of many)
>
>
>     — CLASS INHERITANCE DIAGRAM —
>
>     One of the first steps to using wxErlang is to observe the library
>     in its entirety.
>     So here it is — Here is a picture of the wxErlang class structure:
>
>     Page 1:
>     https://www.scriptculture.com/assets/sc_inherit_class_pg1.jpg
>     <https://www.scriptculture.com/assets/sc_inherit_class_pg1.jpg>
>     Page 2:
>     https://www.scriptculture.com/assets/sc_inherit_class_pg2.jpg
>     <https://www.scriptculture.com/assets/sc_inherit_class_pg2.jpg>
>
>     As a chart of inheritance, this 2-page diagram allows you to
>     visualize what function calls are inherited from upstream modules.
>     That is, every module below (subclass) can call the functions of
>     the module above, its 'super class' module.
>     As reading one module is not enough to gain a complete picture,
>     having beautiful, legible, readily-readable, source code documents
>     becomes important.
>
>
>     — EDITED WX LIBRARY MODULES —
>
>     When you can sit down and seamlessly absorb what functions are at
>     your disposal, it is simply fantastic. Your mind is freed up to
>     think about the code you are about to write or UI, not straining
>     to interpret the code in front of you.
>
>     I am editing all the libraries by hand and releasing them.
>     I have started with:
>     · wxEvent.erl
>     · wxEvtHandler.erl
>     · wxWindow.erl
>
>     Having legible wx modules, with the options clearly labeled, makes
>     wxErlang development not just possible, but efficient and fun.
>     I'll continue to release a new library everyday or so until they
>     are all available.
>     They can be found at:
>
>     https://scriptculture.com/
>
>     My resolution for this year is to bring beautification to the
>     wxErlang Code Base.
>
>     Cheers,
>
>     Robert C.
>
>     ScriptCulture.com © 2018
>     Beautiful Erlang Code & Calligraphy
>     wxfeedback@REDACTED <mailto:wxfeedback@REDACTED>
>
>
>     _______________________________________________
>     erlang-questions mailing list
>     erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>     http://erlang.org/mailman/listinfo/erlang-questions
>     <http://erlang.org/mailman/listinfo/erlang-questions>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180110/ae8cb1c0/attachment.htm>


More information about the erlang-questions mailing list