Community
    • Login

    Function list for Caml

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    function list
    24 Posts 5 Posters 6.6k 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.
    • Scott SumnerS
      Scott Sumner @Tom Saury
      last edited by

      @Tom-Saury said:

      Maybe you have you have to restart NPP to refresh the functionList rules

      Yes! If you manually-edit any of Notepad++'s configuration files (and for functionList.xml that is the only way), changes aren’t going to be picked up until you restart Notepad++. I really think this is obvious, even if you aren’t all that familiar with Notepad++.

      And FYI, be careful when manually editing other config files, because upon shutdown Notepad++ may need to overwrite them with its own changes, blowing away any manual edits you may have done.

      1 Reply Last reply Reply Quote 1
      • Tom SauryT
        Tom Saury
        last edited by Tom Saury

        Wasn’t obvious to me, my bad. This post wouldn’t be there if I knew this. :
        It’s written no where, how can you know that the refresh button doesn’t refresh the rules ?

        Scott SumnerS 1 Reply Last reply Reply Quote 0
        • Scott SumnerS
          Scott Sumner @Tom Saury
          last edited by Scott Sumner

          @Tom-Saury

          Wasn’t obvious to me

          That’s fine, we all have different levels of experience with computers in general. I hope you didn’t spend a lot of time thinking your expressions must be wrong if the right stuff didn’t happen right when you saved the xml file!

          Later thought: Actually, I don’t know what the refresh button in the Function List window does. For all I know it may do what you originally thought and something else was wrong?

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

            The refresh-button refreshes the function list i.e. re-parses the active buffer/source file which isn’t saved yet. When saving a file the refresh is automatically triggered.
            To refresh the parser itself after changing functionList.xml you have to restart Notepad++.

            1 Reply Last reply Reply Quote 5
            • Tom SauryT
              Tom Saury
              last edited by

              Hey everyone !
              Could someone tell me why does “for” match here ?
              Here is my function parser :

                              mainExpr="(?x)                                              # free-spacing (see `RegEx - Pattern Modifiers`)
                                      let                                                 # start-of-function indicator...
                                      \s+                                                 # ...should be followed by at least one white-space
              						(rec\s+)?
                                      \K                                                  # discard text matched so far
                                      [a-z_]\w*                                           # valid character combination for identifiers
                                      \s+                                                 # start-of-parameters indicator
                                      ([a-z_]\w*(\s+[a-z_]\w*)*\s+                        # several parameters are optional
                                      )|(\(\s*\)\s+)                                         # parameters are optional
                                      =                                                   # function-header-body separator
                                      .+                                                  # whatever, until...
                                      \s+in\s                                             # ...end-of-function indicator
                                  "
              

              and here is my source code :

              let boatGenO () =
              	for boat=0 to 4 do
              		let length = boatLength.(boat) in
              		let isPlaced = ref false in
              		while not !isPlaced do
              			if (Random.bool()) then begin
              				let x = Random.int (10-length) and
              					y = Random.int 10 in
              				let canBePlaced = ref true in
              				for i=0 to pred length do
              					if plateauO.(x+i).(y)<>" " then canBePlaced := false;
              				done;
              				if !canBePlaced then begin
              					for d=0 to pred length do
              						plateauO.(x+d).(y) <- (boatSymbol.(boat));
              					done;
              					tabBateauO := Array.concat [!tabBateauO; [|(x, y, (boat, false), 1)|]];
              					isPlaced := true;
              				end;
              			end else begin
              				let y = Random.int (10-length) and
              					x = Random.int 10 in
              				let canBePlaced = ref true in
              				for i=0 to pred length do
              					if plateauO.(x).(y+i)<>" " then canBePlaced := false;
              				done;
              				if !canBePlaced then begin
              					for d=0 to pred length do
              						plateauO.(x).(y+d) <- (boatSymbol.(boat));
              					done;
              					tabBateauO := Array.concat [!tabBateauO; [|(x, y, (boat, false), 0)|]];
              					isPlaced := true;
              				end;
              			end;
              		done;
              	done;
              	Array.iter (fun ligne -> begin
              		print_string "|";
              		Array.iter (fun symb -> print_string (symb^"|");) ligne;
              		print_string "\n";
              		end;) plateauO;
              in
              

              I expected that only boatGenO matchs but it’s not the case and I can’t figure out why.

              Cheers

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

                Make sure you have whitespace at the end of your source file e.g. newline.

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

                  Have a good look at how you parse for (optional) function parameters e.g. are the parentheses optional or mandatory?

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

                    Furthermore, I presume

                    ([a-z_]\w*(\s+[a-z_]\w*)*\s+)|(\(\s*\)\s+)
                    

                    is intended as

                    ([a-z_]\w*(\s+[a-z_]\w*)*\s+|\(\s*\)\s+)
                    
                    1 Reply Last reply Reply Quote 0
                    • Tom SauryT
                      Tom Saury
                      last edited by

                      Indeed, the whitespace at the end was a problem so I replaced \s+in\s with \sin$
                      Still the problem with “for”. I noticed that it happend only with functions which has no parameters, but why…

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

                        Did also remove the superfluous parentheses?

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