CodeParser

  • Thread starter Thread starter Jeti
  • Start date Start date
J

Jeti

is there any class that can parse the source code? I tried with ICodeParser,
but I can't make it...

Whats the best way to parse source?
example: the user of my application enters his source into textbox, and i
want to parse it and display summary... how to do that?

any hints?

thx
 
Hi Jeti.
I haven't done this, but here are some suggestions.
You can compile the source using Microsoft.CSharp.Compiler.
Compiler wrappers for VB and JScript are also provided.
Once you have compiled the source to a file, you can use System.Reflection,
to extract the data you need from the assembly.
Or better yet, when compiling, generate xml doc for the assembly and use it.
Hope this gives you some direction.
Sharon.

Sharon, thanx for reply, but I want to extract detailed data from source
(metadata attributes, mathod params, class & struct definitions, etc...) and
i doubt it i can do it this way... I thin that generated xml doc contains
only relevant and short data...

anyway, thanx for the idea, i'll try to do it that way, maybe it will do...
 
Hi Jeti.
I haven't done this, but here are some suggestions.
You can compile the source using Microsoft.CSharp.Compiler.
Compiler wrappers for VB and JScript are also provided.
Once you have compiled the source to a file, you can use System.Reflection,
to extract the data you need from the assembly.
Or better yet, when compiling, generate xml doc for the assembly and use it.
Hope this gives you some direction.
Sharon.
 
Sharon, thanx for reply, but I want to extract detailed data from source
(metadata attributes, mathod params, class & struct definitions, etc...) and
i doubt it i can do it this way... I thin that generated xml doc contains
only relevant and short data...

I think you can do all that using Reflection.
Xml doc also should contain all this data.
But maybe you'll find some lite code parser that works better.
Try this one:
http://www.codeproject.com/csharp/codedomparser.asp
 
Hi,

There's a free (AFAIR) parser library called GoldParser written in C# which
should have rule sets for C# and VB .NET. You indeed cannot use ICodeParser
since its implementation is not exposed to the general public.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top