Menu

Function List for User-Defined Language

sLai
2007-07-04
2012-11-13
  • sLai

    sLai - 2007-07-04

    Hi,

    I have been trying to create parsing rules for my language but without any success. I wonder if anyone can help.

    In its simplest form, the language syntax looks like the next 2 lines
    keyword_begin function_name ;
    keyword_end ;

    So I defined the following in the Function List Parsing Rules dialog box via Plugins ->Function List -> User Rules and select my language.

    Function Begin: <\keyword_begin\>
    Function List Name: [a-zA-Z_]+
    Function End: <\;\>
    Body End: <\keyword_end ;\>

    All other fields are left blank.

    When I press the Try! button nothing happens. Please help.

    Thanks in advance.

     
    • Nobody/Anonymous

      Ok, there are several reasons, but why you don't do some experiments? Try to find with "Find" dialog the first line! However here the correct rules:

      Function Begin: \<keyword_begin\>[ \t]+
      Function List Name: [a-zA-Z_]+
      Function End: [ \t]*;
      Body End: \<keyword_end\>[ \t]*;

      Regards
      Jens

       
      • Nobody/Anonymous

        Hi,

        Can you please help me to set the function list for a user defined language? I am using fortran for my assignments(economics!) and I defined the fortran 90 format since notepad++ only works with f77.  But I really liked the function list! I tried work with the example in the help but it did not work. How would you set the values to define functions and subroutines in fortran. They are quite simple, say:

        subroutine ex_sub(x,y)
        ...

        end subroutine ex_sub

        cheers,

         

         
      • sLai

        sLai - 2007-07-09

        Hi Jens,

        The problem is actually in the "Try!" button. 

        If I pressed the "Try!" button after a rule is added/modified, the Function List function does not honour the rules changes even if they are correct. I had to restart NPP so the rules can take affect.

         
    • Nobody/Anonymous

      Hello,

      the parser need the positions of white spaces too. This you should change:

      Function Begin: <\keyword_begin\>[ \t]+
      Function List Name: [a-zA-Z_]+
      Function End: [ \t]*<\;\>
      Body End: <\keyword_end\>[ \t];

      Best Regards
      Jens

       
      • sLai

        sLai - 2007-07-09

        Thanks for the tips regarding the "Find" dialog box. Why did I not think of that - lol?

        Now I have a working example, I should be ok now.

        Thanks again.

         
    • sLai

      sLai - 2007-07-04

      Thanks Jens.

      Unfortunately, it still does not work. In the Function List panel, it says "No Functions" after I clicked the Try! button.

      I forgot to mention, I m using v4.1.2.

      Below is the content of InsertExt.ini

      [Function List]
      Show all functions=1
      Sort by names=0
      showCmd=0
      [User Languages]
      Count User Languages=1
      Name 1=test
      KeyWBodyBeg 1=
      KeyWBodyEnd 1=
      MatchCase 1=0
      Count Comment 1=1
      Comment P1.1.1=
      Comment P2.1.1=
      Count Syntax 1=3
      Syntax P1.1.1=<\keyword_begin\>[ \t]+
      Syntax P2.1.1=[ \t]*<\;\>
      Syntax P3.1.1=[a-zA-Z_]+
      Syntax P4.1.1=
      Syntax P5.1.1=<\keyword_end\>[ \t];
      Syntax P6.1.1=
      Syntax P1.2.1=
      Syntax P2.2.1=
      Syntax P3.2.1=
      Syntax P4.2.1=
      Syntax P5.2.1=
      Syntax P6.2.1=
      Syntax P1.3.1=
      Syntax P2.3.1=
      Syntax P3.3.1=
      Syntax P4.3.1=
      Syntax P5.3.1=
      Syntax P6.3.1=
      [HEX-Editor]
      Columns=16
      Bits=1
      Binary=0
      Little=0
      Capitel=1
      Extensions=

       
    • sLai

      sLai - 2007-07-09

      Jens,

      May be you missed my last post. Your original suggestion did not work. Any idea.

       
    • Jens Lorenz

      Jens Lorenz - 2007-07-10

      This is a known bug.

       
    • Nobody/Anonymous

      Hi,

      I don't understand the syntax for the functionlist.

      I use a special language for develop funtions in a CAD-system.

      It's a procedural language.

      Functions an procedures start and end with

      #function <any_name>

      ...

      #end

      #procedure <any_name>

      ...

      #end

      How is the correct syntax for the rule in the functionlist.

      Thanks in advance.

      Andreas
      Germany