Click here to Skip to main content
13,404,713 members (36,673 online)
Click here to Skip to main content
Add your own
alternative version


17 bookmarked
Posted 17 Jul 2003

JS Parser

, 17 Jul 2003
Rate this:
Please Sign up or sign in to vote.
Simple utility to browse and summarize script files


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.

Using the code

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.

Points of interest

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:

  • Documentation file format certainly can be improved.
  • Documentation could be exported as XML even in the same simple schema as VS using for C#. Than you can use other tools to create documentation.
  • Open file and browse to function capability, may be useful.

I’ll be glad to receive any suggestions.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Leon Langleyben
Web Developer
Israel Israel
Leon works as Chief Architect at SRL Group. He leads architectural design and development of various enterprise level projects.
You can meet him on user groups, conferences and forums dedicated to Architecture, ASP.NET, Team System etc. or join him for the next white water rafting adventure

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
alifellod7-Dec-10 21:46
memberalifellod7-Dec-10 21:46 
Generalfrom JS Parser Pin
Cerebrado9-Nov-09 9:56
memberCerebrado9-Nov-09 9:56 
GeneralfilelistView Pin
z_haniza13-Mar-06 18:38
memberz_haniza13-Mar-06 18:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.1802120.2 | Last Updated 18 Jul 2003
Article Copyright 2003 by Leon Langleyben
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid