Introspection at Statement level

Since I am a research in software engineering, I would like to create some code analysis features. I noticed the introspection feature of Xojo which is great. However, I also noticed that I can not read the statements included in a method.

Is there a way to get at the full body of code for analysis purposes. For example, I would like to be able to parse all statements in a method and all components of a statement.


x = c1.m(y)

I want to be able to identify x, operator, class, dot, method, and y, and know that, var(x), classvar(c1), method(m) and parameter(y).

At this stage I am not interested in the fact its an assignment statement, just that the statement involves a number of “lexical” entities strung together to form the statement.

can this be done somehow?



Introspection doesn’t provide source code. Instead you can save your project as Version Control or XML format which are easy to pull the source text out of.

But why do you want to do this on the running app itself. I mean shouldn’t your parsing app take any input, not just the code it was written with?

What exactly do you aim to do? Introspection only works within the application in which it exists, and cannot peek into other applications.

What I have in mind is to experiment with analyses on the quality of the software code written, as one programs, and offer comments/insights to the programmers as well as facilities to improve the code.


Like the analysis feature of Xojo itself, but I want to focus on architecture of the code.

Then it’s best to write a program to read the txt/xml/version-control project file format, parse the code that will neatly already be in a great readable/parsable format, and generate a report. Introspection cannot aide with this. If you want a good analysis with no work, you can run an analysis on your program from the Xojo IDE menu, and you will be presented with a report that can show you areas that need optimization :slight_smile: Reading from a saved file format is best.