#548 FunctionList improvements

Next_release
open
nobody
5
2015-03-24
2014-01-10
Menno Vogels
No

This patch improves execution of the class-, function- and mixed-parsers:

  1. Allows comments within definitions
    e.g.

    type                                      // comment
    function_name /* comment */ (             // comment
        type /* comment */ argument /* comment */ 
        type /* comment */ argument /* comment */ 
        ) /* comment */ 
    {
        /* comment */ 
    };
    
  2. Definitions embedded in block/multiple-line comments are discarded
    e.g.

    =begin
    
    def MethodName1( arg1, arg2, arg3, ... )
       return value
    end
    
    =end
    
    # comment
    def multiply (val1, val2 )
        result = val1 * val2
        return result
    end
    
    alias docalc multiply    # line comment
    

NOTE:

The parser definitions in the functionList.xml-file had to be adapted to comply with the changes of the patch.
Some of the parser definitions have been adapted:

  • INI file;
  • Batch label;
  • Assembly;
  • Ruby;
  • XML node;

The other parsers are still work in progress.

2 Attachments

Related

Patches: #597

Discussion

  • Don HO
    Don HO
    2014-01-24

    Thank you for the patch.

    It's hard to see your modification from the patch, Could you attach your modified files directly please:
    functionListPanel.cpp
    functionListPanel.h
    functionParser.cpp
    functionParser.h

    Don

     
    • Simon Sobisch
      Simon Sobisch
      2014-09-05

      Hi Don, do you have any schedule for including this patch? I did not tested the fix yet but "suffered" from the bug when adding COBOL parser for function list in [patches:#597] (which needs a tweak but likely performs better after applying this patch).

      Simon

       

      Related

      Patches: #597

  • Menno Vogels
    Menno Vogels
    2014-08-10

    Latest ...

     
    Attachments
  • I've built 6.6.9 with the above files and installed the provided functionList.xml. It's worth noting that the Boost root needs to be added to the include path for the project, and the library path also needs to point to wherever the built libraries have been placed. (Makes a difference if you build Boost with stage defined.)

    For C++, it locates few if any functions in the various Notepad source files I've loaded, even those without comments prior to the '{'. For instance, in functionListPanel.cpp, it locates only funclstToolbarProc(); no functions at all in NppIO.cpp.

    In JavaScript, it fails to locate function definitions declared as members of an instantiated class, which is standard practice. (This style is correctly recognized with 6.6.9's original function list, except for the comment problem.) Example: f1 is a function here:

    var ClassObj =
    {
      f1 : function() { /* code */ }
    };
    

    Even for more C-like function declarations, which are identified, the parameter list is not included in the panel's display.

    For Python, the items shown in the panel include the line's indentation and the def keyword. It would be better if the member functions could be grouped under the class name where they are defined.

     
    Last edit: Mike Cowperthwaite 2014-10-18
    • Menno Vogels
      Menno Vogels
      2015-03-24

      My bad, I should have mentioned I used the Boost::RegEx library in the patch and therefore the library needs to be included e.g. by adding the appropriate include- and library-paths in the project settings.

      The parsers are still a work in progress. Feel free to propose updates!

      See attached images of before and after patch-#548-applied views of an example JavaScript file.

       
      Last edit: Menno Vogels 2015-03-24
  • Simon Sobisch
    Simon Sobisch
    2015-03-24

    This patch is still not merged. I just wondered about the "why", can anyone explain it to me?

    Thank you,
    Simon

     
    • Simon Sobisch
      Simon Sobisch
      2015-05-04

      Redump.

      @Menno: Can you please update the files to current rev (if necessary, if not just say so) and tell us if you know of potential problems using them?

      @Don: What about including this patch? I'd like to update [patches:#597] and know if I can base it on NPP with or without this patch.

      Thank you!

       

      Related

      Patches: #597