Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Insert excerpt
gmplPatternsStatement
gmplPatternsStatement


Limitations of pattern strings

Generally speaking pattern strings relate individual elemental operations in the source code to corresponding individual elemental operations in the target code.  But in some cases, more complex target forms may be expressed.  It can be tricky to to this in general, but if the operations follow consistent conventions, it will work out for those cases.  Consider for example is from the MSXML upgrade rules.  This is not a general pattern, but it works well some of the time.  

Code Block
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ScanTool\proj_csh\usr\msxml6.dll.Refactor.xml
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49    <Migrate id="IXMLDOMDocument.load" 
	nPram="2" 
	cshPattern="try{\p%1d.Load(%2d);\q}catch{}\n%1d.HasChildNodes" 
	vbnPattern="%1d.Load(%2d)\n%1d.HasChildNodes" />
  50    <Migrate id="IXMLDOMDocument.loadXML" 
	nPram="2" 
	cshPattern="try{%1d.LoadXml(%2d);}catch{}\n%1d.HasChildNodes" 
	vbnPattern="%1d.LoadXml(%2d)\n%1d.HasChildNodes" />

If more complex or dynamic transformations are required, you will typically have to use dynamic translation rules built with gmSL or gmAPI as discussed elsewhere in this site.

See Also