![]() |
Languages »
C# »
General
Intermediate
JS ParserBy Leon LangleybenSimple utility to browse and summarize script files |
C#, Windows, .NET 1.1, Visual Studio, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||

There are a lot of tools conveniently providing code view and analysis for server side code (C#, VB, C++ etc.), but there is some lack of simple utilities to browse, summarize and document client code (JS, VBS). There is no Class View in Visual Studio for JavaScript, no XML documentation, not even function list. It is very important for me to have some control on quality of interpreted code, so I wrote a simple utility that provides basic documentation and analyze functionality.
JS Parser looks for "function" declaration and comments of any kind in script. It concatenates on any comments found before next function declaration, calculate function location, length and complexity (depth of logical blocks). You can use it just to browse script file and retrieve list of functions or to warn about functions that are too long or too complex. Parser will display a message box with exclamation icon, if complexity of file/function exceeds 3 and error icon for complexity 5 and above. You are welcome to change rules to fit your coding preferences. Documentation file with the same name as source script and extension "txt" created. In this file Comments, summary, name and parameters are extracted for each function. You can use it as starting point for some real documentation.
Browse to directory containing js files. Analyze directory button creates documentation files for each script in selected directory. Double click on file or function to see summary.
Code itself is very simple. There is no equivalent in C# for VB DriveListBox, DirectoryListBox and FileListBox, so I used VB backward compatibility controls.
Some code added to provide ListView sorting by subitems. See appropriate region in frmMain.cs
Some ideas how we can make this utility more useful:
I�ll be glad to receive any suggestions.
| You must Sign In to use this message board. | ||||||||
|
||||||||
|
||||||||
|
||||||||
|
||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 17 Jul 2003 Editor: Smitha Vijayan |
Copyright 2003 by Leon Langleyben Everything else Copyright © CodeProject, 1999-2009 Web15 | Advertise on the Code Project |