Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top