views:

225

answers:

2

As part of my my web development system I have written a text editor witch (among other formats like CSS and HTML) has got ASP syntax highlighting.

Does anyone know of an ASP syntax checker program of (preferably) DLL that I could call from within this editor, so that I could present my users with a list of errors (like I already do with an HTML validator).

I would like to check for the ASP syntax before using the code on a web page. Now, depending on the type and the place of the error, it can take days or weeks before some error pops up.

+2  A: 

I don't know of any syntax checker libraries for ASP. However it is possible to use the Windows Script Interfaces to load and "compile" VBScript or JScript, not for the faint-hearted though.

To enable ASP syntax checking you would need replace >%...<% with something like Response.Write("") and any <%=expr%> with Response.Write(expr). Now you'd have text purely in the Script language. Add a bunch of Dummy objects for Response, Request etc. (the don't actually need any members) to the named objects in the script context. You would also need to be able to map line numbers from the munged script text back to the orignal ASP file text.

Even with all that you would only get the first compile error in the file, that's just the nature of script processing.

AnthonyWJones
That's not a bad idea at all. If I can now just find someone who has done this already, and produced some nice dll-interface for it :). I am sometimes amazed at the software there is hanging around in the world, I now just hope that the one written this syntax checker is a StackOverflow user! About the first compile error: I am a Delphi developer too, and that compiles so quickly that I only fix the first compile error and than recompile anyway. Maybe I'm spoiled here.
Edelcom
A: 

I'm looking for the same thing. There is something called http://aspclassiccompiler.codeplex.com/ which apparently compiles your classic asp into asp.net.

Since I believe this gives some kind of compile time errors, I think syntax errors would be reported during compilation. Haven't tried it out yet though.

User