How to ignore some fold strings for PML

How to ignore some fold strings for PML

4

    Aug 09, 2012#1

    HI
    I create a first version of an wordfile for PML (Aveva PML - Programmable Macro Language),the file of attachment is PML.RAR, it include the PML.UEW ,gphViews.pmlobj,monitormain.pmlfrm,isocutpipe.pmlfrm
    the file of the gphViews.pmlobj,monitormain.pmlfrm can't be folded correctly,the isocutpipe.pmlfrm can be fold correctly;
    the reason of the gphViews.pmlobj,monitormain.pmlfrm can't be folded correctly is not set righty the ignore fold string.
    there are some gadget(control) for PML Form,such as menu,view,bar etc
    the define of menu gadge is


    menu .cntrl
      add |Borders On/Off| |call !!view3DSet(_view, 'Borders')|
      add |Shading On/Off| |call !!view3DSet(_view, 'Shaded')|
      add |Background Colour...| |call !!view3DColourSet(_view)|
       add |ID Colour...| menu .idColours
      add |Perspective On/Off| |call !!view3DSet(_view, 'Perspective')|
      add separator
      add |Close| |call !!notDoneYet()|
    exit


    I set the value of the /Open Fold Strings and /Close Fold Strings in the PML.UEW
    such as:
    /Open Fold Strings = "{" "define object " "define Function " "define method " "frame" "rgroup" "var list" "bar" "view" "menu" "setup form " "do" "handle" "if" "elseIf" "else"
    /Close Fold Strings = "}" "endobject" "endfunction" "endmethod" "endhandle" "elseIf" "endif" "enddo" "else" "exit"

    but I want to ignore the line of the definition of the menu gadget:
    add |ID Colour...| menu .idColours

    my question is How to set ignore fold string for 'add |ID Colour...| menu .idColours',I try to set the follow Ignore fold strings:
    /Ignore Fold Strings = ... "add * menu " ...

    but it don't work correctly?

    Can anyone show me how to set the right ignore fold strings?

    anather question is
    Can the regular expression be used in the ignore fold string?

    my eMail is : [email protected]
    pml_uew.rar (18.66 KiB)   262
    PML UEW file and PML File

    2362
    MasterMaster
    2362

      Aug 09, 2012#2

      Your Ignore string causes UltraEdit to look for the literal string, "add * menu ".

      The ignore fold string does not allow for regular expressions.

      However, simply placing "add" in the ignore fold strings will cause UltraEdit to ignore any fold strings on the same line with the word "add", which should do exactly what you want.

      6,687587
      Grand MasterGrand Master
      6,687587

        Aug 10, 2012#3

        I looked on your wordfile, sorted the words in the file, removed duplicates and tested it for invalid words.

        The only duplicate words kept are:

        boolean in color group 2 and Boolean in color group 3.
        bran in color group 2 and BRAN in color group 7.

        The 4 words are always highlighted with color defined for color group 2. You have to decide if you want to remove the 2 words in color group 2 or the other 2 words in C3 and C7.

        I removed also most ignore fold strings and some open fold strings.

        As I don't know anything about this language. You should look with the updated wordfile as attached on the 3 example files you packed also into the RAR archive. Tell me on which lines code folding does not work correct and I will look into it.
        pml_wordfile1.rar (1.96 KiB)   245
        First version of updated PML wordfile.

        4

          Aug 10, 2012#4

          Hi mofi
          I have looked with the your updated wordfiles,the confusable fold code was showed in my confuse_fold_code.doc which is packed with RAR archive,this RAR archive includes another file testPML.pmlFrm, you can test the confuse fold code with your updated wordfiles.
          thank you

          maxuming
          qt_confuse_fold_code.rar (112.34 KiB)   228

          6,687587
          Grand MasterGrand Master
          6,687587

            Aug 10, 2012#5

            Following was done on second version of PML wordfile:
            • Changed order of delimiter characters accroding to ASCII table (not really needed) and added space and tab character (often forgotten).
            • Redefined the function string regular expressions. There are less function strings (= scan is faster) and ^(...^) are used to define what should be displayed in function list view.

              I could see only one issue: In file testPml.pmlfrm there is the only define function but without a dot after next space character. Are functions defined with "define function ." or just with "define function"? If the second is true, the dot should be removed from function string 1.
            • Fixed code folding issues by using now /Ignore Fold Strings = "add |" "add '" "skip"
            • Made fold string "define function " completely lower case.
            • Added keyword endobject to color group 2.
            pml_wordfile2.rar (1.96 KiB)   246
            Second version of PML wordfile

            4

              Aug 12, 2012#6

              Hi Mofi,

              thanks for your help.

              PML is not a very rigorous macro language, menu, list, view, bar is the gadget (controls) of the forms.
              Their definition is
              menu. VarMenuName ... exit, List. VarListName ... exit, Bar ... exit
              But sometimes 'exit' may be omitted, so I do not know how to define the code fold for menu, list, view, bar in PML.uew.

              The attached rar achive includes testPml-v2.pmlfrm, pmllib and AVEVA PDMS PML Basic Guide. testPml-v2.pmlfrm is confusing code folding. PmlLib is a PML library fold. It can be used to test PML.UEW, PDMS PML Basic Guide is book of PML syntax.pmllib.rar is about 1.8 MB. I will send it to [email protected]
              testPml-v2.rar (14.66 KiB)   262
              confusion Fold code pml program

              6,687587
              Grand MasterGrand Master
              6,687587

                Aug 12, 2012#7

                UltraEdit is not an interpreter for PML code, it is just a text editor. Therefore it is impossible to define open fold strings where the corresponding close fold string is just optional and not strictly required. You either simply always use exit to mark the end of a menu, view, list or bar definition block, or you define code folding without the fold strings for menu, view, list and bar.

                I have another idea too. The PML files I have seen so far are well indented. UltraEdit supports since UE v18.10 also code folding by indent. Therefore it might be an option to remove all open/close/ignore fold strings from the wordfile and add instead on first line EnableCFByIndent left to File Extensions = to enable code folding by indentation level for PML code files.

                4

                  Aug 12, 2012#8

                  hi
                  mofi
                  how to set EnableCFByIndent ,do you have sample?

                  6,687587
                  Grand MasterGrand Master
                  6,687587

                    Aug 12, 2012#9

                    Change the first line of PML.uew to

                    /L9"PML" Nocase Line Comment = -- Line Comment Alt = $* Block Comment On = $( Block Comment Off = $) String Chars = '| EnableCFByIndent File Extensions = pmlfrm pmlmac pmlfnc pmlobj pmldat mac

                    Save the wordfile, close UltraEdit, restart it and open files containing PML code. The open/close/ignore fold strings settings are now ignored and code folding is working now on indentation level.

                    Use the advanced forum search and search for EnableCFByIndent mainly introduced for Python language to find some other topics about this quite new feature. If you are not using UltraEdit v18.10, you won't see any difference as previous versions do not have this feature.