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 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
                                  • PeterJonesP
                                    PeterJones @Lycan Thrope
                                    last edited by

                                    @lycan-thrope said in FunctionList Confused:

                                    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.

                                    The word “QUOTE” shows up like that if you select any text:
                                    06af42e0-fa33-4141-8b23-02bd2b5ae55b-image.png

                                    It is not telling you what character that is. It is the Forum asking you if you would like to use the selected text as the QUOTE portion in your reply.

                                    If you have multiple lines of example text, use the LITERAL TEXT BOXES , not the RED TYPEWRITER TEXT.

                                    But this is getting off the point, and you have shown your regexes. So unless you have more about FunctionList, I think we’ve spent enough on forum formatting.

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

                                      @michael-vincent
                                      Thanks Michael, that’s where some of the understanding is coming from, with the ability to read english via the Java.xml versus the cpp.xml, but since I’m not completely familar with java’s syntax and variations, it’s still clear as mud, but getting clearer. :-)

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

                                        @peterjones
                                        I do appreciate your help, in this regard. I’ve been around awhile, but have to admit, posting in here, is a little different that what I’m used to, even after reading the FAQ…thanks for that clarification, though. Hate to look dumber than I am. :)

                                        Lee

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

                                          @lycan-thrope
                                          Okay, so no after beating the keyboard and my head all day, I figured it was time to present what I have tried and still doesn’t work…but to be fair, all I’m trying to do is get FunctionList to see my class first. Baby steps.

                                          This is my functionlist file:

                                          <?xml version="1.0" encoding="UTF-8" ?>
                                          <!-- ==========================================================================\
                                          |
                                          |   To learn how to make your own language parser, please check the following
                                          |   link:
                                          |       https://npp-user-manual.org/docs/function-list/
                                          |
                                          \=========================================================================== -->
                                          <NotepadPlus>
                                          	<functionList>
                                          		<!-- ========================================================= [ dBASEPlus ] -->
                                          		<parser
                                          			displayName="dBASEPlus"
                                          			id         ="dbaseplus"
                                          			commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
                                          		>
                                          			<classRange
                                          				mainExpr="(?x)                                                                 # use inline comments
                                          					^[\t\x20]*                                                                 # leading whitespace
                                                              class							# class keyword
                                          					[\t\x20]*(\w+)							# class name
                                          										# Following the class name there is the option of parameters, and if so
                                          										# the first entry inside the parens is required, whether there is other 
                                          										# parameters or not, once the parens go up, the first is required. ie:
                                          										# class FrameCtrl(frameObj)
                                          					([\t\x20]*?\(\w*	# first and required parameter
                                          					((,[\t\x20]?\w*)*)?\))?			# the following optional/additional	parameters
                                          													# For the rest of the class declaration, after the class name
                                          													# all other options are part of one big optional set, that 
                                          													# follows 'of' and can be populated by one of several 
                                          													# options. The first and most prevalent is the Superclass
                                          													# name that the class is being subclassed from, and it's
                                          													# options of parameters and again, if it has parameters at
                                          													# least the first one is required ie.:
                                          													# class class ToolButtonFx(oParent) of Toolbutton(oParent)
                                          					(([\t(\x20]of)[\t\x20]\w*(\(\w*((,[\t\x20]?\w*)*)?\))?
                                          													# The next possible option is that it is a custom object and
                                          													# needs to be in this line so if the object or form is opened
                                          													# up in the dBASE IDE, the designers in it won't mess up
                                          													# the object by streaming out missing parts or overriding 
                                          													# properties or objects and functions.
                                          					([\t\x20]custom)?
                                          													# The next option is that the class is being subclassed from
                                          													# another object that is contained elsewhere and the compiler
                                          													# needs to know this reference.  There are two options for 
                                          													# pointing to the file. The first is an Alias path in the IDE
                                          													# that can be accessed by the compiler in the environment, or 
                                          													# second, it is in the current directory and only the name is
                                          													# needed...or it has a path that can be listed here, but this
                                          													# is bad practice, and an Alias is recommended if the file is in
                                          													# a place other than the current directory. If it is, the name
                                          													# can be used in quotes as a string that gets passed to the 
                                          													# compiler. Both follow the word 'From'. The Alias directory
                                          													# is a name that is enclosed in two colons, one immediately
                                          													# before the Alias name and one immediately after, no spaces.
                                          					([\t\x20]from[\t\x20](:\w*:\w*\.\w*| \x22 \w*\.\w* \x22))?)?   # end of class declaration line
                                          					
                                          				"
                                          				
                                          				closeSymbole="endclass"
                                          			>
                                          				<className>
                                          					<nameExpr
                                          						expr="(?x)
                                          						[\t\x20]*?
                                          						^class					# class  keyword
                                          						[\t\x20]*
                                          						\K(\w+)                   # Class name
                                          						"
                                          					/>
                                          					
                                          				</className>
                                          				<function
                                          					mainExpr="                                                                     # function body
                                          					"
                                          				>
                                          					<functionName>
                                          						<funcNameExpr
                                          							expr="                                                            # function parameters
                                          							"
                                          						/>
                                          						<funcNameExpr
                                          							expr="
                                          							"
                                          						/>
                                          					</functionName>
                                          				</function>
                                          			</classRange>
                                          			<function
                                          				mainExpr="                                                                         # function body
                                          				"
                                          			>
                                          				<functionName>
                                          					<nameExpr
                                          						expr="                                                                # function parameters
                                          						"
                                          					/>
                                          					<nameExpr
                                          						expr="
                                          						"
                                          					/>
                                          				</functionName>
                                          				<className>
                                          					<nameExpr expr="
                                          					" />
                                          				</className>
                                          			</function>
                                          		</parser>
                                          	</functionList>
                                          </NotepadPlus>		
                                          

                                          This is a basic file to be searched by the FunctionList dbaseplus.xml:

                                          ** END HEADER -- do not remove this line
                                          //
                                          // Generated on 10/13/2021
                                          //
                                          parameter bModal
                                          local f
                                          f = new PlainObjectListForm()
                                          if (bModal)
                                             f.mdi = false // ensure not MDI
                                             f.readModal()
                                          else
                                             f.open()
                                          endif
                                          
                                          class PlainObjectListForm of FORM
                                             with (this)
                                                onOpen = class::FORM_ONOPEN
                                                doublebuffered = true
                                                metric = 6	// Pixels
                                                colorNormal = "Gray"
                                                height = 529.0
                                                left = 110.0
                                                top = 29.0
                                                width = 1092.0
                                                sizeable = false
                                                refreshAlways = false
                                                pageno = 0
                                             endwith
                                          
                                             function form_onOpen()
                                          
                                                form.testcontainer.vscrollbar1.currentValue = ;
                                                                         form.testcontainer.vscrollbar1.value
                                                form.testContainer.aContainers = new array()
                                                form.testContainer.ncontainers = 0
                                                form.testContainer.nSpacing = 2
                                                return
                                          
                                          endclass
                                          
                                          
                                          

                                          I hope the fact that I don’t have a function search in it yet won’t be the problem, as all I want to do is verify I have the regex, the .xml file correct, and the settings and files in the right place. If it’s my regex and .xml, I won’t feel bad, as it’s new…what can I say, but I think I did it right. ::shrug::

                                          Sorry if the .xml file is a bit long, but I copied it and emptied the C++ code figuring I was going to do this quick and left all the mixed parser stuff in it. ;-( Anyone see, off hand what I’m doing wrong or what’s wrong? I get no acknowledgement of even the file existence in the FunctionList head…that can’t be a good sign. :-(

                                          Lee

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

                                            @lycan-thrope ,

                                            Without any functions defined, the classes don’t show up in the list, even if they do match your text, so you aren’t going to be able to see it work without a function (even if it’s the simplest possible function).

                                            If you want to individually test the regex, you can use the FIND or MARK dialogs with the same expression, which makes it easier to try variants.

                                            If I try your class expression in the FIND dialog, it says that it’s an invalid expression.

                                            When defining a new parser, I generally skip the openSymbole and closeSymbole expressions, and just deal with the mainExpr.

                                            Next, the way I do it, the mainExpr needs to match all of the text in the class – so the whole class … endclass – not just the introductory line, because it only finds class-functions (ie, methods) if they exist inside. If I’m reading your expression right, it’s only matching the single class line. (Maybe with the closeSymbole, you no longer need mainExpr to match as much… but I wouldn’t trust that without more experimentation.)

                                            And when debugging, I try to make the main expression as simple as possible, especially at first; if it needs more complexity later on, I add it… but for helping you get something tot; when debugging it, I start with the simplest form. Which, I think for yours, would be "match from class to endclass. So I’d be tempted to start with mainExpr="(?xms) ^ \h* class \h+.* ^ \h* endclass" – when I use that in a FIND in your document, it finds from class to endclass as I think I expect.

                                            Your class name expression looks reasonable, and does match the class name.

                                            For simple testing, I would then define the function mainExpr="(?x) \h* function \h+ (\w+)"

                                            But, as always, something goes wrong when I try things starting too complex. So I comment out the classRange, and just start with a simple function section:

                                            			<function
                                            				mainExpr="(?x) \h* function \h+ (\w+)"
                                            			>
                                            				<functionName>
                                            					<nameExpr expr="(?x) \h* function \h+ \K (\w+)"
                                            					/>
                                            				</functionName>
                                            			</function>
                                            

                                            If I do that, and add a block before your class

                                            function outsideAnything()
                                               here
                                               return
                                            

                                            (might not be valid, just using it for the parser), then reload when the dbaseplus.xml parser is properly linked in the overrideMap.xml, and the existing file is associated with the dBASEPlus UDL, I get:
                                            b1ca8da1-164d-4c99-bac9-baa4549ba3f2-image.png
                                            … so that means I am doing something right so far.

                                            But when I try to use that same <function> block inside the <classRange> block, it won’t find the class (and no longer shows the form_onOpen)…

                                            Unfortunately, while I’m usually able to get it eventually, it takes time for me. And I’ve spent as much as I can on this for now. maybe I’ll have spare time later today to work on it. But, if nothing else, this will give you a good starting point, because with the classRange commented out as here, it finds two functions, which is at least a starting point for debug:

                                            <?xml version="1.0" encoding="UTF-8" ?>
                                            <!-- ==========================================================================\
                                            |
                                            |   To learn how to make your own language parser, please check the following
                                            |   link:
                                            |       https://npp-user-manual.org/docs/function-list/
                                            |
                                            \=========================================================================== -->
                                            <NotepadPlus>
                                            	<functionList>
                                            		<!-- ========================================================= [ dBASEPlus ] -->
                                            		<parser
                                            			displayName="dBASEPlus"
                                            			id         ="dbaseplus"
                                            			commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
                                            		>
                                            			<!--classRange
                                            				mainExpr="(?xms) ^ \h* class \h+.* ^ \h* endclass"
                                            			>
                                            				<className>
                                            					<nameExpr
                                            						expr="(?x) [\t\x20]*? ^class [\t\x20]* \K(\w+)"
                                            					/>
                                            					
                                            				</className>
                                            				<function
                                            					mainExpr="(?x) \h* function \h+ (\w+)"
                                            				>
                                            					<functionName>
                                            						<nameExpr expr="(?x) \h* function \h+ \K (\w+)"
                                            						/>
                                            					</functionName>
                                            				</function>
                                            			</classRange-->
                                            			<function
                                            				mainExpr="(?x) \h* function \h+ (\w+)"
                                            			>
                                            				<functionName>
                                            					<nameExpr expr="(?x) \h* function \h+ \K (\w+)"
                                            					/>
                                            				</functionName>
                                            			</function>
                                            		</parser>
                                            	</functionList>
                                            </NotepadPlus>	
                                            

                                            and

                                            ** END HEADER -- do not remove this line
                                            //
                                            // Generated on 10/13/2021
                                            //
                                            parameter bModal
                                            local f
                                            f = new PlainObjectListForm()
                                            if (bModal)
                                               f.mdi = false // ensure not MDI
                                               f.readModal()
                                            else
                                               f.open()
                                            endif
                                            
                                            function outsideAnything()
                                               here
                                               return
                                            
                                            
                                            class PlainObjectListForm of FORM
                                               with (this)
                                                  onOpen = class::FORM_ONOPEN
                                                  doublebuffered = true
                                                  metric = 6	// Pixels
                                                  colorNormal = "Gray"
                                                  height = 529.0
                                                  left = 110.0
                                                  top = 29.0
                                                  width = 1092.0
                                                  sizeable = false
                                                  refreshAlways = false
                                                  pageno = 0
                                               endwith
                                            
                                               function form_onOpen()
                                            
                                                  form.testcontainer.vscrollbar1.currentValue = ;
                                                                           form.testcontainer.vscrollbar1.value
                                                  form.testContainer.aContainers = new array()
                                                  form.testContainer.ncontainers = 0
                                                  form.testContainer.nSpacing = 2
                                                  return
                                            
                                            endclass
                                            
                                            

                                            Sorry I couldn’t get more working yet…

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