Menu

Feature Request: Erlang

2007-08-23
2012-11-13
  • Nobody/Anonymous

    Hi can you please add erlang syntax highlighting!
    Thanks for the great product!

     
  • Anonymous

    Anonymous - 2011-09-07

    I found the file you pointed at (http://notepad-plus.sourceforge.net/commun/userDefinedLang/userDefineLang_erlang.xml); also I've found a file made by Robert Horvick (http://www.roberthorvick.com/wp-content/uploads/2009/07/erlangSyntaxDefinition.zip).
    They both aren't good enough.

    Here is my settings:

    <NotepadPlus>
        <UserLang name="Erlang" ext="erl hrl htp">
            <Settings>
                <Global caseIgnored="no" />
                <TreatAsSymbol comment="no" commentLine="yes" />
                <Prefix words1="no" words2="yes" words3="yes" words4="no" />
            </Settings>
            <KeywordLists>
                <Keywords name="Delimiters">&quot;&apos;0&quot;&apos;0</Keywords>
                <Keywords name="Folder+">begin case fun if receive try</Keywords>
                <Keywords name="Folder-">end</Keywords>
                <Keywords name="Operators">- ! # ( ) , . / : ; [ \ ] { | } + &lt; = &gt;</Keywords>
                <Keywords name="Comment">1 1 2 2 0%</Keywords>
                <Keywords name="Words1">after and andalso band behaviour bnot bor bsl bsr bxor catch cond define div export include let module not of or orelse query record rem throw when xor</Keywords>
                <Keywords name="Words2">?</Keywords>
                <Keywords name="Words3">A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _</Keywords>
                <Keywords name="Words4"></Keywords>
            </KeywordLists>
            <Styles>
                <WordsStyle name="DEFAULT" styleID="11" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="0" />
                <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="KEYWORD1" styleID="5" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="KEYWORD2" styleID="6" fgColor="808000" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="KEYWORD3" styleID="7" fgColor="804000" bgColor="FFFFFF" fontName="" fontStyle="0" />
                <WordsStyle name="KEYWORD4" styleID="8" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="0" />
                <WordsStyle name="COMMENT" styleID="1" fgColor="400000" bgColor="FFFFFF" fontName="" fontStyle="0" />
                <WordsStyle name="COMMENT LINE" styleID="2" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" />
                <WordsStyle name="NUMBER" styleID="4" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" />
                <WordsStyle name="OPERATOR" styleID="10" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="1" />
                <WordsStyle name="DELIMINER1" styleID="14" fgColor="008080" bgColor="FFFFFF" fontName="" fontStyle="0" />
                <WordsStyle name="DELIMINER2" styleID="15" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="0" />
                <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            </Styles>
        </UserLang>
    </NotepadPlus>
    

    I'll try to describe this (and this description may serve as the reason why I suppose this to be better than the cited above).
    1. Erlang is case-sensitive; furthermore, the case of a identifier makes it an atom (all-lowercase or anything in single quotes) or a variable (has uppercase letters or starting with underscore).
    2. We cannot use a list of lowercase letter prefixes to specify atoms, as it will override the folder opening/closing keywords; thus, the atoms are defined as standard style (and the DELIMINER2).
    3. The variables are defined as a word starting with a upper-case letter or underscore (Words3).
    4. Words2 defines a macro (i.e. a word starting with question mark); it is not quite true, as Erlang restricts macros to only uppercase letters and underscores; however, I cannot specify this here.
    5. Comment line starts with a percent; it may be followed by any other character, so it must be treated as symbol.
    6. Sharp (#) must be treated as an operator, or else constructs like Var#recordname are treated as a single variable, while really being a variable and an atom construct.
    7. Colon should be treated as an operator, as it separates different atoms specifying module and function name (like in lists:nth/2).
    8. Module names (including trailing colon) should not be keywords, as (a) they are countless, and (b) this use is only meaningful if they are treated as prefix, thus making the whole function name including the module name a keyword. And the same function without the module specification is not treated as keyword, thus creating an inconcistency.

    Small additions of keywords are also made.

     
  • François-R Boyer

    There is an Erlang lexer in Scintilla, so it should be relatively easy to add it to Notepad++.  Is there a reason why there are several lexers in Scintilla which are not listed by Notepad++ ?

     
  • cchris

    cchris - 2011-09-11

    @mikekaganski:
    I'lll upload your file shortly, citing you as th e maintainer
    @frboyer:
    Adding a language requires some N++ code changes - a setErlangLexer() procedure and all the things it can affact. This has been an old request in the forums, and see also http://sourceforge.net/apps/ideatorrent/notepad-plus/ideatorrent/idea/346/. I have +1'ed it long ago.

    CChris

     
  • Anonymous

    Anonymous - 2011-09-18

    Hello CChris!

    I see you have added me as the maintainer at http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=User_Defined_Language_Files. But my email is incorrect; it should end with gmail.com, not users.sourceforge.net.

    Thank you.

     
MongoDB Logo MongoDB