<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Hi Dino,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Thanks a lot. It&#8217;s working reasonably well now. It would be nice to have more comprehensive documentation of these classes, as it is quite a hassle to extract the variables. I&#8217;m now extracting the assignment statements from the script, but excluding those that are inside function bodies. In the expression, I get al name expressions and then remove the function names (call expressions targets) and the global variables. Thanks a lot for your help.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:NL'>With best regards,<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:NL'>Rutger Koperdraad<o:p></o:p></span></p><div class=MsoNormal align=center style='text-align:center'><span style='color:#1F497D;mso-fareast-language:NL'><hr size=1 width="100%" noshade style='color:gray' align=center></span></div><p class=MsoNormal><b><span style='color:#1F497D;mso-fareast-language:NL'>The ExchangeIt Support Team<o:p></o:p></span></b></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:NL'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><img width=187 height=45 id="Picture_x0020_2" src="cid:image001.jpg@01CCBE3A.6A1E1A00" alt="Description: cid:image001.jpg@01C8455E.47D3E2D0"><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:8.0pt;color:#F68222'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><b><span style='font-size:9.0pt;color:#1F497D'>EUR</span></b><span style='font-size:9.0pt;color:#1F497D'>:</span><span style='font-size:9.0pt;color:#F68222'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O:</span><span style='font-size:9.0pt;color:red'> </span><span style='font-size:9.0pt;color:gray'>&nbsp;</span><span style='font-size:9.0pt;color:#1F497D;text-transform:uppercase;mso-fareast-language:NL'>+31 (0)20 893 2601</span><span style='font-size:9.0pt;color:gray'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:9.0pt;color:#F79646'>|</span><span style='font-size:9.0pt;color:navy'>&nbsp; </span><span style='font-size:9.0pt;color:#F79646'>F:</span><span style='font-size:9.0pt;color:gray'>&nbsp; </span><span style='font-size:9.0pt;color:#1F497D'>+31 (0)172 413 746</span><span style='font-size:9.0pt;color:gray'>&nbsp;&nbsp;&nbsp;<o:p></o:p></span></p><p class=MsoNormal><b><span style='font-size:9.0pt;color:#1F497D;mso-fareast-language:NL'>USA:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></b><span style='font-size:9.0pt;color:#F68222;mso-fareast-language:NL'>O:</span><span style='font-size:9.0pt;color:red;mso-fareast-language:NL'> </span><span style='font-size:9.0pt;color:gray;mso-fareast-language:NL'>&nbsp;</span><span style='font-size:9.0pt;color:#1F497D;text-transform:uppercase;mso-fareast-language:NL'>+1 (925) 208 4716</span><span style='font-size:9.0pt;color:#1F497D;mso-fareast-language:NL'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;color:#1F497D;mso-fareast-language:NL'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><b><span style='color:#1F497D'>Support request only via our online support ticket system at </span></b><span style='color:#1F497D'><a href="http://www.exchangeit24.eu/"><b>www.ExchangeIt24.eu</b></a><b> </b></span><b><span style='color:#1F497D'><o:p></o:p></span></b></p><p class=MsoNormal><b><span style='font-size:9.0pt;color:#1F497D'>SALES:&nbsp;&nbsp;&nbsp;&nbsp; </span></b><span style='color:#1F497D'><a href="mailto:Sales@ExchangeIt24.com"><b><span style='font-size:9.0pt'>Sales@ExchangeIt24.com</span></b></a></span><u><span style='font-size:8.0pt;font-family:"Tahoma","sans-serif";color:blue'><o:p></o:p></span></u></p><p class=MsoNormal><b><span style='font-size:9.0pt;color:#1F497D'>WEB:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></b><span style='color:#1F497D'><a href="http://www.exchangeit24.eu/"><b><span style='font-size:9.0pt'>www.ExchangeIt24.eu</span></b></a></span><b><span style='font-size:9.0pt;color:#1F497D'>&nbsp; </span></b><u><span style='font-size:8.0pt;font-family:"Tahoma","sans-serif";color:blue'><o:p></o:p></span></u></p><p class=MsoNormal><b><span style='font-size:9.0pt;color:#1F497D;mso-fareast-language:NL'>FORUM:&nbsp; </span></b><span style='color:#1F497D'><a href="http://www.cardexchange.eu/"><b><span style='font-size:9.0pt;mso-fareast-language:NL'>www.CardExchange.eu</span></b></a></span><b><span style='font-size:9.0pt;color:#1F497D;mso-fareast-language:NL'><o:p></o:p></span></b></p><p class=MsoNormal><b><span style='font-size:9.0pt;color:#1F497D;mso-fareast-language:NL'><o:p>&nbsp;</o:p></span></b></p><p class=MsoNormal><b><i><span style='font-size:12.0pt;color:#F6BB00;mso-fareast-language:NL'>... Solving today's card production problems, with tomorrow in mind!<o:p></o:p></span></i></b></p><p class=MsoNormal><b><i><span style='font-size:12.0pt;color:#F6BB00;mso-fareast-language:NL'><o:p>&nbsp;</o:p></span></i></b></p><p class=MsoNormal><b><span style='font-size:12.0pt;color:#1F497D;mso-fareast-language:NL'>IT'S HERE! CHECK OUT THE NEW CARDEXCHANGE&reg; 6!</span></b><b><span style='color:#1F497D;mso-fareast-language:NL'>&nbsp; </span></b><span style='color:#1F497D'><a href="http://www.exchangeit24.eu/index.php/products/cardexchange/cardexchangetrialversion.html"><b><span style='mso-fareast-language:NL'>Click here to download a FREE trial version</span></b></a><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:7.5pt;color:#1F497D'>This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.</span><span style='color:#1F497D'><o:p></o:p></span></p></div><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Dino Viehland [mailto:dinov@microsoft.com] <br><b>Sent:</b> Thursday, 15 December, 2011 14:07<br><b>To:</b> Rutger Koperdraad; ironpython-users@python.org<br><b>Subject:</b> RE: [Ironpython-users] PythonAst<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><span style='color:#1F497D'>I&#8217;d suggest adding a method in the walker which handles AssignmentStatements and looks to see if the left-hand side is a NameExpression.&nbsp; If it is then you can add it to a list of excluded variable names which you can remove from clnVariableNames after the walk is finished.<o:p></o:p></span></p><p class=MsoNormal><a name="_MailEndCompose"></a><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> ironpython-users-bounces+dinov=microsoft.com@python.org [mailto:ironpython-users-bounces+dinov=microsoft.com@python.org] <b>On Behalf Of </b>Rutger Koperdraad<br><b>Sent:</b> Thursday, December 15, 2011 8:34 AM<br><b>To:</b> ironpython-users@python.org<br><b>Subject:</b> [Ironpython-users] PythonAst<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>I&#8217;m writing an application in Visual Basic .NET that allows the users to write scripts in IronPython for some specialized customization needs. Users provide a script, a number of variable names and values, and an expression. For example, to customize the displaying of dates, they could provide the following script, variables and expressions:<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Script:<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'><b><span lang=NL style='font-family:"Courier New"'>dateformat = 'dddd d MMMM yyyy</span></b><b><span style='font-family:"Courier New"'>'</span></b><b><span lang=NL style='font-family:"Courier New"'><o:p></o:p></span></b></p><p class=MsoNormal style='margin-left:.5in'><b><span style='font-family:"Courier New"'>prefix = 'Birth date: '<o:p></o:p></span></b></p><p class=MsoNormal style='margin-left:.5in'><b><span style='font-family:"Courier New"'><o:p>&nbsp;</o:p></span></b></p><p class=MsoNormal style='margin-left:.5in'><b><span style='font-family:"Courier New"'>def format(d):<o:p></o:p></span></b></p><p class=MsoNormal style='margin-left:.5in'><b><span style='font-family:"Courier New"'>&nbsp; import System<o:p></o:p></span></b></p><p class=MsoNormal style='margin-left:.5in'><b><span style='font-family:"Courier New"'>&nbsp; dd = System.DateTime.Parse(d)<o:p></o:p></span></b></p><p class=MsoNormal style='margin-left:.5in'><b><span style='font-family:"Courier New"'>&nbsp; return dd.ToString(dateformat)<o:p></o:p></span></b></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Variables:<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'><b><span style='font-family:"Courier New"'>birthdate = '10/04/1968'<o:p></o:p></span></b></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Expression:<o:p></o:p></p><p class=MsoNormal style='margin-left:.5in'><b><span style='font-family:"Courier New"'>prefix + format(birthdate)<o:p></o:p></span></b></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>In Visual Basic .NET I create a ScriptRuntime, ScriptEngine, ScriptSource and ScriptScope. I add the variables to the ScriptScope, execute the script and evaluate the expression. That&#8217;s working like a charm.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>I would like to add functionality that automatically detects which variables need to be defined. In the above example, I would like the user to specify the script and the expression and the software to detect that the variable &#8220;birthdate&#8221; is needed and prompt for a value. I tried to do so with PythonAst, but I cannot find sufficient documentation on internet to get it working in general. The functions below work to some extent. They get all the names from the expression and then remove &#8220;format&#8221; for being a function name and not a variable name. But this function still returns &#8220;prefix&#8221;, which it shouldn&#8217;t. Any help or documentation would be appreciated.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp; <span style='color:blue'>Public</span> <span style='color:blue'>Function</span> GetVariableNames(<span style='color:blue'>ByVal</span> strExpression <span style='color:blue'>As</span> <span style='color:blue'>String</span>) <span style='color:blue'>As</span> <span style='color:#2B91AF'>StringCollection</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Try</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>If</span> <span style='color:blue'>Not</span> <span style='color:blue'>String</span>.IsNullOrEmpty(strExpression) <span style='color:blue'>Then</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:green'>' Create a script runtime if needed</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>If</span> m_objScriptRuntime <span style='color:blue'>Is</span> <span style='color:blue'>Nothing</span> <span style='color:blue'>Then</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_objScriptRuntime = <span style='color:#2B91AF'>ScriptRuntime</span>.CreateFromConfiguration()<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>End</span> <span style='color:blue'>If</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:green'>' Create the objects needed by the expression walker</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Dim</span> objEngine <span style='color:blue'>As</span> <span style='color:#2B91AF'>ScriptEngine</span> = m_objScriptRuntime.GetEngine(ScriptLanguage)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Dim</span> objSource <span style='color:blue'>As</span> <span style='color:#2B91AF'>ScriptSource</span> = objEngine.CreateScriptSourceFromString(strExpression, <span style='color:#2B91AF'>SourceCodeKind</span>.Expression)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Dim</span> objSourceUnit <span style='color:blue'>As</span> <span style='color:#2B91AF'>SourceUnit</span> = Providers.<span style='color:#2B91AF'>HostingHelpers</span>.GetSourceUnit(objSource)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Dim</span> objLanguageContext <span style='color:blue'>As</span> <span style='color:#2B91AF'>LanguageContext</span> = <span style='color:#2B91AF'>HostingHelpers</span>.GetLanguageContext(objEngine)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Dim</span> objCompilerContext <span style='color:blue'>As</span> <span style='color:blue'>New</span> <span style='color:#2B91AF'>CompilerContext</span>(objSourceUnit, objLanguageContext.GetCompilerOptions(), <span style='color:#2B91AF'>ErrorSink</span>.Default)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Dim</span> objParser <span style='color:blue'>As</span> <span style='color:#2B91AF'>Parser</span> = <span style='color:#2B91AF'>Parser</span>.CreateParser(objCompilerContext, <span style='color:blue'>New</span> <span style='color:#2B91AF'>PythonOptions</span>)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Dim</span> objPythonAst <span style='color:blue'>As</span> <span style='color:#2B91AF'>PythonAst</span> = objParser.ParseSingleStatement()<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<span style='color:blue'>Dim</span> objExpressionWalker <span style='color:blue'>As</span> <span style='color:blue'>New</span> <span style='color:#2B91AF'>ExpressionWalker</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:green'>' Determine the variable names</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Call</span> objPythonAst.Walk(objExpressionWalker)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Return</span> objExpressionWalker.VariableNames<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>End</span> <span style='color:blue'>If</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Catch</span> ex <span style='color:blue'>As</span> <span style='color:#2B91AF'>Exception</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Call</span> LogException(strExpression, ex)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>End</span> <span style='color:blue'>Try</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Return</span> <span style='color:blue'>New</span> <span style='color:#2B91AF'>StringCollection</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp; <span style='color:blue'>End</span> <span style='color:blue'>Function</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp; <span style='color:blue'>Private</span> <span style='color:blue'>Class</span> <span style='color:#2B91AF'>ExpressionWalker</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Inherits</span> <span style='color:#2B91AF'>PythonWalker</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Private</span> clnVariableNames <span style='color:blue'>As</span> <span style='color:blue'>New</span> <span style='color:#2B91AF'>StringCollection</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='color:blue'>Public</span> <span style='color:blue'>ReadOnly</span> <span style='color:blue'>Property</span> VariableNames <span style='color:blue'>As</span> <span style='color:#2B91AF'>StringCollection</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Get</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Return</span> clnVariableNames<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>End</span> <span style='color:blue'>Get</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>End</span> <span style='color:blue'>Property</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Public</span> <span style='color:blue'>Overrides</span> <span style='color:blue'>Sub</span> PostWalk(node <span style='color:blue'>As</span> <span style='color:#2B91AF'>NameExpression</span>)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Call</span> clnVariableNames.Add(node.Name)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Call</span> <span style='color:blue'>MyBase</span>.PostWalk(node)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>End</span> <span style='color:blue'>Sub</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Public</span> <span style='color:blue'>Overrides</span> <span style='color:blue'>Sub</span> PostWalk(node <span style='color:blue'>As</span> <span style='color:#2B91AF'>CallExpression</span>)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Dim</span> objNameExpression <span style='color:blue'>As</span> <span style='color:#2B91AF'>NameExpression</span> = <span style='color:blue'>TryCast</span>(node.Target, <span style='color:#2B91AF'>NameExpression</span>)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>If</span> <span style='color:blue'>Not</span> objNameExpression <span style='color:blue'>Is</span> <span style='color:blue'>Nothing</span> <span style='color:blue'>Then</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Call</span> clnVariableNames.Remove(objNameExpression.Name)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>End</span> <span style='color:blue'>If</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>Call</span> <span style='color:blue'>MyBase</span>.PostWalk(node)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style='color:blue'>End</span> <span style='color:blue'>Sub</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>&nbsp;&nbsp;&nbsp; <span style='color:blue'>End</span> <span style='color:blue'>Class</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:NL'>With best regards,<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:NL'>Rutger Koperdraad.<o:p></o:p></span></p></div></body></html>