![]() |
#1 |
Участник
|
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 ![]() ![]() ![]() Источник: http://casperkamal.spaces.live.com/B...CD63!141.entry |
|
![]() |
#2 |
MCTS
|
Correct code:
X++: 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); lineCnt++; } pause; }
__________________
![]() В глухомани, в лесу Несмотря на красу Дни проводит Лиса Патрикевна. Я никак не пойму Отчего, почему Не пускают куму На деревню |
|
|
|