How to ignore some fold strings for PML

Syntax highlighting, code folding, brace matching, code indenting, and function list

How to ignore some fold strings for PML

Postby feifeima2008 » Thu Aug 09, 2012 5:41 am

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 : feifeima2008@gmail.com
Attachments
pml_uew.rar
PML UEW file and PML File
(18.66 KiB) Downloaded 124 times
feifeima2008
Newbie
 
Posts: 4
Joined: Thu Aug 09, 2012 3:37 am

Re: How to ignore some fold strings for PML

Postby rhapdog » Thu Aug 09, 2012 8:03 am

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.
User avatar
rhapdog
Master
Master
 
Posts: 272
Joined: Tue Apr 01, 2008 10:02 am
Location: Mississippi, USA

Re: How to ignore some fold strings for PML

Postby Mofi » Fri Aug 10, 2012 12:43 am

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.
Attachments
pml_wordfile1.rar
First version of updated PML wordfile.
(1.96 KiB) Downloaded 118 times
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: How to ignore some fold strings for PML

Postby feifeima2008 » Fri Aug 10, 2012 4:05 am

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
Attachments
qt_confuse_fold_code.rar
(112.34 KiB) Downloaded 110 times
feifeima2008
Newbie
 
Posts: 4
Joined: Thu Aug 09, 2012 3:37 am

Re: How to ignore some fold strings for PML

Postby Mofi » Fri Aug 10, 2012 11:49 am

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.
Attachments
pml_wordfile2.rar
Second version of PML wordfile
(1.96 KiB) Downloaded 118 times
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: How to ignore some fold strings for PML

Postby feifeima2008 » Sun Aug 12, 2012 3:10 am

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 idm@idmcomp.com
Attachments
testPml-v2.rar
confusion Fold code pml program
(14.66 KiB) Downloaded 125 times
feifeima2008
Newbie
 
Posts: 4
Joined: Thu Aug 09, 2012 3:37 am

Re: How to ignore some fold strings for PML

Postby Mofi » Sun Aug 12, 2012 5:59 am

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.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: How to ignore some fold strings for PML

Postby feifeima2008 » Sun Aug 12, 2012 7:38 am

hi
mofi
how to set EnableCFByIndent ,do you have sample?
feifeima2008
Newbie
 
Posts: 4
Joined: Thu Aug 09, 2012 3:37 am

Re: How to ignore some fold strings for PML

Postby Mofi » Sun Aug 12, 2012 12:16 pm

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.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Syntax Highlighting