Community
    • Login

    User Defined language multiple questions

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    udl
    23 Posts 2 Posters 3.7k 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.
    • EkopalypseE
      Ekopalypse @Spiralo-Idioide
      last edited by

      @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
      • EkopalypseE
        Ekopalypse @Spiralo-Idioide
        last edited by

        @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
        • Spiralo-IdioideS
          Spiralo-Idioide
          last edited by

          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.

          EkopalypseE 1 Reply Last reply Reply Quote 0
          • Spiralo-IdioideS
            Spiralo-Idioide
            last edited by Spiralo-Idioide

            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
            • EkopalypseE
              Ekopalypse @Spiralo-Idioide
              last edited by

              @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
              • Spiralo-IdioideS
                Spiralo-Idioide
                last edited by Spiralo-Idioide

                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.

                EkopalypseE 1 Reply Last reply Reply Quote 0
                • EkopalypseE
                  Ekopalypse @Spiralo-Idioide
                  last edited by Ekopalypse

                  @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
                  • EkopalypseE
                    Ekopalypse
                    last edited by

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

                    1 Reply Last reply Reply Quote 1
                    • Spiralo-IdioideS
                      Spiralo-Idioide
                      last edited by

                      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.

                      EkopalypseE 1 Reply Last reply Reply Quote 2
                      • EkopalypseE
                        Ekopalypse @Spiralo-Idioide
                        last edited by

                        @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
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors