I gave this a go as I had been working on related code yesterday. So, a
proper parser would be the right approach if you really need to do that.
Short of that, the quick-and-dirty way I proposed does okay. A few bits of
detail.

Types of lines of code
As far as I can see, there are seven types of lines in a 4D method:

Code
Comments
Regular
Method attributes
Compiler range change directives
Compiler warning message directives
Embedded SQL (inside of a Begin/End SQL block)
Whitespace

That's four types where comments has four types, making for seven possible
types.

Moving past that, there are several places that a method name may appear in
a method:

* A comment line.
* A method call in any valid position in a line.
* A method call passed as a parameter, like ON ERR
CALL("ErrorHandler_ShowAlert")
* A method call embedded in a SQL statement, like {fn System_CountTables as
Numeric}

You can figure all of those out with a bit of brute force by stripping the
method of comments and breaking it down into words & comparing the results
to the master list of project methods. I was just doing it for fun, but it
looks doable-ish, if it's important.

Or let's ask Keisuke Miyako politely for a plug-in ;-)
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to