SourceForge has been redesigned. Learn more.
Close

Function List isn't working with User Defined Language

2013-08-29
2014-07-10
  • Márcio Massula Junior

    Hi All!

    I'm trying to configure the Function List with an user defined language.

    My language is called ABB_Rapid (used by ABB industrial robots). It already configured in UDL, and syntax highlightning works perfectly.

    In functionList.xml, inside the "Association Map node", I put the tag

      <association ext="ABB_Rapid" id="ABB Rapid" />
    

    And, inside the "Parsers" node, i put the parser

      <!-- ABB -->
        <parser id="ABB Rapid" displayName="ABB Rapid" commentExpr="">
            <function
                mainExpr="(MODULE|PROC|FUNC|TRAP).[A-Za-z0-9_()].*"
                displayMode="$className->$functionName">
                <functionName>
                    <nameExpr expr="PROC.[a-zA-Z09_()].*"/>
                </functionName>
                <functionName>
                    <nameExpr expr="FUNC.[a-zA-Z09_()].*"/>
                </functionName>
                <functionName>
                    <nameExpr expr="TRAP.[a-zA-Z09_()].*"/>
                </functionName>
                <className>
                    <nameExpr expr="MODULE.[a-zA-Z09_()].*"/>
                </className>
            </function>
        </parser>
    

    This isn't working and I can't find the reason.

    I evaluated the regex with Kiki and it seems ok.

    I'm using Notepad++ 6.4.5 (UNICODE) on a virtualized Windows XP Professional SP3.

    As a sidenote, I'm actually usind SourceCookifier plugin (see the link below) and it works fine for me, but has a drawback (it relies on .NET), which prevent it to work under certain circunstances where .NET isn't available in the machine.

    http://imgur.com/nJE6N2E

    Thanks in advance.

     
    • Don HO

      Don HO - 2013-08-30

      There will be a combobox on function list panel for applying choosed parser.
      As well, I will try to find a way for User Defined Languages.

      In the meantime, you can make application of parser by file extensions:

      <association ext="abb" id="ABB Rapid"/>
      <association ext="abb2" id="ABB Rapid"/>

      ...

      Don

       
      Last edit: Don HO 2013-08-30
  • Márcio Massula Junior

    Thanks, Don.

    I tried this :

    <association ext="prg" id="ABB Rapid" />
    <association ext="mod" id="ABB Rapid" />
    <association ext="sys" id="ABB Rapid" />
    

    (with and without periods before the file extension), but still didn't work.

    For a while, I will still using the SourceCookifier, but I will keep an eye on Function List.

     
  • Roy Riggs

    Roy Riggs - 2013-09-01

    If the name of the file is showing up in the function list box that means your associations are fine, if it's completely blank, you need to fix your associations.

    It looks to me like you forgot a + after your square bracket matches, unless your functions are only supposed to be one letter long. Also, it's not clear what those empty parens at the end are for? If the function names can include parens, you'll need to backslash escape them.

    I had to add periods in front of my extensions like:

    <association ext=".prg" id="ABB Rapid" />
    
     
    • Don HO

      Don HO - 2013-09-08

      Indeed, the period '.' is mandatory.

      Don

       
  • Márcio Massula Junior

    Hello, Roy.

    In fact, the file name isn't showing up.

    I copied the regex from an old insertExt.ini file (which was the config file for the Plugin Function List 1.x), and tweaked that.

    [Function List]
    Show all functions=0
    Sort by names=0
    showCmd=0
    [User Languages]
    Count User Languages=1
    Name 1=ABB(S4)
    KeyWBodyBeg 2=
    KeyWBodyEnd 2=
    MatchCase 2=1
    Count Comment 2=0
    Count Syntax 2=3
    Syntax P1.1.2=
    Syntax P2.1.2=$
    Syntax P3.1.2=FUNC[ \t]+[a-zA-Z0-9_()].*
    Syntax P4.1.2=
    Syntax P5.1.2=ENDFUNC
    Syntax P6.1.2=
    Syntax P1.2.2=
    Syntax P2.2.2=$
    Syntax P3.2.2=TRAP[ \t]+[a-zA-Z0-9_].*
    Syntax P4.2.2=
    Syntax P5.2.2=ENDFUNC
    Syntax P6.2.2=
    Syntax P1.3.2=
    Syntax P2.3.2=$
    Syntax P3.3.2=PROC[ \t]+[a-zA-Z0-9_].*
    Syntax P4.3.2=
    Syntax P5.3.2=ENDPROC
    Syntax P6.3.2=
    

    Yes, the function names include parens.

    I will try correct the regex with your tips.

    Thanks!

     
    • Robymagic

      Robymagic - 2014-07-10

      Maybe this can help you

       
    • Robymagic

      Robymagic - 2014-07-10

      Or this...

       
  • Roy Riggs

    Roy Riggs - 2013-09-03

    Oh yes, one other issue is that these are apparently multi-line regexps. So you can run into trouble using .* as it will try to match everything to the end of the file.

     
  • Don HO

    Don HO - 2013-09-09

    FYI: In next version, the build-in function list will support User Defined Languages with the new attribute "userDefinedLangName":

    <association userDefinedLangName="my user defined language" id="my_udl_passer_id"/>
    <association userDefinedLangName="Autocad" id="my_autocad_passer_id"/>
    

    Don