Code folding for Harbour functions with multiple return statements

Code folding for Harbour functions with multiple return statements

2
NewbieNewbie
2

    Jan 05, 2017#1

    I am programming in Harbour.
    In my UE configuration I have:

    Code: Select all

    /Open Fold Strings = "FUNCTION" "IF" "ELSE"
    /Close Fold Strings = "RETURN" "ELSE" "ENDIF"
    
    When I have piece of code e.g.

    Code: Select all

    FUNCTION Example()
    ...
    IF <condition>
       < some statement >
    ELSE
       RETURN   // 1
    ENDIF
    ...
    RETURN      // 2
    
    code folding for FUNCTION ends on first RETURN statement (1). How can I achieve that it ends on end of function RETURN (2) statement?

    Thanks,
    Zeka

    6,682583
    Grand MasterGrand Master
    6,682583

      Jan 05, 2017#2

      Code folding counts for each line how many open and how many close fold strings are found up to the current line containing an open or close fold string. It does not matter which close fold string is found for a still open fold string in comparison to brace strings where the matching close brace string must be found for an open brace string.

      I don't know anything about Harbour. But it looks like the keyword RETURN can be used anywhere to exit a function. So it does not really mark the end of a function. I suppose the keyword FUNCTION marks the beginning of a new function and at the same time the end of the previous function.

      Therefore I suggest to use in the wordfile:

      Code: Select all

      /Open Fold Strings = "FUNCTION" "IF" "ELSE"
      /Close Fold Strings = "FUNCTION" "ELSE" "ENDIF"
      
      All functions with the exception of last function in Harbour file can be folded correct with these fold strings.

      It is unfortunately not possible to specify end of file as close fold string to be counted as one close fold string to fold in languages like Harbour also the last function (or on an INI file the last section).
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Jan 05, 2017#3

        Thanks.
        This solution is ok for me.
        Kind regards,
        Zeka