This project is read-only.

LanguageWriter Help

Sep 9, 2007 at 6:07 AM
I am having a great time working with the program, and am taking on a new challenge.

I want to write a add it to cleanup code formatting. I've built the custom language writer, and have everything hooked up, and getting output. The problem is that I don't understand what several of the subs in the visitor class are for. I tend to work mostly in, so is there anywhere where I can find a sample project that shows how to use the visitor class for, or a more detailed description for what each overridable sub should properly do.

For ex, I'm not sure where class attribute tags would be formatted into the typedecleration. Is it from the VisitTypeDecleration or is it another sub in the class.

thanks for your help.
Sep 10, 2007 at 1:21 AM
Can you explain a bit more what you are trying to achieve. ILanguageWriter doesn't have a VisitTypeDeclaration method and doesn't require the implemantation of a visitor of some sort? Did you base your code on some other add-in?
Sep 10, 2007 at 5:47 AM
I'd like to build a module that takes the my code with the pdb file for local var names, and xml comments file, and outputs a cleaned up file like this:

All class member variables have m in their prefix and _ for locals
all class members are output in a selected method (events/custom events/delegates/vars/class/properties/nested types)
alphabetize each one of these in their categories.

I've looked at the two file dumper programs, and they simply use the built in reflector .net ILanguage files, which keeps me from part two:
Fix a few of the vb output issues (big one seems to be bracketing keywords) like trycast, using, and others

. (I like to list the contents of a class as events/vars/class/properties. Right now, looking at the three disassemblers (the one built into reflector, and the two plugins) there is no way to get comments appended to each item.

Looking at the comments in the files, as well as some of the limited info on this site, it seems that I need to build a custom ILanguage file to take care of my needs.

It seems I can configure it to emit the file in the typedecleration as needed, and cleanup the variables.
I tried to setup a Textformatter, but this only writes the component parts, not the final parts.

I've Built a the ILanguage, and can do the ordering (I think correctly) from the visitorclass. (I took the base on from one of the projects here, and have overriden some procdures so far. I get the basic outline for declerations and variables, but outputting the code is a little beyond me right now; I'm not sure what the nomenclature is for each one..

For example: I have the VistTypeDecleration sub writing the entire class. Should it recursively call itself, is there a better sub to call rather than recursively process itself, or another method?

Finally, Since I'm doing all of this on my own to further my education in seems like a fun way to learn a little bit more about how the assemblies are saved and how to improve my coding skills.

So, What I am trying to find is a good explanation on how to build a language writer that works for, or a better way to accomplish this.

Hope that helps.