• Login
Community
  • Login

User Defined language multiple questions

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
udl
23 Posts 2 Posters 3.9k 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.
  • E
    Ekopalypse @Spiralo-Idioide
    last edited by Jul 5, 2019, 8:31 PM

    @Spiralo-Idioide

    which npp version do you use? Can be found as debug-info from ? menu (last menu item). With 7.7.1 it seems that folding is correct, regardless whether I open a gp file or if using a new file. Btw. I have add the gp to the extensions in udl.

    1 Reply Last reply Reply Quote 2
    • S
      Spiralo-Idioide
      last edited by Jul 5, 2019, 8:32 PM

      Yes, I’m using 7.4.2. I’m going to update now.

      E 2 Replies Last reply Jul 5, 2019, 8:34 PM Reply Quote 0
      • E
        Ekopalypse @Spiralo-Idioide
        last edited by Jul 5, 2019, 8:34 PM

        @Spiralo-Idioide

        don’t update. Download a zipped version and see if this changes what you want.
        There are a lot of changes since 7.4, so you might run into other troubles.

        1 Reply Last reply Reply Quote 2
        • E
          Ekopalypse @Spiralo-Idioide
          last edited by Jul 5, 2019, 8:36 PM

          @Spiralo-Idioide

          When variable contains numbers in it’s name and is inside parenthesis, the nuber are highlighted.

          Is caused by the delimiter2 setting to allow nesting with numbers. What do you try to achieve with this delimiter?

          1 Reply Last reply Reply Quote 1
          • S
            Spiralo-Idioide
            last edited by Jul 5, 2019, 8:41 PM

            I tried v7.7.1 and sadly it didn’t resolve my folding problem. And about the delimiter 2, I used it because if don’t numbers are not highlighted at all inside parenthesis.

            E 1 Reply Last reply Jul 5, 2019, 8:49 PM Reply Quote 0
            • S
              Spiralo-Idioide
              last edited by Spiralo-Idioide Jul 5, 2019, 8:47 PM Jul 5, 2019, 8:46 PM

              But in the folding problem is not my main question with the workaround of opening a new file. I’m more intrusted in the variables/functions highlighting. If you could help would be awesome anyway.

              1 Reply Last reply Reply Quote 0
              • E
                Ekopalypse @Spiralo-Idioide
                last edited by Jul 5, 2019, 8:49 PM

                @Spiralo-Idioide

                I tried v7.7.1 and sadly it didn’t resolve my folding problem

                With the same code you sent? What exactly do you do to see this behavior.

                about the delimiter 2, I used it because if don’t numbers are not highlighted at all inside parenthesis

                What do you try to achieve with this delimiter? Why is it needed at all?

                1 Reply Last reply Reply Quote 0
                • S
                  Spiralo-Idioide
                  last edited by Spiralo-Idioide Jul 5, 2019, 8:52 PM Jul 5, 2019, 8:52 PM

                  I used delimiter 2 with parenthesis because when I’m not using it, numbers and strings are not highlighted at all, wich is kind of worse. But this is really not an issue. Just like the folding problem.

                  E 1 Reply Last reply Jul 5, 2019, 9:34 PM Reply Quote 0
                  • E
                    Ekopalypse @Spiralo-Idioide
                    last edited by Ekopalypse Jul 5, 2019, 9:36 PM Jul 5, 2019, 9:34 PM

                    @Spiralo-Idioide

                    for function list you need to edit functionList.xml

                    I added to the end of associationMap tag

                    			<association id=    "gp_function"      userDefinedLangName="GP"                />
                    			<association id=    "gp_function"      ext=".gp"                               />
                    

                    and a new parser tag

                    			<parser
                    				displayName="GP"
                    				id         ="gp_function"
                    			>
                    				<!-- <classRange -->
                    					<!-- mainExpr    ="(?&lt;=^class\x20).*?(?=\n\S|\Z)" -->
                    				<!-- > -->
                    					<!-- <className> -->
                    						<!-- <nameExpr expr="\w+(?=[\(|:])" /> -->
                    					<!-- </className> -->
                    					<!-- <function -->
                    						<!-- mainExpr="(?&lt;=def\x20).+?(?=:)" -->
                    					<!-- > -->
                    						<!-- <functionName> -->
                    							<!-- <funcNameExpr expr=".*" /> -->
                    						<!-- </functionName> -->
                    					<!-- </function> -->
                    				<!-- </classRange> -->
                    				<function
                    					mainExpr="(?m-s)(?&lt;=to\x20).+?(?={.*$)"
                    				>
                    					<functionName>
                    						<nameExpr expr=".*" />
                    					</functionName>
                    				</function>
                    			</parser>
                    

                    The open part is how a class and its methods are defined. Is not part of your sample code.

                    Note, once you edit functionlist.xml you need to restart npp in order to make it work.

                    1 Reply Last reply Reply Quote 3
                    • E
                      Ekopalypse
                      last edited by Jul 5, 2019, 9:50 PM

                      Midnight here - unless someone else takes over I will follow up on this tomorrow.

                      1 Reply Last reply Reply Quote 1
                      • S
                        Spiralo-Idioide
                        last edited by Jul 5, 2019, 10:37 PM

                        Thnks a lot for now.
                        I tried what you said but I still have problems.

                        • Only functions defined by ‘to’ are recognized.

                        • The function are listed with the arguments in their name. For example :

                        to playABC s instr beatsPerMinute transposition {
                          if (isNil instr) { instr = 'piano' }
                          if (isNil beatsPerMinute) { beatsPerMinute = 120 }
                          if (isClass instr 'String') {
                        	instrument = (newSampledInstrument instr)
                          } (isClass instr 'Array') {
                        	instrument = (sampledInstrumentFromSamples instr)
                          } else {
                        	return nil
                          }
                          scorePlayer = (newScorePlayer instrument beatsPerMinute)
                          voice = (parse (new 'ABCParser') s)
                          if (notNil transposition) { transpose (new 'ABCParser') voice transposition }
                          addVoice scorePlayer voice
                          playScore scorePlayer
                          return scorePlayer
                        }
                        

                        Here, the name of the function is just ‘playABC’. Without ‘instr’, ‘beatsPerMinute’ and ‘transposition’.

                        Thanks a lot for all of this. But don’t hurry to help I won’t be able to answer for two weeks.

                        E 1 Reply Last reply Jul 6, 2019, 12:03 PM Reply Quote 2
                        • E
                          Ekopalypse @Spiralo-Idioide
                          last edited by Jul 6, 2019, 12:03 PM

                          @Spiralo-Idioide

                          Only functions defined by ‘to’ are recognized.

                          :-) That’s no wonder as it isn’t included yet. Therefore my statement
                          The open part is how a class and its methods are defined. Is not part of your sample code. :-)

                          The function are listed with the arguments in their name. For example :

                          Yes, as I don’t know this language and don’t know how you wanted it to be reported
                          I used <nameExpr expr=".*" /> which returns the whole line. For example, a change to
                          <nameExpr expr="\w+" /> would return the first word after to.

                          But don’t hurry to help I won’t be able to answer for two weeks.

                          No problem. Just respond when you are back to this thread and we can go on.
                          As said, I need the class and its method definitions as an example.

                          1 Reply Last reply Reply Quote 2
                          21 out of 23
                          • First post
                            21/23
                            Last post
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors