The XppScanner class allows to parse X++ code in the way compiler does it. The simplest way to use it is to traverse all symbols in the given source code using iteration methods – firstSymbol() and nextSymbol(). The integer values returned by these methods are enumerated in the TokenTypes macro. For example, to check if there is “ttsbegin” statement in the code the following job can be used:
public static boolean checkTTSBegin(str _source)
XppScanner xppScanner = new XppScanner(_source);
for (symbol = xppScanner.firstSymbol(); symbol; symbol = xppScanner.nextSymbol())
if (symbol == #TTSBEGIN_SYM)
PS. For this particular task you can, of course, use XppScanner.find() method.