Community
    • Login

    FunctionList Confused

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    82 Posts 5 Posters 20.4k 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.
    • Lycan ThropeL
      Lycan Thrope @Lycan Thrope
      last edited by

      @lycan-thrope
      As a note, I did find a different java file that the FunctionList did work on, however, I’m curious why it didn’t work on that file. The other file that worked, had a Class Main, which is different from the above file, in that the Main comes later in the file. Not sure if that makes a difference, but my language variant won’t have the Main() function, just the layout that is in the rest of the above file with the exception of that opening/closing braces.

      Lee

      Lycan ThropeL 1 Reply Last reply Reply Quote 0
      • Lycan ThropeL
        Lycan Thrope @Lycan Thrope
        last edited by

        @lycan-thrope
        Two other questions, about the FunctionList .xml file.

        If the actual opening of a class is the word “class”, and the closing of it is “endclass”, would the parser find the opening of class in the regex to identify the keyword count as an open and only the keyword “endclass” would be used as: closeSymbole=“endclass”

        Or can this work?
        openSymbole=“class”
        closeSymbole=“endclass”

        One of the problems I seem to be having is figuring out how the regex is capturing the needed informtion and where it fits into each category of nameexp, etc. Sadly I can understand what the FAQ presents, but sadly the rest of the explanation, like what actually is happening and how it’s captured in the different sections. Some of the regex in the C++ file, for instance, just looks like a lot of redundant code, which is why I’ve been beating my head trying to decipher it and figure out how it’s working based on the FunctionList FAQ outline.

        So it makes some sense, I’ve written a UDL for dBASE Plus which is the OOP version of dBASE, and am trying to write the FunctionList to work with that syntax and language. I’ve successfully been able to use Regex101.com to apparently properly decipher and show the captures of most of the Class syntax including options in the declaration line, so now I’m trying to proceed from that point in baby steps to get this language extension into Notepad++ as it has been requested by our community as the more desired external editor for the language.

        So any help along this path would be appreciated.

        Lee

        Lycan ThropeL 2 Replies Last reply Reply Quote 0
        • Lycan ThropeL
          Lycan Thrope @Lycan Thrope
          last edited by

          @lycan-thrope
          Here’s the other java program that works in the FunctionList:

          // Create a Main class
          public class Main {
           
            // Create a fullThrottle() method
            public void fullThrottle() {
              System.out.println("The car is going as fast as it can!");
            }
          
            // Create a speed() method and add a parameter
            public void speed(int maxSpeed) {
              System.out.println("Max speed is: " + maxSpeed);
            }
          
            // Inside main, call the methods on the myCar object
            public static void main(String[] args) {
              Main myCar = new Main();     // Create a myCar object
              myCar.fullThrottle();      // Call the fullThrottle() method
              myCar.speed(200);          // Call the speed() method
            }
          }
          
          

          And this is the screenshot of what it produces:

          c462217b-855f-4f82-8c4b-89607eb87db8-image.png

          So my language isssues aside, this is an interesting look at what may not work for Java programs also. :) Maybe a bug?

          Lee

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

            Make sure there is extra white space (e.g. newline) after the last closing brace.

            Lycan ThropeL 1 Reply Last reply Reply Quote 3
            • Lycan ThropeL
              Lycan Thrope @MAPJe71
              last edited by

              @mapje71
              Thanks mapje71.

              That did the trick…I obviously cut and paste too few space on the copy.

              Now if I can just figure out what regex, goes where…etc. :) Thanks again, and yes, I did figure out that the Java FunctionList xml isn’t a mixed parser, just a classrange parser that can find the methods in the class. At least, most of the regex is readable in that file for me to try and get a handle on it.

              Lee

              1 Reply Last reply Reply Quote 1
              • Lycan ThropeL
                Lycan Thrope @Lycan Thrope
                last edited by

                @lycan-thrope said in FunctionList Confused:

                openSymbole=“class”
                closeSymbole=“endclass”

                Still need to figure out if this will work, but in the meantime, I think I had an epiphany about how the regex fits into the FunctionList, and would appreciate an up or down on if the understanding is correct, bearing in mind, I’m just picking up regex, the boost flavor, and learning the NPP FunctionList functionality. :) No pressure.

                So the “mainexpr” gathers all the possible text that can be gathered in a file, just to read it, not necessarily to parse it, so capturing or non-capturing shouldn’t matter (or does it?) and the following breakdowns start reading through the same code, most of it non-capturing until it gets to the desired area (Class or Function name in this case) and then captures that, so the next step in the breakdown is left only to look at the captured text from the previous breakdown…and is therefore used by the parser to identify and place that Class, Class Function(method), or separate Functions outside that body into their proper place for the FunctionList. Would that be a proper understanding of the process?

                In my testing, I’ve been using all capture groups to isolate and identify syntax, and I think that’s why I didn’t get any kind of response from my FunctionList testing for class…besides not having the Classrange,Classname function working…but like I said, I’m confused and unsure about this process…but am plugging away at trying to understand what I need to do to get it to function properly. This part of the process isn’t that well documented, which is why I’m asking if this is the proper analogy while I continue to beat my head against the wall. :)

                Lee

                Michael VincentM 1 Reply Last reply Reply Quote 0
                • Michael VincentM
                  Michael Vincent @Lycan Thrope
                  last edited by

                  @lycan-thrope said in FunctionList Confused:

                  I think I had an epiphany about how the regex fits into the FunctionList, and would appreciate an up or down on if the understanding is correct, bearing in mind, I’m just picking up regex, the boost flavor, and learning the NPP FunctionList functionality.

                  Have you read the user manual that explains basic Function List behavior?

                  Lycan ThropeL Michael VincentM 3 Replies Last reply Reply Quote 1
                  • Lycan ThropeL
                    Lycan Thrope @Michael Vincent
                    last edited by

                    @michael-vincent
                    Yes I have, but like I said, I’m new to all these tools, so I’m trying to understand what I see there and “how” to implement it. Understanding what you’re trying to do makes it a bit easier than trial and error…that’s all. So does my description make sense of what I’m seeing? That’s what I’m asking…my understanding, versus the mainstream understanding. Like people that learn by reaading, others learn by seeing, and yet others learn by trial and error, all good, but the important thing is do they understand…and that’s what makes clarity of a process…I’m at that point, of trying to understand what I’m trying to do.

                    Does that make sense?

                    Lee

                    1 Reply Last reply Reply Quote 0
                    • Lycan ThropeL
                      Lycan Thrope @Michael Vincent
                      last edited by

                      @michael-vincent
                      Maybe this will clarify what I mean. I have taken these variations of the syntax for the Class declaration starting line. (Watch for wrap):

                      class TruckNotebookForm of TBASE from :Truck:Truckbase.cfm
                      class PlainObjectListForm of FORM
                      class FrameCtrl(frameObj) of dBCWndCtrl custom
                      class dBCWndCtrl
                      class FrameAppCtrl of FrameCtrl custom
                      class ToolButtonFx(oParent) of Toolbutton(oParent) custom
                      class MenuFx(oParent,cName)
                      class dContainersForm of DFORM from “dForm.cfm”
                      class LGCENTRYFIELD(parentObj, name) of ENTRYFIELD(parentObj, name) custom

                      I have come up with variations of the regex to match all of these, the last ones working the best to cover all variations. (Watch wrap):

                      1: ^(class)\s([a-zA-Z0-9]+)\s([a-zA-Z0-9+]+)\s([a-zA-Z0-9+]+)
                      2: ^(class)\s(\w*)\s(\w*)\s(\w*)
                      3: (?x)^[\t\x20](class)[\t\x20]+((\w+)|(\w+)[\x20]+(((\w+)(,\w+)?))?)?((\w+|[^\r\n])[\t\x20]+)(custom)? <—best
                      4: (class)[\t\x20]
                      (\w+)([\t\x20]?(\w(,[\t\x20]?\w*)?))?([\t\x20]of[\t\x20]\w((\w*(,[\t\x20]?\w*)?))?([\t\x20]custom)?([\t\x20]from\t\x20)?)?
                      5: (class)[\t\x20]
                      (\w+)([\t\x20]?(\w(,[\t\x20]?\w*)?))?(([\t(\x20]of)[\t\x20]\w((\w*(,[\t\x20]?\w*)?))?([\t\x20]custom)?([\t\x20]from\t\x20)?)?
                      6: (class)[\t\x20]
                      (\w+)([\t\x20]?(\w(,[\t\x20]?\w*)?))?([\t(\x20]of\t\x20)?((\w(,[\t\x20]?\w*)?))?([\t\x20]custom)?([\t\x20]from\t\x20)?
                      7: (?:class)[\t\x20]
                      (?‘Classname’\w+)([\t\x20]?(\w(,[\t\x20]?\w*)?))?(([\t(\x20]of)\t\x20((\w(,[\t\x20]?\w*)*?))?(\t\x20)?([\t\x20]from\t\x20)?)?

                      Now having done that, what’s the next step, or did I do it right, or have I included enough information to get what I need in “mainexpr”, and where do I get “nameexpr” to extrapolate from that?..How do I seperate the wheat from the chaff, so to speak? If you run this through regex101.com, it works like a charm. Trying to put it in the .xml file, hasn’t been as successful. ::shrug::

                      Lee

                      Lycan ThropeL 2 Replies Last reply Reply Quote 0
                      • Lycan ThropeL
                        Lycan Thrope @Lycan Thrope
                        last edited by

                        @lycan-thrope
                        Yikes, it looks like the forum editor did some editing of my strings in the regex…argh…but I hope you get the point. I’m knowing just enough to be dangerous. :)

                        Lee

                        PeterJonesP 1 Reply Last reply Reply Quote 0
                        • PeterJonesP
                          PeterJones @Lycan Thrope
                          last edited by

                          @lycan-thrope said in FunctionList Confused:

                          Yikes, it looks like the forum editor did some editing of my strings in the regex

                          You should read the FAQ: Formatting Forum Posts

                          Lycan ThropeL 1 Reply Last reply Reply Quote 1
                          • Lycan ThropeL
                            Lycan Thrope @PeterJones
                            last edited by

                            @peterjones
                            Apparently, I need to re-read it…thanks. :)

                            Lee

                            1 Reply Last reply Reply Quote 0
                            • Lycan ThropeL
                              Lycan Thrope @Lycan Thrope
                              last edited by

                              @lycan-thrope Test if this works? Here’s hoping. :)
                              1: ‘^(class)\s([a-zA-Z0-9]+)\s([a-zA-Z0-9+]+)\s([a-zA-Z0-9+]+)’
                              2: ‘^(class)\s(\w*)\s(\w*)\s(\w*)’
                              3: ‘(?x)^[\t\x20](class)[\t\x20]+((\w+)|(\w+)[\x20]+(((\w+)(,\w+)?))?)?((\w+|[^\r\n])[\t\x20]+)(custom)?’
                              4: '(class)[\t\x20]
                              (\w+)([\t\x20]?(\w(,[\t\x20]?\w*)?))?([\t\x20]of[\t\x20]\w((\w*(,[\t\x20]?\w*)?))?([\t\x20]custom)?([\t\x20]from’[‘\t\x20’]'(:\w:\w*.\w*|“\w*.\w*”))?)?’
                              5: ‘(class)[\t\x20](\w+)([\t\x20]?(\w*(,[\t\x20]?\w*)?))?(([\t(\x20]of)[\t\x20]\w((\w*(,[\t\x20]?\w*)?))?([\t\x20]custom)?([\t\x20]from’[‘\t\x20’]'(:\w:\w*.\w*|“\w*.\w*”))?)?’
                              6: ‘(class)[\t\x20](\w+)([\t\x20]?(\w*(,[\t\x20]?\w*)?))?([\t(\x20]of’[‘\t\x20’]'(\w))?((\w*(,[\t\x20]?\w*)?))?([\t\x20]custom)?([\t\x20]from’[‘\t\x20’]'((:\w:\w*.\w*)|(“\w*.\w*”)))?’
                              7: ‘(?:class)[\t\x20](?‘Classname’\w+)([\t\x20]?(\w*(,[\t\x20]?\w*)?))?(([\t(\x20]of)‘[’\t\x20’]'(?‘Superclass’\w)((\w*(,[\t\x20]?\w*)?))?(‘[’\t\x20’]‘(?‘Custom’custom))?(’[’\t\x20’]‘from’[‘\t\x20’]'(:\w:\w*.\w*|“\w*.\w*”))?)?’

                              Lycan ThropeL 1 Reply Last reply Reply Quote 0
                              • Lycan ThropeL
                                Lycan Thrope @Lycan Thrope
                                last edited by

                                @lycan-thrope
                                Unfortunately, the backticks to make the multiline brackets work, will have to be manually removed to run the regex’s…and the backticks around the whole regex did not turn it red typewriter text. :(

                                Lee

                                Lycan ThropeL PeterJonesP 2 Replies Last reply Reply Quote 0
                                • Lycan ThropeL
                                  Lycan Thrope @Lycan Thrope
                                  last edited by

                                  @lycan-thrope Hmmmm Let me try this. Test
                                  'red typewriter text’1: ^(class)\s([a-zA-Z0-9]+)\s([a-zA-Z0-9+]+)\s([a-zA-Z0-9+]+)

                                  1 Reply Last reply Reply Quote 0
                                  • Michael VincentM
                                    Michael Vincent @Michael Vincent
                                    last edited by

                                    @Lycan-Thrope
                                    @michael-vincent said in FunctionList Confused:

                                    I think I had an epiphany about how the regex fits into the FunctionList, and would appreciate an up or down on if the understanding is correct, bearing in mind, I’m just picking up regex, the boost flavor, and learning the NPP FunctionList functionality.

                                    Have you read the user manual that explains basic Function List behavior?

                                    Maybe this community post is a little more detailed than the user manual?

                                    Cheers.

                                    Lycan ThropeL 1 Reply Last reply Reply Quote 1
                                    • PeterJonesP
                                      PeterJones @Lycan Thrope
                                      last edited by PeterJones

                                      @lycan-thrope said in FunctionList Confused:

                                      will have to be manually removed to run the regex’s

                                      You have read the FAQ wrong.

                                      the syntax

                                      1. `^(class)\s([a-zA-Z0-9]+)\s([a-zA-Z0-9+]+)\s([a-zA-Z0-9+]+)`
                                      

                                      renders as

                                      1. ^(class)\s([a-zA-Z0-9]+)\s([a-zA-Z0-9+]+)\s([a-zA-Z0-9+]+)

                                      which you can then just copy/paste the red text.

                                      Please note that what you had,

                                      1: ‘^(class)\s([a-zA-Z0-9]+)\s([a-zA-Z0-9+]+)\s([a-zA-Z0-9+]+)’
                                      

                                      is not the same as

                                      1: `^(class)\s([a-zA-Z0-9]+)\s([a-zA-Z0-9+]+)\s([a-zA-Z0-9+]+)`
                                      

                                      which renders correctly as
                                      1: ^(class)\s([a-zA-Z0-9]+)\s([a-zA-Z0-9+]+)\s([a-zA-Z0-9+]+)

                                      The ` key (often called “backtick” or “grave”) is the one that on a standard US keyboard is the same key as ~, but unshifted . You are typing the single-quote / apostrophe key ' (which on a US keyboard, is the unshifted version of ", the double quote). The single-quote in the forum is then being rendered as ‘smart single quotes’ ‘...’ in your post.

                                      The Formatting Forum Posts gives you plenty of copies of the ` character, which you can copy/paste if you are unable to type the character on your keyboard.

                                      Lycan ThropeL 1 Reply Last reply Reply Quote 1
                                      • Lycan ThropeL
                                        Lycan Thrope @PeterJones
                                        last edited by

                                        @peterjones said in FunctionList Confused:

                                        `

                                        Peter, thanks for clarifying that for me. I just want to show you why I used that character, besides not realizing where the backtick key was. In this screenshot of your message to me, as well as in the documentation FAQ for posting, I highlighted the character to see if these old eyes could make out what it was, and as you see, the little pop up that “says” what it is, is mistaken. :) Thanks for fixing that for me. :) Screenshot of what I saw:
                                        Peterbacktick.PNG

                                        So really, thanks for clearing that up for me. :)

                                        Lee

                                        Lycan ThropeL PeterJonesP 2 Replies Last reply Reply Quote 0
                                        • Lycan ThropeL
                                          Lycan Thrope @Lycan Thrope
                                          last edited by

                                          @lycan-thrope
                                          So…let’s try this again, so I can see if it work right, with just the backtick.
                                          7: (?:class)[\t\x20]*(?'Classname'\w+)([\t\x20]*?\(\w*(,[\t\x20]?\w*)*?\))?(([\t(\x20]of)[\t\x20](?'Superclass'\w*)(\(\w*(,[\t\x20]?\w*)*?\))?([\t\x20](?'Custom'custom))?([\t\x20]from[\t\x20](:\w*:\w*\.\w*|"\w*\.\w*"))?)?

                                          Woohoo…the preview shows it working, but as per the FAQ let’s see if it does it without all the backticking in side the regex on the multiline brackets. :)

                                          Lee

                                          Lycan ThropeL 1 Reply Last reply Reply Quote 0
                                          • Lycan ThropeL
                                            Lycan Thrope @Lycan Thrope
                                            last edited by

                                            @lycan-thrope One more time…with the whole thing. :)

                                            These are the regexs I built leading up to the final ones (4,5,6,7) that work with the complete line in some or fashion. Still need to watch the word wrap.

                                            1: ^(class)\s([a-zA-Z0-9]+)\s([a-zA-Z0-9+]+)\s([a-zA-Z0-9+]+)
                                            2: ^(class)\s(\w*)\s(\w*)\s(\w*)
                                            3: (?x)^[\t\x20]*(class)[\t\x20]+((\w+)|(\w+)[\x20]+(\((\w+)(,\w+)?\))?)?((\w+|[^\r\n]*)[\t\x20]+)*(custom)?
                                            4: (class)[\t\x20]*(\w+)([\t\x20]*?\(\w*(,[\t\x20]?\w*)*?\))?([\t\x20]of[\t\x20]\w*(\(\w*(,[\t\x20]?\w*)*?\))?([\t\x20]custom)?([\t\x20]from[\t\x20](:\w*:\w*\.\w*|"\w*\.\w*"))?)?
                                            5: (class)[\t\x20]*(\w+)([\t\x20]*?\(\w*(,[\t\x20]?\w*)*?\))?(([\t(\x20]of)[\t\x20]\w*(\(\w*(,[\t\x20]?\w*)*?\))?([\t\x20]custom)?([\t\x20]from[\t\x20](:\w*:\w*\.\w*|"\w*\.\w*"))?)?
                                            6: (class)[\t\x20]*(\w+)([\t\x20]*?\(\w*(,[\t\x20]?\w*)*?\))?([\t(\x20]of[\t\x20](\w*))?(\(\w*(,[\t\x20]?\w*)*?\))?([\t\x20]custom)?([\t\x20]from[\t\x20]((:\w*:\w*\.\w*)|("\w*\.\w*")))?
                                            7: (?:class)[\t\x20]*(?'Classname'\w+)([\t\x20]*?\(\w*(,[\t\x20]?\w*)*?\))?(([\t(\x20]of)[\t\x20](?'Superclass'\w*)(\(\w*(,[\t\x20]?\w*)*?\))?([\t\x20](?'Custom'custom))?([\t\x20]from[\t\x20](:\w*:\w*\.\w*|"\w*\.\w*"))?)?

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