...
Insert excerpt | ||||
---|---|---|---|---|
|
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 In some cases, you may have to author more complex target forms may be expressed. It can may be tricky to difficult to do this in general, but it can work out well if the source and target operations closely 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 will work some of the time, but not always.
Code Block |
---|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Samples\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.