[MonoDevelop] Binding parser's Resolve method

Alejandro Serrano trupill at yahoo.es
Thu Feb 2 10:26:22 EST 2006


Lluis Sanchez escribió:
> El mar, 31-01-2006 a las 20:00 +0100, Alejandro Serrano escribió:
>   
> ...
>> Also, Parse works well most of the times, altough sometimes some files 
>> are not parsed, or MD crashes with a GLib exception. This is the code 
>> I'im using:
>>
>>             try
>>             {
>>                     // Engine is the name of the Nemerle parser
>>                     Engine eng = new Engine();
>>                     Project currentProj = 
>> IdeApp.ProjectOperations.CurrentSelectedProject;
>>                
>>                     // I add each reference
>>                     foreach (ProjectReference refer in 
>> currentProj.ProjectReferences)
>>                         if (refer.ReferenceType != ReferenceType.Project)
>>                             eng.References.Add (refer.Reference, 
>> refer.Reference);
>>                
>>                     // I add each file contents
>>                     foreach (ProjectFile file in currentProj.ProjectFiles)
>>                         if (file.Name.ToUpper().EndsWith(".N"))
>>                             eng.Sources.Add (file.Name, file.Data);
>>                
>>                     // Then, the type tree is returned, and CUFromTree 
>> creates wrappers
>>                     TypeTree tree = eng.GetTypeTree();
>>                     return CUFromTree (tree);
>>             }
>>             catch
>>             {
>>                 return null;
>>             }
>>
>> Should Engine be static? Is this the best way to iterate through all 
>> files in a project, or this works only for open files?
>>     
>
> I don't know where are you using that code. You only need to implement
> the Parse() method from the IParser interface. The parser service will
> call this method to parse whatever is needed to parse.
>
> Lluis.
>   
This is my implementation of the Parse method. I'm getting all files, 
and all project references, and getting the type tree for them. I don't 
know if this is totally correct, altough it works most of the times.
However, the GLib exception is sometimes thrown, or other times it 
crashes randomly and shows and empty Class View. I think it is maybe for 
two subsequent calls to Parse which would need a lock(...) in my code.

Thanks in advance,
Serras

		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com


More information about the Monodevelop-list mailing list