Показать сообщение отдельно
Старый 10.11.2006, 01:36   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
casperkamal: Parsing Source Code
Источник: http://casperkamal.spaces.live.com/B...CD63!141.entry
==============

 
     Sometimes its required that we parse the source code written in the classes, Axapata has a class that will help us in doing this. SysScanner Class is the one that will do the Job, it has so many options that will help us in parsing the code easily. Here is a small piece of code on that.
 
 
static void JobSysScannerClass(Args _args)
{
    #AOT
    TreeNode        treeNode   = TreeNode::findNode(#Classespath + '\Class1\Check');
    SysScannerClass sc         = new SysScannerClass(treeNode);
    int             lineCnt = 1;
    ;

 
    while (lineCnt < sc.lines())
    {
        print sc.sourceLine(lineCnt);
    }
   
    pause;
}

 
it also has options to find if the code has the standard symbols like ttscommit, ttsbegin, print,
for this you have to use the Macro #tokentypes which has the integer values for all the standard key words
 
..................My first showpiece
 



Источник: http://casperkamal.spaces.live.com/B...CD63!141.entry