Community
    • Login

    Function List for new language...

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    11 Posts 2 Posters 11.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Diego GavaniD
      Diego Gavani
      last edited by

      Hi Everybody,
      I know that maybe this is a question already answered but i’m really struggling with this since a month so use a little bit of patience with me… I’m an industrial robot developer i used to write program with ultra edit but since my approach with GNU i prefer to use free software so i start to use Notepad++. I found and modified syntax highlighting for robot languages but i’m not able to implement functions list of my source code. The robot languages are very simple languages such as Fortran the functions (or better subroutines) are defined by to simple words but i cannot find any regex that works to show them!!!Please can anybody help me with this? I’m using version Notepad++ v 6.9.2. I use two main languages one is defined so:

      DEF Newprog ( ) <— this is the definition for the name of the Program that will contain all subs and functions

      DEF MainProg() <----- this is the definition for a subroutine called MainProg

      END

      DEF Sub1() <----- this is the definition for a subroutine called Sub1

      END

      DEFFCT func1(num:IN) <----- this is the definition for a function called func1

      ENDFCT

      GLOBAL DEF Sub2() <----- this is the definition for a subroutine called Sub2

      END

      END <----- this is the closing statement of the program

      DEFDAT first() <----- this is the definition for the dat file containing the variable declaration

      ENDDAT

      This is the case for the first language i use, i wrote all keywords to define the main call, subroutine and functions.
      in the specific this is for Kuka Robots and the language is called KRL.
      Then i have the Rapid language for ABB Robots and the key words are :

      MODULE Program1 <----- this is the definition for the program name

      PROC Main <----- this is the definition for a subroutine called Main

      ENDPROC

      FUNC num GetInt( <----- this is the definition for a function
      num IntAdd)
      ENDFUNC

      ENDMODULE <----- this is the closing statement of the program

      I tried to use per regexp to match those statements and show them in function list but it’s a month i try
      and i cannot! The main problem for is that notepad++ doesn’t say anything about errors in functionlist.xml so i cannot figure out how to change the regexp…Please can some one of you who have more experience than me with regexp help me to create a regexp to load thos statement in function list? I’ve already a syntax highliter that can even close and oper subroutine, but is not written with regexp so i cannot copy anything!!!Please help!!!

      PS I will share this Functionlist.xml on robot forums many robot developers will be very happy for that… ;) thanks!

      1 Reply Last reply Reply Quote 0
      • MAPJe71M
        MAPJe71
        last edited by

        Have a look here.

        1 Reply Last reply Reply Quote 0
        • Diego GavaniD
          Diego Gavani
          last edited by

          Well thank you but i can use google…The first reference i found for rapid language with a modified function list doesn’t work…I don’t know if it’s a problem of notepad version or is more tricky then it seems that’s why i’m asking help…

          1 Reply Last reply Reply Quote 0
          • MAPJe71M
            MAPJe71
            last edited by

            Could you supply representative example files (or links) for testing?
            Furthermore, what and how should it show up in the function list tree.

            1 Reply Last reply Reply Quote 0
            • Diego GavaniD
              Diego Gavani
              last edited by

              Thanks for your reply. The files are simple text files with different extension. I already have syntax highlighting working for those languages in fact the extension are recognized. I wrote the structure of the files in my previous post…For Kuka KRL you have two files “name_of_program.src” for source code and “name_of_program.dat” for variable declaration the content is as follow :

              “name_of_program.src”

              DEF Newprog ( ) <— this is the definition for the name of the Program that will contain all subs and functions

              DEF MainProg() <----- this is the definition for a subroutine called MainProg
              …code…
              END

              DEF Sub1() <----- this is the definition for a subroutine called Sub1
              …code…
              END

              DEFFCT func1(num:IN) <----- this is the definition for a function called func1
              …code…
              ENDFCT

              GLOBAL DEF Sub2() <----- this is the definition for a subroutine called Sub2
              …code…
              END

              END

              Instead the declaration is as follow :

              “name_of_program.dat”

              DEFDAT MAIN_PROGRAM
              int num=0
              bool true=false
              …code…
              ENDDAT

              for ABB Rapid instead there is just one file that contains both source code and variable declaration, it’s content is
              as follow :

              “name_of_the_program.prg” (or .mod or .sys)

              MODULE name_of_the_program
              var int num=0
              var bool true=false

              PROC Main
              …code…
              ENDPROC

              FUNC num GetInt
              num IntAdd)
              …code…
              ENDFUNC

              ENDMODULE

              And that’s it! In abb rapid you can get also some file with just variable declaration but in any case the Module-ENDMODULE statements are mandatory, the compiler itselfs write these files with those statements. Hope to be clear, thanks for your help.

              PS.: If you want to test, just copy and past and save the content as “.src” and “.dat” for kuka krl and “.prg” for abb rapid, that’s it.

              1 Reply Last reply Reply Quote 0
              • MAPJe71M
                MAPJe71
                last edited by

                OK, will give it a try.

                1 Reply Last reply Reply Quote 0
                • MAPJe71M
                  MAPJe71
                  last edited by

                  KUKA Robot Language:

                  <association id="krl_syntax" userDefinedLangName="KRL" />
                  <association id="krl_syntax" ext=".src" />
                  <association id="krl_syntax" ext=".dat" /> 
                  
                  <parser displayName="KRL" id="krl_syntax" commentExpr="?'SLC'(?m-s);.*$)">
                  	<function
                  		mainExpr="(?-i:(GLOBAL[\t ]+)?DEF(DAT|FCT)?)[\t ]+\K([A-Za-z_$][A-Za-z0-9_$]{0,23})[\t ]*\([^)]*\)"
                  	>
                  		<!-- comment out the following node to display the method with its parameters -->
                  		<functionName>
                  			<nameExpr expr="[A-Za-z_$][A-Za-z0-9_$]{0,23}" />
                  		</functionName>
                  	</function>
                  </parser>
                  
                  1 Reply Last reply Reply Quote 1
                  • Diego GavaniD
                    Diego Gavani
                    last edited by

                    Thank you very much pal, i don’t know why but it doesn’t work, you expression is very similar to other i try to write by myself that didn’t work. I’m really upset about that and i really don’t understand…Why is so difficult to recognize a so simple language that is derived from fortran and C? Thanks again i’ll keep trying but i think that if it’s not done till now is because it never worked…

                    1 Reply Last reply Reply Quote 0
                    • MAPJe71M
                      MAPJe71
                      last edited by

                      Make sure all three associations are added and the value of the userDefinedLangName attribute exactly matches the name in the Language menu to get this …

                      NPP FL KRL

                      1 Reply Last reply Reply Quote 1
                      • Diego GavaniD
                        Diego Gavani
                        last edited by

                        PAL YOU’RE GREAT!!! I solved! the problem was the “UserLang name=” value, they must be the same you were right…Now i’m thinking that maybe i spent one month playing with that regex and the problem was the reference name—GOSH! Anyway now i’ll make the same thing for Rapid, thank you very much you solved a big problem for me…In this way i’ll spent less time searching for subs in my programs that often are plenty. THANKS!!!

                        1 Reply Last reply Reply Quote 0
                        • MAPJe71M
                          MAPJe71
                          last edited by

                          You’re welcome!

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors