Menu

Is there a way to remove the word 'function'

2007-05-21
2012-11-14
  • Nobody/Anonymous

    For the function list pluggin for Notepad++, I used the same code in Function List help to define my own user rules, but I get the word 'function' next to every function name in the list, making the list too wide. Is there a way to remove that word and just have the funciton name itself displayed for each entry?

     
    • Nobody/Anonymous

      Read only the topic "Searching" on side:
      http://scintilla.sourceforge.net/ScintillaDoc.html#Searching

      I can suggest to play with Find dialog of Notepad to get a feeling how to work with Scintilla Regular Expressions. Function List works similar.

      Best Regards
      Jens

       
    • Nobody/Anonymous

      Hello,

      display a code snipped and the rules exactly.

      Best Regards
      Jens

       
    • Nobody/Anonymous

      Basically everthing is the same as the example given in the Help for the Function List pluggin. I am using it for a custom pascal language, here is my code:

      Function List Parsing Rule
      --------------------------
      Function Begin : [ \t]*function[ \t]+
      Function List name : [a-zA-Z0-9_]+
      Function End : \([a-zA-Z0-9_, \t]+\)
      Seperator between : {I have nothing specified here}
      Body Begin \<begin\>
      Body End \<end\>

      Code snippet:
      --------------
      Function CopyThoseFiles(): boolean;
      var
        var1 : integer;
      begin
        do something...
      end;
      // *********
      Function CopyMoreFiles(): boolean;
      var
        var1 : integer;
      begin
        do something...
      end;

      These functions display in the list like this:
      function CopyThoseFiles(
      function CopyMoreFiles(

       
    • Nobody/Anonymous

      Hello,

      You have to specify the complete expected line. BEGIN and NAME is ok, but use for END following expression:

      \([a-zA-Z0-9_, \t]*\).*

      This I changed ---^--^

      I exchanged the + with * because of: You don't expect in any case content within the braces.
      I add the .* because you have additional information after the braces.

      Best Regards
      Jens

       
    • Nobody/Anonymous

      Thanks, that works if no params passed to my functions, but still the same problem for all the functions with params passed, like this:

      function DoSomething(param1 : string): boolean;
      begin
        do something
      end;

       
    • Nobody/Anonymous

      Just let think about it together ;). Why it couldn't work? Maybe because of the colon?
      Yes it is! You can do following:

      Use this expression and extend it everytime if one function isn't visible:
      \([a-zA-Z0-9_, \t:]*\).*
      -----------------^

      Or use this one and every function is visible in future:
      \(.*\):.*

      For better recognition I added the colon between closing brace and the .* expression.

      Best Regards
      Jens

       
    • Nobody/Anonymous

      Thank you again. Nearly working! I am now using
      \(.*\):.*
      but it displays all functions except when there is a gap between the function name and the bracket (permitted by the compiler so no error when I declare things sometimes this way), eg

      function abc (param1 : string): boolean;
      ------------^-----

       
    • Nobody/Anonymous

      If you have possible gaps in your function declaration use this expression [ \t]* for correct recognition on possible positions. E.g.:

      [ \t]*\(.*\)[ \t]*:.*

      Best Regards
      Jens

       
    • Nobody/Anonymous

      Thank you once again Jens. To make it easier, is there a "simple" webpage somewhere that explains this parsing syntax, the only one I have seen was extremely long...

       
MongoDB Logo MongoDB