Mattias Gaertner wrote:
> On Tue, 09 May 2006 20:14:30 +0200
> Dean Zobec <[EMAIL PROTECTED]> wrote:
> 
>> Mattias Gaertner wrote:
>>
>>>> Then I'm investigating about a way to add the possibility to
>>>> automatically create the stubs for the tests as in Eclipse, through a
>>>> parsing of the unit containing the classes to be tested.
>>>> I would also like to improve the integration in Lazarus. I'm absolutely
>>>> fascinated by the power of the code tools, I think we could give the
>>>> failing tests a first class treatment in Lazarus, similar to compiling
>>>> errors, by creating some special marks in the source editor.
>>>> Though I'm sure I'll need some help from a codetools expert for this.
>>> What do you want to know?
>>>
>> thank you for your reply.
>>
>> 1) to parse the pascal classes and locate the methods of the class as a
>> candidate for the tests I've used the PasTree, PParser, PScanner units.
>> Though I found quite complicated to get the whole interface of the
>> methods, parameters included. Is there a better way to do the parsing
>> using the codetools in Lazarus?
> 
> It depends on what you mean with 'whole interface'. The codetools can give
> you the information ranging from names to code with comments. There are
> alone 5 flags to define how much information to retrieve from a parameter
> list.
> Can you give an example, what you need?
> See the codeexplorer for an example for iterating through the codetree.

That is all I was looking for, a good working example of this features.
You know, I didn't know about the code explorer, Lazarus has so many
features that it takes a while to make good use of all of them.
Thank you very much, I will have a lot of fun in the next evenings
playing with the sources.



> This will load a unit source, parse it, search the class in the interface
> and jumps to the method body (after the 'begin'):
> 
> Code:=CodeToolBoss.LoadFile('/full/path/to/unit1.pas',false,false);
> CodeToolBoss.JumpToPublishedMethodBody(Code,'TForm1','OnClick',NewCode,NewX
> ,NewY,NewTopLine);
> 
> Don't let you confuse by the 'Published' word. It does not search in
> ancestor classes for the method. If the method belongs to an ancestor class,
> it gets more complicated.
Thank you for the explanations it's more than enough for my needs. I do
not have to search in anchestors.
The simplicity is astounding, thank you for this gem :), the more I know
about Lazarus, the more I like it.
I hope to make good use of it.
Ciao, Dean



_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to